summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@nominum.com>2012-04-07 22:09:05 +0100
committerBob Halley <halley@nominum.com>2012-04-07 22:09:05 +0100
commit2ab9852e14cda6d3b1f91a66c929b19c4eaf4b9e (patch)
tree5b54b6c5264de432f5a9fe04b8c90d37a9f9cda8
parenta13a8b22c678b90b3983eb728c3a5204458f0eeb (diff)
downloaddnspython-2ab9852e14cda6d3b1f91a66c929b19c4eaf4b9e.tar.gz
allow whitespace in SSHFP fingerprints
-rw-r--r--ChangeLog4
-rw-r--r--dns/rdtypes/ANY/SSHFP.py12
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index accd9b1..46064a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-04-07 Bob Halley <halley@dnspython.org>
+ * dns/rdtypes/ANY/SSHFP.py (SSHFP.from_text): Allow whitespace in
+ the text string. Thanks to Jan Andres for the report and the
+ patch.
+
* dns/message.py (from_wire): dns.message.from_wire() now takes
an 'ignore_trailing' parameter which defaults to False. If set
to True, then trailing junk will be ignored instead of causing
diff --git a/dns/rdtypes/ANY/SSHFP.py b/dns/rdtypes/ANY/SSHFP.py
index ab87054..b7ee254 100644
--- a/dns/rdtypes/ANY/SSHFP.py
+++ b/dns/rdtypes/ANY/SSHFP.py
@@ -48,8 +48,16 @@ class SSHFP(dns.rdata.Rdata):
def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
algorithm = tok.get_uint8()
fp_type = tok.get_uint8()
- fingerprint = bytes.fromhex(tok.get_string())
- tok.get_eol()
+ 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)
+ hex = ''.join(chunks)
+ fingerprint = bytes.fromhex(hex)
return cls(rdclass, rdtype, algorithm, fp_type, fingerprint)
from_text = classmethod(from_text)