dnspython: Update to latest upstream snapshot.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 27 Aug 2011 14:07:52 +0000 (16:07 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 27 Aug 2011 15:40:39 +0000 (17:40 +0200)
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Aug 27 17:40:39 CEST 2011 on sn-devel-104

109 files changed:
lib/dnspython/ChangeLog
lib/dnspython/Makefile
lib/dnspython/README
lib/dnspython/dns/__init__.py
lib/dnspython/dns/dnssec.py
lib/dnspython/dns/e164.py
lib/dnspython/dns/edns.py
lib/dnspython/dns/entropy.py
lib/dnspython/dns/exception.py
lib/dnspython/dns/flags.py
lib/dnspython/dns/hash.py
lib/dnspython/dns/inet.py
lib/dnspython/dns/ipv4.py
lib/dnspython/dns/ipv6.py
lib/dnspython/dns/message.py
lib/dnspython/dns/name.py
lib/dnspython/dns/namedict.py
lib/dnspython/dns/node.py
lib/dnspython/dns/opcode.py
lib/dnspython/dns/query.py
lib/dnspython/dns/rcode.py
lib/dnspython/dns/rdata.py
lib/dnspython/dns/rdataclass.py
lib/dnspython/dns/rdataset.py
lib/dnspython/dns/rdatatype.py
lib/dnspython/dns/rdtypes/ANY/AFSDB.py
lib/dnspython/dns/rdtypes/ANY/CERT.py
lib/dnspython/dns/rdtypes/ANY/CNAME.py
lib/dnspython/dns/rdtypes/ANY/DLV.py
lib/dnspython/dns/rdtypes/ANY/DNAME.py
lib/dnspython/dns/rdtypes/ANY/DNSKEY.py
lib/dnspython/dns/rdtypes/ANY/DS.py
lib/dnspython/dns/rdtypes/ANY/GPOS.py
lib/dnspython/dns/rdtypes/ANY/HINFO.py
lib/dnspython/dns/rdtypes/ANY/HIP.py
lib/dnspython/dns/rdtypes/ANY/ISDN.py
lib/dnspython/dns/rdtypes/ANY/KEY.py [deleted file]
lib/dnspython/dns/rdtypes/ANY/LOC.py
lib/dnspython/dns/rdtypes/ANY/MX.py
lib/dnspython/dns/rdtypes/ANY/NS.py
lib/dnspython/dns/rdtypes/ANY/NSEC.py
lib/dnspython/dns/rdtypes/ANY/NSEC3.py
lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py
lib/dnspython/dns/rdtypes/ANY/NXT.py [deleted file]
lib/dnspython/dns/rdtypes/ANY/PTR.py
lib/dnspython/dns/rdtypes/ANY/RP.py
lib/dnspython/dns/rdtypes/ANY/RRSIG.py
lib/dnspython/dns/rdtypes/ANY/RT.py
lib/dnspython/dns/rdtypes/ANY/SIG.py [deleted file]
lib/dnspython/dns/rdtypes/ANY/SOA.py
lib/dnspython/dns/rdtypes/ANY/SPF.py
lib/dnspython/dns/rdtypes/ANY/SSHFP.py
lib/dnspython/dns/rdtypes/ANY/TXT.py
lib/dnspython/dns/rdtypes/ANY/X25.py
lib/dnspython/dns/rdtypes/ANY/__init__.py
lib/dnspython/dns/rdtypes/IN/A.py
lib/dnspython/dns/rdtypes/IN/AAAA.py
lib/dnspython/dns/rdtypes/IN/APL.py
lib/dnspython/dns/rdtypes/IN/DHCID.py
lib/dnspython/dns/rdtypes/IN/IPSECKEY.py
lib/dnspython/dns/rdtypes/IN/KX.py
lib/dnspython/dns/rdtypes/IN/NAPTR.py
lib/dnspython/dns/rdtypes/IN/NSAP.py
lib/dnspython/dns/rdtypes/IN/NSAP_PTR.py
lib/dnspython/dns/rdtypes/IN/PX.py
lib/dnspython/dns/rdtypes/IN/SRV.py
lib/dnspython/dns/rdtypes/IN/WKS.py
lib/dnspython/dns/rdtypes/IN/__init__.py
lib/dnspython/dns/rdtypes/__init__.py
lib/dnspython/dns/rdtypes/dsbase.py
lib/dnspython/dns/rdtypes/keybase.py [deleted file]
lib/dnspython/dns/rdtypes/mxbase.py
lib/dnspython/dns/rdtypes/nsbase.py
lib/dnspython/dns/rdtypes/sigbase.py [deleted file]
lib/dnspython/dns/rdtypes/txtbase.py
lib/dnspython/dns/renderer.py
lib/dnspython/dns/resolver.py
lib/dnspython/dns/reversename.py
lib/dnspython/dns/rrset.py
lib/dnspython/dns/set.py
lib/dnspython/dns/tokenizer.py
lib/dnspython/dns/tsig.py
lib/dnspython/dns/tsigkeyring.py
lib/dnspython/dns/ttl.py
lib/dnspython/dns/update.py
lib/dnspython/dns/version.py
lib/dnspython/dns/wiredata.py [new file with mode: 0644]
lib/dnspython/dns/zone.py
lib/dnspython/examples/xfr.py
lib/dnspython/setup.py
lib/dnspython/tests/Makefile
lib/dnspython/tests/bugs.py
lib/dnspython/tests/dnssec.py
lib/dnspython/tests/example
lib/dnspython/tests/example1.good
lib/dnspython/tests/example2.good
lib/dnspython/tests/flags.py
lib/dnspython/tests/message.py
lib/dnspython/tests/name.py
lib/dnspython/tests/namedict.py
lib/dnspython/tests/ntoaaton.py
lib/dnspython/tests/rdtypeandclass.py
lib/dnspython/tests/resolver.py
lib/dnspython/tests/rrset.py
lib/dnspython/tests/set.py
lib/dnspython/tests/tokenizer.py
lib/dnspython/tests/update.py
lib/dnspython/tests/zone.py
lib/dnspython/util/copyrights

index 0fff77f9777a8fffda34780dae862fd98397f5eb..71b796149077fb336ba1433f32b778fc37aa407b 100644 (file)
@@ -1,3 +1,74 @@
+2011-08-22  Robert Halley  <halley@dnspython.org>
+
+       * dns/resolver.py: Added LRUCache, which allows a maximum number
+         of nodes to be cached, and removes the least-recently used node
+         when adding a new node to a full cache.
+
+2011-07-13  Bob Halley  <halley@dnspython.org>
+
+       * dns/resolver.py: dns.resolver.override_system_resolver()
+         overrides the socket module's versions of getaddrinfo(),
+         getnameinfo(), getfqdn(), gethostbyname(), gethostbyname_ex() and
+         gethostbyaddr() with an implementation which uses a dnspython stub
+         resolver instead of the system's stub resolver.  This can be
+         useful in testing situations where you want to control the
+         resolution behavior of python code without having to change the
+         system's resolver settings (e.g. /etc/resolv.conf).
+         dns.resolver.restore_system_resolver() undoes the change.
+
+2011-07-08  Bob Halley  <halley@dnspython.org>
+
+       * dns/ipv4.py: dnspython now provides its own, stricter, versions
+         of IPv4 inet_ntoa() and inet_aton() instead of using the OS's
+         versions.
+
+       * dns/ipv6.py: inet_aton() now bounds checks embedded IPv4 addresses
+         more strictly.  Also, now only dns.exception.SyntaxError can be
+         raised on bad input.
+
+2011-04-05  Bob Halley  <halley@dnspython.org>
+
+       * Old DNSSEC types (KEY, NXT, and SIG) have been removed.
+
+       * Bounds checking of slices in rdata wire processing is now more
+         strict, and bounds errors (e.g. we got less data than was
+         expected) now raise dns.exception.FormError rather than
+         IndexError.
+
+2011-03-28  Bob Halley  <halley@dnspython.org>
+
+       * (Version 1.9.4 released)
+
+2011-03-24  Bob Halley  <halley@dnspython.org>
+
+       * dns/rdata.py (Rdata._wire_cmp): We need to specify no
+         compression and an origin to _wire_cmp() in case names in the
+         rdata are relative names.
+
+       * dns/rdtypes/ANY/SIG.py (SIG._cmp): Add missing 'import struct'.
+         Thanks to Arfrever Frehtes Taifersar Arahesis for reporting the
+         problem.
+
+2011-03-24  Bob Halley  <halley@dnspython.org>
+
+       * (Version 1.9.3 released)
+
+2011-03-22  Bob Halley  <halley@dnspython.org>
+
+       * dns/resolver.py: a boolean parameter, 'raise_on_no_answer', has
+         been added to the query() methods.  In no-error, no-data
+         situations, this parameter determines whether NoAnswer should be
+         raised or not.  If True, NoAnswer is raised.  If False, then an
+         Answer() object with a None rrset will be returned.
+
+       * dns/resolver.py: Answer() objects now have a canonical_name field.
+
+2011-01-11  Bob Halley  <halley@dnspython.org>
+
+       * Dnspython was erroneously doing case-insensitive comparisons
+         of the names in NSEC and RRSIG RRs.  Thanks to Casey Deccio for
+         reporting this bug.
+
 2010-12-17  Bob Halley  <halley@dnspython.org>
 
        * dns/message.py (_WireReader._get_section): use "is" and not "=="
index 3dbfe9534699345609a5101d9e925e3fdf8089f3..1f62c96c249129f6f127d5d65221a6e49436e0fd 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index d53dac61aba9e8b6736f69f650988f1b795d0d9d..367e7a2b76e8bd3e467f64feb1286780d3efee39 100644 (file)
@@ -22,7 +22,47 @@ development by continuing to employ the author :).
 
 ABOUT THIS RELEASE
 
-This is dnspython 1.9.2
+This is dnspython 1.10.0
+
+New since 1.9.4:
+
+        XXX TBS.
+
+Bugs fixed since 1.9.4:
+
+        XXX TBS.
+
+New since 1.9.3:
+
+        Nothing.
+
+Bugs fixed since 1.9.3:
+
+       The rdata _wire_cmp() routine now handles relative names.
+
+       The SIG RR implementation was missing 'import struct'.
+
+New since 1.9.2:
+
+       A boolean parameter, 'raise_on_no_answer', has been added to
+       the query() methods.  In no-error, no-data situations, this
+       parameter determines whether NoAnswer should be raised or not.
+       If True, NoAnswer is raised.  If False, then an Answer()
+       object with a None rrset will be returned.
+
+       Resolver Answer() objects now have a canonical_name field.
+
+       Rdata now have a __hash__ method.
+
+Bugs fixed since 1.9.2:
+
+               Dnspython was erroneously doing case-insensitive comparisons
+       of the names in NSEC and RRSIG RRs.
+
+       We now use "is" and not "==" when testing what section an RR
+       is in.
+
+       The resolver now disallows metaqueries.
 
 New since 1.9.1:
 
index 56e1e8a2ea8085d3e516026e2ef41c78cf0e19d6..c848e485813bb14badba05b2449436adbd85b1ee 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -49,5 +49,6 @@ __all__ = [
     'rdtypes',
     'update',
     'version',
+    'wiredata',
     'zone',
 ]
index a595fd44782534cd8a9038185d109eeb7ea4283e..dd6a27a53642fdbb8bb0b749b8510e40444db54e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -99,7 +99,7 @@ def key_id(key, origin=None):
         return (ord(rdata[-3]) << 8) + ord(rdata[-2])
     else:
         total = 0
