Fixed bug where showcfg for non-existing config files died silently
Made servername verification talk directly to the nameserver, not just any server.
This commit is contained in:
@@ -130,7 +130,9 @@ def readcfg(msg, show=""):
|
|||||||
return msg
|
return msg
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(msg['cfgfile']):
|
if not os.path.exists(msg['cfgfile']):
|
||||||
msg['error'].append("No such file: %s" % msg['cfgfile'])
|
if show:
|
||||||
|
checkerror(msg, show="errors")
|
||||||
|
msg['error'].append("No such file; '%s'" % msg['cfgfile'])
|
||||||
return msg
|
return msg
|
||||||
cfgfile = open(msg['cfgfile'], 'r')
|
cfgfile = open(msg['cfgfile'], 'r')
|
||||||
|
|
||||||
@@ -229,7 +231,9 @@ def verify_ip(msg):
|
|||||||
ip = ""
|
ip = ""
|
||||||
host = msg['hostname'] + "." + msg['domain']
|
host = msg['hostname'] + "." + msg['domain']
|
||||||
try:
|
try:
|
||||||
ans = dns.resolver.query(host, 'A')
|
res = dns.resolver.Resolver()
|
||||||
|
res.nameservers = [msg['nameserver']]
|
||||||
|
ans = res.query(host)
|
||||||
for res in ans:
|
for res in ans:
|
||||||
ip = res.to_text()
|
ip = res.to_text()
|
||||||
except dns.exception.Timeout:
|
except dns.exception.Timeout:
|
||||||
|
|||||||
Reference in New Issue
Block a user