From: Bob Halley Date: Thu, 18 Jun 2009 13:43:59 +0000 (+0100) Subject: Add BADTRUNC X-Git-Tag: v1.7.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e76a057221024b9d0b27524e4d82900409ff9445;p=thirdparty%2Fdnspython.git Add BADTRUNC --- diff --git a/ChangeLog b/ChangeLog index 5a3b41e1..d4eaffa2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-06-18 Bob Halley + + * dns/tsig.py: Added support for BADTRUNC result code. + 2009-06-18 Bob Halley * dns/query.py (udp): When checking that addresses are the same, diff --git a/dns/tsig.py b/dns/tsig.py index ce346b85..3f579d10 100644 --- a/dns/tsig.py +++ b/dns/tsig.py @@ -46,11 +46,16 @@ class PeerBadTime(PeerError): """Raised if the peer didn't like the time we sent""" pass +class PeerBadTruncation(PeerError): + """Raised if the peer didn't like amount of truncation in the TSIG we sent""" + pass + _alg_name = dns.name.from_text('HMAC-MD5.SIG-ALG.REG.INT.').to_digestable() BADSIG = 16 BADKEY = 17 BADTIME = 18 +BADTRUNC = 22 def hmac_md5(wire, keyname, secret, time, fudge, original_id, error, other_data, request_mac, ctx=None, multi=False, first=True): @@ -138,6 +143,8 @@ def validate(wire, keyname, secret, now, request_mac, tsig_start, tsig_rdata, raise PeerBadKey elif error == BADTIME: raise PeerBadTime + elif error == BADTRUNC: + raise PeerBadTruncation else: raise PeerError, 'unknown TSIG error code %d' % error time_low = time - fudge