From 78c1fd054f25ae2d0fa57669a0db102bc916577c Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 23:31:50 +0000 Subject: dce/rpc (This used to be commit 8a7ac4a25d177235a98c0f84f97ee50432fb6359) --- source3/rpc_client/cli_samr.c | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 1428178c26..9fe4c0a16a 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -97,6 +97,63 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, return do_samr_close(cli, &pol_open_user); } +/**************************************************************************** +do a SAMR change user password command +****************************************************************************/ +BOOL do_samr_chgpasswd_user(struct cli_state *cli, + char *srv_name, char *user_name, + char nt_newpass[516], char nt_oldhash[16], + char lm_newpass[516], char lm_oldhash[16]) +{ + prs_struct data; + prs_struct rdata; + + SAMR_Q_CHGPASSWD_USER q_e; + BOOL valid_pwc = False; + + /* create and send a MSRPC command with api SAMR_CHGPASSWD_USER */ + + prs_init(&data , 1024, 4, SAFETY_MARGIN, False); + prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True ); + + DEBUG(4,("SAMR Change User Password. server:%s username:%s\n", + srv_name, user_name)); + + make_samr_q_chgpasswd_user(&q_e, srv_name, user_name, + nt_newpass, nt_oldhash, + lm_newpass, lm_oldhash); + + /* turn parameters into data stream */ + samr_io_q_chgpasswd_user("", &q_e, &data, 0); + + /* send the data on \PIPE\ */ + if (rpc_api_pipe_req(cli, SAMR_CHGPASSWD_USER, &data, &rdata)) + { + SAMR_R_CHGPASSWD_USER r_e; + BOOL p; + + samr_io_r_chgpasswd_user("", &r_e, &rdata, 0); + + p = rdata.offset != 0; + if (p && r_e.status != 0) + { + /* report error code */ + DEBUG(0,("SAMR_R_CHGPASSWD_USER: %s\n", get_nt_error_msg(r_e.status))); + p = False; + } + + if (p) + { + valid_pwc = True; + } + } + + prs_mem_free(&data ); + prs_mem_free(&rdata ); + + return valid_pwc; +} + /**************************************************************************** do a SAMR unknown 0x38 command ****************************************************************************/ -- cgit