From ff63f9f8d5ee10b17119964408573845904f55c3 Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Sat, 24 Jan 2004 00:17:48 +0000 Subject: [PATCH] Fixed bug where showcfg for non-existing config files died silently Made servername verification talk directly to the nameserver, not just any server. --- dnsupdate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dnsupdate.py b/dnsupdate.py index 3dccdaa..a3cbdda 100644 --- a/dnsupdate.py +++ b/dnsupdate.py @@ -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: