61 lines
1.8 KiB
Diff
61 lines
1.8 KiB
Diff
From 26b7ab9339d9e6530244bf35e38a3658d7fc8aa9 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@samba.org>
|
|
Date: Wed, 24 Jul 2019 11:44:51 +0200
|
|
Subject: [PATCH 019/187] s3:rpc_client: Use encode_rc4_passwd_buffer() in
|
|
init_samr_CryptPasswordEx()
|
|
|
|
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
|
|
(cherry picked from commit f0c0cf299eb99e7b78be2f04141b6d415bf525e2)
|
|
---
|
|
source3/rpc_client/init_samr.c | 33 +--------------------------------
|
|
1 file changed, 1 insertion(+), 32 deletions(-)
|
|
|
|
diff --git a/source3/rpc_client/init_samr.c b/source3/rpc_client/init_samr.c
|
|
index 0eb50c54525..a98d50e3f6a 100644
|
|
--- a/source3/rpc_client/init_samr.c
|
|
+++ b/source3/rpc_client/init_samr.c
|
|
@@ -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);
|
|
}
|
|
|
|
/*************************************************************************
|
|
--
|
|
2.23.0
|
|
|