diff options
| author | Bob Halley <halley@dnspython.org> | 2008-10-16 14:26:28 +0000 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2008-10-16 14:26:28 +0000 |
| commit | e52e64e7cd6b35ab4fa66bde71db09daea0c45bc (patch) | |
| tree | 395b21ade22934aeaae9e39fce2df7a47f56803d | |
| parent | e24a606aea6c97d6a73f658388cfc82319f2fce0 (diff) | |
| download | dnspython-e52e64e7cd6b35ab4fa66bde71db09daea0c45bc.tar.gz | |
allow multiple chunks in DS RR Base64
| -rw-r--r-- | dns/rdtypes/ANY/DS.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/dns/rdtypes/ANY/DS.py b/dns/rdtypes/ANY/DS.py index 035ac30..e3ccf59 100644 --- a/dns/rdtypes/ANY/DS.py +++ b/dns/rdtypes/ANY/DS.py @@ -32,7 +32,7 @@ class DS(dns.rdata.Rdata): @see: draft-ietf-dnsext-delegation-signer-14.txt""" __slots__ = ['key_tag', 'algorithm', 'digest_type', 'digest'] - + def __init__(self, rdclass, rdtype, key_tag, algorithm, digest_type, digest): super(DS, self).__init__(rdclass, rdtype) @@ -46,17 +46,24 @@ class DS(dns.rdata.Rdata): self.digest_type, dns.rdata._hexify(self.digest, chunksize=128)) - + def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True): key_tag = tok.get_uint16() algorithm = tok.get_uint8() digest_type = tok.get_uint8() - digest = tok.get_string() + chunks = [] + while 1: + t = tok.get() + if t[0] == dns.tokenizer.EOL or t[0] == dns.tokenizer.EOF: + break + if t[0] != dns.tokenizer.IDENTIFIER: + raise dns.exception.SyntaxError + chunks.append(t[1]) + digest = ''.join(chunks) digest = digest.decode('hex_codec') - tok.get_eol() return cls(rdclass, rdtype, key_tag, algorithm, digest_type, digest) - + from_text = classmethod(from_text) def to_wire(self, file, compress = None, origin = None): @@ -64,7 +71,7 @@ class DS(dns.rdata.Rdata): self.digest_type) file.write(header) file.write(self.digest) - + def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None): header = struct.unpack("!HBB", wire[current : current + 4]) current += 4 |
