While RFC 4255 doesn't say a whole lot about whether or not whitespace
is allowed within the hex string in the textual representation of SSHFP
RRs (the description of the format amounts to the words "presented
in hex"), some tools (notably bind's dnssec-signzone) do split up
long SSHFP RRs into multiple lines, and the result will fail to parse in
dnspython.
I propose the patch below to fix this. The code I inserted was
shamelessly duplicated from dns/rdtypes/sigbase.py.
Regards,
Jan
diff --git a/dns/rdtypes/ANY/SSHFP.py b/dns/rdtypes/ANY/SSHFP.py
index 162dda5..eafd261 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)
--
Jan Andres <[email protected]>
_______________________________________________
dnspython-dev mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-dev