]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python/tests: use encrypt_netr_PasswordInfo in KDCBaseTest._test_samlogon()
authorStefan Metzmacher <metze@samba.org>
Mon, 28 Oct 2024 14:39:57 +0000 (15:39 +0100)
committerJule Anger <janger@samba.org>
Wed, 13 Nov 2024 10:39:12 +0000 (10:39 +0000)
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 e7d57fc6e992ca212b834d5dd4d381244bca55c6)

python/samba/tests/krb5/kdc_base_test.py

index d983c631a468e25c300636d525a0d0246def8e38..5efdb2e9eb60d54c203afffd4a102afaecffaf93 100644 (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