From: Bob Halley Date: Wed, 1 Jun 2016 13:48:56 +0000 (-0700) Subject: Convert TSIG other data into a binary type if needed. X-Git-Tag: v1.15.0~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=898b626b451f05869c6980f3d8b617a962740f27;p=thirdparty%2Fdnspython.git Convert TSIG other data into a binary type if needed. --- diff --git a/dns/tsig.py b/dns/tsig.py index 92ce8603..38fe31eb 100644 --- a/dns/tsig.py +++ b/dns/tsig.py @@ -23,7 +23,7 @@ import dns.exception import dns.hash import dns.rdataclass import dns.name -from ._compat import long, string_types +from ._compat import long, string_types, text_type class BadTime(dns.exception.DNSException): @@ -96,6 +96,8 @@ def sign(wire, keyname, secret, time, fudge, original_id, error, @raises NotImplementedError: I{algorithm} is not supported """ + if isinstance(other_data, text_type): + other_data = other_data.encode() (algorithm_name, digestmod) = get_algorithm(algorithm) if first: ctx = hmac.new(secret, digestmod=digestmod)