mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
Extend reverse domain regexp with classes
With this modification it can be possible, to detect custom IP classes for domains. It just need to modify the multipler in regexp {4} or {1}. In the future it will works automaticly, but not now
This commit is contained in:
parent
1538cf0239
commit
c53d9ace89
@ -1044,8 +1044,10 @@ class Record(object):
|
|||||||
domain_obj = Domain.query.filter(Domain.name == domain).first()
|
domain_obj = Domain.query.filter(Domain.name == domain).first()
|
||||||
domain_auto_ptr = DomainSetting.query.filter(DomainSetting.domain == domain_obj).filter(DomainSetting.setting == 'auto_ptr').first()
|
domain_auto_ptr = DomainSetting.query.filter(DomainSetting.domain == domain_obj).filter(DomainSetting.setting == 'auto_ptr').first()
|
||||||
domain_auto_ptr = strtobool(domain_auto_ptr.value) if domain_auto_ptr else False
|
domain_auto_ptr = strtobool(domain_auto_ptr.value) if domain_auto_ptr else False
|
||||||
|
|
||||||
system_auto_ptr = Setting.query.filter(Setting.name == 'auto_ptr').first()
|
system_auto_ptr = Setting.query.filter(Setting.name == 'auto_ptr').first()
|
||||||
system_auto_ptr = strtobool(system_auto_ptr.value)
|
system_auto_ptr = strtobool(system_auto_ptr.value)
|
||||||
|
|
||||||
if system_auto_ptr or domain_auto_ptr:
|
if system_auto_ptr or domain_auto_ptr:
|
||||||
try:
|
try:
|
||||||
d = Domain()
|
d = Domain()
|
||||||
@ -1053,7 +1055,7 @@ 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)\.?)|(\.(?P<ipv4name>.+r.arpa)\.?)', dns.reversename.from_address(r_content).to_text())
|
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())
|
||||||
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
||||||
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('.')
|
||||||
@ -1066,7 +1068,7 @@ 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)\.?)|(\.(?P<ipv4name>.+r.arpa)\.?)', dns.reversename.from_address(r_content).to_text())
|
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())
|
||||||
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
||||||
self.name = dns.reversename.from_address(r_content).to_text()
|
self.name = dns.reversename.from_address(r_content).to_text()
|
||||||
self.type = 'PTR'
|
self.type = 'PTR'
|
||||||
|
Loading…
Reference in New Issue
Block a user