From: Douglas Bagnall Date: Tue, 11 Jun 2024 23:21:09 +0000 (+1200) Subject: python:lsa_utils: avoid useless use of py2-compat string_to_byte_array X-Git-Tag: tdb-1.4.11~373 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8fb9f19bca909fe4d29378f255bad33ccb1d778;p=thirdparty%2Fsamba.git python:lsa_utils: avoid useless use of py2-compat string_to_byte_array `pw.encode('utf-16-le')` is always bytes. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/lsa_utils.py b/python/samba/lsa_utils.py index a56675d6b63..043e65f3341 100644 --- a/python/samba/lsa_utils.py +++ b/python/samba/lsa_utils.py @@ -22,7 +22,6 @@ from samba import ( NTSTATUSError, aead_aes_256_cbc_hmac_sha512, arcfour_encrypt, - string_to_byte_array ) from samba.ntstatus import ( NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE @@ -81,7 +80,7 @@ def CreateTrustedDomainRelax( ): def generate_AuthInfoInternal(session_key, incoming=None, outgoing=None): - confounder = string_to_byte_array(token_bytes(512)) + confounder = list(token_bytes(512)) trustpass = drsblobs.trustDomainPasswords() @@ -95,7 +94,7 @@ def CreateTrustedDomainRelax( auth_blob = lsa.DATA_BUF2() auth_blob.size = len(encrypted_trustpass) - auth_blob.data = string_to_byte_array(encrypted_trustpass) + auth_blob.data = list(encrypted_trustpass) auth_info = lsa.TrustDomainInfoAuthInfoInternal() auth_info.auth_blob = auth_blob @@ -169,12 +168,12 @@ def CreateTrustedDomainFallback( auth_blob = lsa.DATA_BUF2() auth_blob.size = len(ciphertext) - auth_blob.data = string_to_byte_array(ciphertext) + auth_blob.data = list(ciphertext) auth_info = lsa.TrustDomainInfoAuthInfoInternalAES() auth_info.cipher = auth_blob - auth_info.salt = string_to_byte_array(iv) - auth_info.auth_data = string_to_byte_array(auth_data) + auth_info.salt = list(iv) + auth_info.auth_data = list(auth_data) return conn.CreateTrustedDomainEx3( policy_handle,