]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:rpc_server/netlogon: make use of netlogon_creds_decrypt_samr_CryptPassword
authorStefan Metzmacher <metze@samba.org>
Mon, 28 Oct 2024 15:30:19 +0000 (16:30 +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 f1c1b8661a9121e1ff02784955c98d9f33bca8bd)

source4/rpc_server/netlogon/dcerpc_netlogon.c

index fa859e1125ef9804b68c5d0f9ffcfe0902c5e357..2597ee90eab9b77f12bf6b11865e14b0166273b0 100644 (file)
@@ -1063,6 +1063,10 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
        DATA_BLOB dec_blob = data_blob_null;
        DATA_BLOB enc_blob = data_blob_null;
        struct samr_CryptPassword password_buf;
+       enum dcerpc_AuthType auth_type = DCERPC_AUTH_TYPE_NONE;
+       enum dcerpc_AuthLevel auth_level = DCERPC_AUTH_LEVEL_NONE;
+
+       dcesrv_call_auth_info(dce_call, &auth_type, &auth_level);
 
        nt_status = dcesrv_netr_creds_server_step_check(dce_call,
                                                        mem_ctx,
@@ -1080,16 +1084,10 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
        memcpy(password_buf.data, r->in.new_password->data, 512);
        SIVAL(password_buf.data, 512, r->in.new_password->length);
 
-       if (creds->negotiate_flags & NETLOGON_NEG_SUPPORTS_AES) {
-               nt_status = netlogon_creds_aes_decrypt(creds,
-                                                      password_buf.data,
-                                                      516);
-       } else {
-               nt_status = netlogon_creds_arcfour_crypt(creds,
-                                                        password_buf.data,
-                                                        516);
-       }
-
+       nt_status = netlogon_creds_decrypt_samr_CryptPassword(creds,
+                                                             &password_buf,
+                                                             auth_type,
+                                                             auth_level);
        if (!NT_STATUS_IS_OK(nt_status)) {
                return nt_status;
        }