summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-11-02 16:16:39 +0000
committerNoel Power <npower@samba.org>2018-12-10 10:38:21 +0100
commit1fb9887ea87de11515029d65c7f78873c8396e95 (patch)
treefbeab954f97cee769b0f63ba7f9a889e5bf35371
parent351ca11b0645ed167b4df0433387d24a59bbe595 (diff)
downloadsamba-1fb9887ea87de11515029d65c7f78873c8396e95.tar.gz
python/samba: PY3 ord needs 'str' type not int
string_to_byte_array returns not a bytearray (as the name suggests) but a list of byte values (int). Some code expects the list so even using a 'real' bytearray wont work. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--python/samba/__init__.py2
-rw-r--r--python/samba/tests/auth_log_samlogon.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/python/samba/__init__.py b/python/samba/__init__.py
index 291ef541189..93240dddfbb 100644
--- a/python/samba/__init__.py
+++ b/python/samba/__init__.py
@@ -376,7 +376,7 @@ def string_to_byte_array(string):
blob = [0] * len(string)
for i in range(len(string)):
- blob[i] = ord(string[i])
+ blob[i] = string[i] if isinstance(string[i], int) else ord(string[i])
return blob
diff --git a/python/samba/tests/auth_log_samlogon.py b/python/samba/tests/auth_log_samlogon.py
index d3b14f3d69e..892ad516619 100644
--- a/python/samba/tests/auth_log_samlogon.py
+++ b/python/samba/tests/auth_log_samlogon.py
@@ -124,10 +124,10 @@ class AuthLogTestsSamLogon(samba.tests.auth_log_base.AuthLogTestBase):
logon_level = netlogon.NetlogonNetworkTransitiveInformation
logon = samba.dcerpc.netlogon.netr_NetworkInfo()
- logon.challenge = [ord(x) for x in challenge]
+ logon.challenge = [x if isinstance(x,int) else ord(x) for x in challenge]
logon.nt = netlogon.netr_ChallengeResponse()
logon.nt.length = len(response["nt_response"])
- logon.nt.data = [ord(x) for x in response["nt_response"]]
+ logon.nt.data = [x if isinstance(x,int) else ord(x) for x in response["nt_response"]]
logon.identity_info = samba.dcerpc.netlogon.netr_IdentityInfo()
(username, domain) = creds.get_ntlm_username_domain()