From f30d28379260da07556a0be3ccc5f3acfc4b0eb3 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 27 Oct 2013 08:40:54 +0100 Subject: [PATCH] use empty search list, make sure query fqdn is really a absolute fqdn --- nsupdate/main/dnstools.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nsupdate/main/dnstools.py b/nsupdate/main/dnstools.py index 2818b87..745191e 100644 --- a/nsupdate/main/dnstools.py +++ b/nsupdate/main/dnstools.py @@ -151,17 +151,20 @@ def query_ns(qname, rdtype, origin=None): :return: IP (as str) or "-" if ns is not available """ origin, name = parse_name(qname, origin) + fqdn = name + origin + assert fqdn.is_absolute() origin_str = str(origin) nameserver = get_ns_info(origin_str)[0] resolver = dns.resolver.Resolver(configure=False) # we do not configure it from resolv.conf, but patch in the values we # want into the documented attributes: resolver.nameservers = [nameserver, ] - resolver.search = [dns.name.from_text('nsupdate.info'), ] # FIXME: should work with empty list + resolver.search = [] resolver.lifetime = RESOLVER_TIMEOUT try: - answer = resolver.query(qname, rdtype) + answer = resolver.query(fqdn, rdtype) ip = str(list(answer)[0]) + logger.debug("query: %s answer: %s" % (fqdn.to_text(), ip)) return ip except (dns.resolver.Timeout, dns.resolver.NoNameservers): # socket.error also? logger.warning("timeout when querying for name '%s' in zone '%s' with rdtype '%s'." % (