-        for i in range(len(rdata) / 2):
+        for i in range(len(rdata) // 2):
             total += (ord(rdata[2 * i]) << 8) + ord(rdata[2 * i + 1])
         if len(rdata) % 2 != 0:
             total += ord(rdata[len(rdata) - 1]) << 8
@@ -299,7 +299,7 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
     if _is_rsa(rrsig.algorithm):
         # PKCS1 algorithm identifier goop
         digest = _make_algorithm_id(rrsig.algorithm) + digest
-        padlen = keylen / 8 - len(digest) - 3
+        padlen = keylen // 8 - len(digest) - 3
         digest = chr(0) + chr(1) + chr(0xFF) * padlen + chr(0) + digest
     elif _is_dsa(rrsig.algorithm):
         pass
index d8f71ec7999513e76cc5ca9a5eea055b61fbbf91..d6dcd1b1862af94376cba24f3773c76cb7810d4b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 1731cedde4f4b6d3e9d6a33d53ebdd043e3f849c..f8b6009d3f34ae13a506d2f72779bc2d31e88920 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Nominum, Inc.
+# Copyright (C) 2009, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index fd9d4f8cdf8ce5e1f5cc122e3dda67ef6cc2245b..d380cf8c0d0d609f911c18ee39642ef23cd6981b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Nominum, Inc.
+# Copyright (C) 2009, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index c6d6570d98c4f51db8ab46038fd500a4c36912ac..db6ef6e6e3c495189ea25a9960b2e6e3865f296f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 17afdbc2ec834dabdaff9cd76b36003b7ce678ac..35a8305e8093c8f503c275f091d0df6ade2bec39 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 7bd5ae598008d3affdbda15edf7eb2a9c32ebad6..0c708036b1c259adca9019b5d19d1868351f9dec 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Nominum, Inc.
+# Copyright (C) 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 8a8f3e1ca88ff054daf301cec9bb6f6ece0da970..3b7e88f7b1b767c377faee4fb12cd042e983e4db 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 1569da54759ba397ac59211e2a38f6451b0282e0..e117966e5fbe1d5ae2cba5f8967364e0b8a7ab0b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
 
 """IPv4 helper functions."""
 
-import socket
-import sys
+import struct
 
-if sys.hexversion < 0x02030000 or sys.platform == 'win32':
-    #
-    # Some versions of Python 2.2 have an inet_aton which rejects
-    # the valid IP address '255.255.255.255'.  It appears this
-    # problem is still present on the Win32 platform even in 2.3.
-    # We'll work around the problem.
-    #
-    def inet_aton(text):
-        if text == '255.255.255.255':
-            return '\xff' * 4
-        else:
-            return socket.inet_aton(text)
-else:
-    inet_aton = socket.inet_aton
+import dns.exception
 
-inet_ntoa = socket.inet_ntoa
+def inet_ntoa(address):
+    if len(address) != 4:
+        raise dns.exception.SyntaxError
+    return '%u.%u.%u.%u' % (ord(address[0]), ord(address[1]),
+                            ord(address[2]), ord(address[3]))
+
+def inet_aton(text):
+    parts = text.split('.')
+    if len(parts) != 4:
+        raise dns.exception.SyntaxError
+    for part in parts:
+        if not part.isdigit():
+            raise dns.exception.SyntaxError
+        if len(part) > 1 and part[0] == '0':
+            # No leading zeros
+            raise dns.exception.SyntaxError
+    try:
+        bytes = [int(part) for part in parts]
+        return struct.pack('BBBB', *bytes)
+    except:
+        raise dns.exception.SyntaxError
index 33c6713796d0ab2c43fb1425237ddebe62b73295..69db34a7deac2268b354bfef69d27d945376f7d9 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -89,7 +89,7 @@ def inet_ntoa(address):
         hex = ':'.join(chunks)
     return hex
 
-_v4_ending = re.compile(r'(.*):(\d+)\.(\d+)\.(\d+)\.(\d+)$')
+_v4_ending = re.compile(r'(.*):(\d+\.\d+\.\d+\.\d+)$')
 _colon_colon_start = re.compile(r'::.*')
 _colon_colon_end = re.compile(r'.*::$')
 
@@ -113,9 +113,9 @@ def inet_aton(text):
     #
     m = _v4_ending.match(text)
     if not m is None:
-        text = "%s:%04x:%04x" % (m.group(1),
-                                 int(m.group(2)) * 256 + int(m.group(3)),
-                                 int(m.group(4)) * 256 + int(m.group(5)))
+        b = dns.ipv4.inet_aton(m.group(2))
+        text = "%s:%02x%02x:%02x%02x" % (m.group(1), ord(b[0]), ord(b[1]),
+                                         ord(b[2]), ord(b[3]))
     #
     # Try to turn '::<whatever>' into ':<whatever>'; if no match try to
     # turn '<whatever>::' into '<whatever>:'
index a124a3e1779094e08f762388571737da810a642b..cf291339347291458ff10b9cd550182020647d5d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -34,6 +34,7 @@ import dns.rdatatype
 import dns.rrset
 import dns.renderer
 import dns.tsig
+import dns.wiredata
 
 class ShortHeader(dns.exception.FormError):
     """Raised if the DNS packet passed to from_wire() is too short."""
@@ -577,7 +578,7 @@ class _WireReader(object):
 
     def __init__(self, wire, message, question_only=False,
                  one_rr_per_rrset=False):
-        self.wire = wire
+        self.wire = dns.wiredata.maybe_wrap(wire)
         self.message = message
         self.current = 0
         self.updating = False
index f239c9b5de20eb9dccefeb7be01dea15e0431008..ed3ffeec5713ee73f1f7fbc82377767cee126008 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -29,6 +29,7 @@ if sys.hexversion >= 0x02030000:
     import encodings.idna
 
 import dns.exception
+import dns.wiredata
 
 NAMERELN_NONE = 0
 NAMERELN_SUPERDOMAIN = 1
@@ -670,6 +671,7 @@ def from_wire(message, current):
 
     if not isinstance(message, str):
         raise ValueError("input to from_wire() must be a byte string")
+    message = dns.wiredata.maybe_wrap(message)
     labels = []
     biggest_pointer = current
     hops = 0
@@ -678,7 +680,7 @@ def from_wire(message, current):
     cused = 1
     while count != 0:
         if count < 64:
-            labels.append(message[current : current + count])
+            labels.append(message[current : current + count].unwrap())
             current += count
             if hops == 0:
                 cused += count
index 54afb77188890e3defa64e127c8df9b28aaa135e..9f5a0efb7cfc45f1d31a2a0e1f43cf19eda52c69 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 785a2454641067a7d46f9395137cea05a9985995..7625c66d3acf196313e9a82f26f2b81692fcafb7 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 705bd09a43d1fb887e63fcc0920ef7e317e1e2f7..3258c34cd93491cfd9a42988a8a453226eeaff32 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 9dc88a635c4bb82771effabbbb6a946cf2f8b2c0..addee4e3f2de67adfb4f6c2953e7b37cc5aa51a9 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index c055f2e7cd29c211d3c02a551b060e10e14c830d..7807782aa4dc1d899470da6edfb2a95e7f197160 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 399677e984d697631d785802da58c2711751bb93..350bf790b861942822094b734903711d23f2d151 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -32,6 +32,7 @@ import dns.name
 import dns.rdataclass
 import dns.rdatatype
 import dns.tokenizer
+import dns.wiredata
 
 _hex_chunksize = 32
 
@@ -256,6 +257,19 @@ class Rdata(object):
     def __hash__(self):
         return hash(self.to_digestable(dns.name.root))
 
+    def _wire_cmp(self, other):
+        # A number of types compare rdata in wire form, so we provide
+        # the method here instead of duplicating it.
+        #
+        # We specifiy an arbitrary origin of '.' when doing the
+        # comparison, since the rdata may have relative names and we
+        # can't convert a relative name to wire without an origin.
+        b1 = cStringIO.StringIO()
+        self.to_wire(b1, None, dns.name.root)
+        b2 = cStringIO.StringIO()
+        other.to_wire(b2, None, dns.name.root)
+        return cmp(b1.getvalue(), b2.getvalue())
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         """Build an rdata object from text format.
 
@@ -399,12 +413,15 @@ def from_text(rdclass, rdtype, tok, origin = None, relativize = True):
     Once a class is chosen, its from_text() class method is called
     with the parameters to this function.
 
+    If I{tok} is a string, then a tokenizer is created and the string
+    is used as its input.
+
     @param rdclass: The rdata class
     @type rdclass: int
     @param rdtype: The rdata type
     @type rdtype: int
-    @param tok: The tokenizer
-    @type tok: dns.tokenizer.Tokenizer
+    @param tok: The tokenizer or input text
+    @type tok: dns.tokenizer.Tokenizer or string
     @param origin: The origin to use for relative names
     @type origin: dns.name.Name
     @param relativize: Should names be relativized?
@@ -456,5 +473,6 @@ def from_wire(rdclass, rdtype, wire, current, rdlen, origin = None):
     @type origin: dns.name.Name
     @rtype: dns.rdata.Rdata instance"""
 
+    wire = dns.wiredata.maybe_wrap(wire)
     cls = get_rdata_class(rdclass, rdtype)
     return cls.from_wire(rdclass, rdtype, wire, current, rdlen, origin)
index 887fd1ad6b91462c91e98048c35eaf17b6d89c53..7601e70c3a47ba3e51264381105d71864375d20d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -74,7 +74,7 @@ def from_text(text):
     @param text: the text
     @type text: string
     @rtype: int
-    @raises dns.rdataclass.UnknownRdataClass: the class is unknown
+    @raises dns.rdataclass.UnknownRdataclass: the class is unknown
     @raises ValueError: the rdata class value is not >= 0 and <= 65535
     """
 
index f556d2288b23ee7a7666fec84e813a5f0e2d12e7..dcd2b401913639a99bb5dc1c66ae7c53e1ba4a05 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 1a02b7d3cd9598b4b8dece53545e53909957d3be..380cfcd0d3fbc65576a457b7458b3b9ba07e7a28 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index e8ca6f5cbbcc69bb49380cd45caaefa5b5222c74..c729789afafab6bcceea061111b69b42f9997984 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index d2703519d5f842325f02e02f57a4963e1920b715..c102521a149e72c1d540a695ee33f7ac6b089434 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -106,13 +106,13 @@ class CERT(dns.rdata.Rdata):
         file.write(self.certificate)
 
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
-        prefix = wire[current : current + 5]
+        prefix = wire[current : current + 5].unwrap()
         current += 5
         rdlen -= 5
         if rdlen < 0:
             raise dns.exception.FormError
         (certificate_type, key_tag, algorithm) = struct.unpack("!HHB", prefix)
-        certificate = wire[current : current + rdlen]
+        certificate = wire[current : current + rdlen].unwrap()
         return cls(rdclass, rdtype, certificate_type, key_tag, algorithm,
                    certificate)
 
index 7f5c4b3bd7772c71da0bcc90f848b8269c5aaee3..fb8e9be49ea01e67d426678dbf497bb6cb6fbf52 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 07b9548342c4aa3697fc9a9b0c31591a74dd7817..8bd79793d11616b0d096b035d2305333d03a1d2e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009, 2010 Nominum, Inc.
+# Copyright (C) 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 99b5013f3353ded058e47aba93bdd34df6f786e1..d864001190c1bfd3e8f593607eafce897f5a207f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index ad66ef0c69672186f16cad6401da5270fc50327f..1d678d2f2a5c1a345a6d4ae78a9f1216f3861891 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-import dns.rdtypes.keybase
+
+import struct
+
+import dns.exception
+import dns.dnssec
+import dns.rdata
 
 # flag constants
 SEP = 0x0001
 REVOKE = 0x0080
 ZONE = 0x0100
 
-class DNSKEY(dns.rdtypes.keybase.KEYBase):
-    """DNSKEY record"""
-    pass
+class DNSKEY(dns.rdata.Rdata):
+    """DNSKEY record
+
+    @ivar flags: the key flags
+    @type flags: int
+    @ivar protocol: the protocol for which this key may be used
+    @type protocol: int
+    @ivar algorithm: the algorithm used for the key
+    @type algorithm: int
+    @ivar key: the public key
+    @type key: string"""
+
+    __slots__ = ['flags', 'protocol', 'algorithm', 'key']
+
+    def __init__(self, rdclass, rdtype, flags, protocol, algorithm, key):
+        super(DNSKEY, self).__init__(rdclass, rdtype)
+        self.flags = flags
+        self.protocol = protocol
+        self.algorithm = algorithm
+        self.key = key
+
+    def to_text(self, origin=None, relativize=True, **kw):
+        return '%d %d %d %s' % (self.flags, self.protocol, self.algorithm,
+                                dns.rdata._base64ify(self.key))
+
+    def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
+        flags = tok.get_uint16()
+        protocol = tok.get_uint8()
+        algorithm = dns.dnssec.algorithm_from_text(tok.get_string())
+        chunks = []
+        while 1:
+            t = tok.get().unescape()
+            if t.is_eol_or_eof():
+                break
+            if not t.is_identifier():
+                raise dns.exception.SyntaxError
+            chunks.append(t.value)
+        b64 = ''.join(chunks)
+        key = b64.decode('base64_codec')
+        return cls(rdclass, rdtype, flags, protocol, algorithm, key)
+
+    from_text = classmethod(from_text)
+
+    def to_wire(self, file, compress = None, origin = None):
+        header = struct.pack("!HBB", self.flags, self.protocol, self.algorithm)
+        file.write(header)
+        file.write(self.key)
+
+    def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
+        if rdlen < 4:
+            raise dns.exception.FormError
+        header = struct.unpack('!HBB', wire[current : current + 4])
+        current += 4
+        rdlen -= 4
+        key = wire[current : current + rdlen].unwrap()
+        return cls(rdclass, rdtype, header[0], header[1], header[2],
+                   key)
+
+    from_wire = classmethod(from_wire)
+
+    def _cmp(self, other):
+        hs = struct.pack("!HBB", self.flags, self.protocol, self.algorithm)
+        ho = struct.pack("!HBB", other.flags, other.protocol, other.algorithm)
+        v = cmp(hs, ho)
+        if v == 0:
+            v = cmp(self.key, other.key)
+        return v
index 3a06f448f77c6cb307d09e2b59cd3d1eff36cda2..56b6332de208b8e6dfe0eeea31cbe744919cdcf0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 6f63cc05f63c549cecb28a9b42ce6d4bb5d144aa..38d1d88b287fbd3708dade05e2f3d68cb10ee765 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -29,7 +29,7 @@ def _validate_float_string(what):
         raise dns.exception.FormError
     if not right == '' and not right.isdigit():
         raise dns.exception.FormError
-    
+
 class GPOS(dns.rdata.Rdata):
     """GPOS record
 
@@ -42,7 +42,7 @@ class GPOS(dns.rdata.Rdata):
     @see: RFC 1712"""
 
     __slots__ = ['latitude', 'longitude', 'altitude']
-    
+
     def __init__(self, rdclass, rdtype, latitude, longitude, altitude):
         super(GPOS, self).__init__(rdclass, rdtype)
         if isinstance(latitude, float) or \
@@ -66,14 +66,14 @@ class GPOS(dns.rdata.Rdata):
 
     def to_text(self, origin=None, relativize=True, **kw):
         return '%s %s %s' % (self.latitude, self.longitude, self.altitude)
-        
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         latitude = tok.get_string()
         longitude = tok.get_string()
         altitude = tok.get_string()
         tok.get_eol()
         return cls(rdclass, rdtype, latitude, longitude, altitude)
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
@@ -92,14 +92,14 @@ class GPOS(dns.rdata.Rdata):
         byte = chr(l)
         file.write(byte)
         file.write(self.altitude)
-        
+
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
         l = ord(wire[current])
         current += 1
         rdlen -= 1
         if l > rdlen:
             raise dns.exception.FormError
-        latitude = wire[current : current + l]
+        latitude = wire[current : current + l].unwrap()
         current += l
         rdlen -= l
         l = ord(wire[current])
@@ -107,7 +107,7 @@ class GPOS(dns.rdata.Rdata):
         rdlen -= 1
         if l > rdlen:
             raise dns.exception.FormError
-        longitude = wire[current : current + l]
+        longitude = wire[current : current + l].unwrap()
         current += l
         rdlen -= l
         l = ord(wire[current])
@@ -115,7 +115,7 @@ class GPOS(dns.rdata.Rdata):
         rdlen -= 1
         if l != rdlen:
             raise dns.exception.FormError
-        altitude = wire[current : current + l]
+        altitude = wire[current : current + l].unwrap()
         return cls(rdclass, rdtype, latitude, longitude, altitude)
 
     from_wire = classmethod(from_wire)
index e592ad39a7d86b5a30e5d2b223a09be83d612d34..15fd54e69ef03c7ac0dd739b4f9cde124d8b1208 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -27,7 +27,7 @@ class HINFO(dns.rdata.Rdata):
     @see: RFC 1035"""
 
     __slots__ = ['cpu', 'os']
-    
+
     def __init__(self, rdclass, rdtype, cpu, os):
         super(HINFO, self).__init__(rdclass, rdtype)
         self.cpu = cpu
@@ -36,13 +36,13 @@ class HINFO(dns.rdata.Rdata):
     def to_text(self, origin=None, relativize=True, **kw):
         return '"%s" "%s"' % (dns.rdata._escapify(self.cpu),
                               dns.rdata._escapify(self.os))
-        
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         cpu = tok.get_string()
         os = tok.get_string()
         tok.get_eol()
         return cls(rdclass, rdtype, cpu, os)
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
@@ -56,14 +56,14 @@ class HINFO(dns.rdata.Rdata):
         byte = chr(l)
         file.write(byte)
         file.write(self.os)
-        
+
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
         l = ord(wire[current])
         current += 1
         rdlen -= 1
         if l > rdlen:
             raise dns.exception.FormError
-        cpu = wire[current : current + l]
+        cpu = wire[current : current + l].unwrap()
         current += l
         rdlen -= l
         l = ord(wire[current])
@@ -71,7 +71,7 @@ class HINFO(dns.rdata.Rdata):
         rdlen -= 1
         if l != rdlen:
             raise dns.exception.FormError
-        os = wire[current : current + l]
+        os = wire[current : current + l].unwrap()
         return cls(rdclass, rdtype, cpu, os)
 
     from_wire = classmethod(from_wire)
index 8f96ae93d640cc8dbd4a699a494fa94c8c6b902d..968b36f5e23f09d77fde0c0ee0187db2345eb78c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Nominum, Inc.
+# Copyright (C) 2010, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -86,10 +86,10 @@ class HIP(dns.rdata.Rdata):
                                             wire[current : current + 4])
         current += 4
         rdlen -= 4
