]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
add check_origin parameter to dns.zone.from_xfr()
authorBob Halley <halley@nominum.com>
Sat, 7 Apr 2012 21:16:05 +0000 (22:16 +0100)
committerBob Halley <halley@nominum.com>
Sat, 7 Apr 2012 21:16:05 +0000 (22:16 +0100)
ChangeLog
dns/zone.py

index 46064a5f925a0c8ba345bc81a108f560822b5f17..108cb4036e94e55860dac99ac7e24adbb935f645 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-04-07  Bob Halley  <halley@dnspython.org>
 
+       * dns/zone.py (from_xfr): dns.zone.from_xfr() now takes a
+         'check_origin' parameter which defaults to True.  If set to
+         False, then dnspython will not make origin checks on the zone.
+         Thanks to Carlos Perez for the report.
+
        * dns/rdtypes/ANY/SSHFP.py (SSHFP.from_text): Allow whitespace in
          the text string.  Thanks to Jan Andres for the report and the
          patch.
index 72ae706ff26923a201d4db9ab27e9ccb388c1434..a4fa07b58b6a0dfe0082fff8b9196776a561d9ba 100644 (file)
@@ -796,7 +796,7 @@ def from_file(f, origin = None, rdclass = dns.rdataclass.IN,
             f.close()
     return z
 
-def from_xfr(xfr, zone_factory=Zone, relativize=True):
+def from_xfr(xfr, zone_factory=Zone, relativize=True, check_origin=True):
     """Convert the output of a zone transfer generator into a zone object.
 
     @param xfr: The xfr generator
@@ -805,6 +805,9 @@ def from_xfr(xfr, zone_factory=Zone, relativize=True):
     It is essential that the relativize setting matches the one specified
     to dns.query.xfr().
     @type relativize: bool
+    @param check_origin: should sanity checks of the origin node be done?
+    The default is True.
+    @type check_origin: bool
     @raises dns.zone.NoSOA: No SOA RR was found at the zone origin
     @raises dns.zone.NoNS: No NS RRset was found at the zone origin
     @rtype: dns.zone.Zone object
@@ -830,5 +833,6 @@ def from_xfr(xfr, zone_factory=Zone, relativize=True):
             for rd in rrset:
                 rd.choose_relativity(z.origin, relativize)
                 zrds.add(rd)
-    z.check_origin()
+    if check_origin:
+        z.check_origin()
     return z