From 3de564b9b6559690578ca649f8acf52d82bc592e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 12 Jan 2011 08:46:28 +0100 Subject: s3-rpc_client: Added dcerpc_samr_chgpasswd_user2. --- source3/rpc_client/cli_samr.c | 47 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'source3/rpc_client/cli_samr.c') diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 03acafe515..236981a2f1 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -107,27 +107,29 @@ NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli, /* User change password */ -NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli, +NTSTATUS dcerpc_samr_chgpasswd_user2(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, + const char *srv_name_slash, const char *username, const char *newpassword, - const char *oldpassword) + const char *oldpassword, + NTSTATUS *presult) { - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + NTSTATUS status; struct samr_CryptPassword new_nt_password; struct samr_CryptPassword new_lm_password; struct samr_Password old_nt_hash_enc; struct samr_Password old_lanman_hash_enc; - uchar old_nt_hash[16]; - uchar old_lanman_hash[16]; - uchar new_nt_hash[16]; - uchar new_lanman_hash[16]; + uint8_t old_nt_hash[16]; + uint8_t old_lanman_hash[16]; + uint8_t new_nt_hash[16]; + uint8_t new_lanman_hash[16]; struct lsa_String server, account; DEBUG(10,("rpccli_samr_chgpasswd_user2\n")); - init_lsa_String(&server, cli->srv_name_slash); + init_lsa_String(&server, srv_name_slash); init_lsa_String(&account, username); /* Calculate the MD4 hash (NT compatible) of the password */ @@ -156,14 +158,39 @@ NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli, arcfour_crypt(new_nt_password.data, old_nt_hash, 516); E_old_pw_hash(new_nt_hash, old_nt_hash, old_nt_hash_enc.hash); - result = rpccli_samr_ChangePasswordUser2(cli, mem_ctx, + status = dcerpc_samr_ChangePasswordUser2(h, + mem_ctx, &server, &account, &new_nt_password, &old_nt_hash_enc, true, &new_lm_password, - &old_lanman_hash_enc); + &old_lanman_hash_enc, + presult); + + return status; +} + +NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *username, + const char *newpassword, + const char *oldpassword) +{ + NTSTATUS status; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + + status = dcerpc_samr_chgpasswd_user2(cli->binding_handle, + mem_ctx, + cli->srv_name_slash, + username, + newpassword, + oldpassword, + &result); + if (!NT_STATUS_IS_OK(status)) { + return status; + } return result; } -- cgit