-        hit = wire[current : current + lh]
+        hit = wire[current : current + lh].unwrap()
         current += lh
         rdlen -= lh
-        key = wire[current : current + lk]
+        key = wire[current : current + lk].unwrap()
         current += lk
         rdlen -= lk
         servers = []
index 424d3a9a3c9f95194e91a0d26efe797a3af08248..0c2d3cd035b9568539b519b61e1c6770662ff2d9 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -73,7 +73,7 @@ class ISDN(dns.rdata.Rdata):
         rdlen -= 1
         if l > rdlen:
             raise dns.exception.FormError
-        address = wire[current : current + l]
+        address = wire[current : current + l].unwrap()
         current += l
         rdlen -= l
         if rdlen > 0:
@@ -82,7 +82,7 @@ class ISDN(dns.rdata.Rdata):
             rdlen -= 1
             if l != rdlen:
                 raise dns.exception.FormError
-            subaddress = wire[current : current + l]
+            subaddress = wire[current : current + l].unwrap()
         else:
             subaddress = ''
         return cls(rdclass, rdtype, address, subaddress)
diff --git a/lib/dnspython/dns/rdtypes/ANY/KEY.py b/lib/dnspython/dns/rdtypes/ANY/KEY.py
deleted file mode 100644 (file)
index c8581ed..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose with or without fee is hereby granted,
-# provided that the above copyright notice and this permission notice
-# appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-import dns.rdtypes.keybase
-
-class KEY(dns.rdtypes.keybase.KEYBase):
-    """KEY record"""
-    pass
index 518dd6010f7c6d7a3084fd2e2c65022af918b2c0..154546d79d2e7a0a30da07dc5a6d55dc05249be1 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 9cad2606722874994d55ff6615cab1b2d4a4deb5..92f41532a76ef0d6989430640b9d40041d27c028 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 4b03a3ab4760368efd959414ec784af1b452d7c8..6b45d4d4b60d4bc6339ea97ac80242b9f5e060ad 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 72859ce108a883a0bcbcc4fd8ae185d7aea433f3..ad113a4b59df673b42a7ed7f89e55450f2f3ca43 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -79,7 +79,7 @@ class NSEC(dns.rdata.Rdata):
                 bitmap = ['\0'] * 32
                 window = new_window
             offset = nrdtype % 256
-            byte = offset / 8
+            byte = offset // 8
             bit = offset % 8
             octets = byte + 1
             bitmap[byte] = chr(ord(bitmap[byte]) | (0x80 >> bit))
@@ -111,7 +111,7 @@ class NSEC(dns.rdata.Rdata):
             rdlen -= 2
             if rdlen < octets:
                 raise dns.exception.FormError("bad NSEC bitmap length")
-            bitmap = wire[current : current + octets]
+            bitmap = wire[current : current + octets].unwrap()
             current += octets
             rdlen -= octets
             windows.append((window, bitmap))
@@ -125,17 +125,4 @@ class NSEC(dns.rdata.Rdata):
         self.next = self.next.choose_relativity(origin, relativize)
 
     def _cmp(self, other):
-        v = cmp(self.next, other.next)
-        if v == 0:
-            b1 = cStringIO.StringIO()
-            for (window, bitmap) in self.windows:
-                b1.write(chr(window))
-                b1.write(chr(len(bitmap)))
-                b1.write(bitmap)
-            b2 = cStringIO.StringIO()
-            for (window, bitmap) in other.windows:
-                b2.write(chr(window))
-                b2.write(chr(len(bitmap)))
-                b2.write(bitmap)
-            v = cmp(b1.getvalue(), b2.getvalue())
-        return v
+        return self._wire_cmp(other)
index 932d7b40327553a83e5f8c971f6558a4b94d8a11..c7ac7375b41da1031284690f6d68d64ed0523a51 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -118,7 +118,7 @@ class NSEC3(dns.rdata.Rdata):
                 bitmap = ['\0'] * 32
                 window = new_window
             offset = nrdtype % 256
-            byte = offset / 8
+            byte = offset // 8
             bit = offset % 8
             octets = byte + 1
             bitmap[byte] = chr(ord(bitmap[byte]) | (0x80 >> bit))
@@ -145,13 +145,13 @@ class NSEC3(dns.rdata.Rdata):
                                                              wire[current : current + 5])
         current += 5
         rdlen -= 5
-        salt = wire[current : current + slen]
+        salt = wire[current : current + slen].unwrap()
         current += slen
         rdlen -= slen
         (nlen, ) = struct.unpack('!B', wire[current])
         current += 1
         rdlen -= 1
-        next = wire[current : current + nlen]
+        next = wire[current : current + nlen].unwrap()
         current += nlen
         rdlen -= nlen
         windows = []
@@ -166,7 +166,7 @@ class NSEC3(dns.rdata.Rdata):
             rdlen -= 2
             if rdlen < octets:
                 raise dns.exception.FormError("bad NSEC3 bitmap length")
-            bitmap = wire[current : current + octets]
+            bitmap = wire[current : current + octets].unwrap()
             current += octets
             rdlen -= octets
             windows.append((window, bitmap))
index ec91e5e85c3a76544f5529f9ab09487439277bb9..4e687825ad70ab8c45257842b43ee8240728259c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -71,7 +71,7 @@ class NSEC3PARAM(dns.rdata.Rdata):
                                                              wire[current : current + 5])
         current += 5
         rdlen -= 5
-        salt = wire[current : current + slen]
+        salt = wire[current : current + slen].unwrap()
         current += slen
         rdlen -= slen
         if rdlen != 0:
diff --git a/lib/dnspython/dns/rdtypes/ANY/NXT.py b/lib/dnspython/dns/rdtypes/ANY/NXT.py
deleted file mode 100644 (file)
index 99ae9b9..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose with or without fee is hereby granted,
-# provided that the above copyright notice and this permission notice
-# appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-import dns.exception
-import dns.rdata
-import dns.rdatatype
-import dns.name
-
-class NXT(dns.rdata.Rdata):
-    """NXT record
-
-    @ivar next: the next name
-    @type next: dns.name.Name object
-    @ivar bitmap: the type bitmap
-    @type bitmap: string
-    @see: RFC 2535"""
-
-    __slots__ = ['next', 'bitmap']
-
-    def __init__(self, rdclass, rdtype, next, bitmap):
-        super(NXT, self).__init__(rdclass, rdtype)
-        self.next = next
-        self.bitmap = bitmap
-
-    def to_text(self, origin=None, relativize=True, **kw):
-        next = self.next.choose_relativity(origin, relativize)
-        bits = []
-        for i in xrange(0, len(self.bitmap)):
-            byte = ord(self.bitmap[i])
-            for j in xrange(0, 8):
-                if byte & (0x80 >> j):
-                    bits.append(dns.rdatatype.to_text(i * 8 + j))
-        text = ' '.join(bits)
-        return '%s %s' % (next, text)
-
-    def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
-        next = tok.get_name()
-        next = next.choose_relativity(origin, relativize)
-        bitmap = ['\x00', '\x00', '\x00', '\x00',
-                  '\x00', '\x00', '\x00', '\x00',
-                  '\x00', '\x00', '\x00', '\x00',
-                  '\x00', '\x00', '\x00', '\x00' ]
-        while 1:
-            token = tok.get().unescape()
-            if token.is_eol_or_eof():
-                break
-            if token.value.isdigit():
-                nrdtype = int(token.value)
-            else:
-                nrdtype = dns.rdatatype.from_text(token.value)
-            if nrdtype == 0:
-                raise dns.exception.SyntaxError("NXT with bit 0")
-            if nrdtype > 127:
-                raise dns.exception.SyntaxError("NXT with bit > 127")
-            i = nrdtype // 8
-            bitmap[i] = chr(ord(bitmap[i]) | (0x80 >> (nrdtype % 8)))
-        bitmap = dns.rdata._truncate_bitmap(bitmap)
-        return cls(rdclass, rdtype, next, bitmap)
-
-    from_text = classmethod(from_text)
-
-    def to_wire(self, file, compress = None, origin = None):
-        self.next.to_wire(file, None, origin)
-        file.write(self.bitmap)
-
-    def to_digestable(self, origin = None):
-        return self.next.to_digestable(origin) + self.bitmap
-
-    def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
-        (next, cused) = dns.name.from_wire(wire[: current + rdlen], current)
-        current += cused
-        rdlen -= cused
-        bitmap = wire[current : current + rdlen]
-        if not origin is None:
-            next = next.relativize(origin)
-        return cls(rdclass, rdtype, next, bitmap)
-
-    from_wire = classmethod(from_wire)
-
-    def choose_relativity(self, origin = None, relativize = True):
-        self.next = self.next.choose_relativity(origin, relativize)
-
-    def _cmp(self, other):
-        v = cmp(self.next, other.next)
-        if v == 0:
-            v = cmp(self.bitmap, other.bitmap)
-        return v
index 6c4b79eaac3d3d56ca855abc91e7b4613bb60207..4a037537b6c0a6a2803b99f6e395c838e174a03d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 421ce8e207ece7e782f15ecfff2d94a8cbc3cfde..26c55314e136c89184a66bda74a68c37c16e1c3f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 0e4816f64846787a99f89ef320f813437f16c9b7..63d389cd7ae263a2a51487dbf8cbbbc588730a06 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-import dns.rdtypes.sigbase
+import calendar
+import struct
+import time
 
-class RRSIG(dns.rdtypes.sigbase.SIGBase):
-    """RRSIG record"""
+import dns.dnssec
+import dns.exception
+import dns.rdata
+import dns.rdatatype
+
+class BadSigTime(dns.exception.DNSException):
+    """Raised when a SIG or RRSIG RR's time cannot be parsed."""
     pass
+
+def sigtime_to_posixtime(what):
+    if len(what) != 14:
+        raise BadSigTime
+    year = int(what[0:4])
+    month = int(what[4:6])
+    day = int(what[6:8])
+    hour = int(what[8:10])
+    minute = int(what[10:12])
+    second = int(what[12:14])
+    return calendar.timegm((year, month, day, hour, minute, second,
+                            0, 0, 0))
+
+def posixtime_to_sigtime(what):
+    return time.strftime('%Y%m%d%H%M%S', time.gmtime(what))
+
+class RRSIG(dns.rdata.Rdata):
+    """RRSIG record
+
+    @ivar type_covered: the rdata type this signature covers
+    @type type_covered: int
+    @ivar algorithm: the algorithm used for the sig
+    @type algorithm: int
+    @ivar labels: number of labels
+    @type labels: int
+    @ivar original_ttl: the original TTL
+    @type original_ttl: long
+    @ivar expiration: signature expiration time
+    @type expiration: long
+    @ivar inception: signature inception time
+    @type inception: long
+    @ivar key_tag: the key tag
+    @type key_tag: int
+    @ivar signer: the signer
+    @type signer: dns.name.Name object
+    @ivar signature: the signature
+    @type signature: string"""
+
+    __slots__ = ['type_covered', 'algorithm', 'labels', 'original_ttl',
+                 'expiration', 'inception', 'key_tag', 'signer',
+                 'signature']
+
+    def __init__(self, rdclass, rdtype, type_covered, algorithm, labels,
+                 original_ttl, expiration, inception, key_tag, signer,
+                 signature):
+        super(RRSIG, self).__init__(rdclass, rdtype)
+        self.type_covered = type_covered
+        self.algorithm = algorithm
+        self.labels = labels
+        self.original_ttl = original_ttl
+        self.expiration = expiration
+        self.inception = inception
+        self.key_tag = key_tag
+        self.signer = signer
+        self.signature = signature
+
+    def covers(self):
+        return self.type_covered
+
+    def to_text(self, origin=None, relativize=True, **kw):
+        return '%s %d %d %d %s %s %d %s %s' % (
+            dns.rdatatype.to_text(self.type_covered),
+            self.algorithm,
+            self.labels,
+            self.original_ttl,
+            posixtime_to_sigtime(self.expiration),
+            posixtime_to_sigtime(self.inception),
+            self.key_tag,
+            self.signer,
+            dns.rdata._base64ify(self.signature)
+            )
+
+    def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
+        type_covered = dns.rdatatype.from_text(tok.get_string())
+        algorithm = dns.dnssec.algorithm_from_text(tok.get_string())
+        labels = tok.get_int()
+        original_ttl = tok.get_ttl()
+        expiration = sigtime_to_posixtime(tok.get_string())
+        inception = sigtime_to_posixtime(tok.get_string())
+        key_tag = tok.get_int()
+        signer = tok.get_name()
+        signer = signer.choose_relativity(origin, relativize)
+        chunks = []
+        while 1:
+            t = tok.get().unescape()
+            if t.is_eol_or_eof():
+                break
+            if not t.is_identifier():
+                raise dns.exception.SyntaxError
+            chunks.append(t.value)
+        b64 = ''.join(chunks)
+        signature = b64.decode('base64_codec')
+        return cls(rdclass, rdtype, type_covered, algorithm, labels,
+                   original_ttl, expiration, inception, key_tag, signer,
+                   signature)
+
+    from_text = classmethod(from_text)
+
+    def to_wire(self, file, compress = None, origin = None):
+        header = struct.pack('!HBBIIIH', self.type_covered,
+                             self.algorithm, self.labels,
+                             self.original_ttl, self.expiration,
+                             self.inception, self.key_tag)
+        file.write(header)
+        self.signer.to_wire(file, None, origin)
+        file.write(self.signature)
+
+    def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
+        header = struct.unpack('!HBBIIIH', wire[current : current + 18])
+        current += 18
+        rdlen -= 18
+        (signer, cused) = dns.name.from_wire(wire[: current + rdlen], current)
+        current += cused
+        rdlen -= cused
+        if not origin is None:
+            signer = signer.relativize(origin)
+        signature = wire[current : current + rdlen].unwrap()
+        return cls(rdclass, rdtype, header[0], header[1], header[2],
+                   header[3], header[4], header[5], header[6], signer,
+                   signature)
+
+    from_wire = classmethod(from_wire)
+
+    def choose_relativity(self, origin = None, relativize = True):
+        self.signer = self.signer.choose_relativity(origin, relativize)
+
+    def _cmp(self, other):
+        return self._wire_cmp(other)
index 1efd3724d945d77ca35ffec77ff1f332866a636e..f9653fdb344a22b5eb6b292f07bccd0f8ef23a67 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/dns/rdtypes/ANY/SIG.py b/lib/dnspython/dns/rdtypes/ANY/SIG.py
deleted file mode 100644 (file)
index 501e29c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose with or without fee is hereby granted,
-# provided that the above copyright notice and this permission notice
-# appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-import dns.rdtypes.sigbase
-
-class SIG(dns.rdtypes.sigbase.SIGBase):
-    """SIG record"""
-    def to_digestable(self, origin = None):
-        return struct.pack('!HBBIIIH', self.type_covered,
-                           self.algorithm, self.labels,
-                           self.original_ttl, self.expiration,
-                           self.inception, self.key_tag) + \
-                           self.signer.to_digestable(origin) + \
-                           self.signature
index a25a35e29b0bf4bb1a9eb42ea4d2d4003dcd620a..2d6f21b56b9bacbe247e7aca682f91f5f399aeab 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -41,7 +41,7 @@ class SOA(dns.rdata.Rdata):
 
     __slots__ = ['mname', 'rname', 'serial', 'refresh', 'retry', 'expire',
                  'minimum']
