summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2012-04-07 22:08:52 +0100
committerBob Halley <halley@dnspython.org>2012-04-07 22:08:52 +0100
commitc411ec81ba3a03cd47cc353e5686595899ca311b (patch)
tree294c90c3ab0448dd45c7a40a9aa93bc77655aa7b
parent84fd7372b00afa4c55d4b32ca1d6f0c5a35b77df (diff)
downloaddnspython-c411ec81ba3a03cd47cc353e5686595899ca311b.tar.gz
allow whitespace in SSHFP fingerprints
-rw-r--r--ChangeLog4
-rw-r--r--dns/rdtypes/ANY/SSHFP.py11
2 files changed, 13 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 cec650a..4c43951 100644
--- a/dns/rdtypes/ANY/SSHFP.py
+++ b/dns/rdtypes/ANY/SSHFP.py
@@ -47,9 +47,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 = 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)
+ fingerprint = ''.join(chunks)
fingerprint = fingerprint.decode('hex_codec')
- tok.get_eol()
return cls(rdclass, rdtype, algorithm, fp_type, fingerprint)
from_text = classmethod(from_text)