]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/auth: make use of netlogon_creds_encrypt_samr_CryptPassword
authorStefan Metzmacher <metze@samba.org>
Mon, 28 Oct 2024 14:56:09 +0000 (15:56 +0100)
committerJule Anger <janger@samba.org>
Wed, 13 Nov 2024 10:39:12 +0000 (10:39 +0000)
This will help when implementing netr_ServerAuthenticateKerberos()...

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 285ec9ecde712e40e6f0981bcb379ee911bfe9d8)

libcli/auth/netlogon_creds_cli.c

index 78aa9bf8b7598b532f2caf428a5a7657a670cd8c..017f30601396b8a93eb18b18c22fa188e27b5dfa 100644 (file)
@@ -2346,22 +2346,13 @@ static void netlogon_creds_cli_ServerPasswordSet_locked(struct tevent_req *subre
 
        if (state->tmp_creds.negotiate_flags & NETLOGON_NEG_PASSWORD_SET2) {
 
-               if (state->tmp_creds.negotiate_flags & NETLOGON_NEG_SUPPORTS_AES) {
-                       status = netlogon_creds_aes_encrypt(&state->tmp_creds,
-                                                           state->samr_crypt_password.data,
-                                                           516);
-                       if (tevent_req_nterror(req, status)) {
-                               netlogon_creds_cli_ServerPasswordSet_cleanup(req, status);
-                               return;
-                       }
-               } else {
-                       status = netlogon_creds_arcfour_crypt(&state->tmp_creds,
-                                                             state->samr_crypt_password.data,
-                                                             516);
-                       if (tevent_req_nterror(req, status)) {
-                               netlogon_creds_cli_ServerPasswordSet_cleanup(req, status);
-                               return;
-                       }
+               status = netlogon_creds_encrypt_samr_CryptPassword(&state->tmp_creds,
+                                                                  &state->samr_crypt_password,
+                                                                  state->auth_type,
+                                                                  state->auth_level);
+               if (tevent_req_nterror(req, status)) {
+                       netlogon_creds_cli_ServerPasswordSet_cleanup(req, status);
+                       return;
                }
 
                memcpy(state->netr_crypt_password.data,