-    
+
     def __init__(self, rdclass, rdtype, mname, rname, serial, refresh, retry,
                  expire, minimum):
         super(SOA, self).__init__(rdclass, rdtype)
@@ -59,7 +59,7 @@ class SOA(dns.rdata.Rdata):
         return '%s %s %d %d %d %d %d' % (
             mname, rname, self.serial, self.refresh, self.retry,
             self.expire, self.minimum )
-        
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         mname = tok.get_name()
         rname = tok.get_name()
@@ -73,7 +73,7 @@ class SOA(dns.rdata.Rdata):
         tok.get_eol()
         return cls(rdclass, rdtype, mname, rname, serial, refresh, retry,
                    expire, minimum )
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
index 9b5a9a9fedfdf79583432d6eba2908505df0fdf6..8860dd72bb428f6304a17fbd5cf5fda21c1392eb 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 162dda5c4887ae501634370bf0c5fe7abd96b436..cec650a570c0223822b9157b172e5a033b083839 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2005-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -30,7 +30,7 @@ class SSHFP(dns.rdata.Rdata):
     @see: draft-ietf-secsh-dns-05.txt"""
 
     __slots__ = ['algorithm', 'fp_type', 'fingerprint']
-    
+
     def __init__(self, rdclass, rdtype, algorithm, fp_type,
                  fingerprint):
         super(SSHFP, self).__init__(rdclass, rdtype)
@@ -43,7 +43,7 @@ class SSHFP(dns.rdata.Rdata):
                              self.fp_type,
                              dns.rdata._hexify(self.fingerprint,
                                                chunksize=128))
-        
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         algorithm = tok.get_uint8()
         fp_type = tok.get_uint8()
@@ -51,19 +51,19 @@ class SSHFP(dns.rdata.Rdata):
         fingerprint = fingerprint.decode('hex_codec')
         tok.get_eol()
         return cls(rdclass, rdtype, algorithm, fp_type, fingerprint)
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
         header = struct.pack("!BB", self.algorithm, self.fp_type)
         file.write(header)
         file.write(self.fingerprint)
-        
+
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
         header = struct.unpack("!BB", wire[current : current + 2])
         current += 2
         rdlen -= 2
-        fingerprint = wire[current : current + rdlen]
+        fingerprint = wire[current : current + rdlen].unwrap()
         return cls(rdclass, rdtype, header[0], header[1], fingerprint)
 
     from_wire = classmethod(from_wire)
index 23f4f3b7c66f511a570cb9ad85df431c57a98edc..604fd0f4deb8b83fa86235692d0211231245ca72 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index c3632f7fc406b088c08dd834f3a0fc8e9be101a0..ae91295f8c98094b30dc6ff1e5d677dad1231a3e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -25,19 +25,19 @@ class X25(dns.rdata.Rdata):
     @see: RFC 1183"""
 
     __slots__ = ['address']
-    
+
     def __init__(self, rdclass, rdtype, address):
         super(X25, self).__init__(rdclass, rdtype)
         self.address = address
 
     def to_text(self, origin=None, relativize=True, **kw):
         return '"%s"' % dns.rdata._escapify(self.address)
-        
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         address = tok.get_string()
         tok.get_eol()
         return cls(rdclass, rdtype, address)
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
@@ -46,14 +46,14 @@ class X25(dns.rdata.Rdata):
         byte = chr(l)
         file.write(byte)
         file.write(self.address)
-        
+
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
         l = ord(wire[current])
         current += 1
         rdlen -= 1
         if l != rdlen:
             raise dns.exception.FormError
-        address = wire[current : current + l]
+        address = wire[current : current + l].unwrap()
         return cls(rdclass, rdtype, address)
 
     from_wire = classmethod(from_wire)
