********************************************************************/
void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist,
- uint32 flag, NTTIME nt_expire, NTTIME nt_min_age)
+ uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age)
{
u_1->min_length_password = min_pass_len;
u_1->password_history = pass_hist;
- u_1->flag = flag;
+ u_1->password_properties = password_properties;
/* password never expire */
u_1->expire.high = nt_expire.high;
return False;
if(!prs_uint16("password_history", ps, depth, &u_1->password_history))
return False;
- if(!prs_uint32("flag", ps, depth, &u_1->flag))
+ if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties))
return False;
if(!smb_io_time("expire", &u_1->expire, ps, depth))
return False;
********************************************************************/
void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u,
- POLICY_HND *hnd, uint16 switch_value)
+ const POLICY_HND *hnd, uint16 switch_value)
{
DEBUG(5, ("init_samr_q_query_userinfo\n"));
return True;
}
+/*******************************************************************
+inits a SAM_USER_INFO_9 structure.
+********************************************************************/
+
+void init_sam_user_info9(SAM_USER_INFO_9 * usr, uint32 rid_group)
+{
+ DEBUG(5, ("init_sam_user_info9\n"));
+
+ usr->rid_group = rid_group;
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+
+static BOOL sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr,
+ prs_struct *ps, int depth)
+{
+ if (usr == NULL)
+ return False;
+
+ prs_debug(ps, depth, desc, "samr_io_r_user_info9");
+ depth++;
+
+ if(!prs_align(ps))
+ return False;
+
+ if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
+ return False;
+
+ return True;
+}
+
/*******************************************************************
inits a SAM_USER_INFO_16 structure.
********************************************************************/
}
ret = sam_io_user_info7("", ctr->info.id7, ps, depth);
break;
+ case 9:
+ if (UNMARSHALLING(ps))
+ ctr->info.id9 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_9,1);
+ if (ctr->info.id9 == NULL) {
+ DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
+ return False;
+ }
+ ret = sam_io_user_info9("", ctr->info.id9, ps, depth);
+ break;
case 16:
if (UNMARSHALLING(ps))
ctr->info.id16 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_16,1);
********************************************************************/
void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u,
- POLICY_HND *hnd, DATA_BLOB *sess_key,
+ const POLICY_HND *hnd, DATA_BLOB *sess_key,
uint16 switch_value, void *info)
{
DEBUG(5, ("init_samr_q_set_userinfo\n"));
********************************************************************/
void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
- POLICY_HND *hnd, DATA_BLOB *sess_key,
+ const POLICY_HND *hnd, DATA_BLOB *sess_key,
uint16 switch_value, SAM_USERINFO_CTR * ctr)
{
DEBUG(5, ("init_samr_q_set_userinfo2\n"));
}
/*******************************************************************
-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,
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.
********************************************************************/
if(!prs_align(ps))
return False;
- if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL)
- return False;
+ if (UNMARSHALLING(ps)) {
+ if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL)
+ return False;
+ }
switch (q_u->switch_value) {