]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
dns.resolver.zone_for_name() would return the wrong answer sometimes if the response...
authorBob Halley <halley@nominum.com>
Sun, 31 Oct 2010 13:40:00 +0000 (13:40 +0000)
committerBob Halley <halley@nominum.com>
Sun, 31 Oct 2010 13:40:00 +0000 (13:40 +0000)
ChangeLog
dns/resolver.py

index 45a660b4b8a30a5471a31bb41baedbe1a687a011..4a06474840db9a50248f11a4eb35b7a32d5d8c69 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-10-31  Bob Halley  <halley@dnspython.org>
 
+       * dns/resolver.py (zone_for_name): A query name resulting in a
+         CNAME or DNAME response to a node which had an SOA was incorrectly
+         treated as a zone origin.  In these cases, we should just look
+         higher.
+
        * Added zonediff.py to examples.  This program compares two zones
          and shows the differences either in diff-like plain text, or
          HTML.  Thanks to Dennis Kaarsemaker for contributing this
index edeac014c830b3c57e2dc2b52aacd1fecaf0b5cc..f803eb6d2087ef7243ee1f28ff830ce8f2d45563 100644 (file)
@@ -754,9 +754,12 @@ def zone_for_name(name, rdclass=dns.rdataclass.IN, tcp=False, resolver=None):
     while 1:
         try:
             answer = resolver.query(name, dns.rdatatype.SOA, rdclass, tcp)
-            return name
+            if answer.rrset.name == name:
+                return name
+            # otherwise we were CNAMEd or DNAMEd and need to look higher
         except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
-            try:
-                name = name.parent()
-            except dns.name.NoParent:
-                raise NoRootSOA
+            pass
+        try:
+            name = name.parent()
+        except dns.name.NoParent:
+            raise NoRootSOA