diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-08-27 16:07:52 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-08-27 17:40:39 +0200 |
commit | 8bd71350abe48fdcfc0125e48fa97abdf31e1270 (patch) | |
tree | 2873d7fc77f9ec1992e24886a9feae80b48ffaef | |
parent | bd01a8e79faa3d657f01529c063cd0e09d711880 (diff) | |
download | samba-8bd71350abe48fdcfc0125e48fa97abdf31e1270.tar.gz samba-8bd71350abe48fdcfc0125e48fa97abdf31e1270.tar.bz2 samba-8bd71350abe48fdcfc0125e48fa97abdf31e1270.zip |
dnspython: Update to latest upstream snapshot.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Aug 27 17:40:39 CEST 2011 on sn-devel-104
109 files changed, 1197 insertions, 858 deletions
diff --git a/lib/dnspython/ChangeLog b/lib/dnspython/ChangeLog index 0fff77f977..71b7961490 100644 --- a/lib/dnspython/ChangeLog +++ b/lib/dnspython/ChangeLog @@ -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 "==" diff --git a/lib/dnspython/Makefile b/lib/dnspython/Makefile index 3dbfe95346..1f62c96c24 100644 --- a/lib/dnspython/Makefile +++ b/lib/dnspython/Makefile @@ -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, diff --git a/lib/dnspython/README b/lib/dnspython/README index d53dac61ab..367e7a2b76 100644 --- a/lib/dnspython/README +++ b/lib/dnspython/README @@ -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: diff --git a/lib/dnspython/dns/__init__.py b/lib/dnspython/dns/__init__.py index 56e1e8a2ea..c848e48581 100644 --- a/lib/dnspython/dns/__init__.py +++ b/lib/dnspython/dns/__init__.py @@ -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', ] diff --git a/lib/dnspython/dns/dnssec.py b/lib/dnspython/dns/dnssec.py index a595fd4478..dd6a27a536 100644 --- a/lib/dnspython/dns/dnssec.py +++ b/lib/dnspython/dns/dnssec.py @@ -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 diff --git a/lib/dnspython/dns/e164.py b/lib/dnspython/dns/e164.py index d8f71ec799..d6dcd1b186 100644 --- a/lib/dnspython/dns/e164.py +++ b/lib/dnspython/dns/e164.py @@ -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, diff --git a/lib/dnspython/dns/edns.py b/lib/dnspython/dns/edns.py index 1731cedde4..f8b6009d3f 100644 --- a/lib/dnspython/dns/edns.py +++ b/lib/dnspython/dns/edns.py @@ -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, diff --git a/lib/dnspython/dns/entropy.py b/lib/dnspython/dns/entropy.py index fd9d4f8cdf..d380cf8c0d 100644 --- a/lib/dnspython/dns/entropy.py +++ b/lib/dnspython/dns/entropy.py @@ -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, diff --git a/lib/dnspython/dns/exception.py b/lib/dnspython/dns/exception.py index c6d6570d98..db6ef6e6e3 100644 --- a/lib/dnspython/dns/exception.py +++ b/lib/dnspython/dns/exception.py @@ -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/flags.py b/lib/dnspython/dns/flags.py index 17afdbc2ec..35a8305e80 100644 --- a/lib/dnspython/dns/flags.py +++ b/lib/dnspython/dns/flags.py @@ -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, diff --git a/lib/dnspython/dns/hash.py b/lib/dnspython/dns/hash.py index 7bd5ae5980..0c708036b1 100644 --- a/lib/dnspython/dns/hash.py +++ b/lib/dnspython/dns/hash.py @@ -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, diff --git a/lib/dnspython/dns/inet.py b/lib/dnspython/dns/inet.py index 8a8f3e1ca8..3b7e88f7b1 100644 --- a/lib/dnspython/dns/inet.py +++ b/lib/dnspython/dns/inet.py @@ -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/ipv4.py b/lib/dnspython/dns/ipv4.py index 1569da5475..e117966e5f 100644 --- a/lib/dnspython/dns/ipv4.py +++ b/lib/dnspython/dns/ipv4.py @@ -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, @@ -15,22 +15,28 @@ """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 diff --git a/lib/dnspython/dns/ipv6.py b/lib/dnspython/dns/ipv6.py index 33c6713796..69db34a7de 100644 --- a/lib/dnspython/dns/ipv6.py +++ b/lib/dnspython/dns/ipv6.py @@ -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>:' diff --git a/lib/dnspython/dns/message.py b/lib/dnspython/dns/message.py index a124a3e177..cf29133934 100644 --- a/lib/dnspython/dns/message.py +++ b/lib/dnspython/dns/message.py @@ -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 diff --git a/lib/dnspython/dns/name.py b/lib/dnspython/dns/name.py index f239c9b5de..ed3ffeec57 100644 --- a/lib/dnspython/dns/name.py +++ b/lib/dnspython/dns/name.py @@ -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 diff --git a/lib/dnspython/dns/namedict.py b/lib/dnspython/dns/namedict.py index 54afb77188..9f5a0efb7c 100644 --- a/lib/dnspython/dns/namedict.py +++ b/lib/dnspython/dns/namedict.py @@ -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/node.py b/lib/dnspython/dns/node.py index 785a245464..7625c66d3a 100644 --- a/lib/dnspython/dns/node.py +++ b/lib/dnspython/dns/node.py @@ -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, diff --git a/lib/dnspython/dns/opcode.py b/lib/dnspython/dns/opcode.py index 705bd09a43..3258c34cd9 100644 --- a/lib/dnspython/dns/opcode.py +++ b/lib/dnspython/dns/opcode.py @@ -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, diff --git a/lib/dnspython/dns/query.py b/lib/dnspython/dns/query.py index 9dc88a635c..addee4e3f2 100644 --- a/lib/dnspython/dns/query.py +++ b/lib/dnspython/dns/query.py @@ -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/rcode.py b/lib/dnspython/dns/rcode.py index c055f2e7cd..7807782aa4 100644 --- a/lib/dnspython/dns/rcode.py +++ b/lib/dnspython/dns/rcode.py @@ -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, diff --git a/lib/dnspython/dns/rdata.py b/lib/dnspython/dns/rdata.py index 399677e984..350bf790b8 100644 --- a/lib/dnspython/dns/rdata.py +++ b/lib/dnspython/dns/rdata.py @@ -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) diff --git a/lib/dnspython/dns/rdataclass.py b/lib/dnspython/dns/rdataclass.py index 887fd1ad6b..7601e70c3a 100644 --- a/lib/dnspython/dns/rdataclass.py +++ b/lib/dnspython/dns/rdataclass.py @@ -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 """ diff --git a/lib/dnspython/dns/rdataset.py b/lib/dnspython/dns/rdataset.py index f556d2288b..dcd2b40191 100644 --- a/lib/dnspython/dns/rdataset.py +++ b/lib/dnspython/dns/rdataset.py @@ -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, diff --git a/lib/dnspython/dns/rdatatype.py b/lib/dnspython/dns/rdatatype.py index 1a02b7d3cd..380cfcd0d3 100644 --- a/lib/dnspython/dns/rdatatype.py +++ b/lib/dnspython/dns/rdatatype.py @@ -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, diff --git a/lib/dnspython/dns/rdtypes/ANY/AFSDB.py b/lib/dnspython/dns/rdtypes/ANY/AFSDB.py index e8ca6f5cbb..c729789afa 100644 --- a/lib/dnspython/dns/rdtypes/ANY/AFSDB.py +++ b/lib/dnspython/dns/rdtypes/ANY/AFSDB.py @@ -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/CERT.py b/lib/dnspython/dns/rdtypes/ANY/CERT.py index d2703519d5..c102521a14 100644 --- a/lib/dnspython/dns/rdtypes/ANY/CERT.py +++ b/lib/dnspython/dns/rdtypes/ANY/CERT.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/ANY/CNAME.py b/lib/dnspython/dns/rdtypes/ANY/CNAME.py index 7f5c4b3bd7..fb8e9be49e 100644 --- a/lib/dnspython/dns/rdtypes/ANY/CNAME.py +++ b/lib/dnspython/dns/rdtypes/ANY/CNAME.py @@ -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/DLV.py b/lib/dnspython/dns/rdtypes/ANY/DLV.py index 07b9548342..8bd79793d1 100644 --- a/lib/dnspython/dns/rdtypes/ANY/DLV.py +++ b/lib/dnspython/dns/rdtypes/ANY/DLV.py @@ -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, diff --git a/lib/dnspython/dns/rdtypes/ANY/DNAME.py b/lib/dnspython/dns/rdtypes/ANY/DNAME.py index 99b5013f33..d864001190 100644 --- a/lib/dnspython/dns/rdtypes/ANY/DNAME.py +++ b/lib/dnspython/dns/rdtypes/ANY/DNAME.py @@ -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/DNSKEY.py b/lib/dnspython/dns/rdtypes/ANY/DNSKEY.py index ad66ef0c69..1d678d2f2a 100644 --- a/lib/dnspython/dns/rdtypes/ANY/DNSKEY.py +++ b/lib/dnspython/dns/rdtypes/ANY/DNSKEY.py @@ -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, @@ -13,13 +13,82 @@ # 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 diff --git a/lib/dnspython/dns/rdtypes/ANY/DS.py b/lib/dnspython/dns/rdtypes/ANY/DS.py index 3a06f448f7..56b6332de2 100644 --- a/lib/dnspython/dns/rdtypes/ANY/DS.py +++ b/lib/dnspython/dns/rdtypes/ANY/DS.py @@ -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/GPOS.py b/lib/dnspython/dns/rdtypes/ANY/GPOS.py index 6f63cc05f6..38d1d88b28 100644 --- a/lib/dnspython/dns/rdtypes/ANY/GPOS.py +++ b/lib/dnspython/dns/rdtypes/ANY/GPOS.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/ANY/HINFO.py b/lib/dnspython/dns/rdtypes/ANY/HINFO.py index e592ad39a7..15fd54e69e 100644 --- a/lib/dnspython/dns/rdtypes/ANY/HINFO.py +++ b/lib/dnspython/dns/rdtypes/ANY/HINFO.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/ANY/HIP.py b/lib/dnspython/dns/rdtypes/ANY/HIP.py index 8f96ae93d6..968b36f5e2 100644 --- a/lib/dnspython/dns/rdtypes/ANY/HIP.py +++ b/lib/dnspython/dns/rdtypes/ANY/HIP.py @@ -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 = [] diff --git a/lib/dnspython/dns/rdtypes/ANY/ISDN.py b/lib/dnspython/dns/rdtypes/ANY/ISDN.py index 424d3a9a3c..0c2d3cd035 100644 --- a/lib/dnspython/dns/rdtypes/ANY/ISDN.py +++ b/lib/dnspython/dns/rdtypes/ANY/ISDN.py @@ -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 index c8581edbeb..0000000000 --- a/lib/dnspython/dns/rdtypes/ANY/KEY.py +++ /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 diff --git a/lib/dnspython/dns/rdtypes/ANY/LOC.py b/lib/dnspython/dns/rdtypes/ANY/LOC.py index 518dd6010f..154546d79d 100644 --- a/lib/dnspython/dns/rdtypes/ANY/LOC.py +++ b/lib/dnspython/dns/rdtypes/ANY/LOC.py @@ -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/MX.py b/lib/dnspython/dns/rdtypes/ANY/MX.py index 9cad260672..92f41532a7 100644 --- a/lib/dnspython/dns/rdtypes/ANY/MX.py +++ b/lib/dnspython/dns/rdtypes/ANY/MX.py @@ -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/NS.py b/lib/dnspython/dns/rdtypes/ANY/NS.py index 4b03a3ab47..6b45d4d4b6 100644 --- a/lib/dnspython/dns/rdtypes/ANY/NS.py +++ b/lib/dnspython/dns/rdtypes/ANY/NS.py @@ -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/NSEC.py b/lib/dnspython/dns/rdtypes/ANY/NSEC.py index 72859ce108..ad113a4b59 100644 --- a/lib/dnspython/dns/rdtypes/ANY/NSEC.py +++ b/lib/dnspython/dns/rdtypes/ANY/NSEC.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/ANY/NSEC3.py b/lib/dnspython/dns/rdtypes/ANY/NSEC3.py index 932d7b4032..c7ac7375b4 100644 --- a/lib/dnspython/dns/rdtypes/ANY/NSEC3.py +++ b/lib/dnspython/dns/rdtypes/ANY/NSEC3.py @@ -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)) diff --git a/lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py b/lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py index ec91e5e85c..4e687825ad 100644 --- a/lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py +++ b/lib/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py @@ -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 index 99ae9b9dff..0000000000 --- a/lib/dnspython/dns/rdtypes/ANY/NXT.py +++ /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 diff --git a/lib/dnspython/dns/rdtypes/ANY/PTR.py b/lib/dnspython/dns/rdtypes/ANY/PTR.py index 6c4b79eaac..4a037537b6 100644 --- a/lib/dnspython/dns/rdtypes/ANY/PTR.py +++ b/lib/dnspython/dns/rdtypes/ANY/PTR.py @@ -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/RP.py b/lib/dnspython/dns/rdtypes/ANY/RP.py index 421ce8e207..26c55314e1 100644 --- a/lib/dnspython/dns/rdtypes/ANY/RP.py +++ b/lib/dnspython/dns/rdtypes/ANY/RP.py @@ -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/RRSIG.py b/lib/dnspython/dns/rdtypes/ANY/RRSIG.py index 0e4816f648..63d389cd7a 100644 --- a/lib/dnspython/dns/rdtypes/ANY/RRSIG.py +++ b/lib/dnspython/dns/rdtypes/ANY/RRSIG.py @@ -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, @@ -13,8 +13,143 @@ # 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) diff --git a/lib/dnspython/dns/rdtypes/ANY/RT.py b/lib/dnspython/dns/rdtypes/ANY/RT.py index 1efd3724d9..f9653fdb34 100644 --- a/lib/dnspython/dns/rdtypes/ANY/RT.py +++ b/lib/dnspython/dns/rdtypes/ANY/RT.py @@ -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 index 501e29cc8c..0000000000 --- a/lib/dnspython/dns/rdtypes/ANY/SIG.py +++ /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 diff --git a/lib/dnspython/dns/rdtypes/ANY/SOA.py b/lib/dnspython/dns/rdtypes/ANY/SOA.py index a25a35e29b..2d6f21b56b 100644 --- a/lib/dnspython/dns/rdtypes/ANY/SOA.py +++ b/lib/dnspython/dns/rdtypes/ANY/SOA.py @@ -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): diff --git a/lib/dnspython/dns/rdtypes/ANY/SPF.py b/lib/dnspython/dns/rdtypes/ANY/SPF.py index 9b5a9a9fed..8860dd72bb 100644 --- a/lib/dnspython/dns/rdtypes/ANY/SPF.py +++ b/lib/dnspython/dns/rdtypes/ANY/SPF.py @@ -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, diff --git a/lib/dnspython/dns/rdtypes/ANY/SSHFP.py b/lib/dnspython/dns/rdtypes/ANY/SSHFP.py index 162dda5c48..cec650a570 100644 --- a/lib/dnspython/dns/rdtypes/ANY/SSHFP.py +++ b/lib/dnspython/dns/rdtypes/ANY/SSHFP.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/ANY/TXT.py b/lib/dnspython/dns/rdtypes/ANY/TXT.py index 23f4f3b7c6..604fd0f4de 100644 --- a/lib/dnspython/dns/rdtypes/ANY/TXT.py +++ b/lib/dnspython/dns/rdtypes/ANY/TXT.py @@ -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/X25.py b/lib/dnspython/dns/rdtypes/ANY/X25.py index c3632f7fc4..ae91295f8c 100644 --- a/lib/dnspython/dns/rdtypes/ANY/X25.py +++ b/lib/dnspython/dns/rdtypes/ANY/X25.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/ANY/__init__.py b/lib/dnspython/dns/rdtypes/ANY/__init__.py index 0815dd5450..721e9dd60b 100644 --- a/lib/dnspython/dns/rdtypes/ANY/__init__.py +++ b/lib/dnspython/dns/rdtypes/ANY/__init__.py @@ -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', diff --git a/lib/dnspython/dns/rdtypes/IN/A.py b/lib/dnspython/dns/rdtypes/IN/A.py index e05f204a2f..372d333226 100644 --- a/lib/dnspython/dns/rdtypes/IN/A.py +++ b/lib/dnspython/dns/rdtypes/IN/A.py @@ -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/IN/AAAA.py b/lib/dnspython/dns/rdtypes/IN/AAAA.py index 2d812d39eb..e131bd5070 100644 --- a/lib/dnspython/dns/rdtypes/IN/AAAA.py +++ b/lib/dnspython/dns/rdtypes/IN/AAAA.py @@ -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/IN/APL.py b/lib/dnspython/dns/rdtypes/IN/APL.py index 7412c02d30..260fd6f39f 100644 --- a/lib/dnspython/dns/rdtypes/IN/APL.py +++ b/lib/dnspython/dns/rdtypes/IN/APL.py @@ -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: diff --git a/lib/dnspython/dns/rdtypes/IN/DHCID.py b/lib/dnspython/dns/rdtypes/IN/DHCID.py index 2d35234bf0..5524beadd1 100644 --- a/lib/dnspython/dns/rdtypes/IN/DHCID.py +++ b/lib/dnspython/dns/rdtypes/IN/DHCID.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/IN/IPSECKEY.py b/lib/dnspython/dns/rdtypes/IN/IPSECKEY.py index 9ab08d881c..d85b6fe993 100644 --- a/lib/dnspython/dns/rdtypes/IN/IPSECKEY.py +++ b/lib/dnspython/dns/rdtypes/IN/IPSECKEY.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/IN/KX.py b/lib/dnspython/dns/rdtypes/IN/KX.py index 4d8a3a7d6b..c7bd5bbe65 100644 --- a/lib/dnspython/dns/rdtypes/IN/KX.py +++ b/lib/dnspython/dns/rdtypes/IN/KX.py @@ -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/IN/NAPTR.py b/lib/dnspython/dns/rdtypes/IN/NAPTR.py index a3cca55e1c..7fe043082b 100644 --- a/lib/dnspython/dns/rdtypes/IN/NAPTR.py +++ b/lib/dnspython/dns/rdtypes/IN/NAPTR.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/IN/NSAP.py b/lib/dnspython/dns/rdtypes/IN/NSAP.py index 22b9131ccf..216cb0a81a 100644 --- a/lib/dnspython/dns/rdtypes/IN/NSAP.py +++ b/lib/dnspython/dns/rdtypes/IN/NSAP.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/IN/NSAP_PTR.py b/lib/dnspython/dns/rdtypes/IN/NSAP_PTR.py index 6f591f4ec0..df5b989ac8 100644 --- a/lib/dnspython/dns/rdtypes/IN/NSAP_PTR.py +++ b/lib/dnspython/dns/rdtypes/IN/NSAP_PTR.py @@ -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/IN/PX.py b/lib/dnspython/dns/rdtypes/IN/PX.py index 0f11290724..1422b83487 100644 --- a/lib/dnspython/dns/rdtypes/IN/PX.py +++ b/lib/dnspython/dns/rdtypes/IN/PX.py @@ -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 diff --git a/lib/dnspython/dns/rdtypes/IN/SRV.py b/lib/dnspython/dns/rdtypes/IN/SRV.py index c9c5823381..e101b26bea 100644 --- a/lib/dnspython/dns/rdtypes/IN/SRV.py +++ b/lib/dnspython/dns/rdtypes/IN/SRV.py @@ -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/IN/WKS.py b/lib/dnspython/dns/rdtypes/IN/WKS.py index 85aafb3d23..04c3054e44 100644 --- a/lib/dnspython/dns/rdtypes/IN/WKS.py +++ b/lib/dnspython/dns/rdtypes/IN/WKS.py @@ -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) diff --git a/lib/dnspython/dns/rdtypes/IN/__init__.py b/lib/dnspython/dns/rdtypes/IN/__init__.py index ab931296ec..24cf1ece4e 100644 --- a/lib/dnspython/dns/rdtypes/IN/__init__.py +++ b/lib/dnspython/dns/rdtypes/IN/__init__.py @@ -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/__init__.py b/lib/dnspython/dns/rdtypes/__init__.py index 13282be73a..49db5a3776 100644 --- a/lib/dnspython/dns/rdtypes/__init__.py +++ b/lib/dnspython/dns/rdtypes/__init__.py @@ -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', ] diff --git a/lib/dnspython/dns/rdtypes/dsbase.py b/lib/dnspython/dns/rdtypes/dsbase.py index aa46403a5f..6f5559a7e4 100644 --- a/lib/dnspython/dns/rdtypes/dsbase.py +++ b/lib/dnspython/dns/rdtypes/dsbase.py @@ -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 index 75c9272670..0000000000 --- a/lib/dnspython/dns/rdtypes/keybase.py +++ /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 diff --git a/lib/dnspython/dns/rdtypes/mxbase.py b/lib/dnspython/dns/rdtypes/mxbase.py index 5e3515bec4..abc6a9ed5b 100644 --- a/lib/dnspython/dns/rdtypes/mxbase.py +++ b/lib/dnspython/dns/rdtypes/mxbase.py @@ -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/nsbase.py b/lib/dnspython/dns/rdtypes/nsbase.py index 7cdb2a0289..fbd5ef1e51 100644 --- a/lib/dnspython/dns/rdtypes/nsbase.py +++ b/lib/dnspython/dns/rdtypes/nsbase.py @@ -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 index ccb6dd69ae..0000000000 --- a/lib/dnspython/dns/rdtypes/sigbase.py +++ /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 diff --git a/lib/dnspython/dns/rdtypes/txtbase.py b/lib/dnspython/dns/rdtypes/txtbase.py index 43db2a48c0..580f056ea0 100644 --- a/lib/dnspython/dns/rdtypes/txtbase.py +++ b/lib/dnspython/dns/rdtypes/txtbase.py @@ -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) diff --git a/lib/dnspython/dns/renderer.py b/lib/dnspython/dns/renderer.py index bb0218ac30..ad3f83d450 100644 --- a/lib/dnspython/dns/renderer.py +++ b/lib/dnspython/dns/renderer.py @@ -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) diff --git a/lib/dnspython/dns/resolver.py b/lib/dnspython/dns/resolver.py index 30977f3a8b..90f95e8ed0 100644 --- a/lib/dnspython/dns/resolver.py +++ b/lib/dnspython/dns/resolver.py @@ -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 diff --git a/lib/dnspython/dns/reversename.py b/lib/dnspython/dns/reversename.py index 0a61b827b0..4925cfd6ff 100644 --- a/lib/dnspython/dns/reversename.py +++ b/lib/dnspython/dns/reversename.py @@ -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, diff --git a/lib/dnspython/dns/rrset.py b/lib/dnspython/dns/rrset.py index 21468174d4..f6051fea4f 100644 --- a/lib/dnspython/dns/rrset.py +++ b/lib/dnspython/dns/rrset.py @@ -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/set.py b/lib/dnspython/dns/set.py index 91f9fb8766..14c76a05c4 100644 --- a/lib/dnspython/dns/set.py +++ b/lib/dnspython/dns/set.py @@ -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/tokenizer.py b/lib/dnspython/dns/tokenizer.py index 4f68a2a495..4bff7b6c72 100644 --- a/lib/dnspython/dns/tokenizer.py +++ b/lib/dnspython/dns/tokenizer.py @@ -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/tsig.py b/lib/dnspython/dns/tsig.py index 5e58ea8841..63b925afbb 100644 --- a/lib/dnspython/dns/tsig.py +++ b/lib/dnspython/dns/tsig.py @@ -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, diff --git a/lib/dnspython/dns/tsigkeyring.py b/lib/dnspython/dns/tsigkeyring.py index cbd1a27bbf..0ddd93410f 100644 --- a/lib/dnspython/dns/tsigkeyring.py +++ b/lib/dnspython/dns/tsigkeyring.py @@ -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/ttl.py b/lib/dnspython/dns/ttl.py index f295300517..ab6ddf4e66 100644 --- a/lib/dnspython/dns/ttl.py +++ b/lib/dnspython/dns/ttl.py @@ -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/update.py b/lib/dnspython/dns/update.py index e67acafec9..e692226918 100644 --- a/lib/dnspython/dns/update.py +++ b/lib/dnspython/dns/update.py @@ -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/version.py b/lib/dnspython/dns/version.py index 46799a77d9..7de430b638 100644 --- a/lib/dnspython/dns/version.py +++ b/lib/dnspython/dns/version.py @@ -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 index 0000000000..86d954a90a --- /dev/null +++ b/lib/dnspython/dns/wiredata.py @@ -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 diff --git a/lib/dnspython/dns/zone.py b/lib/dnspython/dns/zone.py index db5fd5df85..67c952d3cc 100644 --- a/lib/dnspython/dns/zone.py +++ b/lib/dnspython/dns/zone.py @@ -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/examples/xfr.py b/lib/dnspython/examples/xfr.py index 5cd6f55c06..e67ab18927 100755 --- a/lib/dnspython/examples/xfr.py +++ b/lib/dnspython/examples/xfr.py @@ -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: diff --git a/lib/dnspython/setup.py b/lib/dnspython/setup.py index f84711f795..33d7c20679 100755 --- a/lib/dnspython/setup.py +++ b/lib/dnspython/setup.py @@ -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'] = [] diff --git a/lib/dnspython/tests/Makefile b/lib/dnspython/tests/Makefile index 584f6a7da7..6ab444f451 100644 --- a/lib/dnspython/tests/Makefile +++ b/lib/dnspython/tests/Makefile @@ -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/tests/bugs.py b/lib/dnspython/tests/bugs.py index 0896e3f02d..c2fa6b6659 100644 --- a/lib/dnspython/tests/bugs.py +++ b/lib/dnspython/tests/bugs.py @@ -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, diff --git a/lib/dnspython/tests/dnssec.py b/lib/dnspython/tests/dnssec.py index b30e847fba..7b4546a086 100644 --- a/lib/dnspython/tests/dnssec.py +++ b/lib/dnspython/tests/dnssec.py @@ -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, diff --git a/lib/dnspython/tests/example b/lib/dnspython/tests/example index e8fed1161b..2f753a2f75 100644 --- a/lib/dnspython/tests/example +++ b/lib/dnspython/tests/example @@ -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 diff --git a/lib/dnspython/tests/example1.good b/lib/dnspython/tests/example1.good index ca5ead6379..0834d17150 100644 --- a/lib/dnspython/tests/example1.good +++ b/lib/dnspython/tests/example1.good @@ -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. diff --git a/lib/dnspython/tests/example2.good b/lib/dnspython/tests/example2.good index c923c09b7c..de4bcd59fd 100644 --- a/lib/dnspython/tests/example2.good +++ b/lib/dnspython/tests/example2.good @@ -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. diff --git a/lib/dnspython/tests/flags.py b/lib/dnspython/tests/flags.py index 7ee2d8e12e..b3cf6716bc 100644 --- a/lib/dnspython/tests/flags.py +++ b/lib/dnspython/tests/flags.py @@ -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/tests/message.py b/lib/dnspython/tests/message.py index 7134661d3a..931bb1977d 100644 --- a/lib/dnspython/tests/message.py +++ b/lib/dnspython/tests/message.py @@ -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/tests/name.py b/lib/dnspython/tests/name.py index 1ab4f52814..e30e43d3a2 100644 --- a/lib/dnspython/tests/name.py +++ b/lib/dnspython/tests/name.py @@ -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.') diff --git a/lib/dnspython/tests/namedict.py b/lib/dnspython/tests/namedict.py index 0261142186..e256bfe679 100644 --- a/lib/dnspython/tests/namedict.py +++ b/lib/dnspython/tests/namedict.py @@ -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/tests/ntoaaton.py b/lib/dnspython/tests/ntoaaton.py index 77befd26e3..9d8bedd702 100644 --- a/lib/dnspython/tests/ntoaaton.py +++ b/lib/dnspython/tests/ntoaaton.py @@ -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,141 +16,182 @@ 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() diff --git a/lib/dnspython/tests/rdtypeandclass.py b/lib/dnspython/tests/rdtypeandclass.py index 0c8a830e27..f3c0628d36 100644 --- a/lib/dnspython/tests/rdtypeandclass.py +++ b/lib/dnspython/tests/rdtypeandclass.py @@ -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/tests/resolver.py b/lib/dnspython/tests/resolver.py index bd6dc5fbc2..28d5a42cdf 100644 --- a/lib/dnspython/tests/resolver.py +++ b/lib/dnspython/tests/resolver.py @@ -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/tests/rrset.py b/lib/dnspython/tests/rrset.py index 3cafbee891..be1324b0ec 100644 --- a/lib/dnspython/tests/rrset.py +++ b/lib/dnspython/tests/rrset.py @@ -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/tests/set.py b/lib/dnspython/tests/set.py index e2bca51b82..583d20cfa0 100644 --- a/lib/dnspython/tests/set.py +++ b/lib/dnspython/tests/set.py @@ -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/tests/tokenizer.py b/lib/dnspython/tests/tokenizer.py index 4f4a1bdc90..1d561ae1b5 100644 --- a/lib/dnspython/tests/tokenizer.py +++ b/lib/dnspython/tests/tokenizer.py @@ -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/tests/update.py b/lib/dnspython/tests/update.py index 5f7b31f23f..92ddb565fc 100644 --- a/lib/dnspython/tests/update.py +++ b/lib/dnspython/tests/update.py @@ -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/tests/zone.py b/lib/dnspython/tests/zone.py index 075be0a48a..31e7405b0f 100644 --- a/lib/dnspython/tests/zone.py +++ b/lib/dnspython/tests/zone.py @@ -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/util/copyrights b/lib/dnspython/util/copyrights index ae578381cb..f73e9f6fe3 100644 --- a/lib/dnspython/util/copyrights +++ b/lib/dnspython/util/copyrights @@ -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 @@ -95,23 +92,25 @@ ./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 |