From 70d5209b11f4a3db2e1791cb5461945327c25493 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 28 Apr 2008 16:06:23 -0400 Subject: Fix a bug in our dns library, do not return the query as a reply if 0 replies were returned. --- ipa-python/dnsclient.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ipa-python/dnsclient.py b/ipa-python/dnsclient.py index 44dae4d7..58d93d85 100644 --- a/ipa-python/dnsclient.py +++ b/ipa-python/dnsclient.py @@ -365,22 +365,22 @@ def dnsParseResults(results): if not rest: return [] - rr = DNSResult() + qq = DNSResult() (rest, label) = dnsParseLabel(rest, results) if label is None: return [] - if len(rest) < rr.qsize(): + if len(rest) < qq.qsize(): return [] - rr.qunpack(rest) + qq.qunpack(rest) - rest = rest[rr.qsize():] + rest = rest[qq.qsize():] if DEBUG_DNSCLIENT: print "Queried for '%s', class = %d, type = %d." % (label, - rr.dns_class, rr.dns_type) + qq.dns_class, qq.dns_type) for i in xrange(header.dns_ancount + header.dns_nscount + header.dns_arcount): (rest, label) = dnsParseLabel(rest, results) @@ -424,8 +424,6 @@ def dnsParseResults(results): rest = rest[rr.dns_rlength:] rrlist += [rr] - if not rrlist: - rrlist = [rr] return rrlist def query(query, qclass, qtype): -- cgit