]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix nsec3_hash() when passed a dns.name.Name.
authorBrian Wellington <bwelling@xbill.org>
Mon, 11 May 2020 17:11:21 +0000 (10:11 -0700)
committerBrian Wellington <bwelling@xbill.org>
Mon, 11 May 2020 17:11:21 +0000 (10:11 -0700)
The documentation claims that it supports this, but the code was
incorrect.

dns/dnssec.py

index 0e3143d87e28a544df6c9b7f060c2885e9001df9..d241cce0e6b2c5291e9f22995940ee947aafdc94 100644 (file)
@@ -557,8 +557,8 @@ def nsec3_hash(domain, salt, iterations, algorithm):
             raise ValueError("Invalid salt length")
 
     if not isinstance(domain, dns.name.Name):
-        domain_encoded = dns.name.from_text(domain)
-    domain_encoded = domain_encoded.canonicalize().to_wire()
+        domain = dns.name.from_text(domain)
+    domain_encoded = domain.canonicalize().to_wire()
 
     digest = hashlib.sha1(domain_encoded + salt_encoded).digest()
     for i in range(iterations):