summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-07-30 19:52:56 +0200
committerGünther Deschner <gd@samba.org>2008-07-31 13:52:33 +0200
commit9294303943c1f28df4afeef729689331d53cc242 (patch)
tree80528ee17f2ae372a93d63065c2562b5cd4885ea /source3/utils/net_rpc.c
parentd701d23b604dd21288e894b7d286de206eca2857 (diff)
downloadsamba-9294303943c1f28df4afeef729689331d53cc242.tar.gz
samba-9294303943c1f28df4afeef729689331d53cc242.tar.bz2
samba-9294303943c1f28df4afeef729689331d53cc242.zip
rpc_client: use init_samr_CryptPassword(Ex) in client tools.
Guenther (This used to be commit 97f7f9f21f17e8414de15953cf4eaa9959dc6f75)
Diffstat (limited to 'source3/utils/net_rpc.c')
-rw-r--r--source3/utils/net_rpc.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index f6b6d3a095..a3fdb69bd8 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -849,11 +849,11 @@ static NTSTATUS rpc_user_password_internals(struct net_context *c,
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
POLICY_HND connect_pol, domain_pol, user_pol;
- uchar pwbuf[516];
const char *user;
const char *new_password;
char *prompt = NULL;
union samr_UserInfo info;
+ struct samr_CryptPassword crypt_pwd;
if (argc < 1 || c->display_usage) {
rpc_user_usage(c, argc, argv);
@@ -922,12 +922,11 @@ static NTSTATUS rpc_user_password_internals(struct net_context *c,
/* Set password on account */
- encode_pw_buffer(pwbuf, new_password, STR_UNICODE);
+ init_samr_CryptPassword(new_password,
+ &cli->user_session_key,
+ &crypt_pwd);
- init_samr_user_info24(&info.info24, pwbuf, 24);
-
- SamOEMhashBlob(info.info24.password.data, 516,
- &cli->user_session_key);
+ init_samr_user_info24(&info.info24, crypt_pwd.data, 24);
result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
&user_pol,
@@ -5731,9 +5730,7 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
struct samr_LogonHours hours;
struct lsa_BinaryString parameters;
const int units_per_week = 168;
- uchar pwbuf[516];
-
- encode_pw_buffer(pwbuf, argv[1], STR_UNICODE);
+ struct samr_CryptPassword crypt_pwd;
ZERO_STRUCT(notime);
ZERO_STRUCT(hours);
@@ -5747,6 +5744,10 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
hours.units_per_week = units_per_week;
memset(hours.bits, 0xFF, units_per_week);
+ init_samr_CryptPassword(argv[1],
+ &cli->user_session_key,
+ &crypt_pwd);
+
init_samr_user_info23(&info.info23,
notime, notime, notime,
notime, notime, notime,
@@ -5755,10 +5756,7 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
0, 0, ACB_DOMTRUST, SAMR_FIELD_ACCT_FLAGS,
hours,
0, 0, 0, 0, 0, 0, 0,
- pwbuf, 24);
-
- SamOEMhashBlob(info.info23.password.data, 516,
- &cli->user_session_key);
+ crypt_pwd.data, 24);
result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
&user_pol,