index 0815dd5450fd70280393a9d0e9133cf25991fa9a..721e9dd60b7032368b3ae09c09a49efd65a69b60 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -27,19 +27,16 @@ __all__ = [
     'HINFO',
     'HIP',
     'ISDN',
-    'KEY',
     'LOC',
     'MX',
     'NS',
     'NSEC',
     'NSEC3',
     'NSEC3PARAM',
-    'NXT',
     'PTR',
     'RP',
     'RRSIG',
     'RT',
-    'SIG',
     'SOA',
     'SPF',
     'SSHFP',
index e05f204a2fd59014188fbad8f3eba2c0f00f850b..372d3332260eefc8926706b6f1491e9b167ffd6c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 2d812d39eb95cc5b8c378e52d9600af4bc4ba728..e131bd5070308b7bac9a5aa3b091c21bac96e5c3 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 7412c02d304196d9570e1b55c46553201356bdce..260fd6f39fc8e2dbb0033cbbcad566d6e809c0c4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -131,7 +131,7 @@ class APL(dns.rdata.Rdata):
             rdlen -= 4
             if rdlen < afdlen:
                 raise dns.exception.FormError
-            address = wire[current : current + afdlen]
+            address = wire[current : current + afdlen].unwrap()
             l = len(address)
             if header[0] == 1:
                 if l < 4:
index 2d35234bf04ca025638438698c4097ae078e8ec0..5524beadd13f283514d6005dc003dedd9f0bb5fc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -51,7 +51,7 @@ class DHCID(dns.rdata.Rdata):
         file.write(self.data)
 
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
-        data = wire[current : current + rdlen]
+        data = wire[current : current + rdlen].unwrap()
         return cls(rdclass, rdtype, data)
 
     from_wire = classmethod(from_wire)
index 9ab08d881c552877090315192d30629210a9d759..d85b6fe9931b4ae2c58eab01e7b007a53b4db81b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -140,7 +140,7 @@ class IPSECKEY(dns.rdata.Rdata):
             rdlen -= cused
         else:
             raise dns.exception.FormError('invalid IPSECKEY gateway type')
-        key = wire[current : current + rdlen]
+        key = wire[current : current + rdlen].unwrap()
         return cls(rdclass, rdtype, header[0], gateway_type, header[2],
                    gateway, key)
 
index 4d8a3a7d6bdab99a9f78b17dce179416d800bc89..c7bd5bbe65b9df686a7a04a39e24a1abe438945f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index a3cca55e1ce6fe581377f4ab891d8fafa061c1c9..7fe043082b397c948b308e37bdd0f63d554238a4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -45,7 +45,7 @@ class NAPTR(dns.rdata.Rdata):
 
     __slots__ = ['order', 'preference', 'flags', 'service', 'regexp',
                  'replacement']
-    
+
     def __init__(self, rdclass, rdtype, order, preference, flags, service,
                  regexp, replacement):
         super(NAPTR, self).__init__(rdclass, rdtype)
@@ -76,7 +76,7 @@ class NAPTR(dns.rdata.Rdata):
         tok.get_eol()
         return cls(rdclass, rdtype, order, preference, flags, service,
                    regexp, replacement)
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
@@ -86,7 +86,7 @@ class NAPTR(dns.rdata.Rdata):
         _write_string(file, self.service)
         _write_string(file, self.regexp)
         self.replacement.to_wire(file, compress, origin)
-        
+
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
         (order, preference) = struct.unpack('!HH', wire[current : current + 4])
         current += 4
@@ -98,7 +98,7 @@ class NAPTR(dns.rdata.Rdata):
             rdlen -= 1
             if l > rdlen or rdlen < 0:
                 raise dns.exception.FormError
-            s = wire[current : current + l]
+            s = wire[current : current + l].unwrap()
             current += l
             rdlen -= l
             strings.append(s)
@@ -116,7 +116,7 @@ class NAPTR(dns.rdata.Rdata):
     def choose_relativity(self, origin = None, relativize = True):
         self.replacement = self.replacement.choose_relativity(origin,
                                                               relativize)
-        
+
     def _cmp(self, other):
         sp = struct.pack("!HH", self.order, self.preference)
         op = struct.pack("!HH", other.order, other.preference)
index 22b9131ccf3fe0c751801f542cf3131f54d4b453..216cb0a81aac33bd0a3746c4c5b08f84398d538b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -50,7 +50,7 @@ class NSAP(dns.rdata.Rdata):
         file.write(self.address)
 
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
-        address = wire[current : current + rdlen]
+        address = wire[current : current + rdlen].unwrap()
         return cls(rdclass, rdtype, address)
 
     from_wire = classmethod(from_wire)
index 6f591f4ec08ad7f4f2e234b30cb4c01d59172f3e..df5b989ac80bdd980fb6e92be98c4d4b6fb84405 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 0f112907240696c0cb74acbed5855c8a1c2df3e9..1422b8348756785bd0a5503dc5a0db82b0e08471 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -31,7 +31,7 @@ class PX(dns.rdata.Rdata):
     @see: RFC 2163"""
 
     __slots__ = ['preference', 'map822', 'mapx400']
-        
+
     def __init__(self, rdclass, rdtype, preference, map822, mapx400):
         super(PX, self).__init__(rdclass, rdtype)
         self.preference = preference
@@ -42,7 +42,7 @@ class PX(dns.rdata.Rdata):
         map822 = self.map822.choose_relativity(origin, relativize)
         mapx400 = self.mapx400.choose_relativity(origin, relativize)
         return '%d %s %s' % (self.preference, map822, mapx400)
-        
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         preference = tok.get_uint16()
         map822 = tok.get_name()
@@ -51,7 +51,7 @@ class PX(dns.rdata.Rdata):
         mapx400 = mapx400.choose_relativity(origin, relativize)
         tok.get_eol()
         return cls(rdclass, rdtype, preference, map822, mapx400)
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
@@ -59,7 +59,7 @@ class PX(dns.rdata.Rdata):
         file.write(pref)
         self.map822.to_wire(file, None, origin)
         self.mapx400.to_wire(file, None, origin)
-        
+
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
         (preference, ) = struct.unpack('!H', wire[current : current + 2])
         current += 2
index c9c5823381fe159594664564f23981f5f2030971..e101b26beaeb24e8a644b2b83159ed26e78bb8bb 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 85aafb3d231d546cf3d68c5ed89cf0b9318fd87c..04c3054e449c72c96faf6310ac8163c5d81d69d2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -95,7 +95,7 @@ class WKS(dns.rdata.Rdata):
         protocol, = struct.unpack('!B', wire[current + 4 : current + 5])
         current += 5
         rdlen -= 5
-        bitmap = wire[current : current + rdlen]
+        bitmap = wire[current : current + rdlen].unwrap()
         return cls(rdclass, rdtype, address, protocol, bitmap)
 
     from_wire = classmethod(from_wire)
index ab931296ececab5bf1a59826a14a864cdd0318ce..24cf1ece4eb8afbfe2b840191e725efceb96dd8d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 13282be73a0afef6135e9268be38681ea66334a0..49db5a3776922a63ac106a7f04b323d9cb7722ec 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -20,6 +20,4 @@ __all__ = [
     'IN',
     'mxbase',
     'nsbase',
-    'sigbase',
-    'keybase',
 ]
index aa46403a5f181ac69583cf00eda077a63b8e314c..6f5559a7e4ed5c53f39338583991e6f564a20d3a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Nominum, Inc.
+# Copyright (C) 2010, 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -76,7 +76,7 @@ class DSBase(dns.rdata.Rdata):
         header = struct.unpack("!HBB", wire[current : current + 4])
         current += 4
         rdlen -= 4
-        digest = wire[current : current + rdlen]
+        digest = wire[current : current + rdlen].unwrap()
         return cls(rdclass, rdtype, header[0], header[1], header[2], digest)
 
     from_wire = classmethod(from_wire)
diff --git a/lib/dnspython/dns/rdtypes/keybase.py b/lib/dnspython/dns/rdtypes/keybase.py
deleted file mode 100644 (file)
index 75c9272..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose with or without fee is hereby granted,
-# provided that the above copyright notice and this permission notice
-# appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-import struct
-
-import dns.exception
-import dns.dnssec
-import dns.rdata
-
-_flags_from_text = {
-    'NOCONF': (0x4000, 0xC000),
-    'NOAUTH': (0x8000, 0xC000),
-    'NOKEY': (0xC000, 0xC000),
-    'FLAG2': (0x2000, 0x2000),
-    'EXTEND': (0x1000, 0x1000),
-    'FLAG4': (0x0800, 0x0800),
-    'FLAG5': (0x0400, 0x0400),
-    'USER': (0x0000, 0x0300),
-    'ZONE': (0x0100, 0x0300),
-    'HOST': (0x0200, 0x0300),
-    'NTYP3': (0x0300, 0x0300),
-    'FLAG8': (0x0080, 0x0080),
-    'FLAG9': (0x0040, 0x0040),
-    'FLAG10': (0x0020, 0x0020),
-    'FLAG11': (0x0010, 0x0010),
-    'SIG0': (0x0000, 0x000f),
-    'SIG1': (0x0001, 0x000f),
-    'SIG2': (0x0002, 0x000f),
-    'SIG3': (0x0003, 0x000f),
-    'SIG4': (0x0004, 0x000f),
-    'SIG5': (0x0005, 0x000f),
-    'SIG6': (0x0006, 0x000f),
-    'SIG7': (0x0007, 0x000f),
-    'SIG8': (0x0008, 0x000f),
-    'SIG9': (0x0009, 0x000f),
-    'SIG10': (0x000a, 0x000f),
-    'SIG11': (0x000b, 0x000f),
-    'SIG12': (0x000c, 0x000f),
-    'SIG13': (0x000d, 0x000f),
-    'SIG14': (0x000e, 0x000f),
-    'SIG15': (0x000f, 0x000f),
-    }
-
-_protocol_from_text = {
-    'NONE' : 0,
-    'TLS' : 1,
-    'EMAIL' : 2,
-    'DNSSEC' : 3,
-    'IPSEC' : 4,
-    'ALL' : 255,
-    }
-
-class KEYBase(dns.rdata.Rdata):
-    """KEY-like record base
-
-    @ivar flags: the key flags
-    @type flags: int
-    @ivar protocol: the protocol for which this key may be used
-    @type protocol: int
-    @ivar algorithm: the algorithm used for the key
-    @type algorithm: int
-    @ivar key: the public key
-    @type key: string"""
-
-    __slots__ = ['flags', 'protocol', 'algorithm', 'key']
-
-    def __init__(self, rdclass, rdtype, flags, protocol, algorithm, key):
-        super(KEYBase, self).__init__(rdclass, rdtype)
-        self.flags = flags
-        self.protocol = protocol
-        self.algorithm = algorithm
-        self.key = key
-
-    def to_text(self, origin=None, relativize=True, **kw):
-        return '%d %d %d %s' % (self.flags, self.protocol, self.algorithm,
-                                dns.rdata._base64ify(self.key))
-
-    def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
-        flags = tok.get_string()
-        if flags.isdigit():
-            flags = int(flags)
-        else:
-            flag_names = flags.split('|')
-            flags = 0
-            for flag in flag_names:
-                v = _flags_from_text.get(flag)
-                if v is None:
-                    raise dns.exception.SyntaxError('unknown flag %s' % flag)
-                flags &= ~v[1]
-                flags |= v[0]
-        protocol = tok.get_string()
-        if protocol.isdigit():
-            protocol = int(protocol)
-        else:
-            protocol = _protocol_from_text.get(protocol)
-            if protocol is None:
-                raise dns.exception.SyntaxError('unknown protocol %s' % protocol)
-
-        algorithm = dns.dnssec.algorithm_from_text(tok.get_string())
-        chunks = []
-        while 1:
-            t = tok.get().unescape()
-            if t.is_eol_or_eof():
-                break
-            if not t.is_identifier():
-                raise dns.exception.SyntaxError
-            chunks.append(t.value)
-        b64 = ''.join(chunks)
-        key = b64.decode('base64_codec')
-        return cls(rdclass, rdtype, flags, protocol, algorithm, key)
-
-    from_text = classmethod(from_text)
-
-    def to_wire(self, file, compress = None, origin = None):
-        header = struct.pack("!HBB", self.flags, self.protocol, self.algorithm)
-        file.write(header)
-        file.write(self.key)
-
-    def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
-        if rdlen < 4:
-            raise dns.exception.FormError
-        header = struct.unpack('!HBB', wire[current : current + 4])
-        current += 4
-        rdlen -= 4
-        key = wire[current : current + rdlen]
-        return cls(rdclass, rdtype, header[0], header[1], header[2],
-                   key)
-
-    from_wire = classmethod(from_wire)
-
-    def _cmp(self, other):
-        hs = struct.pack("!HBB", self.flags, self.protocol, self.algorithm)
-        ho = struct.pack("!HBB", other.flags, other.protocol, other.algorithm)
-        v = cmp(hs, ho)
-        if v == 0:
-            v = cmp(self.key, other.key)
-        return v
index 5e3515bec4bcc6cb1bcea5c5d34d743e61ecb41e..abc6a9ed5b241867f350da9ba0647299c6320d39 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 7cdb2a0289a2b1c3c224011fadd23701d8bdfc85..fbd5ef1e51eb027f8189d26335dab0106d577408 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/dns/rdtypes/sigbase.py b/lib/dnspython/dns/rdtypes/sigbase.py
deleted file mode 100644 (file)
index ccb6dd6..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-# Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose with or without fee is hereby granted,
-# provided that the above copyright notice and this permission notice
-# appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-import calendar
-import struct
-import time
-
-import dns.dnssec
-import dns.exception
-import dns.rdata
-import dns.rdatatype
-
-class BadSigTime(dns.exception.DNSException):
-    """Raised when a SIG or RRSIG RR's time cannot be parsed."""
-    pass
-
-def sigtime_to_posixtime(what):
-    if len(what) != 14:
-        raise BadSigTime
-    year = int(what[0:4])
-    month = int(what[4:6])
-    day = int(what[6:8])
-    hour = int(what[8:10])
-    minute = int(what[10:12])
-    second = int(what[12:14])
-    return calendar.timegm((year, month, day, hour, minute, second,
-                            0, 0, 0))
-
-def posixtime_to_sigtime(what):
-    return time.strftime('%Y%m%d%H%M%S', time.gmtime(what))
-
-class SIGBase(dns.rdata.Rdata):
-    """SIG-like record base
-
-    @ivar type_covered: the rdata type this signature covers
-    @type type_covered: int
-    @ivar algorithm: the algorithm used for the sig
-    @type algorithm: int
-    @ivar labels: number of labels
-    @type labels: int
-    @ivar original_ttl: the original TTL
-    @type original_ttl: long
-    @ivar expiration: signature expiration time
-    @type expiration: long
-    @ivar inception: signature inception time
-    @type inception: long
-    @ivar key_tag: the key tag
-    @type key_tag: int
-    @ivar signer: the signer
-    @type signer: dns.name.Name object
-    @ivar signature: the signature
-    @type signature: string"""
-
-    __slots__ = ['type_covered', 'algorithm', 'labels', 'original_ttl',
-                 'expiration', 'inception', 'key_tag', 'signer',
-                 'signature']
-
-    def __init__(self, rdclass, rdtype, type_covered, algorithm, labels,
-                 original_ttl, expiration, inception, key_tag, signer,
-                 signature):
-        super(SIGBase, self).__init__(rdclass, rdtype)
-        self.type_covered = type_covered
-        self.algorithm = algorithm
-        self.labels = labels
-        self.original_ttl = original_ttl
-        self.expiration = expiration
-        self.inception = inception
-        self.key_tag = key_tag
-        self.signer = signer
-        self.signature = signature
-
-    def covers(self):
-        return self.type_covered
-
-    def to_text(self, origin=None, relativize=True, **kw):
-        return '%s %d %d %d %s %s %d %s %s' % (
-            dns.rdatatype.to_text(self.type_covered),
-            self.algorithm,
-            self.labels,
-            self.original_ttl,
-            posixtime_to_sigtime(self.expiration),
-            posixtime_to_sigtime(self.inception),
-            self.key_tag,
-            self.signer,
-            dns.rdata._base64ify(self.signature)
-            )
-
-    def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
-        type_covered = dns.rdatatype.from_text(tok.get_string())
-        algorithm = dns.dnssec.algorithm_from_text(tok.get_string())
-        labels = tok.get_int()
-        original_ttl = tok.get_ttl()
-        expiration = sigtime_to_posixtime(tok.get_string())
-        inception = sigtime_to_posixtime(tok.get_string())
-        key_tag = tok.get_int()
-        signer = tok.get_name()
-        signer = signer.choose_relativity(origin, relativize)
-        chunks = []
-        while 1:
-            t = tok.get().unescape()
-            if t.is_eol_or_eof():
-                break
-            if not t.is_identifier():
-                raise dns.exception.SyntaxError
-            chunks.append(t.value)
-        b64 = ''.join(chunks)
-        signature = b64.decode('base64_codec')
-        return cls(rdclass, rdtype, type_covered, algorithm, labels,
-                   original_ttl, expiration, inception, key_tag, signer,
-                   signature)
-
-    from_text = classmethod(from_text)
-
-    def to_wire(self, file, compress = None, origin = None):
-        header = struct.pack('!HBBIIIH', self.type_covered,
-                             self.algorithm, self.labels,
-                             self.original_ttl, self.expiration,
-                             self.inception, self.key_tag)
-        file.write(header)
-        self.signer.to_wire(file, None, origin)
-        file.write(self.signature)
-
-    def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
-        header = struct.unpack('!HBBIIIH', wire[current : current + 18])
-        current += 18
-        rdlen -= 18
-        (signer, cused) = dns.name.from_wire(wire[: current + rdlen], current)
-        current += cused
-        rdlen -= cused
-        if not origin is None:
-            signer = signer.relativize(origin)
-        signature = wire[current : current + rdlen]
-        return cls(rdclass, rdtype, header[0], header[1], header[2],
-                   header[3], header[4], header[5], header[6], signer,
-                   signature)
-
-    from_wire = classmethod(from_wire)
-
-    def choose_relativity(self, origin = None, relativize = True):
-        self.signer = self.signer.choose_relativity(origin, relativize)
-
-    def _cmp(self, other):
-        hs = struct.pack('!HBBIIIH', self.type_covered,
-                         self.algorithm, self.labels,
-                         self.original_ttl, self.expiration,
-                         self.inception, self.key_tag)
-        ho = struct.pack('!HBBIIIH', other.type_covered,
-                         other.algorithm, other.labels,
-                         other.original_ttl, other.expiration,
-                         other.inception, other.key_tag)
-        v = cmp(hs, ho)
-        if v == 0:
-            v = cmp(self.signer, other.signer)
-            if v == 0:
-                v = cmp(self.signature, other.signature)
-        return v
index 43db2a48c0791c407acc403a33d2c12833aee412..580f056ea0999d81e59fddaebfc7424e297f8dbc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -75,7 +75,7 @@ class TXTBase(dns.rdata.Rdata):
             rdlen -= 1
             if l > rdlen:
                 raise dns.exception.FormError
-            s = wire[current : current + l]
+            s = wire[current : current + l].unwrap()
             current += l
             rdlen -= l
             strings.append(s)
index bb0218ac301d81ec0b993fff56d2c9a3e2b44812..ad3f83d450e3cff550c47d3a18a19f84377963a2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -267,8 +267,9 @@ class Renderer(object):
         @type other_data: string
         @param request_mac: This message is a response to the request which
         had the specified MAC.
-        @param algorithm: the TSIG algorithm to use
         @type request_mac: string
+        @param algorithm: the TSIG algorithm to use
+        @type algorithm: dns.name.Name object
         """
 
         self._set_section(ADDITIONAL)
index 30977f3a8bbb98164be057ce1952d426620317ce..90f95e8ed0504f42bf86f66c55e488149ef4c8ff 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -23,12 +23,15 @@ import sys
 import time
 
 import dns.exception
+import dns.ipv4
+import dns.ipv6
 import dns.message
 import dns.name
 import dns.query
 import dns.rcode
 import dns.rdataclass
 import dns.rdatatype
+import dns.reversename
 
 if sys.platform == 'win32':
     import _winreg
@@ -93,8 +96,11 @@ class Answer(object):
     @type rrset: dns.rrset.RRset object
     @ivar expiration: The time when the answer expires
     @type expiration: float (seconds since the epoch)
+    @ivar canonical_name: The canonical name of the query name
+    @type canonical_name: dns.name.Name object
     """
-    def __init__(self, qname, rdtype, rdclass, response):
+    def __init__(self, qname, rdtype, rdclass, response,
+                 raise_on_no_answer=True):
         self.qname = qname
         self.rdtype = rdtype
         self.rdclass = rdclass
@@ -122,11 +128,31 @@ class Answer(object):
                             break
                         continue
                     except KeyError:
-                        raise NoAnswer
-                raise NoAnswer
-        if rrset is None:
+                        if raise_on_no_answer:
+                            raise NoAnswer
+                if raise_on_no_answer:
+                    raise NoAnswer
+        if rrset is None and raise_on_no_answer:
             raise NoAnswer
+        self.canonical_name = qname
         self.rrset = rrset
+        if rrset is None:
+            while 1:
+                # Look for a SOA RR whose owner name is a superdomain
+                # of qname.
+                try:
+                    srrset = response.find_rrset(response.authority, qname,
+                                                rdclass, dns.rdatatype.SOA)
+                    if min_ttl == -1 or srrset.ttl < min_ttl:
+                        min_ttl = srrset.ttl
+                    if srrset[0].minimum < min_ttl:
+                        min_ttl = srrset[0].minimum
+                    break
+                except KeyError:
+                    try:
+                        qname = qname.parent()
+                    except dns.name.NoParent:
+                        break
         self.expiration = time.time() + min_ttl
 
     def __getattr__(self, attr):
@@ -244,6 +270,127 @@ class Cache(object):
             self.data = {}
             self.next_cleaning = time.time() + self.cleaning_interval
 
+class LRUCacheNode(object):
+    """LRUCache node.
+    """
+    def __init__(self, key, value):
+        self.key = key
+        self.value = value
+        self.prev = self
+        self.next = self
+
+    def link_before(self, node):
+        self.prev = node.prev
+        self.next = node
+        node.prev.next = self
+        node.prev = self
+
+    def link_after(self, node):
+        self.prev = node
+        self.next = node.next
+        node.next.prev = self
+        node.next = self
+
+    def unlink(self):
+        self.next.prev = self.prev
+        self.prev.next = self.next
+
+class LRUCache(object):
+    """Bounded least-recently-used DNS answer cache.
+
+    This cache is better than the simple cache (above) if you're
+    running a web crawler or other process that does a lot of
+    resolutions.  The LRUCache has a maximum number of nodes, and when
+    it is full, the least-recently used node is removed to make space
+    for a new one.
+
+    @ivar data: A dictionary of cached data
+    @type data: dict
+    @ivar sentinel: sentinel node for circular doubly linked list of nodes
+    @type sentinel: LRUCacheNode object
+    @ivar max_size: The maximum number of nodes
+    @type max_size: int
+    """
+
+    def __init__(self, max_size=100000):
+        """Initialize a DNS cache.
+
+        @param max_size: The maximum number of nodes to cache; the default is
+        100000.  Must be > 1.
+        @type max_size: int
+        """
+        self.data = {}
+        self.set_max_size(max_size)
+        self.sentinel = LRUCacheNode(None, None)
+
+    def set_max_size(self, max_size):
+        if max_size < 1:
+            max_size = 1
+        self.max_size = max_size
+
+    def get(self, key):
+        """Get the answer associated with I{key}.  Returns None if
+        no answer is cached for the key.
+        @param key: the key
+        @type key: (dns.name.Name, int, int) tuple whose values are the
+        query name, rdtype, and rdclass.
+        @rtype: dns.resolver.Answer object or None
+        """
+        node = self.data.get(key)
+        if node is None:
+            return None
+        # Unlink because we're either going to move the node to the front
+        # of the LRU list or we're going to free it.
+        node.unlink()
+        if node.value.expiration <= time.time():
+            del self.data[node.key]
+            return None
+        node.link_after(self.sentinel)
+        return node.value
+
+    def put(self, key, value):
+        """Associate key and value in the cache.
+        @param key: the key
+        @type key: (dns.name.Name, int, int) tuple whose values are the
+        query name, rdtype, and rdclass.
+        @param value: The answer being cached
+        @type value: dns.resolver.Answer object
+        """
+        node = self.data.get(key)
+        if not node is None:
+            node.unlink()
+            del self.data[node.key]
+        while len(self.data) >= self.max_size:
+            node = self.sentinel.prev
+            node.unlink()
+            del self.data[node.key]
+        node = LRUCacheNode(key, value)
+        node.link_after(self.sentinel)
+        self.data[key] = node
+
+    def flush(self, key=None):
+        """Flush the cache.
+
+        If I{key} is specified, only that item is flushed.  Otherwise
+        the entire cache is flushed.
+
+        @param key: the key to flush
+        @type key: (dns.name.Name, int, int) tuple or None
+        """
+        if not key is None:
+            node = self.data.get(key)
+            if not node is None:
+                node.unlink()
+                del self.data[node.key]
+        else:
+            node = self.sentinel.next
+            while node != self.sentinel:
+                next = node.next
+                node.prev = None
+                node.next = None
+                node = next
+            self.data = {}
+
 class Resolver(object):
     """DNS stub resolver
 
@@ -546,7 +693,7 @@ class Resolver(object):
         return min(self.lifetime - duration, self.timeout)
 
     def query(self, qname, rdtype=dns.rdatatype.A, rdclass=dns.rdataclass.IN,
-              tcp=False, source=None):
+              tcp=False, source=None, raise_on_no_answer=True):
         """Query nameservers to find the answer to the question.
 
         The I{qname}, I{rdtype}, and I{rdclass} parameters may be objects
@@ -564,10 +711,14 @@ class Resolver(object):
         @type tcp: bool
         @param source: bind to this IP address (defaults to machine default IP).
         @type source: IP address in dotted quad notation
+        @param raise_on_no_answer: raise NoAnswer if there's no answer
+        (defaults is True).
+        @type raise_on_no_answer: bool
         @rtype: dns.resolver.Answer instance
         @raises Timeout: no answers could be found in the specified lifetime
         @raises NXDOMAIN: the query name does not exist
-        @raises NoAnswer: the response did not contain an answer
+        @raises NoAnswer: the response did not contain an answer and
+        raise_on_no_answer is True.
         @raises NoNameservers: no non-broken nameservers are available to
         answer the question."""
 
@@ -597,8 +748,11 @@ class Resolver(object):
         for qname in qnames_to_try:
             if self.cache:
                 answer = self.cache.get((qname, rdtype, rdclass))
-                if answer:
-                    return answer
+                if not answer is None:
+                    if answer.rrset is None and raise_on_no_answer:
+                        raise NoAnswer
+                    else:
+                        return answer
             request = dns.message.make_query(qname, rdtype, rdclass)
             if not self.keyname is None:
                 request.use_tsig(self.keyring, self.keyname,
@@ -678,7 +832,8 @@ class Resolver(object):
             break
         if all_nxdomain:
             raise NXDOMAIN
-        answer = Answer(qname, rdtype, rdclass, response)
+        answer = Answer(qname, rdtype, rdclass, response,
+                        raise_on_no_answer)
         if self.cache:
             self.cache.put((qname, rdtype, rdclass), answer)
         return answer
@@ -731,14 +886,15 @@ def get_default_resolver():
     return default_resolver
 
 def query(qname, rdtype=dns.rdatatype.A, rdclass=dns.rdataclass.IN,
-          tcp=False, source=None):
+          tcp=False, source=None, raise_on_no_answer=True):
     """Query nameservers to find the answer to the question.
 
     This is a convenience function that uses the default resolver
     object to make the query.
     @see: L{dns.resolver.Resolver.query} for more information on the
     parameters."""
-    return get_default_resolver().query(qname, rdtype, rdclass, tcp, source)
+    return get_default_resolver().query(qname, rdtype, rdclass, tcp, source,
+                                        raise_on_no_answer)
 
 def zone_for_name(name, rdclass=dns.rdataclass.IN, tcp=False, resolver=None):
     """Find the name of the zone which contains the specified name.
@@ -771,3 +927,235 @@ def zone_for_name(name, rdclass=dns.rdataclass.IN, tcp=False, resolver=None):
             name = name.parent()
         except dns.name.NoParent:
             raise NoRootSOA
+
+#
+# Support for overriding the system resolver for all python code in the
+# running process.
+#
+
+_protocols_for_socktype = {
+    socket.SOCK_DGRAM : [socket.SOL_UDP],
+    socket.SOCK_STREAM : [socket.SOL_TCP],
+    }
+
+_resolver = None
+_original_getaddrinfo = socket.getaddrinfo
+_original_getnameinfo = socket.getnameinfo
+_original_getfqdn = socket.getfqdn
+_original_gethostbyname = socket.gethostbyname
+_original_gethostbyname_ex = socket.gethostbyname_ex
+_original_gethostbyaddr = socket.gethostbyaddr
+
+def _getaddrinfo(host=None, service=None, family=socket.AF_UNSPEC, socktype=0,
+                 proto=0, flags=0):
+    if flags & (socket.AI_ADDRCONFIG|socket.AI_V4MAPPED) != 0:
+        raise NotImplementedError
+    if host is None and service is None:
+        raise socket.gaierror(socket.EAI_NONAME)
+    v6addrs = []
+    v4addrs = []
+    canonical_name = None
+    try:
+        # Is host None or a V6 address literal?
+        if host is None:
+            canonical_name = 'localhost'
+            if flags & socket.AI_PASSIVE != 0:
+                v6addrs.append('::')
+                v4addrs.append('0.0.0.0')
+            else:
+                v6addrs.append('::1')
+                v4addrs.append('127.0.0.1')
+        else:
+            parts = host.split('%')
+            if len(parts) == 2:
+                ahost = parts[0]
+            else:
+                ahost = host
+            addr = dns.ipv6.inet_aton(ahost)
+            v6addrs.append(host)
+            canonical_name = host
+    except:
+        try:
+            # Is it a V4 address literal?
+            addr = dns.ipv4.inet_aton(host)
+            v4addrs.append(host)
+            canonical_name = host
+        except:
+            if flags & socket.AI_NUMERICHOST == 0:
+                try:
+                    qname = None
+                    if family == socket.AF_INET6 or family == socket.AF_UNSPEC:
+                        v6 = _resolver.query(host, dns.rdatatype.AAAA,
+                                             raise_on_no_answer=False)
+                        # Note that setting host ensures we query the same name
+                        # for A as we did for AAAA.
+                        host = v6.qname
+                        canonical_name = v6.canonical_name.to_text(True)
+                        if v6.rrset is not None:
+                            for rdata in v6.rrset:
+                                v6addrs.append(rdata.address)
+                    if family == socket.AF_INET or family == socket.AF_UNSPEC:
+                        v4 = _resolver.query(host, dns.rdatatype.A,
+                                             raise_on_no_answer=False)
+                        host = v4.qname
+                        canonical_name = v4.canonical_name.to_text(True)
+                        if v4.rrset is not None:
+                            for rdata in v4.rrset:
+                                v4addrs.append(rdata.address)
+                except dns.resolver.NXDOMAIN:
+                    raise socket.gaierror(socket.EAI_NONAME)
+                except:
+                    raise socket.gaierror(socket.EAI_SYSTEM)
+    port = None
+    try:
+        # Is it a port literal?
+        if service is None:
+            port = 0
+        else:
+            port = int(service)
+    except:
+        if flags & socket.AI_NUMERICSERV == 0:
+            try:
+                port = socket.getservbyname(service)
+            except:
+                pass
+    if port is None:
+        raise socket.gaierror(socket.EAI_NONAME)
+    tuples = []
+    if socktype == 0:
+        socktypes = [socket.SOCK_DGRAM, socket.SOCK_STREAM]
+    else:
+        socktypes = [socktype]
+    if flags & socket.AI_CANONNAME != 0:
+        cname = canonical_name
+    else:
+        cname = ''
+    if family == socket.AF_INET6 or family == socket.AF_UNSPEC:
+        for addr in v6addrs:
+            for socktype in socktypes:
+                for proto in _protocols_for_socktype[socktype]:
+                    tuples.append((socket.AF_INET6, socktype, proto,
+                                   cname, (addr, port, 0, 0)))
+    if family == socket.AF_INET or family == socket.AF_UNSPEC:
+        for addr in v4addrs:
+            for socktype in socktypes:
+                for proto in _protocols_for_socktype[socktype]:
+                    tuples.append((socket.AF_INET, socktype, proto,
+                                   cname, (addr, port)))
+    if len(tuples) == 0:
+        raise socket.gaierror(socket.EAI_NONAME)
+    return tuples
+
+def _getnameinfo(sockaddr, flags=0):
+    host = sockaddr[0]
+    port = sockaddr[1]
+    if len(sockaddr) == 4:
+        scope = sockaddr[3]
+        family = socket.AF_INET6
+    else:
+        scope = None
+        family = socket.AF_INET
+    tuples = _getaddrinfo(host, port, family, socket.SOCK_STREAM,
+                          socket.SOL_TCP, 0)
+    if len(tuples) > 1:
+        raise socket.error('sockaddr resolved to multiple addresses')
+    addr = tuples[0][4][0]
+    if flags & socket.NI_DGRAM:
+        pname = 'udp'
+    else:
+        pname = 'tcp'
+    qname = dns.reversename.from_address(addr)
+    if flags & socket.NI_NUMERICHOST == 0:
+        try:
+            answer = _resolver.query(qname, 'PTR')
+            hostname = answer.rrset[0].target.to_text(True)
+        except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
+            if flags & socket.NI_NAMEREQD:
+                raise socket.gaierror(socket.EAI_NONAME)
+            hostname = addr
+            if scope is not None:
+                hostname += '%' + str(scope)
+    else:
+        hostname = addr
+        if scope is not None:
+            hostname += '%' + str(scope)
+    if flags & socket.NI_NUMERICSERV:
+        service = str(port)
+    else:
+        service = socket.getservbyport(port, pname)
+    return (hostname, service)
+
+def _getfqdn(name=None):
+    if name is None:
+        name = socket.gethostname()
+    return _getnameinfo(_getaddrinfo(name, 80)[0][4])[0]
+
+def _gethostbyname(name):
+    return _gethostbyname_ex(name)[2][0]
+
+def _gethostbyname_ex(name):
+    aliases = []
+    addresses = []
+    tuples = _getaddrinfo(name, 0, socket.AF_INET, socket.SOCK_STREAM,
+                         socket.SOL_TCP, socket.AI_CANONNAME)
+    canonical = tuples[0][3]
+    for item in tuples:
+        addresses.append(item[4][0])
+    # XXX we just ignore aliases
+    return (canonical, aliases, addresses)
+
+def _gethostbyaddr(ip):
+    try:
+        addr = dns.ipv6.inet_aton(ip)
+        sockaddr = (ip, 80, 0, 0)
+        family = socket.AF_INET6
+    except:
+        sockaddr = (ip, 80)
+        family = socket.AF_INET
+    (name, port) = _getnameinfo(sockaddr, socket.NI_NAMEREQD)
+    aliases = []
+    addresses = []
+    tuples = _getaddrinfo(name, 0, family, socket.SOCK_STREAM, socket.SOL_TCP,
+                          socket.AI_CANONNAME)
+    canonical = tuples[0][3]
+    for item in tuples:
+        addresses.append(item[4][0])
+    # XXX we just ignore aliases
+    return (canonical, aliases, addresses)
+
+def override_system_resolver(resolver=None):
+    """Override the system resolver routines in the socket module with
+    versions which use dnspython's resolver.
+
+    This can be useful in testing situations where you want to control
+    the resolution behavior of python code without having to change
+    the system's resolver settings (e.g. /etc/resolv.conf).
+
+    The resolver to use may be specified; if it's not, the default
+    resolver will be used.
+
+    @param resolver: the resolver to use
+    @type resolver: dns.resolver.Resolver object or None
+    """
+    if resolver is None:
+        resolver = get_default_resolver()
+    global _resolver
+    _resolver = resolver
+    socket.getaddrinfo = _getaddrinfo
+    socket.getnameinfo = _getnameinfo
+    socket.getfqdn = _getfqdn
+    socket.gethostbyname = _gethostbyname
+    socket.gethostbyname_ex = _gethostbyname_ex
+    socket.gethostbyaddr = _gethostbyaddr
+
+def restore_system_resolver():
+    """Undo the effects of override_system_resolver().
+    """
+    global _resolver
+    _resolver = None
+    socket.getaddrinfo = _original_getaddrinfo
+    socket.getnameinfo = _original_getnameinfo
+    socket.getfqdn = _original_getfqdn
+    socket.gethostbyname = _original_gethostbyname
+    socket.gethostbyname_ex = _original_gethostbyname_ex
+    socket.gethostbyaddr = _original_gethostbyaddr
index 0a61b827b0c6fe8680ae98e37749e7b9775a2577..4925cfd6ffdf17dc14ee142481cfd87f4fd22407 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 21468174d4ec188851c410293112ec1d4dc8c9ce..f6051fea4fc1a6134807c42c1ab796ac7d5f8677 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 91f9fb876693d3cd5fb9945bfff2f3c6f3b7d052..14c76a05c47df26b56604c0abff85cc9e256007e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 4f68a2a4952c467567518b478a998a79b38735dc..4bff7b6c72d552dc5441d6420221c54fd03b2648 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 5e58ea884135934481bf80f5d2a84d3a828f89dd..63b925afbb330218a32b3d06dfb07a144282db60 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index cbd1a27bbf8faac69608ab4986e166d2bea9c111..0ddd93410fad4b0727b10fd1284a5eb0e52d5e64 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index f295300517755cb7cc89d29b950bc7d1d74fead8..ab6ddf4e6659b95b3a679d7e4c53a38e4281357c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index e67acafec9304cd77483be0c483234f8d77b26c9..e6922269180875bb6c37fc73eb035cb6865aa850 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 46799a77d97ead5836f1de56b44349784b78ecfd..7de430b638aeaf8ba72f4c3e2a6f823dbd8c7b91 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -16,8 +16,8 @@
 """dnspython release version information."""
 
 MAJOR = 1
-MINOR = 9
-MICRO = 3
+MINOR = 10
+MICRO = 0
 RELEASELEVEL = 0x0f
 SERIAL = 0
 
diff --git a/lib/dnspython/dns/wiredata.py b/lib/dnspython/dns/wiredata.py
new file mode 100644 (file)
index 0000000..86d954a
--- /dev/null
@@ -0,0 +1,59 @@
+# Copyright (C) 2011 Nominum, Inc.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose with or without fee is hereby granted,
+# provided that the above copyright notice and this permission notice
+# appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+"""DNS Wire Data Helper"""
+
+import sys
+
+import dns.exception
+
+class WireData(str):
+    # WireData is a string with stricter slicing
+    def __getitem__(self, key):
+        try:
+            return WireData(super(WireData, self).__getitem__(key))
+        except IndexError:
+            raise dns.exception.FormError
+    def __getslice__(self, i, j):
+        try:
+            if j == sys.maxint:
+                # handle the case where the right bound is unspecified
+                j = len(self)
+            if i < 0 or j < 0:
+                raise dns.exception.FormError
+            # If it's not an empty slice, access left and right bounds
+            # to make sure they're valid
+            if i != j:
+                super(WireData, self).__getitem__(i)
+                super(WireData, self).__getitem__(j - 1)
+            return WireData(super(WireData, self).__getslice__(i, j))
+        except IndexError:
+            raise dns.exception.FormError
+    def __iter__(self):
+        i = 0
+        while 1:
+            try:
+                yield self[i]
+                i += 1
+            except dns.exception.FormError:
+                raise StopIteration
+    def unwrap(self):
+        return str(self)
+
+def maybe_wrap(wire):
+    if not isinstance(wire, WireData):
+        return WireData(wire)
+    else:
+        return wire
index db5fd5df85bc48489d0ad84e2dc0fd42c0fd8969..67c952d3cc51016d1fc1ad89fb4a6ca2f9c2c153 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 5cd6f55c06c7cb08f6f553b633bf759d6eaa5cf0..e67ab189273df79a47863e273530a0288e3c2e9d 100755 (executable)
@@ -1,9 +1,13 @@
 #!/usr/bin/env python
 
 import dns.query
+import dns.resolver
 import dns.zone
 
-z = dns.zone.from_xfr(dns.query.xfr('204.152.189.147', 'dnspython.org'))
+soa_answer = dns.resolver.query('dnspython.org', 'SOA')
+master_answer = dns.resolver.query(soa_answer[0].mname, 'A')
+
+z = dns.zone.from_xfr(dns.query.xfr(master_answer[0].address, 'dnspython.org'))
 names = z.nodes.keys()
 names.sort()
 for n in names:
index f84711f795b50792b8b911dba20e74d5def20ee7..33d7c2067973f73e08e9075a28046d40d3cf61c6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -18,7 +18,7 @@
 import sys
 from distutils.core import setup
 
-version = '1.9.3'
+version = '1.10.0'
 
 kwargs = {
     'name' : 'dnspython',
@@ -38,13 +38,9 @@ direct manipulation of DNS zones, messages, names, and records.""",
     'license' : 'BSD-like',
     'url' : 'http://www.dnspython.org',
     'packages' : ['dns', 'dns.rdtypes', 'dns.rdtypes.IN', 'dns.rdtypes.ANY'],
-    }
-
-if sys.hexversion >= 0x02020300:
-    kwargs['download_url'] = \
-       'http://www.dnspython.org/kits/%s/dnspython-%s.tar.gz' % (version,
-                                                                  version)
-    kwargs['classifiers'] = [
+    'download_url' : \
+    'http://www.dnspython.org/kits/%s/dnspython-%s.tar.gz' % (version, version),
+    'classifiers' : [
         "Development Status :: 5 - Production/Stable",
         "Intended Audience :: Developers",
         "Intended Audience :: System Administrators",
@@ -54,7 +50,8 @@ if sys.hexversion >= 0x02020300:
         "Programming Language :: Python",
         "Topic :: Internet :: Name Service (DNS)",
         "Topic :: Software Development :: Libraries :: Python Modules",
-        ]
+        ],
+    }
 
 if sys.hexversion >= 0x02050000:
     kwargs['requires'] = []
index 584f6a7da70a70516e8752f238df1f881ba33ea4..6ab444f451e2097c4d2f723b5ab20168640657e8 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 0896e3f02d2037311a35ebf63da79e74e2d4b0fb..c2fa6b6659c00fa29decaa916db03b9720b7c279 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index b30e847fbac430ddb8ae0c4c88644771e9db1f30..7b4546a08657c9d2c4c0f51fec466a7b19b711a7 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Nominum, Inc.
+# Copyright (C) 2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index e8fed1161b1f6e170edf2d9b8d78dbd1703c0b1f..2f753a2f7581f96d383ebed968e40beef96cd37a 100644 (file)
@@ -101,16 +101,17 @@ isdn01                    ISDN    "isdn-address"
 isdn02                 ISDN    "isdn-address" "subaddress"
 isdn03                 ISDN    "isdn-address"
 isdn04                 ISDN    "isdn-address" "subaddress"
-key01                  KEY     512 255 1 (
-                               AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
-                               yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
-                               GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
-                               jqf0BaqHT+8= )
-key02                  KEY     HOST|FLAG4 DNSSEC RSAMD5 (
-                               AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
-                               yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
-                               GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
-                               jqf0BaqHT+8= )
+;; dnspython no longer supports old DNSSEC
+;;key01                        KEY     512 255 1 (
+;;                             AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
+;;                             yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
+;;                             GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
+;;                             jqf0BaqHT+8= )
+;;key02                        KEY     HOST|FLAG4 DNSSEC RSAMD5 (
+;;                             AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
+;;                             yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
+;;                             GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
+;;                             jqf0BaqHT+8= )
 kx01                   KX      10 kdc
 kx02                   KX      10 .
 loc01                  LOC     60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
@@ -137,10 +138,10 @@ nsap-ptr01                NSAP-PTR foo.
                        NSAP-PTR .
 nsap01                 NSAP    0x47000580005a0000000001e133ffffff00016100
 nsap02                 NSAP    0x47.000580005a0000000001e133ffffff000161.00
-nxt01                  NXT     a.secure ( NS SOA MX SIG KEY LOC NXT )
-nxt02                  NXT     . ( NSAP-PTR NXT )
-nxt03                  NXT     . ( A )
-nxt04                  NXT     . ( 127 )
+;;nxt01                        NXT     a.secure ( NS SOA MX SIG KEY LOC NXT )
+;;nxt02                        NXT     . ( NSAP-PTR NXT )
+;;nxt03                        NXT     . ( A )
+;;nxt04                        NXT     . ( 127 )
 ptr01                  PTR     example.
 px01                   PX      65535 foo. bar.
 px02                   PX      65535 . .
@@ -154,11 +155,11 @@ $ORIGIN s.example.
 ns                     A       73.80.65.49
 $ORIGIN example.
 $TTL 3600      ; 1 hour
-sig01                  SIG     NXT 1 3 3600 (
-                               20200101000000 20030101000000 2143 foo
-                               MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi
-                               WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl
-                               d80jEeC8aTrO+KKmCaY= )
+;;sig01                        SIG     NXT 1 3 3600 (
+;;                             20200101000000 20030101000000 2143 foo
+;;                             MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi
+;;                             WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl
+;;                             d80jEeC8aTrO+KKmCaY= )
 srv01                  SRV     0 0 0 .
 srv02                  SRV     65535 65535 65535 old-slow-box.example.com.
 $TTL 301       ; 5 minutes 1 second
@@ -202,7 +203,7 @@ dnskey01            DNSKEY  512 255 1 (
                                yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
                                GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
                                jqf0BaqHT+8= )
-dnskey02               DNSKEY  HOST|FLAG4 DNSSEC RSAMD5 (
+dnskey02               DNSKEY  257 3 RSAMD5 (
                                AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
                                yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
                                GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
index ca5ead6379f0a87d0d7d36be47ae4e79f1da49fa..0834d171500443a44cbfd8d9bf0d99863c55f88a 100644 (file)
@@ -27,7 +27,7 @@ dname01 3600 IN DNAME dname-target.
 dname02 3600 IN DNAME dname-target
 dname03 3600 IN DNAME .
 dnskey01 3600 IN DNSKEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-dnskey02 3600 IN DNSKEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
+dnskey02 3600 IN DNSKEY 257 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
 ds01 3600 IN DS 12345 3 1 123456789abcdef67890123456789abcdef67890
 e 300 IN MX 10 mail
 e 300 IN TXT "one"
@@ -51,8 +51,6 @@ isdn01 3600 IN ISDN "isdn-address"
 isdn02 3600 IN ISDN "isdn-address" "subaddress"
 isdn03 3600 IN ISDN "isdn-address"
 isdn04 3600 IN ISDN "isdn-address" "subaddress"
-key01 3600 IN KEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-key02 3600 IN KEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
 kx01 3600 IN KX 10 kdc
 kx02 3600 IN KX 10 .
 loc01 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
@@ -77,10 +75,6 @@ nsec301 3600 IN NSEC3 1 1 12 aabbccdd 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA MX
 nsec302 3600 IN NSEC3 1 1 12 - 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA MX RRSIG DNSKEY NSEC3PARAM
 nsec3param01 3600 IN NSEC3PARAM 1 1 12 aabbccdd
 nsec3param02 3600 IN NSEC3PARAM 1 1 12 -
-nxt01 3600 IN NXT a.secure NS SOA MX SIG KEY LOC NXT
-nxt02 3600 IN NXT . NSAP-PTR NXT
-nxt03 3600 IN NXT . A
-nxt04 3600 IN NXT . TYPE127
 ptr01 3600 IN PTR @
 px01 3600 IN PX 65535 foo. bar.
 px02 3600 IN PX 65535 . .
@@ -91,7 +85,6 @@ rt01 3600 IN RT 0 intermediate-host
 rt02 3600 IN RT 65535 .
 s 300 IN NS ns.s
 ns.s 300 IN A 73.80.65.49
-sig01 3600 IN SIG NXT 1 3 3600 20200101000000 20030101000000 2143 foo MxFcby9k/yvedMfQgKzhH5er0Mu/vILz 45IkskceFGgiWCn/GxHhai6VAuHAoNUz 4YoU1tVfSCSqQYn6//11U6Nld80jEeC8 aTrO+KKmCaY=
 spf 3600 IN SPF "v=spf1 mx -all"
 srv01 3600 IN SRV 0 0 0 .
 srv02 3600 IN SRV 65535 65535 65535 old-slow-box.example.com.
index c923c09b7c4b31e2cfbdcf4c7827885a1d36bdb4..de4bcd59fde970f4b30947a6847c88db9d7e55a8 100644 (file)
@@ -27,7 +27,7 @@ dname01.example. 3600 IN DNAME dname-target.
 dname02.example. 3600 IN DNAME dname-target.example.
 dname03.example. 3600 IN DNAME .
 dnskey01.example. 3600 IN DNSKEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-dnskey02.example. 3600 IN DNSKEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
+dnskey02.example. 3600 IN DNSKEY 257 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
 ds01.example. 3600 IN DS 12345 3 1 123456789abcdef67890123456789abcdef67890
 e.example. 300 IN MX 10 mail.example.
 e.example. 300 IN TXT "one"
@@ -51,8 +51,6 @@ isdn01.example. 3600 IN ISDN "isdn-address"
 isdn02.example. 3600 IN ISDN "isdn-address" "subaddress"
 isdn03.example. 3600 IN ISDN "isdn-address"
 isdn04.example. 3600 IN ISDN "isdn-address" "subaddress"
-key01.example. 3600 IN KEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-key02.example. 3600 IN KEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
 kx01.example. 3600 IN KX 10 kdc.example.
 kx02.example. 3600 IN KX 10 .
 loc01.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
@@ -77,10 +75,6 @@ nsec301.example. 3600 IN NSEC3 1 1 12 aabbccdd 2t7b4g4vsa5smi47k61mv5bv1a22bojr
 nsec302.example. 3600 IN NSEC3 1 1 12 - 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA MX RRSIG DNSKEY NSEC3PARAM
 nsec3param01.example. 3600 IN NSEC3PARAM 1 1 12 aabbccdd
 nsec3param02.example. 3600 IN NSEC3PARAM 1 1 12 -
-nxt01.example. 3600 IN NXT a.secure.example. NS SOA MX SIG KEY LOC NXT
-nxt02.example. 3600 IN NXT . NSAP-PTR NXT
-nxt03.example. 3600 IN NXT . A
-nxt04.example. 3600 IN NXT . TYPE127
 ptr01.example. 3600 IN PTR example.
 px01.example. 3600 IN PX 65535 foo. bar.
 px02.example. 3600 IN PX 65535 . .
@@ -91,7 +85,6 @@ rt01.example. 3600 IN RT 0 intermediate-host.example.
 rt02.example. 3600 IN RT 65535 .
 s.example. 300 IN NS ns.s.example.
 ns.s.example. 300 IN A 73.80.65.49
-sig01.example. 3600 IN SIG NXT 1 3 3600 20200101000000 20030101000000 2143 foo.example. MxFcby9k/yvedMfQgKzhH5er0Mu/vILz 45IkskceFGgiWCn/GxHhai6VAuHAoNUz 4YoU1tVfSCSqQYn6//11U6Nld80jEeC8 aTrO+KKmCaY=
 spf.example. 3600 IN SPF "v=spf1 mx -all"
 srv01.example. 3600 IN SRV 0 0 0 .
 srv02.example. 3600 IN SRV 65535 65535 65535 old-slow-box.example.com.
index 7ee2d8e12e1405ba7a63a160a110bffc0e8dfa9d..b3cf6716bcd83d67eee41ea9cc0de62129ca5d12 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 7134661d3ae7fc9e37e9b715a097202d9e2e6bac..931bb1977d5cc858db10fbc1f367b0768cf06ce6 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 1ab4f52814b90c88277840d804ecf5873e9432cd..e30e43d3a221eb1fbb6e4b99560deb836037ad5e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
@@ -662,12 +662,12 @@ class NameTestCase(unittest.TestCase):
     def testBadReverseIPv4(self):
         def bad():
             n = dns.reversename.from_address('127.0.foo.1')
-        self.failUnlessRaises(socket.error, bad)
+        self.failUnlessRaises(dns.exception.SyntaxError, bad)
 
     def testBadReverseIPv6(self):
         def bad():
             n = dns.reversename.from_address('::1::1')
-        self.failUnlessRaises(socket.error, bad)
+        self.failUnlessRaises(dns.exception.SyntaxError, bad)
 
     def testForwardIPv4(self):
         n = dns.name.from_text('1.0.0.127.in-addr.arpa.')
index 026114218676069b9c63c4360ae2ff7e0709aa34..e256bfe679da3c3ffb606c3e53f7f13b6e1d47b8 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 77befd26e3a8c1a84eea0cc5d9800fa5fafc052f..9d8bedd702d92679601ab7e597b858901bd17cb3 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
 import unittest
 
 import dns.exception
+import dns.ipv4
 import dns.ipv6
 
+# for convenience
+aton4 = dns.ipv4.inet_aton
+ntoa4 = dns.ipv4.inet_ntoa
+aton6 = dns.ipv6.inet_aton
+ntoa6 = dns.ipv6.inet_ntoa
+
+v4_bad_addrs = ['256.1.1.1', '1.1.1', '1.1.1.1.1', '01.1.1.1',
+                '+1.1.1.1', '1.1.1.1+', '1..2.3.4', '.1.2.3.4',
+                '1.2.3.4.']
+
 class NtoAAtoNTestCase(unittest.TestCase):
 
     def test_aton1(self):
-        a = dns.ipv6.inet_aton('::')
+        a = aton6('::')
         self.failUnless(a == '\x00' * 16)
 
     def test_aton2(self):
-        a = dns.ipv6.inet_aton('::1')
+        a = aton6('::1')
         self.failUnless(a == '\x00' * 15 + '\x01')
 
     def test_aton3(self):
-        a = dns.ipv6.inet_aton('::10.0.0.1')
+        a = aton6('::10.0.0.1')
         self.failUnless(a == '\x00' * 12 + '\x0a\x00\x00\x01')
 
     def test_aton4(self):
-        a = dns.ipv6.inet_aton('abcd::dcba')
+        a = aton6('abcd::dcba')
         self.failUnless(a == '\xab\xcd' + '\x00' * 12 + '\xdc\xba')
 
     def test_aton5(self):
-        a = dns.ipv6.inet_aton('1:2:3:4:5:6:7:8')
+        a = aton6('1:2:3:4:5:6:7:8')
         self.failUnless(a == \
                         '00010002000300040005000600070008'.decode('hex_codec'))
 
     def test_bad_aton1(self):
         def bad():
-            a = dns.ipv6.inet_aton('abcd:dcba')
+            a = aton6('abcd:dcba')
         self.failUnlessRaises(dns.exception.SyntaxError, bad)
 
     def test_bad_aton2(self):
         def bad():
-            a = dns.ipv6.inet_aton('abcd::dcba::1')
+            a = aton6('abcd::dcba::1')
         self.failUnlessRaises(dns.exception.SyntaxError, bad)
 
     def test_bad_aton3(self):
         def bad():
-            a = dns.ipv6.inet_aton('1:2:3:4:5:6:7:8:9')
+            a = aton6('1:2:3:4:5:6:7:8:9')
         self.failUnlessRaises(dns.exception.SyntaxError, bad)
 
     def test_aton1(self):
-        a = dns.ipv6.inet_aton('::')
+        a = aton6('::')
         self.failUnless(a == '\x00' * 16)
 
     def test_aton2(self):
-        a = dns.ipv6.inet_aton('::1')
+        a = aton6('::1')
         self.failUnless(a == '\x00' * 15 + '\x01')
 
     def test_aton3(self):
-        a = dns.ipv6.inet_aton('::10.0.0.1')
+        a = aton6('::10.0.0.1')
         self.failUnless(a == '\x00' * 12 + '\x0a\x00\x00\x01')
 
     def test_aton4(self):
-        a = dns.ipv6.inet_aton('abcd::dcba')
+        a = aton6('abcd::dcba')
         self.failUnless(a == '\xab\xcd' + '\x00' * 12 + '\xdc\xba')
 
     def test_ntoa1(self):
         b = '00010002000300040005000600070008'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '1:2:3:4:5:6:7:8')
 
     def test_ntoa2(self):
         b = '\x00' * 16
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::')
 
     def test_ntoa3(self):
         b = '\x00' * 15 + '\x01'
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::1')
 
     def test_ntoa4(self):
         b = '\x80' + '\x00' * 15
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '8000::')
 
     def test_ntoa5(self):
         b = '\x01\xcd' + '\x00' * 12 + '\x03\xef'
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '1cd::3ef')
 
     def test_ntoa6(self):
         b = 'ffff00000000ffff000000000000ffff'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == 'ffff:0:0:ffff::ffff')
 
     def test_ntoa7(self):
         b = '00000000ffff000000000000ffffffff'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '0:0:ffff::ffff:ffff')
 
     def test_ntoa8(self):
         b = 'ffff0000ffff00000000ffff00000000'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == 'ffff:0:ffff::ffff:0:0')
 
     def test_ntoa9(self):
         b = '0000000000000000000000000a000001'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::10.0.0.1')
 
     def test_ntoa10(self):
         b = '0000000000000000000000010a000001'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::1:a00:1')
 
     def test_ntoa11(self):
         b = '00000000000000000000ffff0a000001'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::ffff:10.0.0.1')
 
     def test_ntoa12(self):
         b = '000000000000000000000000ffffffff'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::255.255.255.255')
 
     def test_ntoa13(self):
         b = '00000000000000000000ffffffffffff'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::ffff:255.255.255.255')
 
     def test_ntoa14(self):
         b = '0000000000000000000000000001ffff'.decode('hex_codec')
-        t = dns.ipv6.inet_ntoa(b)
+        t = ntoa6(b)
         self.failUnless(t == '::0.1.255.255')
 
     def test_bad_ntoa1(self):
         def bad():
-            a = dns.ipv6.inet_ntoa('')
+            a = ntoa6('')
         self.failUnlessRaises(ValueError, bad)
 
     def test_bad_ntoa2(self):
         def bad():
-            a = dns.ipv6.inet_ntoa('\x00' * 17)
+            a = ntoa6('\x00' * 17)
         self.failUnlessRaises(ValueError, bad)
 
+    def test_good_v4_aton(self):
+        pairs = [('1.2.3.4', '\x01\x02\x03\x04'),
+                 ('255.255.255.255', '\xff\xff\xff\xff'),
+                 ('0.0.0.0', '\x00\x00\x00\x00')]
+        for (t, b) in pairs:
+            b1 = aton4(t)
+            t1 = ntoa4(b1)
+            self.failUnless(b1 == b)
+            self.failUnless(t1 == t)
+
+    def test_bad_v4_aton(self):
+        def make_bad(a):
+            def bad():
+                return aton4(a)
+            return bad
+        for addr in v4_bad_addrs:
+            self.failUnlessRaises(dns.exception.SyntaxError, make_bad(addr))
+
+    def test_bad_v6_aton(self):
+        addrs = ['+::0', '0::0::', '::0::', '1:2:3:4:5:6:7:8:9',
+                 ':::::::']
+        embedded = ['::' + x for x in v4_bad_addrs]
+        addrs.extend(embedded)
+        def make_bad(a):
+            def bad():
+                x = aton6(a)
+            return bad
+        for addr in addrs:
+            self.failUnlessRaises(dns.exception.SyntaxError, make_bad(addr))
+
 if __name__ == '__main__':
     unittest.main()
index 0c8a830e27686eb7c09d0f0c70a62d000171abea..f3c0628d361abaa11382442d8bc451910bebed73 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index bd6dc5fbc2725f430a8df5b1157004863bf38daf..28d5a42cdfff9b81970394b933a4db87fb11d0fb 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 3cafbee891a13e26014f3c1c9f9d4f3d312b3695..be1324b0ecfef7b3cc809e3b04489d5c2f3f5090 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index e2bca51b8270dbac224ab8f17d1930a66f2d4007..583d20cfa053ad7b40435162ba0abd6f57e073fc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 4f4a1bdc90b472710d43d8fdaf592bfa517a00f6..1d561ae1b5dc06e74787d3d1610efca676118026 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 5f7b31f23fa581e9028f5347483e459be0c9c170..92ddb565fc1aece1f44a43679cfd2b529258ed50 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index 075be0a48a35d3ba5c9c28cb1ac230028c39dbe4..31e7405b0f8d994e6ea2a0f73da22043f9156d8c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose with or without fee is hereby granted,
index ae578381cb95fdc06f47a2618c15cf08ccc2c1d9..f73e9f6fe3cb8d0775a9163844692e19ad7d7f6f 100644 (file)
@@ -2,92 +2,89 @@
 ./ChangeLog                                    X       2003,2004,2005,2006,2007
 ./LICENSE                                      X       2003,2004,2005,2006,2007
 ./MANIFEST.in                                  X       2003,2004,2005,2006,2007
-./Makefile                                     MAKE    2003,2004,2005,2006,2007,2009
+./Makefile                                     MAKE    2003,2004,2005,2006,2007,2009,2011
 ./README                                       X       2003,2004,2005,2006,2007
 ./TODO                                         X       2003,2004,2005,2006,2007
-./dns/__init__.py                              PYTHON  2003,2004,2005,2006,2007,2009
-./dns/dnssec.py                                        PYTHON  2003,2004,2005,2006,2007,2009
-./dns/e164.py                                  PYTHON  2006,2007,2009
-./dns/edns.py                                  PYTHON  2009
-./dns/entropy.py                               PYTHON  2009
-./dns/exception.py                             PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/flags.py                                 PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/inet.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/ipv4.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/ipv6.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/message.py                               PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/name.py                                  PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/namedict.py                              PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/node.py                                  PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/opcode.py                                        PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/query.py                                 PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rcode.py                                 PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/rdata.py                                 PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/rdataclass.py                            PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/rdataset.py                              PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/rdatatype.py                             PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/AFSDB.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/CERT.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/CNAME.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/DLV.py                       PYTHON  2009,2010
-./dns/rdtypes/ANY/DNAME.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/DNSKEY.py                    PYTHON  2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/DS.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/GPOS.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/HINFO.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/HIP.py                       PYTHON  2010
-./dns/rdtypes/ANY/ISDN.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/KEY.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/LOC.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/MX.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/NS.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/NSEC.py                      PYTHON  2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/NSEC3.py                     PYTHON  2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/NSEC3PARAM.py                        PYTHON  2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/NXT.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/PTR.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/RP.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/RRSIG.py                     PYTHON  2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/RT.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/SIG.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/SOA.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/SPF.py                       PYTHON  2006,2007,2009,2010
-./dns/rdtypes/ANY/SSHFP.py                     PYTHON  2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/TXT.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/X25.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/ANY/__init__.py                  PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/A.py                          PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/AAAA.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/APL.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/DHCID.py                      PYTHON  2006,2007,2009,2010
-./dns/rdtypes/IN/IPSECKEY.py                   PYTHON  2006,2007,2009,2010
-./dns/rdtypes/IN/KX.py                         PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/NAPTR.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/NSAP.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/NSAP_PTR.py                   PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/PX.py                         PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/SRV.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/WKS.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/IN/__init__.py                   PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/__init__.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/dsbase.py                                PYTHON  2010
-./dns/rdtypes/keybase.py                       PYTHON  2004,2005,2006,2007,2009,2010
-./dns/rdtypes/mxbase.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/nsbase.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/rdtypes/sigbase.py                       PYTHON  2004,2005,2006,2007,2009,2010
-./dns/rdtypes/txtbase.py                       PYTHON  2006,2007,2009,2010
-./dns/renderer.py                              PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/resolver.py                              PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/reversename.py                           PYTHON  2006,2007,2009,2010
-./dns/rrset.py                                 PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/set.py                                   PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/tokenizer.py                             PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/tsig.py                                  PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010
-./dns/tsigkeyring.py                           PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/ttl.py                                   PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/update.py                                        PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/version.py                               PYTHON  2003,2004,2005,2006,2007,2009,2010
-./dns/zone.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010
+./dns/__init__.py                              PYTHON  2003,2004,2005,2006,2007,2009,2011
+./dns/dnssec.py                                        PYTHON  2003,2004,2005,2006,2007,2009,2011
+./dns/e164.py                                  PYTHON  2006,2007,2009,2011
+./dns/edns.py                                  PYTHON  2009,2011
+./dns/entropy.py                               PYTHON  2009,2011
+./dns/exception.py                             PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/flags.py                                 PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/hash.py                                  PYTHON  2011
+./dns/inet.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/ipv4.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/ipv6.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/message.py                               PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/name.py                                  PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/namedict.py                              PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/node.py                                  PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/opcode.py                                        PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/query.py                                 PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rcode.py                                 PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdata.py                                 PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdataclass.py                            PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdataset.py                              PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdatatype.py                             PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/AFSDB.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/CERT.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/CNAME.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/DLV.py                       PYTHON  2009,2010,2011
+./dns/rdtypes/ANY/DNAME.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/DNSKEY.py                    PYTHON  2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/DS.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/GPOS.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/HINFO.py                     PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/HIP.py                       PYTHON  2010,2011
+./dns/rdtypes/ANY/ISDN.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/LOC.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/MX.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/NS.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/NSEC.py                      PYTHON  2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/NSEC3.py                     PYTHON  2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/NSEC3PARAM.py                        PYTHON  2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/PTR.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/RP.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/RRSIG.py                     PYTHON  2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/RT.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/SOA.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/SPF.py                       PYTHON  2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/SSHFP.py                     PYTHON  2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/TXT.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/X25.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/ANY/__init__.py                  PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/A.py                          PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/AAAA.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/APL.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/DHCID.py                      PYTHON  2006,2007,2009,2010,2011
+./dns/rdtypes/IN/IPSECKEY.py                   PYTHON  2006,2007,2009,2010,2011
+./dns/rdtypes/IN/KX.py                         PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/NAPTR.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/NSAP.py                       PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/NSAP_PTR.py                   PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/PX.py                         PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/SRV.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/WKS.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/IN/__init__.py                   PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/__init__.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/dsbase.py                                PYTHON  2010,2011
+./dns/rdtypes/mxbase.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/nsbase.py                                PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/rdtypes/txtbase.py                       PYTHON  2006,2007,2009,2010,2011
+./dns/renderer.py                              PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/resolver.py                              PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/reversename.py                           PYTHON  2006,2007,2009,2010,2011
+./dns/rrset.py                                 PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/set.py                                   PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/tokenizer.py                             PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/tsig.py                                  PYTHON  2001,2002,2003,2004,2005,2006,2007,2009,2010,2011
+./dns/tsigkeyring.py                           PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/ttl.py                                   PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/update.py                                        PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/version.py                               PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./dns/wiredata.py                              PYTHON  2011
+./dns/zone.py                                  PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
 ./examples/ddns.py                             X       2006,2007
 ./examples/e164.py                             X       2006,2007
 ./examples/mx.py                               X       2003,2004,2005,2006,2007
 ./examples/reverse.py                          X       2003,2004,2005,2006,2007
 ./examples/reverse_name.py                     X       2006,2007
 ./examples/xfr.py                              X       2003,2004,2005,2006,2007
-./setup.py                                     PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/Makefile                               MAKE    2003,2004,2005,2006,2007,2009,2010
-./tests/bugs.py                                        PYTHON  2006,2007,2009,2010
+./examples/zonediff.py                         X       2010,2011
+./setup.py                                     PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/Makefile                               MAKE    2003,2004,2005,2006,2007,2009,2010,2011
+./tests/bugs.py                                        PYTHON  2006,2007,2009,2010,2011
+./tests/dnssec.py                              PYTHON  2011
 ./tests/example                                        X       2003,2004,2005,2006,2007
 ./tests/example1.good                          X       2003,2004,2005,2006,2007
 ./tests/example2.good                          X       2003,2004,2005,2006,2007
-./tests/flags.py                               PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/message.py                             PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/name.py                                        PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/namedict.py                            PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/ntoaaton.py                            PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/rdtypeandclass.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/resolver.py                            PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/rrset.py                               PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/set.py                                 PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/tokenizer.py                           PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/update.py                              PYTHON  2003,2004,2005,2006,2007,2009,2010
-./tests/zone.py                                        PYTHON  2003,2004,2005,2006,2007,2009,2010
+./tests/flags.py                               PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/message.py                             PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/name.py                                        PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/namedict.py                            PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/ntoaaton.py                            PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/rdtypeandclass.py                      PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/resolver.py                            PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/rrset.py                               PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/set.py                                 PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/tokenizer.py                           PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/update.py                              PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
+./tests/zone.py                                        PYTHON  2003,2004,2005,2006,2007,2009,2010,2011
 ./util/COPYRIGHT                               X       2003,2004,2005,2006,2007
 ./util/copyrights                              X       2003,2004,2005,2006,2007