mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-10 07:30:26 +00:00
Add get_reverse_domain_name functionality
In this way the reverse it is possible to create auto-ptr records in higher ip classes (eg. class A in IPv4). Only works with existing higher class domain. If is isn't find higher class domain, create a lowest class domain, and add there the reverse PTRs. Also works with IPv6!
This commit is contained in:
parent
b9f95da906
commit
e6e3c39778
@ -1068,8 +1068,8 @@ class Record(object):
|
|||||||
if r['type'] in ['A', 'AAAA']:
|
if r['type'] in ['A', 'AAAA']:
|
||||||
r_name = r['name'] + '.'
|
r_name = r['name'] + '.'
|
||||||
r_content = r['content']
|
r_content = r['content']
|
||||||
temp = re.search('^((([a-f0-9]\.){4})(?P<ipv6name>.+6.arpa)\.?)|((([0-9]+\.){1})(?P<ipv4name>.+r.arpa)\.?)', dns.reversename.from_address(r_content).to_text())
|
reverse_host_address = dns.reversename.from_address(r_content).to_text()
|
||||||
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
domain_reverse_name = d.get_reverse_domain_name(reverse_host_address)
|
||||||
d.create_reverse_domain(domain, domain_reverse_name)
|
d.create_reverse_domain(domain, domain_reverse_name)
|
||||||
self.name = dns.reversename.from_address(r_content).to_text().rstrip('.')
|
self.name = dns.reversename.from_address(r_content).to_text().rstrip('.')
|
||||||
self.type = 'PTR'
|
self.type = 'PTR'
|
||||||
@ -1081,9 +1081,9 @@ class Record(object):
|
|||||||
if r['type'] in ['A', 'AAAA']:
|
if r['type'] in ['A', 'AAAA']:
|
||||||
r_name = r['name'] + '.'
|
r_name = r['name'] + '.'
|
||||||
r_content = r['content']
|
r_content = r['content']
|
||||||
temp = re.search('^((([a-f0-9]\.){4})(?P<ipv6name>.+6.arpa)\.?)|((([0-9]+\.){1})(?P<ipv4name>.+r.arpa)\.?)', dns.reversename.from_address(r_content).to_text())
|
reverse_host_address = dns.reversename.from_address(r_content).to_text()
|
||||||
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
domain_reverse_name = d.get_reverse_domain_name(reverse_host_address)
|
||||||
self.name = dns.reversename.from_address(r_content).to_text()
|
self.name = reverse_host_address
|
||||||
self.type = 'PTR'
|
self.type = 'PTR'
|
||||||
self.data = r_content
|
self.data = r_content
|
||||||
self.delete(domain_reverse_name)
|
self.delete(domain_reverse_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user