summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@nominum.com>2009-06-18 14:43:59 +0100
committerBob Halley <halley@nominum.com>2009-06-18 14:43:59 +0100
commite76a057221024b9d0b27524e4d82900409ff9445 (patch)
treec078fffaf3f5122961f2dd5e20468ad74f43edd3
parenta7b4f346dabaa410d5a2932869beffda19954d39 (diff)
downloaddnspython-e76a057221024b9d0b27524e4d82900409ff9445.tar.gz
Add BADTRUNC
-rw-r--r--ChangeLog4
-rw-r--r--dns/tsig.py7
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a3b41e..d4eaffa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-06-18 Bob Halley <halley@dnspython.org>
+ * dns/tsig.py: Added support for BADTRUNC result code.
+
+2009-06-18 Bob Halley <halley@dnspython.org>
+
* dns/query.py (udp): When checking that addresses are the same,
use the binary form of the address in the comparison. This
ensures that we don't treat addresses as different if they have
diff --git a/dns/tsig.py b/dns/tsig.py
index ce346b8..3f579d1 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