added python-dns-1.16-base64.patch
This commit is contained in:
parent
f75030bc11
commit
d6535f2042
60
python-dns-1.16-base64.patch
Normal file
60
python-dns-1.16-base64.patch
Normal file
@ -0,0 +1,60 @@
|
||||
diff -Naur dnspython-1.16.0-orig/dns/tsigkeyring.py dnspython-1.16.0/dns/tsigkeyring.py
|
||||
--- dnspython-1.16.0-orig/dns/tsigkeyring.py 2018-12-01 10:25:27.000000000 -0500
|
||||
+++ dnspython-1.16.0/dns/tsigkeyring.py 2020-04-15 15:25:22.026211793 -0400
|
||||
@@ -32,7 +32,7 @@
|
||||
keyring = {}
|
||||
for keytext in textring:
|
||||
keyname = dns.name.from_text(keytext)
|
||||
- secret = base64.decodestring(maybe_encode(textring[keytext]))
|
||||
+ secret = base64.decodebytes(textring[keytext].encode())
|
||||
keyring[keyname] = secret
|
||||
return keyring
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
|
||||
textring = {}
|
||||
for keyname in keyring:
|
||||
- keytext = maybe_decode(keyname.to_text())
|
||||
- secret = maybe_decode(base64.encodestring(keyring[keyname]))
|
||||
+ keytext = keyname.to_text()
|
||||
+ # rstrip to get rid of the \n encoding adds
|
||||
+ secret = base64.encodebytes(keyring[keyname]).decode().rstrip()
|
||||
textring[keytext] = secret
|
||||
return textring
|
||||
diff -Naur dnspython-1.16.0-orig/tests/test_tsigkeyring.py dnspython-1.16.0/tests/test_tsigkeyring.py
|
||||
--- dnspython-1.16.0-orig/tests/test_tsigkeyring.py 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ dnspython-1.16.0/tests/test_tsigkeyring.py 2020-04-15 15:26:16.884138201 -0400
|
||||
@@ -0,0 +1,33 @@
|
||||
+# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
|
||||
+
|
||||
+import base64
|
||||
+import unittest
|
||||
+
|
||||
+import dns.tsigkeyring
|
||||
+
|
||||
+text_keyring = {
|
||||
+ 'keyname.' : 'NjHwPsMKjdN++dOfE5iAiQ=='
|
||||
+}
|
||||
+
|
||||
+rich_keyring = {
|
||||
+ dns.name.from_text('keyname.') : \
|
||||
+ base64.decodebytes('NjHwPsMKjdN++dOfE5iAiQ=='.encode())
|
||||
+}
|
||||
+
|
||||
+class TSIGKeyRingTestCase(unittest.TestCase):
|
||||
+
|
||||
+ def test_from_text(self):
|
||||
+ """text keyring -> rich keyring"""
|
||||
+ rkeyring = dns.tsigkeyring.from_text(text_keyring)
|
||||
+ self.assertEqual(rkeyring, rich_keyring)
|
||||
+
|
||||
+ def test_to_text(self):
|
||||
+ """text keyring -> rich keyring -> text keyring"""
|
||||
+ tkeyring = dns.tsigkeyring.to_text(rich_keyring)
|
||||
+ self.assertEqual(tkeyring, text_keyring)
|
||||
+
|
||||
+ def test_from_and_to_text(self):
|
||||
+ """text keyring -> rich keyring -> text keyring"""
|
||||
+ rkeyring = dns.tsigkeyring.from_text(text_keyring)
|
||||
+ tkeyring = dns.tsigkeyring.to_text(rkeyring)
|
||||
+ self.assertEqual(tkeyring, text_keyring)
|
Loading…
Reference in New Issue
Block a user