From 41eb1127fdc9b554e283246d994d65588078907b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 Nov 2005 23:23:02 +0000 Subject: r11963: add rpccli_samr_chgpasswd3 from samba4. Guenther (This used to be commit 0705fed566efdeab05d605dd239afe67ca5e9811) --- source3/rpc_parse/parse_samr.c | 168 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 167 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index ed6abc398b..b5aa2cd831 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7137,7 +7137,7 @@ BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh, } /******************************************************************* -inits a SAMR_R_GET_DOM_PWINFO structure. +inits a SAMR_Q_CHGPASSWD_USER structure. ********************************************************************/ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, @@ -7245,6 +7245,172 @@ BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u, return True; } +/******************************************************************* +inits a SAMR_Q_CHGPASSWD3 structure. +********************************************************************/ + +void init_samr_q_chgpasswd3(SAMR_Q_CHGPASSWD3 * q_u, + const char *dest_host, const char *user_name, + const uchar nt_newpass[516], + const uchar nt_oldhash[16], + const uchar lm_newpass[516], + const uchar lm_oldhash[16]) +{ + DEBUG(5, ("init_samr_q_chgpasswd3\n")); + + q_u->ptr_0 = 1; + init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE); + init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host); + + init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE); + init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name); + + init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass); + init_enc_hash(&q_u->nt_oldhash, nt_oldhash); + + q_u->lm_change = 0x01; + + init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass); + init_enc_hash(&q_u->lm_oldhash, lm_oldhash); + + init_enc_passwd(&q_u->password3, NULL); +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_q_chgpasswd3(const char *desc, SAMR_Q_CHGPASSWD3 * q_u, + prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_q_chgpasswd3"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0)) + return False; + + if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth)) + return False; + if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth)) + return False; + + if(!prs_align(ps)) + return False; + if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth)) + return False; + if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth)) + return False; + + if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth)) + return False; + if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth)) + return False; + + if(!prs_uint32("lm_change", ps, depth, &q_u->lm_change)) + return False; + + if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth)) + return False; + if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth)) + return False; + + if(!samr_io_enc_passwd("password3", &q_u->password3, ps, depth)) + return False; + + return True; +} + +/******************************************************************* +inits a SAMR_R_CHGPASSWD3 structure. +********************************************************************/ + +void init_samr_r_chgpasswd3(SAMR_R_CHGPASSWD3 * r_u, NTSTATUS status) +{ + DEBUG(5, ("init_r_chgpasswd3\n")); + + r_u->status = status; +} + +/******************************************************************* + Reads or writes an SAMR_CHANGE_REJECT structure. +********************************************************************/ + +BOOL samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_struct *ps, int depth) +{ + if (reject == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_change_reject"); + depth++; + + if(!prs_align(ps)) + return False; + + if(UNMARSHALLING(ps)) + ZERO_STRUCTP(reject); + + if (!prs_uint32("reject_reason", ps, depth, &reject->reject_reason)) + return False; + + if (!prs_uint32("unknown1", ps, depth, &reject->unknown1)) + return False; + + if (!prs_uint32("unknown2", ps, depth, &reject->unknown2)) + return False; + + return True; +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ + +BOOL samr_io_r_chgpasswd3(const char *desc, SAMR_R_CHGPASSWD3 * r_u, + prs_struct *ps, int depth) +{ + uint32 ptr_info, ptr_reject; + + if (r_u == NULL) + return False; + + prs_debug(ps, depth, desc, "samr_io_r_chgpasswd3"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_info", ps, depth, &ptr_info)) + return False; + + if (ptr_info) { + + /* SAM_UNK_INFO_1 */ + if(!sam_io_unk_info1("info", &r_u->info, ps, depth)) + return False; + } + + if(!prs_uint32("ptr_reject", ps, depth, &ptr_reject)) + return False; + + if (ptr_reject) { + + /* SAMR_CHANGE_REJECT */ + if(!samr_io_change_reject("reject", &r_u->reject, ps, depth)) + return False; + } + + if(!prs_ntstatus("status", ps, depth, &r_u->status)) + return False; + + return True; +} + /******************************************************************* reads or writes a structure. ********************************************************************/ -- cgit