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
|
||||
else:
|
||||
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
|
||||
cfgfile = open(msg['cfgfile'], 'r')
|
||||
|
||||
@@ -229,7 +231,9 @@ def verify_ip(msg):
|
||||
ip = ""
|
||||
host = msg['hostname'] + "." + msg['domain']
|
||||
try:
|
||||
ans = dns.resolver.query(host, 'A')
|
||||
res = dns.resolver.Resolver()
|
||||
res.nameservers = [msg['nameserver']]
|
||||
ans = res.query(host)
|
||||
for res in ans:
|
||||
ip = res.to_text()
|
||||
except dns.exception.Timeout:
|
||||
|
||||
Reference in New Issue
Block a user