diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-09-04 23:05:16 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-09-04 23:05:16 +0200 |
commit | 6185fb4e9e3d3e654ad9f6325da0f4886013dda6 (patch) | |
tree | 81a767238fdd3b1902672330a49948d838acd2c7 /lib/dnspython/dns | |
parent | 5de2ec0def3e4ad0ead20b426e81509fd8e48c6d (diff) | |
download | samba-6185fb4e9e3d3e654ad9f6325da0f4886013dda6.tar.gz samba-6185fb4e9e3d3e654ad9f6325da0f4886013dda6.tar.bz2 samba-6185fb4e9e3d3e654ad9f6325da0f4886013dda6.zip |
dnspython: Update to latest upstream.
Diffstat (limited to 'lib/dnspython/dns')
-rw-r--r-- | lib/dnspython/dns/dnssec.py | 4 | ||||
-rw-r--r-- | lib/dnspython/dns/flags.py | 2 | ||||
-rw-r--r-- | lib/dnspython/dns/inet.py | 4 | ||||
-rw-r--r-- | lib/dnspython/dns/node.py | 14 | ||||
-rw-r--r-- | lib/dnspython/dns/opcode.py | 10 | ||||
-rw-r--r-- | lib/dnspython/dns/rdtypes/ANY/GPOS.py | 10 | ||||
-rw-r--r-- | lib/dnspython/dns/rdtypes/ANY/HINFO.py | 8 | ||||
-rw-r--r-- | lib/dnspython/dns/rdtypes/ANY/SOA.py | 6 | ||||
-rw-r--r-- | lib/dnspython/dns/rdtypes/ANY/SSHFP.py | 8 | ||||
-rw-r--r-- | lib/dnspython/dns/rdtypes/ANY/X25.py | 8 | ||||
-rw-r--r-- | lib/dnspython/dns/rdtypes/IN/NAPTR.py | 8 | ||||
-rw-r--r-- | lib/dnspython/dns/rdtypes/IN/PX.py | 8 | ||||
-rw-r--r-- | lib/dnspython/dns/resolver.py | 3 | ||||
-rw-r--r-- | lib/dnspython/dns/tsigkeyring.py | 4 | ||||
-rw-r--r-- | lib/dnspython/dns/update.py | 2 | ||||
-rw-r--r-- | lib/dnspython/dns/version.py | 2 |
16 files changed, 51 insertions, 50 deletions
diff --git a/lib/dnspython/dns/dnssec.py b/lib/dnspython/dns/dnssec.py index acf46535b9..54fd78d9c9 100644 --- a/lib/dnspython/dns/dnssec.py +++ b/lib/dnspython/dns/dnssec.py @@ -56,7 +56,7 @@ class UnknownAlgorithm(Exception): def algorithm_from_text(text): """Convert text into a DNSSEC algorithm value @rtype: int""" - + value = _algorithm_by_text.get(text.upper()) if value is None: value = int(text) @@ -65,7 +65,7 @@ def algorithm_from_text(text): def algorithm_to_text(value): """Convert a DNSSEC algorithm value to text @rtype: string""" - + text = _algorithm_by_value.get(value) if text is None: text = str(value) diff --git a/lib/dnspython/dns/flags.py b/lib/dnspython/dns/flags.py index 79375ea2ce..17afdbc2ec 100644 --- a/lib/dnspython/dns/flags.py +++ b/lib/dnspython/dns/flags.py @@ -89,7 +89,7 @@ def to_text(flags): @rtype: string""" return _to_text(flags, _by_value, _flags_order) - + def edns_from_text(text): """Convert a space-separated list of EDNS flag text values into a EDNS diff --git a/lib/dnspython/dns/inet.py b/lib/dnspython/dns/inet.py index 993a2f9436..8a8f3e1ca8 100644 --- a/lib/dnspython/dns/inet.py +++ b/lib/dnspython/dns/inet.py @@ -45,7 +45,7 @@ def inet_pton(family, text): implemented. @rtype: string """ - + if family == AF_INET: return dns.ipv4.inet_aton(text) elif family == AF_INET6: @@ -105,4 +105,4 @@ def is_multicast(text): return (first == 255) except: raise ValueError - + diff --git a/lib/dnspython/dns/node.py b/lib/dnspython/dns/node.py index 785a245464..07fff9293c 100644 --- a/lib/dnspython/dns/node.py +++ b/lib/dnspython/dns/node.py @@ -23,18 +23,18 @@ import dns.renderer class Node(object): """A DNS node. - + A node is a set of rdatasets @ivar rdatasets: the node's rdatasets @type rdatasets: list of dns.rdataset.Rdataset objects""" __slots__ = ['rdatasets'] - + def __init__(self): """Initialize a DNS node. """ - + self.rdatasets = []; def to_text(self, name, **kw): @@ -46,7 +46,7 @@ class Node(object): @type name: dns.name.Name object @rtype: string """ - + s = StringIO.StringIO() for rds in self.rdatasets: print >> s, rds.to_text(name, **kw) @@ -54,7 +54,7 @@ class Node(object): def __repr__(self): return '<DNS node ' + str(id(self)) + '>' - + def __eq__(self, other): """Two nodes are equal if they have the same rdatasets. @@ -73,7 +73,7 @@ class Node(object): def __ne__(self, other): return not self.__eq__(other) - + def __len__(self): return len(self.rdatasets) @@ -159,7 +159,7 @@ class Node(object): def replace_rdataset(self, replacement): """Replace an rdataset. - + It is not an error if there is no rdataset matching I{replacement}. Ownership of the I{replacement} object is transferred to the node; diff --git a/lib/dnspython/dns/opcode.py b/lib/dnspython/dns/opcode.py index 735d3a1f7d..705bd09a43 100644 --- a/lib/dnspython/dns/opcode.py +++ b/lib/dnspython/dns/opcode.py @@ -66,7 +66,7 @@ def from_flags(flags): @param flags: int @rtype: int """ - + return (flags & 0x7800) >> 11 def to_flags(value): @@ -74,9 +74,9 @@ def to_flags(value): flags. @rtype: int """ - + return (value << 11) & 0x7800 - + def to_text(value): """Convert an opcode to text. @@ -85,7 +85,7 @@ def to_text(value): @raises UnknownOpcode: the opcode is unknown @rtype: string """ - + text = _by_value.get(value) if text is None: text = str(value) @@ -98,7 +98,7 @@ def is_update(flags): @type flags: int @rtype: bool """ - + if (from_flags(flags) == UPDATE): return True return False diff --git a/lib/dnspython/dns/rdtypes/ANY/GPOS.py b/lib/dnspython/dns/rdtypes/ANY/GPOS.py index aa8000f8ca..6f63cc05f6 100644 --- a/lib/dnspython/dns/rdtypes/ANY/GPOS.py +++ b/lib/dnspython/dns/rdtypes/ANY/GPOS.py @@ -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,7 +92,7 @@ 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 diff --git a/lib/dnspython/dns/rdtypes/ANY/HINFO.py b/lib/dnspython/dns/rdtypes/ANY/HINFO.py index 5cfef5a932..e592ad39a7 100644 --- a/lib/dnspython/dns/rdtypes/ANY/HINFO.py +++ b/lib/dnspython/dns/rdtypes/ANY/HINFO.py @@ -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,7 +56,7 @@ 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 diff --git a/lib/dnspython/dns/rdtypes/ANY/SOA.py b/lib/dnspython/dns/rdtypes/ANY/SOA.py index 5f74b8d384..a25a35e29b 100644 --- a/lib/dnspython/dns/rdtypes/ANY/SOA.py +++ b/lib/dnspython/dns/rdtypes/ANY/SOA.py @@ -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/SSHFP.py b/lib/dnspython/dns/rdtypes/ANY/SSHFP.py index bc54f5e260..162dda5c48 100644 --- a/lib/dnspython/dns/rdtypes/ANY/SSHFP.py +++ b/lib/dnspython/dns/rdtypes/ANY/SSHFP.py @@ -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,14 +51,14 @@ 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 diff --git a/lib/dnspython/dns/rdtypes/ANY/X25.py b/lib/dnspython/dns/rdtypes/ANY/X25.py index fc4790fe8a..c3632f7fc4 100644 --- a/lib/dnspython/dns/rdtypes/ANY/X25.py +++ b/lib/dnspython/dns/rdtypes/ANY/X25.py @@ -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,7 +46,7 @@ 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 diff --git a/lib/dnspython/dns/rdtypes/IN/NAPTR.py b/lib/dnspython/dns/rdtypes/IN/NAPTR.py index 3a30d16d7b..a3cca55e1c 100644 --- a/lib/dnspython/dns/rdtypes/IN/NAPTR.py +++ b/lib/dnspython/dns/rdtypes/IN/NAPTR.py @@ -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 @@ -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/PX.py b/lib/dnspython/dns/rdtypes/IN/PX.py index 4718944ff4..0f11290724 100644 --- a/lib/dnspython/dns/rdtypes/IN/PX.py +++ b/lib/dnspython/dns/rdtypes/IN/PX.py @@ -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/resolver.py b/lib/dnspython/dns/resolver.py index 372d7d8361..cd0e5f804b 100644 --- a/lib/dnspython/dns/resolver.py +++ b/lib/dnspython/dns/resolver.py @@ -593,7 +593,8 @@ class Resolver(object): return answer request = dns.message.make_query(qname, rdtype, rdclass) if not self.keyname is None: - request.use_tsig(self.keyring, self.keyname, self.keyalgorithm) + request.use_tsig(self.keyring, self.keyname, + algorithm=self.keyalgorithm) request.use_edns(self.edns, self.ednsflags, self.payload) response = None # diff --git a/lib/dnspython/dns/tsigkeyring.py b/lib/dnspython/dns/tsigkeyring.py index 4d68f96c85..cbd1a27bbf 100644 --- a/lib/dnspython/dns/tsigkeyring.py +++ b/lib/dnspython/dns/tsigkeyring.py @@ -23,7 +23,7 @@ def from_text(textring): """Convert a dictionary containing (textual DNS name, base64 secret) pairs into a binary keyring which has (dns.name.Name, binary secret) pairs. @rtype: dict""" - + keyring = {} for keytext in textring: keyname = dns.name.from_text(keytext) @@ -35,7 +35,7 @@ def to_text(keyring): """Convert a dictionary containing (dns.name.Name, binary secret) pairs into a text keyring which has (textual DNS name, base64 secret) pairs. @rtype: dict""" - + textring = {} for keyname in keyring: keytext = dns.name.to_text(keyname) diff --git a/lib/dnspython/dns/update.py b/lib/dnspython/dns/update.py index 7d42636891..97aea18fb9 100644 --- a/lib/dnspython/dns/update.py +++ b/lib/dnspython/dns/update.py @@ -56,7 +56,7 @@ class Update(dns.message.Message): self.find_rrset(self.question, self.origin, rdclass, dns.rdatatype.SOA, create=True, force_unique=True) if not keyring is None: - self.use_tsig(keyring, keyname, keyalgorithm) + self.use_tsig(keyring, keyname, algorithm=keyalgorithm) def _add_rr(self, name, ttl, rd, deleting=None, section=None): """Add a single RR to the update section.""" diff --git a/lib/dnspython/dns/version.py b/lib/dnspython/dns/version.py index 7a36775180..dd135a13e5 100644 --- a/lib/dnspython/dns/version.py +++ b/lib/dnspython/dns/version.py @@ -17,7 +17,7 @@ MAJOR = 1 MINOR = 8 -MICRO = 0 +MICRO = 1 RELEASELEVEL = 0x0f SERIAL = 0 |