]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
allow whitespace in SSHFP fingerprints
authorBob Halley <halley@nominum.com>
Sat, 7 Apr 2012 21:09:05 +0000 (22:09 +0100)
committerBob Halley <halley@nominum.com>
Sat, 7 Apr 2012 21:09:05 +0000 (22:09 +0100)
ChangeLog
dns/rdtypes/ANY/SSHFP.py

index accd9b19db0e30883fdce6ee0a1240125e309515..46064a5f925a0c8ba345bc81a108f560822b5f17 100644 (file)
--- 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
index ab8705425fe13aa48c836749b1a18f30821379ba..b7ee254436999e00c93d636788ce29b310dc54ea 100644 (file)
@@ -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)