summaryrefslogtreecommitdiff
path: root/dns/tsig.py
diff options
context:
space:
mode:
authorBrian Wellington <bwelling@xbill.org>2020-07-01 14:58:14 -0700
committerBrian Wellington <bwelling@xbill.org>2020-07-01 15:01:04 -0700
commit77e747da6bd5b9b7732d1a28ee0572bf9bcd827b (patch)
treedbb702bd8f07a2583c473d7e073b8a4eae9b2feb /dns/tsig.py
parent0703a8e6d132d4c988d5886233e49d3740c0e6a8 (diff)
downloaddnspython-77e747da6bd5b9b7732d1a28ee0572bf9bcd827b.tar.gz
Better deal with backwards compatibility.
If dns.tsigkeyring.from_text() creates dns.tsig.Key objects with the default algorithm, that causes problems for code that specifies a different algorithm. There's no good way to handle this, so change dns.tsigkeyring.from_text() to not create dns.tsig.Key objects unless it knows the algorithm.
Diffstat (limited to 'dns/tsig.py')
-rw-r--r--dns/tsig.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/dns/tsig.py b/dns/tsig.py
index 89183cf..08ab41e 100644
--- a/dns/tsig.py
+++ b/dns/tsig.py
@@ -209,6 +209,8 @@ class Key:
if isinstance(secret, str):
secret = base64.decodebytes(secret.encode())
self.secret = secret
+ if isinstance(algorithm, str):
+ algorithm = dns.name.from_text(algorithm)
self.algorithm = algorithm
def __eq__(self, other):