Skip to content

Commit

Permalink
allow whitespace in SSHFP fingerprints
Browse files Browse the repository at this point in the history
  • Loading branch information
rthalley committed Apr 7, 2012
1 parent 84fd737 commit c411ec8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 9 additions & 2 deletions dns/rdtypes/ANY/SSHFP.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ def to_text(self, origin=None, relativize=True, **kw):
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)
Expand Down

0 comments on commit c411ec8

Please sign in to comment.