]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_client: Use encode_rc4_passwd_buffer() in init_samr_CryptPasswordEx()
authorAndreas Schneider <asn@samba.org>
Wed, 24 Jul 2019 09:44:51 +0000 (11:44 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 26 Jul 2019 01:48:23 +0000 (01:48 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_client/init_samr.c

index 0eb50c545257a51be3645e21c9e14b7d6402135e..a98d50e3f6a714de24516463546958a160e73ebe 100644 (file)
@@ -33,38 +33,7 @@ NTSTATUS init_samr_CryptPasswordEx(const char *pwd,
                                   DATA_BLOB *session_key,
                                   struct samr_CryptPasswordEx *pwd_buf)
 {
-       /* samr_CryptPasswordEx */
-
-       uint8_t _confounder[16] = {0};
-       DATA_BLOB confounder = data_blob_const(_confounder, 16);
-       uint8_t pwbuf[532] = {0};
-       DATA_BLOB encrypt_pwbuf = data_blob_const(pwbuf, 516);
-       bool ok;
-       int rc;
-
-       ok = encode_pw_buffer(pwbuf, pwd, STR_UNICODE);
-       if (!ok) {
-               return NT_STATUS_INTERNAL_ERROR;
-       }
-
-       generate_random_buffer(_confounder, sizeof(_confounder));
-
-       rc = samba_gnutls_arcfour_confounded_md5(&confounder,
-                                                session_key,
-                                                &encrypt_pwbuf,
-                                                SAMBA_GNUTLS_ENCRYPT);
-       if (rc < 0) {
-               ZERO_ARRAY(_confounder);
-               return gnutls_error_to_ntstatus(rc, NT_STATUS_ACCESS_DISABLED_BY_POLICY_OTHER);
-       }
-
-       memcpy(&pwbuf[516], confounder.data, confounder.length);
-       ZERO_ARRAY(_confounder);
-
-       memcpy(pwd_buf->data, pwbuf, sizeof(pwbuf));
-       ZERO_ARRAY(pwbuf);
-
-       return NT_STATUS_OK;
+       return encode_rc4_passwd_buffer(pwd, session_key, pwd_buf);
 }
 
 /*************************************************************************