[Freeipa-devel] [PATCH] Fix a bug in our dns library, do not return the query as a reply

Simo Sorce ssorce at redhat.com
Mon Apr 28 20:16:36 UTC 2008


>From 8e9f6e9c6d42a552dfa7fe9dd37824fc811d7625 Mon Sep 17 00:00:00 2001
From: Simo Sorce <ssorce at redhat.com>
Date: Mon, 28 Apr 2008 16:06:23 -0400
Subject: [PATCH] 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 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/ipa-python/dnsclient.py b/ipa-python/dnsclient.py
index 44dae4d..58d93d8 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):
-- 
1.5.4.1

-- 
Simo Sorce * Red Hat, Inc * New York


More information about the Freeipa-devel mailing list