mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
make the dns authoritative check code stronger
This commit is contained in:
@@ -199,9 +199,16 @@ def get_authoritative_server(domain, resolver=None):
|
||||
while True:
|
||||
try:
|
||||
answers = dns.resolver.resolve(dnsname, 'NS')
|
||||
return str(answers[0].target)
|
||||
if answers:
|
||||
first_answer = answers[0]
|
||||
if hasattr(first_answer, "target"):
|
||||
return str(first_answer.target)
|
||||
if hasattr(first_answer, "address"):
|
||||
return str(first_answer.address)
|
||||
except dns.resolver.NoAnswer as e:
|
||||
dnsname = dnsname.parent()
|
||||
else:
|
||||
dnsname = dnsname.parent()
|
||||
|
||||
|
||||
def get_authoritative_ip(domain, resolver=None):
|
||||
|
||||
Reference in New Issue
Block a user