]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix nsec3_hash() with salt==None.
authorBrian Wellington <bwelling@xbill.org>
Mon, 11 May 2020 16:59:08 +0000 (09:59 -0700)
committerBrian Wellington <bwelling@xbill.org>
Mon, 11 May 2020 17:00:48 +0000 (10:00 -0700)
The documentation claims that it supports salt==None, but it caused a
TypeError.

dns/dnssec.py

index bf5ce1e8556d8dbc6fa4342137b9293e42e2ea25..0e3143d87e28a544df6c9b7f060c2885e9001df9 100644 (file)
@@ -548,7 +548,9 @@ def nsec3_hash(domain, salt, iterations, algorithm):
         raise ValueError("Wrong hash algorithm (only SHA1 is supported)")
 
     salt_encoded = salt
-    if isinstance(salt, str):
+    if salt is None:
+        salt_encoded = b''
+    elif isinstance(salt, str):
         if len(salt) % 2 == 0:
             salt_encoded = bytes.fromhex(salt)
         else: