summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-07-18 20:43:14 +0200
committerGünther Deschner <gd@samba.org>2008-07-30 16:43:05 +0200
commit3076cc4257d2673d4ecc2734682d45d1736fd462 (patch)
tree06c3824d57044e8fb27d787bab7b0c6bb3a2c1f1
parent21a8177ed21ad4400fbc00443bdf6a2dad44fc59 (diff)
downloadsamba-3076cc4257d2673d4ecc2734682d45d1736fd462.tar.gz
samba-3076cc4257d2673d4ecc2734682d45d1736fd462.tar.bz2
samba-3076cc4257d2673d4ecc2734682d45d1736fd462.zip
netapi: use init_samr_CryptPasswordEx and init_samr_CryptPassword.
Guenther (This used to be commit 97106199f1a2add886a14523aa7b402667d2cd89)
-rw-r--r--source3/lib/netapi/user.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c
index fe30b14d77..e36274bfad 100644
--- a/source3/lib/netapi/user.c
+++ b/source3/lib/netapi/user.c
@@ -292,29 +292,12 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
if (uX.usriX_password) {
- uchar pwbuf[532];
- struct MD5Context md5_ctx;
- uint8_t confounder[16];
- DATA_BLOB confounded_session_key = data_blob(NULL, 16);
-
- encode_pw_buffer(pwbuf, uX.usriX_password, STR_UNICODE);
-
- generate_random_buffer((uint8_t *)confounder, 16);
-
- MD5Init(&md5_ctx);
- MD5Update(&md5_ctx, confounder, 16);
- MD5Update(&md5_ctx, cli->user_session_key.data,
- cli->user_session_key.length);
- MD5Final(confounded_session_key.data, &md5_ctx);
-
- SamOEMhashBlob(pwbuf, 516, &confounded_session_key);
- memcpy(&pwbuf[516], confounder, 16);
-
- memcpy(user_info->info25.password.data, pwbuf, sizeof(pwbuf));
- data_blob_free(&confounded_session_key);
-
user_info->info25.info = info21;
+ init_samr_CryptPasswordEx(uX.usriX_password,
+ &cli->user_session_key,
+ &user_info->info25.password);
+
status = rpccli_samr_SetUserInfo2(pipe_cli, ctx,
&user_handle,
25,
@@ -324,10 +307,9 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
user_info->info23.info = info21;
- encode_pw_buffer(user_info->info23.password.data,
- uX.usriX_password, STR_UNICODE);
- SamOEMhashBlob(user_info->info23.password.data, 516,
- &cli->user_session_key);
+ init_samr_CryptPassword(uX.usriX_password,
+ &cli->user_session_key,
+ &user_info->info23.password);
status = rpccli_samr_SetUserInfo2(pipe_cli, ctx,
&user_handle,
@@ -335,7 +317,9 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
user_info);
}
} else {
+
user_info->info21 = info21;
+
status = rpccli_samr_SetUserInfo(pipe_cli, ctx,
&user_handle,
21,