1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

python/tests: use encrypt_netr_PasswordInfo in KDCBaseTest._test_samlogon()

This will make it easier to implement netr_ServerAuthenticateKerberos()
later...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15425

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit e7d57fc6e9)
This commit is contained in:
Stefan Metzmacher 2024-10-28 15:39:57 +01:00 committed by Jule Anger
parent 254440c71a
commit 10da7c803b

View File

@ -51,6 +51,7 @@ from samba.credentials import (
from samba.crypto import des_crypt_blob_16, md4_hash_blob
from samba.dcerpc import (
claims,
dcerpc,
drsblobs,
drsuapi,
krb5ccache,
@ -3685,10 +3686,12 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest):
workstation = domain_joined_mach_creds.get_username()
# Calling this initializes netlogon_creds on mach_creds, as is required
# before calling mach_creds.encrypt_samr_password().
# before calling mach_creds.encrypt_netr_PasswordInfo().
conn = netlogon.netlogon(f'ncacn_ip_tcp:{dc_server}[schannel,seal]',
self.get_lp(),
domain_joined_mach_creds)
auth_type = dcerpc.DCERPC_AUTH_TYPE_SCHANNEL
auth_level = dcerpc.DCERPC_AUTH_LEVEL_PRIVACY
if logon_type == netlogon.NetlogonInteractiveInformation:
logon = netlogon.netr_PasswordInfo()
@ -3698,11 +3701,14 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest):
nt_pass = samr.Password()
nt_pass.hash = list(creds.get_nt_hash())
domain_joined_mach_creds.encrypt_samr_password(nt_pass)
logon.lmpassword = lm_pass
logon.ntpassword = nt_pass
domain_joined_mach_creds.encrypt_netr_PasswordInfo(info=logon,
auth_type=auth_type,
auth_level=auth_level)
elif logon_type == netlogon.NetlogonNetworkInformation:
computername = ntlmssp.AV_PAIR()
computername.AvId = ntlmssp.MsvAvNbComputerName