2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2000,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6 * Copyright (C) Paul Ashton 1997-2000,
7 * Copyright (C) Elrond 2000,
8 * Copyright (C) Jeremy Allison 2001,
9 * Copyright (C) Jean François Micouleau 1998-2001,
10 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #define DBGC_CLASS DBGC_RPC_PARSE
32 /*******************************************************************
33 inits a SAMR_Q_CLOSE_HND structure.
34 ********************************************************************/
36 void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd)
38 DEBUG(5, ("init_samr_q_close_hnd\n"));
43 /*******************************************************************
44 reads or writes a structure.
45 ********************************************************************/
47 BOOL samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u,
48 prs_struct *ps, int depth)
53 prs_debug(ps, depth, desc, "samr_io_q_close_hnd");
59 return smb_io_pol_hnd("pol", &q_u->pol, ps, depth);
62 /*******************************************************************
63 reads or writes a structure.
64 ********************************************************************/
66 BOOL samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u,
67 prs_struct *ps, int depth)
72 prs_debug(ps, depth, desc, "samr_io_r_close_hnd");
78 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
81 if(!prs_ntstatus("status", ps, depth, &r_u->status))
87 /*******************************************************************
88 inits a SAMR_Q_LOOKUP_DOMAIN structure.
89 ********************************************************************/
91 void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u,
92 POLICY_HND *pol, char *dom_name)
94 DEBUG(5, ("init_samr_q_lookup_domain\n"));
96 q_u->connect_pol = *pol;
98 init_unistr2(&q_u->uni_domain, dom_name, UNI_FLAGS_NONE);
99 init_uni_hdr(&q_u->hdr_domain, &q_u->uni_domain);
102 /*******************************************************************
103 reads or writes a structure.
104 ********************************************************************/
105 BOOL samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u,
106 prs_struct *ps, int depth)
111 prs_debug(ps, depth, desc, "samr_io_q_lookup_domain");
117 if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth))
120 if(!smb_io_unihdr("hdr_domain", &q_u->hdr_domain, ps, depth))
123 if(!smb_io_unistr2("uni_domain", &q_u->uni_domain, q_u->hdr_domain.buffer, ps, depth))
129 /*******************************************************************
130 inits a SAMR_R_LOOKUP_DOMAIN structure.
131 ********************************************************************/
133 void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u,
134 DOM_SID *dom_sid, NTSTATUS status)
136 DEBUG(5, ("init_samr_r_lookup_domain\n"));
138 r_u->status = status;
140 if (NT_STATUS_IS_OK(status)) {
142 init_dom_sid2(&r_u->dom_sid, dom_sid);
146 /*******************************************************************
147 reads or writes a structure.
148 ********************************************************************/
150 BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u,
151 prs_struct *ps, int depth)
156 prs_debug(ps, depth, desc, "samr_io_r_lookup_domain");
162 if(!prs_uint32("ptr", ps, depth, &r_u->ptr_sid))
165 if (r_u->ptr_sid != 0) {
166 if(!smb_io_dom_sid2("sid", &r_u->dom_sid, ps, depth))
172 if(!prs_ntstatus("status", ps, depth, &r_u->status))
178 /*******************************************************************
179 reads or writes a structure.
180 ********************************************************************/
182 void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid)
184 DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n"));
186 q_u->dom_pol = *dom_pol;
187 init_dom_sid2(&q_u->sid, sid);
190 /*******************************************************************
191 reads or writes a structure.
192 ********************************************************************/
194 BOOL samr_io_q_remove_sid_foreign_domain(const char *desc, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u,
195 prs_struct *ps, int depth)
200 prs_debug(ps, depth, desc, "samr_io_q_remove_sid_foreign_domain");
206 if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
209 if(!smb_io_dom_sid2("sid", &q_u->sid, ps, depth))
218 /*******************************************************************
219 reads or writes a structure.
220 ********************************************************************/
222 BOOL samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN * r_u,
223 prs_struct *ps, int depth)
228 prs_debug(ps, depth, desc, "samr_io_r_remove_sid_foreign_domain");
234 if(!prs_ntstatus("status", ps, depth, &r_u->status))
240 /*******************************************************************
241 reads or writes a structure.
242 ********************************************************************/
244 void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u,
245 POLICY_HND *pol, uint32 flags,
248 DEBUG(5, ("samr_init_samr_q_open_domain\n"));
252 init_dom_sid2(&q_u->dom_sid, sid);
255 /*******************************************************************
256 reads or writes a structure.
257 ********************************************************************/
259 BOOL samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u,
260 prs_struct *ps, int depth)
265 prs_debug(ps, depth, desc, "samr_io_q_open_domain");
271 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
274 if(!prs_uint32("flags", ps, depth, &q_u->flags))
277 if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth))
283 /*******************************************************************
284 reads or writes a structure.
285 ********************************************************************/
287 BOOL samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u,
288 prs_struct *ps, int depth)
293 prs_debug(ps, depth, desc, "samr_io_r_open_domain");
299 if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth))
302 if(!prs_ntstatus("status", ps, depth, &r_u->status))
308 /*******************************************************************
309 reads or writes a structure.
310 ********************************************************************/
312 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u,
313 POLICY_HND *user_pol)
315 DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
317 q_u->user_pol = *user_pol;
320 /*******************************************************************
321 reads or writes a structure.
322 ********************************************************************/
324 BOOL samr_io_q_get_usrdom_pwinfo(const char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u,
325 prs_struct *ps, int depth)
330 prs_debug(ps, depth, desc, "samr_io_q_get_usrdom_pwinfo");
336 return smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth);
339 /*******************************************************************
341 ********************************************************************/
343 void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS status)
345 DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
347 r_u->min_pwd_length = 0x0000;
351 * r_u->unknown_1 = 0x0015;
354 r_u->unknown_1 = 0x01D1;
355 r_u->unknown_1 = 0x0015;
357 r_u->password_properties = 0x00000000;
359 r_u->status = status;
362 /*******************************************************************
363 reads or writes a structure.
364 ********************************************************************/
366 BOOL samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u,
367 prs_struct *ps, int depth)
372 prs_debug(ps, depth, desc, "samr_io_r_get_usrdom_pwinfo");
378 if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
380 if(!prs_uint16("unknown_1", ps, depth, &r_u->unknown_1))
382 if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
385 if(!prs_ntstatus("status ", ps, depth, &r_u->status))
392 /*******************************************************************
393 reads or writes a structure.
394 ********************************************************************/
396 BOOL samr_io_q_set_sec_obj(const char *desc, SAMR_Q_SET_SEC_OBJ * q_u,
397 prs_struct *ps, int depth)
402 prs_debug(ps, depth, desc, "samr_io_q_set_sec_obj");
408 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
411 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
414 if(!sec_io_desc_buf("sec_desc", &q_u->buf, ps, depth))
421 /*******************************************************************
422 reads or writes a structure.
423 ********************************************************************/
425 void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u,
426 POLICY_HND *user_pol, uint32 sec_info)
428 DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
430 q_u->user_pol = *user_pol;
431 q_u->sec_info = sec_info;
435 /*******************************************************************
436 reads or writes a structure.
437 ********************************************************************/
439 BOOL samr_io_q_query_sec_obj(const char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u,
440 prs_struct *ps, int depth)
445 prs_debug(ps, depth, desc, "samr_io_q_query_sec_obj");
451 if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
454 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
460 /*******************************************************************
461 reads or writes a structure.
462 ********************************************************************/
464 void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u,
465 POLICY_HND *domain_pol, uint16 switch_value)
467 DEBUG(5, ("samr_init_samr_q_query_dom_info\n"));
469 q_u->domain_pol = *domain_pol;
470 q_u->switch_value = switch_value;
473 /*******************************************************************
474 reads or writes a structure.
475 ********************************************************************/
477 BOOL samr_io_q_query_dom_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u,
478 prs_struct *ps, int depth)
483 prs_debug(ps, depth, desc, "samr_io_q_query_dom_info");
489 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
492 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
499 /*******************************************************************
501 ********************************************************************/
503 void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout)
505 u_3->logout.low = nt_logout.low;
506 u_3->logout.high = nt_logout.high;
509 /*******************************************************************
510 reads or writes a structure.
511 ********************************************************************/
513 static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3,
514 prs_struct *ps, int depth)
519 prs_debug(ps, depth, desc, "sam_io_unk_info3");
522 if(!smb_io_time("logout", &u_3->logout, ps, depth))
528 /*******************************************************************
530 ********************************************************************/
532 void init_unk_info6(SAM_UNK_INFO_6 * u_6)
534 u_6->unknown_0 = 0x00000000;
536 memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */
539 /*******************************************************************
540 reads or writes a structure.
541 ********************************************************************/
543 static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6,
544 prs_struct *ps, int depth)
549 prs_debug(ps, depth, desc, "sam_io_unk_info6");
552 if(!prs_uint32("unknown_0", ps, depth, &u_6->unknown_0)) /* 0x0000 0000 */
554 if(!prs_uint32("ptr_0", ps, depth, &u_6->ptr_0)) /* pointer to unknown structure */
556 if(!prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding))) /* 12 bytes zeros */
562 /*******************************************************************
564 ********************************************************************/
566 void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role)
568 u_7->server_role = server_role;
571 /*******************************************************************
572 reads or writes a structure.
573 ********************************************************************/
575 static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7,
576 prs_struct *ps, int depth)
581 prs_debug(ps, depth, desc, "sam_io_unk_info7");
584 if(!prs_uint16("server_role", ps, depth, &u_7->server_role))
590 /*******************************************************************
592 ********************************************************************/
594 void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num)
596 unix_to_nt_time(&u_8->domain_create_time, 0);
597 u_8->seq_num.low = seq_num;
598 u_8->seq_num.high = 0x0000;
601 /*******************************************************************
602 reads or writes a structure.
603 ********************************************************************/
605 static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8,
606 prs_struct *ps, int depth)
611 prs_debug(ps, depth, desc, "sam_io_unk_info8");
614 if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num))
617 if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth))
624 /*******************************************************************
626 ********************************************************************/
628 void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout)
630 u_12->duration.low = nt_lock_duration.low;
631 u_12->duration.high = nt_lock_duration.high;
632 u_12->reset_count.low = nt_reset_time.low;
633 u_12->reset_count.high = nt_reset_time.high;
635 u_12->bad_attempt_lockout = lockout;
638 /*******************************************************************
639 reads or writes a structure.
640 ********************************************************************/
642 static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12,
643 prs_struct *ps, int depth)
648 prs_debug(ps, depth, desc, "sam_io_unk_info12");
651 if(!smb_io_time("duration", &u_12->duration, ps, depth))
653 if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth))
655 if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout))
661 /*******************************************************************
663 ********************************************************************/
665 void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain)
667 init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE);
668 init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain);
671 /*******************************************************************
672 reads or writes a structure.
673 ********************************************************************/
675 static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5,
676 prs_struct *ps, int depth)
681 prs_debug(ps, depth, desc, "sam_io_unk_info5");
684 if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth))
687 if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth))
693 /*******************************************************************
695 ********************************************************************/
697 void init_unk_info2(SAM_UNK_INFO_2 * u_2,
698 const char *comment, const char *domain, const char *server,
699 uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role)
701 u_2->logout.low = nt_logout.low;
702 u_2->logout.high = nt_logout.high;
704 u_2->seq_num.low = seq_num;
705 u_2->seq_num.high = 0x00000000;
708 u_2->unknown_4 = 0x00000001;
709 u_2->server_role = server_role;
710 u_2->unknown_6 = 0x00000001;
711 u_2->num_domain_usrs = num_users;
712 u_2->num_domain_grps = num_groups;
713 u_2->num_local_grps = num_alias;
715 init_unistr2(&u_2->uni_comment, comment, UNI_FLAGS_NONE);
716 init_uni_hdr(&u_2->hdr_comment, &u_2->uni_comment);
717 init_unistr2(&u_2->uni_domain, domain, UNI_FLAGS_NONE);
718 init_uni_hdr(&u_2->hdr_domain, &u_2->uni_domain);
719 init_unistr2(&u_2->uni_server, server, UNI_FLAGS_NONE);
720 init_uni_hdr(&u_2->hdr_server, &u_2->uni_server);
723 /*******************************************************************
724 reads or writes a structure.
725 ********************************************************************/
727 static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2,
728 prs_struct *ps, int depth)
733 prs_debug(ps, depth, desc, "sam_io_unk_info2");
736 if(!smb_io_time("logout", &u_2->logout, ps, depth))
738 if(!smb_io_unihdr("hdr_comment", &u_2->hdr_comment, ps, depth))
740 if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth))
742 if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth))
745 /* put all the data in here, at the moment, including what the above
746 pointer is referring to
749 if(!prs_uint64("seq_num ", ps, depth, &u_2->seq_num))
752 if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4)) /* 0x0000 0001 */
754 if(!prs_uint32("server_role ", ps, depth, &u_2->server_role))
756 if(!prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6)) /* 0x0000 0001 */
758 if(!prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs))
760 if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps))
762 if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps))
765 if(!smb_io_unistr2("uni_comment", &u_2->uni_comment, u_2->hdr_comment.buffer, ps, depth))
767 if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth))
769 if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth))
775 /*******************************************************************
777 ********************************************************************/
779 void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist,
780 uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age)
782 u_1->min_length_password = min_pass_len;
783 u_1->password_history = pass_hist;
784 u_1->password_properties = password_properties;
786 /* password never expire */
787 u_1->expire.high = nt_expire.high;
788 u_1->expire.low = nt_expire.low;
790 /* can change the password now */
791 u_1->min_passwordage.high = nt_min_age.high;
792 u_1->min_passwordage.low = nt_min_age.low;
796 /*******************************************************************
797 reads or writes a structure.
798 ********************************************************************/
800 static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1,
801 prs_struct *ps, int depth)
806 prs_debug(ps, depth, desc, "sam_io_unk_info1");
809 if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password))
811 if(!prs_uint16("password_history", ps, depth, &u_1->password_history))
813 if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties))
815 if(!smb_io_time("expire", &u_1->expire, ps, depth))
817 if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth))
823 /*******************************************************************
824 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
825 ********************************************************************/
827 void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u,
828 uint16 switch_value, SAM_UNK_CTR * ctr,
831 DEBUG(5, ("init_samr_r_query_dom_info\n"));
834 r_u->switch_value = 0;
835 r_u->status = status; /* return status */
837 if (NT_STATUS_IS_OK(status)) {
838 r_u->switch_value = switch_value;
844 /*******************************************************************
845 reads or writes a structure.
846 ********************************************************************/
848 BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u,
849 prs_struct *ps, int depth)
854 prs_debug(ps, depth, desc, "samr_io_r_query_dom_info");
860 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
863 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
864 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
869 switch (r_u->switch_value) {
871 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
875 if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
879 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
883 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
887 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
891 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
895 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
899 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
903 DEBUG(0, ("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
905 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
913 if(!prs_ntstatus("status", ps, depth, &r_u->status))
919 /*******************************************************************
920 reads or writes a structure.
921 ********************************************************************/
923 void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ * q_u,
924 POLICY_HND *pol, uint32 sec_info, SEC_DESC_BUF *buf)
926 DEBUG(5, ("samr_init_samr_q_set_sec_obj\n"));
929 q_u->sec_info = sec_info;
934 /*******************************************************************
935 reads or writes a SAMR_R_SET_SEC_OBJ structure.
936 ********************************************************************/
938 BOOL samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u,
939 prs_struct *ps, int depth)
944 prs_debug(ps, depth, desc, "samr_io_r_set_sec_obj");
950 if(!prs_ntstatus("status", ps, depth, &r_u->status))
956 /*******************************************************************
957 reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
958 ********************************************************************/
960 BOOL samr_io_r_query_sec_obj(const char *desc, SAMR_R_QUERY_SEC_OBJ * r_u,
961 prs_struct *ps, int depth)
966 prs_debug(ps, depth, desc, "samr_io_r_query_sec_obj");
972 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
975 if(!sec_io_desc_buf("sec", &r_u->buf, ps, depth))
979 if(!prs_ntstatus("status", ps, depth, &r_u->status))
985 /*******************************************************************
986 reads or writes a SAM_STR1 structure.
987 ********************************************************************/
989 static BOOL sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf,
990 uint32 name_buf, uint32 desc_buf,
991 prs_struct *ps, int depth)
996 prs_debug(ps, depth, desc, "sam_io_sam_str1");
1001 if (!smb_io_unistr2("name", &sam->uni_acct_name, acct_buf, ps, depth))
1004 if (!smb_io_unistr2("desc", &sam->uni_acct_desc, desc_buf, ps, depth))
1007 if (!smb_io_unistr2("full", &sam->uni_full_name, name_buf, ps, depth))
1013 /*******************************************************************
1014 inits a SAM_ENTRY1 structure.
1015 ********************************************************************/
1017 static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
1018 UNISTR2 *sam_name, UNISTR2 *sam_full,
1019 UNISTR2 *sam_desc, uint32 rid_user,
1022 DEBUG(5, ("init_sam_entry1\n"));
1026 sam->user_idx = user_idx;
1027 sam->rid_user = rid_user;
1028 sam->acb_info = acb_info;
1030 init_uni_hdr(&sam->hdr_acct_name, sam_name);
1031 init_uni_hdr(&sam->hdr_user_name, sam_full);
1032 init_uni_hdr(&sam->hdr_user_desc, sam_desc);
1035 /*******************************************************************
1036 reads or writes a SAM_ENTRY1 structure.
1037 ********************************************************************/
1039 static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam,
1040 prs_struct *ps, int depth)
1045 prs_debug(ps, depth, desc, "sam_io_sam_entry1");
1051 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
1054 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
1056 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
1059 if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth))
1061 if (!smb_io_unihdr("hdr_user_desc", &sam->hdr_user_desc, ps, depth))
1063 if (!smb_io_unihdr("hdr_user_name", &sam->hdr_user_name, ps, depth))
1069 /*******************************************************************
1070 reads or writes a SAM_STR2 structure.
1071 ********************************************************************/
1073 static BOOL sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf,
1074 uint32 desc_buf, prs_struct *ps, int depth)
1079 prs_debug(ps, depth, desc, "sam_io_sam_str2");
1085 if(!smb_io_unistr2("uni_srv_name", &sam->uni_srv_name, acct_buf, ps, depth)) /* account name unicode string */
1087 if(!smb_io_unistr2("uni_srv_desc", &sam->uni_srv_desc, desc_buf, ps, depth)) /* account desc unicode string */
1093 /*******************************************************************
1094 inits a SAM_ENTRY2 structure.
1095 ********************************************************************/
1096 static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx,
1097 UNISTR2 *sam_name, UNISTR2 *sam_desc,
1098 uint32 rid_user, uint32 acb_info)
1100 DEBUG(5, ("init_sam_entry2\n"));
1102 sam->user_idx = user_idx;
1103 sam->rid_user = rid_user;
1104 sam->acb_info = acb_info;
1106 init_uni_hdr(&sam->hdr_srv_name, sam_name);
1107 init_uni_hdr(&sam->hdr_srv_desc, sam_desc);
1110 /*******************************************************************
1111 reads or writes a SAM_ENTRY2 structure.
1112 ********************************************************************/
1114 static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam,
1115 prs_struct *ps, int depth)
1120 prs_debug(ps, depth, desc, "sam_io_sam_entry2");
1126 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
1129 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
1131 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
1134 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth)) /* account name unicode string header */
1136 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_desc, ps, depth)) /* account name unicode string header */
1142 /*******************************************************************
1143 reads or writes a SAM_STR3 structure.
1144 ********************************************************************/
1146 static BOOL sam_io_sam_str3(const char *desc, SAM_STR3 * sam, uint32 acct_buf,
1147 uint32 desc_buf, prs_struct *ps, int depth)
1152 prs_debug(ps, depth, desc, "sam_io_sam_str3");
1158 if(!smb_io_unistr2("uni_grp_name", &sam->uni_grp_name, acct_buf, ps, depth)) /* account name unicode string */
1160 if(!smb_io_unistr2("uni_grp_desc", &sam->uni_grp_desc, desc_buf, ps, depth)) /* account desc unicode string */
1166 /*******************************************************************
1167 inits a SAM_ENTRY3 structure.
1168 ********************************************************************/
1170 static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx,
1171 UNISTR2 *grp_name, UNISTR2 *grp_desc,
1174 DEBUG(5, ("init_sam_entry3\n"));
1176 sam->grp_idx = grp_idx;
1177 sam->rid_grp = rid_grp;
1178 sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */
1180 init_uni_hdr(&sam->hdr_grp_name, grp_name);
1181 init_uni_hdr(&sam->hdr_grp_desc, grp_desc);
1184 /*******************************************************************
1185 reads or writes a SAM_ENTRY3 structure.
1186 ********************************************************************/
1188 static BOOL sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam,
1189 prs_struct *ps, int depth)
1194 prs_debug(ps, depth, desc, "sam_io_sam_entry3");
1200 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
1203 if(!prs_uint32("rid_grp", ps, depth, &sam->rid_grp))
1205 if(!prs_uint32("attr ", ps, depth, &sam->attr))
1208 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_name, ps, depth)) /* account name unicode string header */
1210 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_desc, ps, depth)) /* account name unicode string header */
1216 /*******************************************************************
1217 inits a SAM_ENTRY4 structure.
1218 ********************************************************************/
1220 static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx,
1221 uint32 len_acct_name)
1223 DEBUG(5, ("init_sam_entry4\n"));
1225 sam->user_idx = user_idx;
1226 init_str_hdr(&sam->hdr_acct_name, len_acct_name+1, len_acct_name, len_acct_name != 0);
1229 /*******************************************************************
1230 reads or writes a SAM_ENTRY4 structure.
1231 ********************************************************************/
1233 static BOOL sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam,
1234 prs_struct *ps, int depth)
1239 prs_debug(ps, depth, desc, "sam_io_sam_entry4");
1245 if(!prs_uint32("user_idx", ps, depth, &sam->user_idx))
1247 if(!smb_io_strhdr("strhdr", &sam->hdr_acct_name, ps, depth))
1253 /*******************************************************************
1254 inits a SAM_ENTRY5 structure.
1255 ********************************************************************/
1257 static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx,
1258 uint32 len_grp_name)
1260 DEBUG(5, ("init_sam_entry5\n"));
1262 sam->grp_idx = grp_idx;
1263 init_str_hdr(&sam->hdr_grp_name, len_grp_name, len_grp_name,
1267 /*******************************************************************
1268 reads or writes a SAM_ENTRY5 structure.
1269 ********************************************************************/
1271 static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam,
1272 prs_struct *ps, int depth)
1277 prs_debug(ps, depth, desc, "sam_io_sam_entry5");
1283 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
1285 if(!smb_io_strhdr("strhdr", &sam->hdr_grp_name, ps, depth))
1291 /*******************************************************************
1292 inits a SAM_ENTRY structure.
1293 ********************************************************************/
1295 void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid)
1297 DEBUG(10, ("init_sam_entry: %d\n", rid));
1300 init_uni_hdr(&sam->hdr_name, uni2);
1303 /*******************************************************************
1304 reads or writes a SAM_ENTRY structure.
1305 ********************************************************************/
1307 static BOOL sam_io_sam_entry(const char *desc, SAM_ENTRY * sam,
1308 prs_struct *ps, int depth)
1313 prs_debug(ps, depth, desc, "sam_io_sam_entry");
1318 if(!prs_uint32("rid", ps, depth, &sam->rid))
1320 if(!smb_io_unihdr("unihdr", &sam->hdr_name, ps, depth)) /* account name unicode string header */
1326 /*******************************************************************
1327 inits a SAMR_Q_ENUM_DOM_USERS structure.
1328 ********************************************************************/
1330 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol,
1332 uint32 acb_mask, uint32 size)
1334 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
1338 q_e->start_idx = start_idx; /* zero indicates lots */
1339 q_e->acb_mask = acb_mask;
1340 q_e->max_size = size;
1343 /*******************************************************************
1344 reads or writes a structure.
1345 ********************************************************************/
1347 BOOL samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e,
1348 prs_struct *ps, int depth)
1353 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
1359 if(!smb_io_pol_hnd("domain_pol", &q_e->pol, ps, depth))
1362 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
1364 if(!prs_uint32("acb_mask ", ps, depth, &q_e->acb_mask))
1367 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
1374 /*******************************************************************
1375 inits a SAMR_R_ENUM_DOM_USERS structure.
1376 ********************************************************************/
1378 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u,
1379 uint32 next_idx, uint32 num_sam_entries)
1381 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
1383 r_u->next_idx = next_idx;
1385 if (num_sam_entries != 0) {
1386 r_u->ptr_entries1 = 1;
1387 r_u->ptr_entries2 = 1;
1388 r_u->num_entries2 = num_sam_entries;
1389 r_u->num_entries3 = num_sam_entries;
1391 r_u->num_entries4 = num_sam_entries;
1393 r_u->ptr_entries1 = 0;
1394 r_u->num_entries2 = num_sam_entries;
1395 r_u->ptr_entries2 = 1;
1399 /*******************************************************************
1400 reads or writes a structure.
1401 ********************************************************************/
1403 BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
1404 prs_struct *ps, int depth)
1411 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
1417 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
1419 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
1422 if (r_u->ptr_entries1 != 0) {
1423 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
1425 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
1427 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
1430 if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) {
1431 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY, r_u->num_entries2);
1432 r_u->uni_acct_name = PRS_ALLOC_MEM(ps,UNISTR2, r_u->num_entries2);
1435 if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) {
1436 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
1437 r_u->num_entries4 = 0;
1438 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
1442 for (i = 0; i < r_u->num_entries2; i++) {
1443 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
1447 for (i = 0; i < r_u->num_entries2; i++) {
1448 if(!smb_io_unistr2("", &r_u->uni_acct_name[i],r_u->sam[i].hdr_name.buffer, ps,depth))
1457 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
1459 if(!prs_ntstatus("status", ps, depth, &r_u->status))
1465 /*******************************************************************
1466 inits a SAMR_Q_QUERY_DISPINFO structure.
1467 ********************************************************************/
1469 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol,
1470 uint16 switch_level, uint32 start_idx,
1471 uint32 max_entries, uint32 max_size)
1473 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
1475 q_e->domain_pol = *pol;
1477 q_e->switch_level = switch_level;
1479 q_e->start_idx = start_idx;
1480 q_e->max_entries = max_entries;
1481 q_e->max_size = max_size;
1484 /*******************************************************************
1485 reads or writes a structure.
1486 ********************************************************************/
1488 BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e,
1489 prs_struct *ps, int depth)
1494 prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo");
1500 if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth))
1503 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
1508 if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx))
1510 if(!prs_uint32("max_entries ", ps, depth, &q_e->max_entries))
1512 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
1518 /*******************************************************************
1519 inits a SAM_DISPINFO_1 structure.
1520 ********************************************************************/
1522 NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam,
1523 uint32 num_entries, uint32 start_idx,
1524 struct samr_displayentry *entries)
1528 DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries));
1531 return NT_STATUS_OK;
1533 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_1, num_entries);
1535 return NT_STATUS_NO_MEMORY;
1537 (*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries);
1538 if ((*sam)->sam == NULL)
1539 return NT_STATUS_NO_MEMORY;
1541 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries);
1542 if ((*sam)->str == NULL)
1543 return NT_STATUS_NO_MEMORY;
1545 for (i = 0; i < num_entries ; i++) {
1546 init_unistr2(&(*sam)->str[i].uni_acct_name,
1547 entries[i].account_name, UNI_FLAGS_NONE);
1548 init_unistr2(&(*sam)->str[i].uni_full_name,
1549 entries[i].fullname, UNI_FLAGS_NONE);
1550 init_unistr2(&(*sam)->str[i].uni_acct_desc,
1551 entries[i].description, UNI_FLAGS_NONE);
1553 init_sam_entry1(&(*sam)->sam[i], start_idx+i+1,
1554 &(*sam)->str[i].uni_acct_name,
1555 &(*sam)->str[i].uni_full_name,
1556 &(*sam)->str[i].uni_acct_desc,
1557 entries[i].rid, entries[i].acct_flags);
1560 return NT_STATUS_OK;
1563 /*******************************************************************
1564 reads or writes a structure.
1565 ********************************************************************/
1567 static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam,
1569 prs_struct *ps, int depth)
1573 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1");
1579 if (UNMARSHALLING(ps) && num_entries > 0) {
1581 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY1, num_entries)) == NULL) {
1582 DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
1586 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR1, num_entries)) == NULL) {
1587 DEBUG(0, ("out of memory allocating SAM_STR1\n"));
1592 for (i = 0; i < num_entries; i++) {
1593 if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth))
1597 for (i = 0; i < num_entries; i++) {
1598 if(!sam_io_sam_str1("", &sam->str[i],
1599 sam->sam[i].hdr_acct_name.buffer,
1600 sam->sam[i].hdr_user_name.buffer,
1601 sam->sam[i].hdr_user_desc.buffer, ps, depth))
1608 /*******************************************************************
1609 inits a SAM_DISPINFO_2 structure.
1610 ********************************************************************/
1612 NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam,
1613 uint32 num_entries, uint32 start_idx,
1614 struct samr_displayentry *entries)
1618 DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries));
1621 return NT_STATUS_OK;
1623 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_2, num_entries);
1625 return NT_STATUS_NO_MEMORY;
1627 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries);
1628 if ((*sam)->sam == NULL)
1629 return NT_STATUS_NO_MEMORY;
1631 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR2, num_entries);
1632 if ((*sam)->str == NULL)
1633 return NT_STATUS_NO_MEMORY;
1635 for (i = 0; i < num_entries; i++) {
1636 init_unistr2(&(*sam)->str[i].uni_srv_name,
1637 entries[i].account_name, UNI_FLAGS_NONE);
1638 init_unistr2(&(*sam)->str[i].uni_srv_desc,
1639 entries[i].description, UNI_FLAGS_NONE);
1641 init_sam_entry2(&(*sam)->sam[i], start_idx + i + 1,
1642 &(*sam)->str[i].uni_srv_name,
1643 &(*sam)->str[i].uni_srv_desc,
1644 entries[i].rid, entries[i].acct_flags);
1647 return NT_STATUS_OK;
1650 /*******************************************************************
1651 reads or writes a structure.
1652 ********************************************************************/
1654 static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam,
1656 prs_struct *ps, int depth)
1663 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2");
1669 if (UNMARSHALLING(ps) && num_entries > 0) {
1671 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY2, num_entries)) == NULL) {
1672 DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
1676 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR2, num_entries)) == NULL) {
1677 DEBUG(0, ("out of memory allocating SAM_STR2\n"));
1682 for (i = 0; i < num_entries; i++) {
1683 if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth))
1687 for (i = 0; i < num_entries; i++) {
1688 if(!sam_io_sam_str2("", &sam->str[i],
1689 sam->sam[i].hdr_srv_name.buffer,
1690 sam->sam[i].hdr_srv_desc.buffer, ps, depth))
1697 /*******************************************************************
1698 inits a SAM_DISPINFO_3 structure.
1699 ********************************************************************/
1701 NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam,
1702 uint32 num_entries, uint32 start_idx,
1703 struct samr_displayentry *entries)
1707 DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries));
1710 return NT_STATUS_OK;
1712 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_3, num_entries);
1714 return NT_STATUS_NO_MEMORY;
1716 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries)))
1717 return NT_STATUS_NO_MEMORY;
1719 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries)))
1720 return NT_STATUS_NO_MEMORY;
1722 for (i = 0; i < num_entries; i++) {
1723 DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i));
1725 init_unistr2(&(*sam)->str[i].uni_grp_name,
1726 entries[i].account_name, UNI_FLAGS_NONE);
1727 init_unistr2(&(*sam)->str[i].uni_grp_desc,
1728 entries[i].description, UNI_FLAGS_NONE);
1730 init_sam_entry3(&(*sam)->sam[i], start_idx+i+1,
1731 &(*sam)->str[i].uni_grp_name,
1732 &(*sam)->str[i].uni_grp_desc,
1736 return NT_STATUS_OK;
1739 /*******************************************************************
1740 reads or writes a structure.
1741 ********************************************************************/
1743 static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam,
1745 prs_struct *ps, int depth)
1752 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3");
1758 if (UNMARSHALLING(ps) && num_entries > 0) {
1760 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY3, num_entries)) == NULL) {
1761 DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
1765 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR3, num_entries)) == NULL) {
1766 DEBUG(0, ("out of memory allocating SAM_STR3\n"));
1771 for (i = 0; i < num_entries; i++) {
1772 if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth))
1776 for (i = 0; i < num_entries; i++) {
1777 if(!sam_io_sam_str3("", &sam->str[i],
1778 sam->sam[i].hdr_grp_name.buffer,
1779 sam->sam[i].hdr_grp_desc.buffer, ps, depth))
1786 /*******************************************************************
1787 inits a SAM_DISPINFO_4 structure.
1788 ********************************************************************/
1790 NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam,
1791 uint32 num_entries, uint32 start_idx,
1792 struct samr_displayentry *entries)
1796 DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries));
1799 return NT_STATUS_OK;
1801 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_4, num_entries);
1803 return NT_STATUS_NO_MEMORY;
1805 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries);
1806 if ((*sam)->sam == NULL)
1807 return NT_STATUS_NO_MEMORY;
1809 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries);
1810 if ((*sam)->str == NULL)
1811 return NT_STATUS_NO_MEMORY;
1813 for (i = 0; i < num_entries; i++) {
1814 size_t len_sam_name = strlen(entries[i].account_name);
1816 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i));
1818 init_sam_entry4(&(*sam)->sam[i], start_idx + i + 1,
1821 init_string2(&(*sam)->str[i].acct_name,
1822 entries[i].account_name, len_sam_name+1,
1826 return NT_STATUS_OK;
1829 /*******************************************************************
1830 reads or writes a structure.
1831 ********************************************************************/
1833 static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam,
1835 prs_struct *ps, int depth)
1842 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4");
1848 if (UNMARSHALLING(ps) && num_entries > 0) {
1850 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY4, num_entries)) == NULL) {
1851 DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
1855 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR4, num_entries)) == NULL) {
1856 DEBUG(0, ("out of memory allocating SAM_STR4\n"));
1861 for (i = 0; i < num_entries; i++) {
1862 if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth))
1866 for (i = 0; i < num_entries; i++) {
1867 if(!smb_io_string2("acct_name", &sam->str[i].acct_name,
1868 sam->sam[i].hdr_acct_name.buffer, ps, depth))
1875 /*******************************************************************
1876 inits a SAM_DISPINFO_5 structure.
1877 ********************************************************************/
1879 NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 **sam,
1880 uint32 num_entries, uint32 start_idx,
1881 struct samr_displayentry *entries)
1883 uint32 len_sam_name;
1886 DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries));
1889 return NT_STATUS_OK;
1891 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_5, num_entries);
1893 return NT_STATUS_NO_MEMORY;
1895 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries)))
1896 return NT_STATUS_NO_MEMORY;
1898 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries)))
1899 return NT_STATUS_NO_MEMORY;
1901 for (i = 0; i < num_entries; i++) {
1902 DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i));
1904 len_sam_name = strlen(entries[i].account_name);
1906 init_sam_entry5(&(*sam)->sam[i], start_idx+i+1, len_sam_name);
1907 init_string2(&(*sam)->str[i].grp_name, entries[i].account_name,
1908 len_sam_name+1, len_sam_name);
1911 return NT_STATUS_OK;
1914 /*******************************************************************
1915 reads or writes a structure.
1916 ********************************************************************/
1918 static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam,
1920 prs_struct *ps, int depth)
1927 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5");
1933 if (UNMARSHALLING(ps) && num_entries > 0) {
1935 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY5, num_entries)) == NULL) {
1936 DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
1940 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR5, num_entries)) == NULL) {
1941 DEBUG(0, ("out of memory allocating SAM_STR5\n"));
1946 for (i = 0; i < num_entries; i++) {
1947 if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth))
1951 for (i = 0; i < num_entries; i++) {
1952 if(!smb_io_string2("grp_name", &sam->str[i].grp_name,
1953 sam->sam[i].hdr_grp_name.buffer, ps, depth))
1960 /*******************************************************************
1961 inits a SAMR_R_QUERY_DISPINFO structure.
1962 ********************************************************************/
1964 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u,
1965 uint32 num_entries, uint32 total_size, uint32 data_size,
1966 uint16 switch_level, SAM_DISPINFO_CTR * ctr,
1969 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level));
1971 r_u->total_size = total_size;
1973 r_u->data_size = data_size;
1975 r_u->switch_level = switch_level;
1976 r_u->num_entries = num_entries;
1979 r_u->ptr_entries = 0;
1981 r_u->ptr_entries = 1;
1983 r_u->num_entries2 = num_entries;
1986 r_u->status = status;
1989 /*******************************************************************
1990 reads or writes a structure.
1991 ********************************************************************/
1993 BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
1994 prs_struct *ps, int depth)
1999 prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo");
2005 if(!prs_uint32("total_size ", ps, depth, &r_u->total_size))
2007 if(!prs_uint32("data_size ", ps, depth, &r_u->data_size))
2009 if(!prs_uint16("switch_level", ps, depth, &r_u->switch_level))
2014 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
2016 if(!prs_uint32("ptr_entries ", ps, depth, &r_u->ptr_entries))
2019 if (r_u->ptr_entries==0) {
2022 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2028 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
2031 switch (r_u->switch_level) {
2033 if(!sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1,
2034 r_u->num_entries, ps, depth))
2038 if(!sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2,
2039 r_u->num_entries, ps, depth))
2043 if(!sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3,
2044 r_u->num_entries, ps, depth))
2048 if(!sam_io_sam_dispinfo_4("user list",
2049 r_u->ctr->sam.info4,
2050 r_u->num_entries, ps, depth))
2054 if(!sam_io_sam_dispinfo_5("group list",
2055 r_u->ctr->sam.info5,
2056 r_u->num_entries, ps, depth))
2060 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
2066 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2072 /*******************************************************************
2073 inits a SAMR_Q_OPEN_GROUP structure.
2074 ********************************************************************/
2076 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c,
2078 uint32 access_mask, uint32 rid)
2080 DEBUG(5, ("init_samr_q_open_group\n"));
2082 q_c->domain_pol = *hnd;
2083 q_c->access_mask = access_mask;
2084 q_c->rid_group = rid;
2087 /*******************************************************************
2088 reads or writes a structure.
2089 ********************************************************************/
2091 BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u,
2092 prs_struct *ps, int depth)
2097 prs_debug(ps, depth, desc, "samr_io_q_open_group");
2103 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
2106 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
2108 if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group))
2114 /*******************************************************************
2115 reads or writes a structure.
2116 ********************************************************************/
2118 BOOL samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u,
2119 prs_struct *ps, int depth)
2124 prs_debug(ps, depth, desc, "samr_io_r_open_group");
2130 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2133 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2139 /*******************************************************************
2140 inits a GROUP_INFO1 structure.
2141 ********************************************************************/
2143 void init_samr_group_info1(GROUP_INFO1 * gr1,
2144 char *acct_name, char *acct_desc,
2147 DEBUG(5, ("init_samr_group_info1\n"));
2149 gr1->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2150 gr1->num_members = num_members;
2152 init_unistr2(&gr1->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2153 init_uni_hdr(&gr1->hdr_acct_name, &gr1->uni_acct_name);
2154 init_unistr2(&gr1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2155 init_uni_hdr(&gr1->hdr_acct_desc, &gr1->uni_acct_desc);
2158 /*******************************************************************
2159 reads or writes a structure.
2160 ********************************************************************/
2162 BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1,
2163 prs_struct *ps, int depth)
2170 prs_debug(ps, depth, desc, "samr_io_group_info1");
2173 if(!prs_uint16("level", ps, depth, &dummy))
2179 if(!smb_io_unihdr("hdr_acct_name", &gr1->hdr_acct_name, ps, depth))
2182 if(!prs_uint32("group_attr", ps, depth, &gr1->group_attr))
2184 if(!prs_uint32("num_members", ps, depth, &gr1->num_members))
2187 if(!smb_io_unihdr("hdr_acct_desc", &gr1->hdr_acct_desc, ps, depth))
2190 if(!smb_io_unistr2("uni_acct_name", &gr1->uni_acct_name,
2191 gr1->hdr_acct_name.buffer, ps, depth))
2194 if(!smb_io_unistr2("uni_acct_desc", &gr1->uni_acct_desc,
2195 gr1->hdr_acct_desc.buffer, ps, depth))
2201 /*******************************************************************
2202 inits a GROUP_INFO2 structure.
2203 ********************************************************************/
2205 void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name)
2207 DEBUG(5, ("init_samr_group_info2\n"));
2210 init_unistr2(&gr2->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2211 init_uni_hdr(&gr2->hdr_acct_name, &gr2->uni_acct_name);
2214 /*******************************************************************
2215 reads or writes a structure.
2216 ********************************************************************/
2218 BOOL samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int depth)
2223 prs_debug(ps, depth, desc, "samr_io_group_info2");
2226 if(!prs_uint16("hdr_level", ps, depth, &gr2->level))
2229 if(!smb_io_unihdr("hdr_acct_name", &gr2->hdr_acct_name, ps, depth))
2231 if(!smb_io_unistr2("uni_acct_name", &gr2->uni_acct_name,
2232 gr2->hdr_acct_name.buffer, ps, depth))
2238 /*******************************************************************
2239 inits a GROUP_INFO3 structure.
2240 ********************************************************************/
2242 void init_samr_group_info3(GROUP_INFO3 *gr3)
2244 DEBUG(5, ("init_samr_group_info3\n"));
2246 gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2249 /*******************************************************************
2250 reads or writes a structure.
2251 ********************************************************************/
2253 BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth)
2258 prs_debug(ps, depth, desc, "samr_io_group_info3");
2264 if(!prs_uint32("group_attr", ps, depth, &gr3->group_attr))
2270 /*******************************************************************
2271 inits a GROUP_INFO4 structure.
2272 ********************************************************************/
2274 void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc)
2276 DEBUG(5, ("init_samr_group_info4\n"));
2279 init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2280 init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc);
2283 /*******************************************************************
2284 reads or writes a structure.
2285 ********************************************************************/
2287 BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4,
2288 prs_struct *ps, int depth)
2293 prs_debug(ps, depth, desc, "samr_io_group_info4");
2296 if(!prs_uint16("hdr_level", ps, depth, &gr4->level))
2298 if(!smb_io_unihdr("hdr_acct_desc", &gr4->hdr_acct_desc, ps, depth))
2300 if(!smb_io_unistr2("uni_acct_desc", &gr4->uni_acct_desc,
2301 gr4->hdr_acct_desc.buffer, ps, depth))
2307 /*******************************************************************
2308 inits a GROUP_INFO5 structure.
2309 ********************************************************************/
2311 void init_samr_group_info5(GROUP_INFO5 * gr5,
2312 char *acct_name, char *acct_desc,
2315 DEBUG(5, ("init_samr_group_info5\n"));
2317 gr5->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2318 gr5->num_members = num_members;
2320 init_unistr2(&gr5->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2321 init_uni_hdr(&gr5->hdr_acct_name, &gr5->uni_acct_name);
2322 init_unistr2(&gr5->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2323 init_uni_hdr(&gr5->hdr_acct_desc, &gr5->uni_acct_desc);
2326 /*******************************************************************
2327 reads or writes a structure.
2328 ********************************************************************/
2330 BOOL samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5,
2331 prs_struct *ps, int depth)
2338 prs_debug(ps, depth, desc, "samr_io_group_info5");
2341 if(!prs_uint16("level", ps, depth, &dummy))
2347 if(!smb_io_unihdr("hdr_acct_name", &gr5->hdr_acct_name, ps, depth))
2350 if(!prs_uint32("group_attr", ps, depth, &gr5->group_attr))
2352 if(!prs_uint32("num_members", ps, depth, &gr5->num_members))
2355 if(!smb_io_unihdr("hdr_acct_desc", &gr5->hdr_acct_desc, ps, depth))
2358 if(!smb_io_unistr2("uni_acct_name", &gr5->uni_acct_name,
2359 gr5->hdr_acct_name.buffer, ps, depth))
2362 if(!smb_io_unistr2("uni_acct_desc", &gr5->uni_acct_desc,
2363 gr5->hdr_acct_desc.buffer, ps, depth))
2370 /*******************************************************************
2371 reads or writes a structure.
2372 ********************************************************************/
2374 static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr,
2375 prs_struct *ps, int depth)
2377 if (UNMARSHALLING(ps))
2378 *ctr = PRS_ALLOC_MEM(ps,GROUP_INFO_CTR,1);
2383 prs_debug(ps, depth, desc, "samr_group_info_ctr");
2386 if(!prs_uint16("switch_value1", ps, depth, &(*ctr)->switch_value1))
2389 switch ((*ctr)->switch_value1) {
2391 if(!samr_io_group_info1("group_info1", &(*ctr)->group.info1, ps, depth))
2395 if(!samr_io_group_info2("group_info2", &(*ctr)->group.info2, ps, depth))
2399 if(!samr_io_group_info3("group_info3", &(*ctr)->group.info3, ps, depth))
2403 if(!samr_io_group_info4("group_info4", &(*ctr)->group.info4, ps, depth))
2407 if(!samr_io_group_info5("group_info5", &(*ctr)->group.info5, ps, depth))
2411 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2418 /*******************************************************************
2419 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2420 ********************************************************************/
2422 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
2423 POLICY_HND *pol, const char *acct_desc,
2426 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2430 init_unistr2(&q_e->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2431 init_uni_hdr(&q_e->hdr_acct_desc, &q_e->uni_acct_desc);
2433 q_e->access_mask = access_mask;
2436 /*******************************************************************
2437 reads or writes a structure.
2438 ********************************************************************/
2440 BOOL samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
2441 prs_struct *ps, int depth)
2446 prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
2452 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2455 if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth))
2457 if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc,
2458 q_e->hdr_acct_desc.buffer, ps, depth))
2463 if(!prs_uint32("access", ps, depth, &q_e->access_mask))
2469 /*******************************************************************
2470 reads or writes a structure.
2471 ********************************************************************/
2473 BOOL samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u,
2474 prs_struct *ps, int depth)
2479 prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
2485 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2488 if(!prs_uint32("rid ", ps, depth, &r_u->rid))
2490 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2496 /*******************************************************************
2497 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2498 ********************************************************************/
2500 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c,
2503 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2505 q_c->group_pol = *hnd;
2508 /*******************************************************************
2509 reads or writes a structure.
2510 ********************************************************************/
2512 BOOL samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u,
2513 prs_struct *ps, int depth)
2518 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
2524 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
2530 /*******************************************************************
2531 reads or writes a structure.
2532 ********************************************************************/
2534 BOOL samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u,
2535 prs_struct *ps, int depth)
2540 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
2546 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2549 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2555 /*******************************************************************
2556 inits a SAMR_Q_DEL_GROUPMEM structure.
2557 ********************************************************************/
2559 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e,
2560 POLICY_HND *pol, uint32 rid)
2562 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2568 /*******************************************************************
2569 reads or writes a structure.
2570 ********************************************************************/
2572 BOOL samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e,
2573 prs_struct *ps, int depth)
2578 prs_debug(ps, depth, desc, "samr_io_q_del_groupmem");
2584 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2587 if(!prs_uint32("rid", ps, depth, &q_e->rid))
2593 /*******************************************************************
2594 inits a SAMR_R_DEL_GROUPMEM structure.
2595 ********************************************************************/
2597 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol,
2600 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2602 r_u->status = status;
2605 /*******************************************************************
2606 reads or writes a structure.
2607 ********************************************************************/
2609 BOOL samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u,
2610 prs_struct *ps, int depth)
2615 prs_debug(ps, depth, desc, "samr_io_r_del_groupmem");
2621 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2627 /*******************************************************************
2628 inits a SAMR_Q_ADD_GROUPMEM structure.
2629 ********************************************************************/
2631 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e,
2632 POLICY_HND *pol, uint32 rid)
2634 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2638 q_e->unknown = 0x0005;
2641 /*******************************************************************
2642 reads or writes a structure.
2643 ********************************************************************/
2645 BOOL samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e,
2646 prs_struct *ps, int depth)
2651 prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
2657 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2660 if(!prs_uint32("rid ", ps, depth, &q_e->rid))
2662 if(!prs_uint32("unknown", ps, depth, &q_e->unknown))
2668 /*******************************************************************
2669 inits a SAMR_R_ADD_GROUPMEM structure.
2670 ********************************************************************/
2672 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol,
2675 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2677 r_u->status = status;
2680 /*******************************************************************
2681 reads or writes a structure.
2682 ********************************************************************/
2684 BOOL samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u,
2685 prs_struct *ps, int depth)
2690 prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
2696 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2702 /*******************************************************************
2703 inits a SAMR_Q_SET_GROUPINFO structure.
2704 ********************************************************************/
2706 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e,
2707 POLICY_HND *pol, GROUP_INFO_CTR * ctr)
2709 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2715 /*******************************************************************
2716 reads or writes a structure.
2717 ********************************************************************/
2719 BOOL samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e,
2720 prs_struct *ps, int depth)
2725 prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
2731 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2734 if(!samr_group_info_ctr("ctr", &q_e->ctr, ps, depth))
2740 /*******************************************************************
2741 inits a SAMR_R_SET_GROUPINFO structure.
2742 ********************************************************************/
2744 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status)
2746 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2748 r_u->status = status;
2751 /*******************************************************************
2752 reads or writes a structure.
2753 ********************************************************************/
2755 BOOL samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u,
2756 prs_struct *ps, int depth)
2761 prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
2767 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2773 /*******************************************************************
2774 inits a SAMR_Q_QUERY_GROUPINFO structure.
2775 ********************************************************************/
2777 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e,
2778 POLICY_HND *pol, uint16 switch_level)
2780 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2784 q_e->switch_level = switch_level;
2787 /*******************************************************************
2788 reads or writes a structure.
2789 ********************************************************************/
2791 BOOL samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e,
2792 prs_struct *ps, int depth)
2797 prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
2803 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2806 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
2812 /*******************************************************************
2813 inits a SAMR_R_QUERY_GROUPINFO structure.
2814 ********************************************************************/
2816 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u,
2817 GROUP_INFO_CTR * ctr, NTSTATUS status)
2819 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2821 r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0;
2823 r_u->status = status;
2826 /*******************************************************************
2827 reads or writes a structure.
2828 ********************************************************************/
2830 BOOL samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u,
2831 prs_struct *ps, int depth)
2836 prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
2842 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
2845 if (r_u->ptr != 0) {
2846 if(!samr_group_info_ctr("ctr", &r_u->ctr, ps, depth))
2852 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2858 /*******************************************************************
2859 inits a SAMR_Q_QUERY_GROUPMEM structure.
2860 ********************************************************************/
2862 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd)
2864 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2866 q_c->group_pol = *hnd;
2869 /*******************************************************************
2870 reads or writes a structure.
2871 ********************************************************************/
2873 BOOL samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u,
2874 prs_struct *ps, int depth)
2879 prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
2885 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
2891 /*******************************************************************
2892 inits a SAMR_R_QUERY_GROUPMEM structure.
2893 ********************************************************************/
2895 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u,
2896 uint32 num_entries, uint32 *rid,
2897 uint32 *attr, NTSTATUS status)
2899 DEBUG(5, ("init_samr_r_query_groupmem\n"));
2901 if (NT_STATUS_IS_OK(status)) {
2903 r_u->num_entries = num_entries;
2905 r_u->ptr_attrs = attr != NULL ? 1 : 0;
2906 r_u->ptr_rids = rid != NULL ? 1 : 0;
2908 r_u->num_rids = num_entries;
2911 r_u->num_attrs = num_entries;
2915 r_u->num_entries = 0;
2918 r_u->status = status;
2921 /*******************************************************************
2922 reads or writes a structure.
2923 ********************************************************************/
2925 BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u,
2926 prs_struct *ps, int depth)
2933 if (UNMARSHALLING(ps))
2936 prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
2942 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
2944 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
2947 if (r_u->ptr != 0) {
2948 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
2950 if(!prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs))
2953 if (r_u->ptr_rids != 0) {
2954 if(!prs_uint32("num_rids", ps, depth, &r_u->num_rids))
2956 if (UNMARSHALLING(ps) && r_u->num_rids != 0) {
2957 r_u->rid = PRS_ALLOC_MEM(ps,uint32,r_u->num_rids);
2958 if (r_u->rid == NULL)
2962 for (i = 0; i < r_u->num_rids; i++) {
2963 if(!prs_uint32("", ps, depth, &r_u->rid[i]))
2968 if (r_u->ptr_attrs != 0) {
2969 if(!prs_uint32("num_attrs", ps, depth, &r_u->num_attrs))
2972 if (UNMARSHALLING(ps) && r_u->num_attrs != 0) {
2973 r_u->attr = PRS_ALLOC_MEM(ps,uint32,r_u->num_attrs);
2974 if (r_u->attr == NULL)
2978 for (i = 0; i < r_u->num_attrs; i++) {
2979 if(!prs_uint32("", ps, depth, &r_u->attr[i]))
2985 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2991 /*******************************************************************
2992 inits a SAMR_Q_QUERY_USERGROUPS structure.
2993 ********************************************************************/
2995 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u,
2998 DEBUG(5, ("init_samr_q_query_usergroups\n"));
3003 /*******************************************************************
3004 reads or writes a structure.
3005 ********************************************************************/
3007 BOOL samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u,
3008 prs_struct *ps, int depth)
3013 prs_debug(ps, depth, desc, "samr_io_q_query_usergroups");
3019 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
3025 /*******************************************************************
3026 inits a SAMR_R_QUERY_USERGROUPS structure.
3027 ********************************************************************/
3029 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u,
3030 uint32 num_gids, DOM_GID * gid,
3033 DEBUG(5, ("init_samr_r_query_usergroups\n"));
3035 if (NT_STATUS_IS_OK(status)) {
3037 r_u->num_entries = num_gids;
3038 r_u->ptr_1 = (num_gids != 0) ? 1 : 0;
3039 r_u->num_entries2 = num_gids;
3044 r_u->num_entries = 0;
3049 r_u->status = status;
3052 /*******************************************************************
3053 reads or writes a structure.
3054 ********************************************************************/
3056 BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid,
3057 prs_struct *ps, int depth)
3063 prs_debug(ps, depth, desc, "samr_io_gids");
3069 if(!prs_uint32("num_gids", ps, depth, num_gids))
3072 if ((*num_gids) != 0) {
3073 if (UNMARSHALLING(ps)) {
3074 (*gid) = PRS_ALLOC_MEM(ps,DOM_GID,*num_gids);
3077 if ((*gid) == NULL) {
3081 for (i = 0; i < (*num_gids); i++) {
3082 if(!smb_io_gid("gids", &(*gid)[i], ps, depth))
3090 /*******************************************************************
3091 reads or writes a structure.
3092 ********************************************************************/
3094 BOOL samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u,
3095 prs_struct *ps, int depth)
3100 prs_debug(ps, depth, desc, "samr_io_r_query_usergroups");
3106 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
3109 if (r_u->ptr_0 != 0) {
3110 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
3112 if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1))
3115 if (r_u->num_entries != 0 && r_u->ptr_1 != 0) {
3116 if(!samr_io_gids("gids", &r_u->num_entries2, &r_u->gid, ps, depth))
3123 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3129 /*******************************************************************
3130 inits a SAMR_Q_ENUM_DOMAINS structure.
3131 ********************************************************************/
3133 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e,
3135 uint32 start_idx, uint32 size)
3137 DEBUG(5, ("init_samr_q_enum_domains\n"));
3141 q_e->start_idx = start_idx;
3142 q_e->max_size = size;
3145 /*******************************************************************
3146 reads or writes a structure.
3147 ********************************************************************/
3149 BOOL samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e,
3150 prs_struct *ps, int depth)
3155 prs_debug(ps, depth, desc, "samr_io_q_enum_domains");
3161 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
3164 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3166 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3172 /*******************************************************************
3173 inits a SAMR_R_ENUM_DOMAINS structure.
3174 ********************************************************************/
3176 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u,
3177 uint32 next_idx, uint32 num_sam_entries)
3179 DEBUG(5, ("init_samr_r_enum_domains\n"));
3181 r_u->next_idx = next_idx;
3183 if (num_sam_entries != 0) {
3184 r_u->ptr_entries1 = 1;
3185 r_u->ptr_entries2 = 1;
3186 r_u->num_entries2 = num_sam_entries;
3187 r_u->num_entries3 = num_sam_entries;
3189 r_u->num_entries4 = num_sam_entries;
3191 r_u->ptr_entries1 = 0;
3192 r_u->num_entries2 = num_sam_entries;
3193 r_u->ptr_entries2 = 1;
3197 /*******************************************************************
3198 reads or writes a structure.
3199 ********************************************************************/
3201 BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u,
3202 prs_struct *ps, int depth)
3209 prs_debug(ps, depth, desc, "samr_io_r_enum_domains");
3215 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3217 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3220 if (r_u->ptr_entries1 != 0) {
3221 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3223 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3225 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3228 if (UNMARSHALLING(ps)) {
3229 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3230 r_u->uni_dom_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3233 if ((r_u->sam == NULL || r_u->uni_dom_name == NULL) && r_u->num_entries2 != 0) {
3234 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
3235 r_u->num_entries4 = 0;
3236 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3240 for (i = 0; i < r_u->num_entries2; i++) {
3242 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
3243 if(!sam_io_sam_entry(tmp, &r_u->sam[i], ps, depth))
3247 for (i = 0; i < r_u->num_entries2; i++) {
3249 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
3250 if(!smb_io_unistr2(tmp, &r_u->uni_dom_name[i],
3251 r_u->sam[i].hdr_name.buffer, ps,
3260 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3262 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3268 /*******************************************************************
3269 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
3270 ********************************************************************/
3272 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e,
3274 uint32 start_idx, uint32 size)
3276 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
3280 q_e->start_idx = start_idx;
3281 q_e->max_size = size;
3284 /*******************************************************************
3285 reads or writes a structure.
3286 ********************************************************************/
3288 BOOL samr_io_q_enum_dom_groups(const char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e,
3289 prs_struct *ps, int depth)
3294 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups");
3300 if(!smb_io_pol_hnd("pol", &(q_e->pol), ps, depth))
3303 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3305 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3311 /*******************************************************************
3312 inits a SAMR_R_ENUM_DOM_GROUPS structure.
3313 ********************************************************************/
3315 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u,
3316 uint32 next_idx, uint32 num_sam_entries)
3318 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
3320 r_u->next_idx = next_idx;
3322 if (num_sam_entries != 0) {
3323 r_u->ptr_entries1 = 1;
3324 r_u->ptr_entries2 = 1;
3325 r_u->num_entries2 = num_sam_entries;
3326 r_u->num_entries3 = num_sam_entries;
3328 r_u->num_entries4 = num_sam_entries;
3330 r_u->ptr_entries1 = 0;
3331 r_u->num_entries2 = num_sam_entries;
3332 r_u->ptr_entries2 = 1;
3336 /*******************************************************************
3337 reads or writes a structure.
3338 ********************************************************************/
3340 BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u,
3341 prs_struct *ps, int depth)
3348 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups");
3354 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3356 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3359 if (r_u->ptr_entries1 != 0) {
3360 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3362 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3364 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3367 if (UNMARSHALLING(ps)) {
3368 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3369 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3372 if ((r_u->sam == NULL || r_u->uni_grp_name == NULL) && r_u->num_entries2 != 0) {
3374 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3375 r_u->num_entries4 = 0;
3376 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3380 for (i = 0; i < r_u->num_entries2; i++) {
3381 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
3385 for (i = 0; i < r_u->num_entries2; i++) {
3386 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
3387 r_u->sam[i].hdr_name.buffer, ps, depth))
3394 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3396 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3402 /*******************************************************************
3403 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3404 ********************************************************************/
3406 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e,
3407 POLICY_HND *pol, uint32 start_idx,
3410 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3414 q_e->start_idx = start_idx;
3415 q_e->max_size = size;
3419 /*******************************************************************
3420 reads or writes a structure.
3421 ********************************************************************/
3423 BOOL samr_io_q_enum_dom_aliases(const char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e,
3424 prs_struct *ps, int depth)
3429 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases");
3435 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
3438 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3440 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3446 /*******************************************************************
3447 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3448 ********************************************************************/
3450 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, uint32 num_sam_entries)
3452 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3454 r_u->next_idx = next_idx;
3456 if (num_sam_entries != 0) {
3457 r_u->ptr_entries1 = 1;
3458 r_u->ptr_entries2 = 1;
3459 r_u->num_entries2 = num_sam_entries;
3460 r_u->num_entries3 = num_sam_entries;
3462 r_u->num_entries4 = num_sam_entries;
3464 r_u->ptr_entries1 = 0;
3465 r_u->num_entries2 = num_sam_entries;
3466 r_u->ptr_entries2 = 1;
3470 /*******************************************************************
3471 reads or writes a structure.
3472 ********************************************************************/
3474 BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
3475 prs_struct *ps, int depth)
3482 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases");
3488 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3490 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3493 if (r_u->ptr_entries1 != 0) {
3494 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3496 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3498 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3501 if (UNMARSHALLING(ps) && (r_u->num_entries2 > 0)) {
3502 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3503 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3506 if (r_u->num_entries2 != 0 &&
3507 (r_u->sam == NULL || r_u->uni_grp_name == NULL)) {
3508 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3509 r_u->num_entries4 = 0;
3510 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3514 for (i = 0; i < r_u->num_entries2; i++) {
3515 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
3519 for (i = 0; i < r_u->num_entries2; i++) {
3520 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
3521 r_u->sam[i].hdr_name.buffer, ps,
3529 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3531 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3537 /*******************************************************************
3538 inits a ALIAS_INFO1 structure.
3539 ********************************************************************/
3541 void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc)
3543 DEBUG(5, ("init_samr_alias_info1\n"));
3545 init_unistr4(&al1->name, acct_name, UNI_FLAGS_NONE);
3546 al1->num_member = num_member;
3547 init_unistr4(&al1->description, acct_desc, UNI_FLAGS_NONE);
3550 /*******************************************************************
3551 reads or writes a structure.
3552 ********************************************************************/
3554 BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1,
3555 prs_struct *ps, int depth)
3560 prs_debug(ps, depth, desc, "samr_io_alias_info1");
3566 if ( !prs_unistr4_hdr("name", ps, depth, &al1->name) )
3568 if ( !prs_uint32("num_member", ps, depth, &al1->num_member) )
3570 if ( !prs_unistr4_hdr("description", ps, depth, &al1->description) )
3573 if ( !prs_unistr4_str("name", ps, depth, &al1->name) )
3575 if ( !prs_align(ps) )
3577 if ( !prs_unistr4_str("description", ps, depth, &al1->description) )
3579 if ( !prs_align(ps) )
3585 /*******************************************************************
3586 inits a ALIAS_INFO3 structure.
3587 ********************************************************************/
3589 void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc)
3591 DEBUG(5, ("init_samr_alias_info3\n"));
3593 init_unistr4(&al3->description, acct_desc, UNI_FLAGS_NONE);
3596 /*******************************************************************
3597 reads or writes a structure.
3598 ********************************************************************/
3600 BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3,
3601 prs_struct *ps, int depth)
3606 prs_debug(ps, depth, desc, "samr_io_alias_info3");
3612 if (!prs_unistr4("description", ps, depth, &al3->description))
3618 /*******************************************************************
3619 reads or writes a structure.
3620 ********************************************************************/
3622 BOOL samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2,
3623 prs_struct *ps, int depth)
3628 prs_debug(ps, depth, desc, "samr_io_alias_info2");
3634 if (!prs_unistr4("name", ps, depth, &al2->name))
3640 /*******************************************************************
3641 reads or writes a structure.
3642 ********************************************************************/
3644 BOOL samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr)
3649 prs_debug(ps, depth, desc, "samr_alias_info_ctr");
3652 if ( !prs_uint16("level", ps, depth, &ctr->level) )
3657 switch (ctr->level) {
3659 if(!samr_io_alias_info1("alias_info1", &ctr->alias.info1, ps, depth))
3663 if(!samr_io_alias_info2("alias_info2", &ctr->alias.info2, ps, depth))
3667 if(!samr_io_alias_info3("alias_info3", &ctr->alias.info3, ps, depth))
3671 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3678 /*******************************************************************
3679 inits a SAMR_Q_QUERY_ALIASINFO structure.
3680 ********************************************************************/
3682 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e,
3683 POLICY_HND *pol, uint32 switch_level)
3685 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3688 q_e->level = switch_level;
3691 /*******************************************************************
3692 reads or writes a structure.
3693 ********************************************************************/
3695 BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in,
3696 prs_struct *ps, int depth)
3701 prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo");
3707 if ( !smb_io_pol_hnd("pol", &(in->pol), ps, depth) )
3710 if ( !prs_uint16("level", ps, depth, &in->level) )
3716 /*******************************************************************
3717 inits a SAMR_R_QUERY_ALIASINFO structure.
3718 ********************************************************************/
3720 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *out,
3721 ALIAS_INFO_CTR * ctr, NTSTATUS status)
3723 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3726 out->status = status;
3729 /*******************************************************************
3730 reads or writes a structure.
3731 ********************************************************************/
3733 BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out,
3734 prs_struct *ps, int depth)
3739 prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo");
3745 if ( !prs_pointer("alias", ps, depth, (void**)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr))
3750 if(!prs_ntstatus("status", ps, depth, &out->status))
3756 /*******************************************************************
3757 inits a SAMR_Q_SET_ALIASINFO structure.
3758 ********************************************************************/
3760 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u,
3761 POLICY_HND *hnd, ALIAS_INFO_CTR * ctr)
3763 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3765 q_u->alias_pol = *hnd;
3769 /*******************************************************************
3770 reads or writes a structure.
3771 ********************************************************************/
3773 BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u,
3774 prs_struct *ps, int depth)
3779 prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo");
3785 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
3787 if(!samr_alias_info_ctr("ctr", ps, depth, &q_u->ctr))
3793 /*******************************************************************
3794 reads or writes a structure.
3795 ********************************************************************/
3797 BOOL samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u,
3798 prs_struct *ps, int depth)
3803 prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo");
3808 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3814 /*******************************************************************
3815 inits a SAMR_Q_QUERY_USERALIASES structure.
3816 ********************************************************************/
3818 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u,
3821 uint32 *ptr_sid, DOM_SID2 * sid)
3823 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3827 q_u->num_sids1 = num_sids;
3829 q_u->num_sids2 = num_sids;
3831 q_u->ptr_sid = ptr_sid;
3835 /*******************************************************************
3836 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3837 ********************************************************************/
3839 BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u,
3840 prs_struct *ps, int depth)
3848 prs_debug(ps, depth, desc, "samr_io_q_query_useraliases");
3854 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
3857 if(!prs_uint32("num_sids1", ps, depth, &q_u->num_sids1))
3859 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
3865 if(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2))
3868 if (UNMARSHALLING(ps) && (q_u->num_sids2 != 0)) {
3869 q_u->ptr_sid = PRS_ALLOC_MEM(ps,uint32,q_u->num_sids2);
3870 if (q_u->ptr_sid == NULL)
3873 q_u->sid = PRS_ALLOC_MEM(ps, DOM_SID2, q_u->num_sids2);
3874 if (q_u->sid == NULL)
3878 for (i = 0; i < q_u->num_sids2; i++) {
3879 slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i);
3880 if(!prs_uint32(tmp, ps, depth, &q_u->ptr_sid[i]))
3884 for (i = 0; i < q_u->num_sids2; i++) {
3885 if (q_u->ptr_sid[i] != 0) {
3886 slprintf(tmp, sizeof(tmp) - 1, "sid[%02d]", i);
3887 if(!smb_io_dom_sid2(tmp, &q_u->sid[i], ps, depth))
3895 /*******************************************************************
3896 inits a SAMR_R_QUERY_USERALIASES structure.
3897 ********************************************************************/
3899 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u,
3900 uint32 num_rids, uint32 *rid,
3903 DEBUG(5, ("init_samr_r_query_useraliases\n"));
3905 if (NT_STATUS_IS_OK(status)) {
3906 r_u->num_entries = num_rids;
3908 r_u->num_entries2 = num_rids;
3912 r_u->num_entries = 0;
3914 r_u->num_entries2 = 0;
3917 r_u->status = status;
3920 /*******************************************************************
3921 reads or writes a structure.
3922 ********************************************************************/
3924 BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid,
3925 prs_struct *ps, int depth)
3932 prs_debug(ps, depth, desc, "samr_io_rids");
3938 if(!prs_uint32("num_rids", ps, depth, num_rids))
3941 if ((*num_rids) != 0) {
3942 if (UNMARSHALLING(ps)) {
3944 (*rid) = PRS_ALLOC_MEM(ps,uint32, *num_rids);
3949 for (i = 0; i < (*num_rids); i++) {
3950 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d]", i);
3951 if(!prs_uint32(tmp, ps, depth, &((*rid)[i])))
3959 /*******************************************************************
3960 reads or writes a structure.
3961 ********************************************************************/
3963 BOOL samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u,
3964 prs_struct *ps, int depth)
3969 prs_debug(ps, depth, desc, "samr_io_r_query_useraliases");
3975 if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries))
3977 if(!prs_uint32("ptr ", ps, depth, &r_u->ptr))
3980 if (r_u->ptr != 0) {
3981 if(!samr_io_rids("rids", &r_u->num_entries2, &r_u->rid, ps, depth))
3987 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3993 /*******************************************************************
3994 inits a SAMR_Q_OPEN_ALIAS structure.
3995 ********************************************************************/
3997 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol,
3998 uint32 access_mask, uint32 rid)
4000 DEBUG(5, ("init_samr_q_open_alias\n"));
4002 q_u->dom_pol = *pol;
4003 q_u->access_mask = access_mask;
4004 q_u->rid_alias = rid;
4007 /*******************************************************************
4008 reads or writes a structure.
4009 ********************************************************************/
4011 BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u,
4012 prs_struct *ps, int depth)
4017 prs_debug(ps, depth, desc, "samr_io_q_open_alias");
4023 if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
4026 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
4028 if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias))
4034 /*******************************************************************
4035 reads or writes a structure.
4036 ********************************************************************/
4038 BOOL samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u,
4039 prs_struct *ps, int depth)
4044 prs_debug(ps, depth, desc, "samr_io_r_open_alias");
4050 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4053 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4059 /*******************************************************************
4060 inits a SAMR_Q_LOOKUP_RIDS structure.
4061 ********************************************************************/
4063 void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u,
4064 POLICY_HND *pol, uint32 flags,
4065 uint32 num_rids, uint32 *rid)
4067 DEBUG(5, ("init_samr_q_lookup_rids\n"));
4071 q_u->num_rids1 = num_rids;
4074 q_u->num_rids2 = num_rids;
4075 q_u->rid = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids );
4076 if (q_u->rid == NULL) {
4080 memcpy(q_u->rid, rid, num_rids * sizeof(q_u->rid[0]));
4084 /*******************************************************************
4085 reads or writes a structure.
4086 ********************************************************************/
4088 BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u,
4089 prs_struct *ps, int depth)
4097 prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
4100 if (UNMARSHALLING(ps))
4106 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
4109 if(!prs_uint32("num_rids1", ps, depth, &q_u->num_rids1))
4111 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
4113 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
4115 if(!prs_uint32("num_rids2", ps, depth, &q_u->num_rids2))
4118 if (UNMARSHALLING(ps) && (q_u->num_rids2 != 0)) {
4119 q_u->rid = PRS_ALLOC_MEM(ps, uint32, q_u->num_rids2);
4120 if (q_u->rid == NULL)
4124 for (i = 0; i < q_u->num_rids2; i++) {
4125 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
4126 if(!prs_uint32(tmp, ps, depth, &q_u->rid[i]))
4133 /*******************************************************************
4134 inits a SAMR_R_LOOKUP_RIDS structure.
4135 ********************************************************************/
4137 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u,
4138 uint32 num_names, UNIHDR * hdr_name,
4139 UNISTR2 *uni_name, uint32 *type)
4141 DEBUG(5, ("init_samr_r_lookup_rids\n"));
4143 r_u->hdr_name = NULL;
4144 r_u->uni_name = NULL;
4147 if (num_names != 0) {
4148 r_u->num_names1 = num_names;
4150 r_u->num_names2 = num_names;
4152 r_u->num_types1 = num_names;
4154 r_u->num_types2 = num_names;
4156 r_u->hdr_name = hdr_name;
4157 r_u->uni_name = uni_name;
4160 r_u->num_names1 = num_names;
4162 r_u->num_names2 = num_names;
4164 r_u->num_types1 = num_names;
4166 r_u->num_types2 = num_names;
4170 /*******************************************************************
4171 reads or writes a structure.
4172 ********************************************************************/
4174 BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u,
4175 prs_struct *ps, int depth)
4182 prs_debug(ps, depth, desc, "samr_io_r_lookup_rids");
4188 if(!prs_uint32("num_names1", ps, depth, &r_u->num_names1))
4190 if(!prs_uint32("ptr_names ", ps, depth, &r_u->ptr_names))
4193 if (r_u->ptr_names != 0) {
4195 if(!prs_uint32("num_names2", ps, depth, &r_u->num_names2))
4199 if (UNMARSHALLING(ps) && (r_u->num_names2 != 0)) {
4200 r_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, r_u->num_names2);
4201 if (r_u->hdr_name == NULL)
4204 r_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, r_u->num_names2);
4205 if (r_u->uni_name == NULL)
4209 for (i = 0; i < r_u->num_names2; i++) {
4210 slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
4211 if(!smb_io_unihdr("", &r_u->hdr_name[i], ps, depth))
4214 for (i = 0; i < r_u->num_names2; i++) {
4215 slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
4216 if(!smb_io_unistr2("", &r_u->uni_name[i], r_u->hdr_name[i].buffer, ps, depth))
4224 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
4226 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
4229 if (r_u->ptr_types != 0) {
4231 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
4234 if (UNMARSHALLING(ps) && (r_u->num_types2 != 0)) {
4235 r_u->type = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
4236 if (r_u->type == NULL)
4240 for (i = 0; i < r_u->num_types2; i++) {
4241 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
4242 if(!prs_uint32(tmp, ps, depth, &r_u->type[i]))
4247 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4253 /*******************************************************************
4254 inits a SAMR_Q_OPEN_ALIAS structure.
4255 ********************************************************************/
4257 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd)
4259 DEBUG(5, ("init_samr_q_delete_alias\n"));
4261 q_u->alias_pol = *hnd;
4264 /*******************************************************************
4265 reads or writes a structure.
4266 ********************************************************************/
4268 BOOL samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
4269 prs_struct *ps, int depth)
4274 prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
4280 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4286 /*******************************************************************
4287 reads or writes a structure.
4288 ********************************************************************/
4290 BOOL samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
4291 prs_struct *ps, int depth)
4296 prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
4302 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4304 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4310 /*******************************************************************
4311 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
4312 ********************************************************************/
4314 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
4315 POLICY_HND *hnd, const char *acct_desc)
4317 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
4319 q_u->dom_pol = *hnd;
4321 init_unistr2(&q_u->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
4322 init_uni_hdr(&q_u->hdr_acct_desc, &q_u->uni_acct_desc);
4324 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
4327 /*******************************************************************
4328 reads or writes a structure.
4329 ********************************************************************/
4331 BOOL samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u,
4332 prs_struct *ps, int depth)
4337 prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
4343 if(!smb_io_pol_hnd("dom_pol", &q_u->dom_pol, ps, depth))
4346 if(!smb_io_unihdr("hdr_acct_desc", &q_u->hdr_acct_desc, ps, depth))
4348 if(!smb_io_unistr2("uni_acct_desc", &q_u->uni_acct_desc,
4349 q_u->hdr_acct_desc.buffer, ps, depth))
4354 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
4360 /*******************************************************************
4361 reads or writes a structure.
4362 ********************************************************************/
4364 BOOL samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u,
4365 prs_struct *ps, int depth)
4370 prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
4376 if(!smb_io_pol_hnd("alias_pol", &r_u->alias_pol, ps, depth))
4379 if(!prs_uint32("rid", ps, depth, &r_u->rid))
4382 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4388 /*******************************************************************
4389 inits a SAMR_Q_ADD_ALIASMEM structure.
4390 ********************************************************************/
4392 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd,
4395 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
4397 q_u->alias_pol = *hnd;
4398 init_dom_sid2(&q_u->sid, sid);
4401 /*******************************************************************
4402 reads or writes a structure.
4403 ********************************************************************/
4405 BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u,
4406 prs_struct *ps, int depth)
4411 prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
4417 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4419 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
4425 /*******************************************************************
4426 reads or writes a structure.
4427 ********************************************************************/
4429 BOOL samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u,
4430 prs_struct *ps, int depth)
4435 prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
4441 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4447 /*******************************************************************
4448 inits a SAMR_Q_DEL_ALIASMEM structure.
4449 ********************************************************************/
4451 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd,
4454 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4456 q_u->alias_pol = *hnd;
4457 init_dom_sid2(&q_u->sid, sid);
4460 /*******************************************************************
4461 reads or writes a structure.
4462 ********************************************************************/
4464 BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u,
4465 prs_struct *ps, int depth)
4470 prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
4476 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4478 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
4484 /*******************************************************************
4485 reads or writes a structure.
4486 ********************************************************************/
4488 BOOL samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
4489 prs_struct *ps, int depth)
4494 prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
4500 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4506 /*******************************************************************
4507 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4508 ********************************************************************/
4510 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c,
4513 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4515 q_c->alias_pol = *hnd;
4518 /*******************************************************************
4519 reads or writes a structure.
4520 ********************************************************************/
4522 BOOL samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
4523 prs_struct *ps, int depth)
4528 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
4534 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4540 /*******************************************************************
4541 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4542 ********************************************************************/
4544 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u,
4547 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4549 r_u->status = status;
4552 /*******************************************************************
4553 reads or writes a structure.
4554 ********************************************************************/
4556 BOOL samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
4557 prs_struct *ps, int depth)
4562 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
4568 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4571 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4577 /*******************************************************************
4578 inits a SAMR_Q_QUERY_ALIASMEM structure.
4579 ********************************************************************/
4581 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c,
4584 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4586 q_c->alias_pol = *hnd;
4589 /*******************************************************************
4590 reads or writes a structure.
4591 ********************************************************************/
4593 BOOL samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u,
4594 prs_struct *ps, int depth)
4599 prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem");
4605 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4611 /*******************************************************************
4612 inits a SAMR_R_QUERY_ALIASMEM structure.
4613 ********************************************************************/
4615 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u,
4616 uint32 num_sids, DOM_SID2 * sid,
4619 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4621 if (NT_STATUS_IS_OK(status)) {
4622 r_u->num_sids = num_sids;
4623 r_u->ptr = (num_sids != 0) ? 1 : 0;
4624 r_u->num_sids1 = num_sids;
4632 r_u->status = status;
4635 /*******************************************************************
4636 reads or writes a structure.
4637 ********************************************************************/
4639 BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u,
4640 prs_struct *ps, int depth)
4647 prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem");
4653 if(!prs_uint32("num_sids ", ps, depth, &r_u->num_sids))
4655 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
4658 if (r_u->ptr != 0 && r_u->num_sids != 0) {
4659 uint32 *ptr_sid = NULL;
4661 if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1))
4664 ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1);
4669 for (i = 0; i < r_u->num_sids1; i++) {
4671 if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i]))
4675 if (UNMARSHALLING(ps)) {
4676 r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1);
4679 for (i = 0; i < r_u->num_sids1; i++) {
4680 if (ptr_sid[i] != 0) {
4681 if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth))
4689 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4695 /*******************************************************************
4696 inits a SAMR_Q_LOOKUP_NAMES structure.
4697 ********************************************************************/
4699 NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
4700 POLICY_HND *pol, uint32 flags,
4701 uint32 num_names, const char **name)
4705 DEBUG(5, ("init_samr_q_lookup_names\n"));
4709 q_u->num_names1 = num_names;
4712 q_u->num_names2 = num_names;
4714 if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names)))
4715 return NT_STATUS_NO_MEMORY;
4717 if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names)))
4718 return NT_STATUS_NO_MEMORY;
4720 for (i = 0; i < num_names; i++) {
4721 init_unistr2(&q_u->uni_name[i], name[i], UNI_FLAGS_NONE); /* unicode string for machine account */
4722 init_uni_hdr(&q_u->hdr_name[i], &q_u->uni_name[i]); /* unicode header for user_name */
4725 return NT_STATUS_OK;
4728 /*******************************************************************
4729 reads or writes a structure.
4730 ********************************************************************/
4732 BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
4733 prs_struct *ps, int depth)
4740 prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
4743 if (UNMARSHALLING(ps))
4749 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
4752 if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1))
4754 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
4756 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
4758 if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2))
4761 if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) {
4762 q_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_u->num_names2);
4763 q_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_u->num_names2);
4764 if (!q_u->hdr_name || !q_u->uni_name)
4768 for (i = 0; i < q_u->num_names2; i++) {
4769 if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth))
4773 for (i = 0; i < q_u->num_names2; i++) {
4774 if(!smb_io_unistr2("", &q_u->uni_name[i], q_u->hdr_name[i].buffer, ps, depth))
4781 /*******************************************************************
4782 inits a SAMR_R_LOOKUP_NAMES structure.
4783 ********************************************************************/
4785 NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
4787 uint32 *rid, uint32 *type,
4790 DEBUG(5, ("init_samr_r_lookup_names\n"));
4792 if (NT_STATUS_IS_OK(status) && (num_rids != 0)) {
4795 r_u->num_types1 = num_rids;
4797 r_u->num_types2 = num_rids;
4799 r_u->num_rids1 = num_rids;
4801 r_u->num_rids2 = num_rids;
4803 if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
4804 return NT_STATUS_NO_MEMORY;
4805 if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
4806 return NT_STATUS_NO_MEMORY;
4808 if (!r_u->rids || !r_u->types)
4811 for (i = 0; i < num_rids; i++) {
4812 r_u->rids[i] = rid[i];
4813 r_u->types[i] = type[i];
4818 r_u->num_types1 = 0;
4820 r_u->num_types2 = 0;
4830 r_u->status = status;
4832 return NT_STATUS_OK;
4835 /*******************************************************************
4836 reads or writes a structure.
4837 ********************************************************************/
4839 BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u,
4840 prs_struct *ps, int depth)
4848 prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
4851 if (UNMARSHALLING(ps))
4857 if(!prs_uint32("num_rids1", ps, depth, &r_u->num_rids1))
4859 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
4862 if (r_u->ptr_rids != 0) {
4863 if(!prs_uint32("num_rids2", ps, depth, &r_u->num_rids2))
4866 if (r_u->num_rids2 != r_u->num_rids1) {
4871 if (UNMARSHALLING(ps))
4872 r_u->rids = PRS_ALLOC_MEM(ps, uint32, r_u->num_rids2);
4875 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
4879 for (i = 0; i < r_u->num_rids2; i++) {
4880 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
4881 if(!prs_uint32(tmp, ps, depth, &r_u->rids[i]))
4886 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
4888 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
4891 if (r_u->ptr_types != 0) {
4892 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
4895 if (r_u->num_types2 != r_u->num_types1) {
4900 if (UNMARSHALLING(ps))
4901 r_u->types = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
4904 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
4908 for (i = 0; i < r_u->num_types2; i++) {
4909 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
4910 if(!prs_uint32(tmp, ps, depth, &r_u->types[i]))
4915 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4921 /*******************************************************************
4922 inits a SAMR_Q_DELETE_DOM_USER structure.
4923 ********************************************************************/
4925 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c,
4928 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
4930 q_c->user_pol = *hnd;
4933 /*******************************************************************
4934 reads or writes a structure.
4935 ********************************************************************/
4937 BOOL samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u,
4938 prs_struct *ps, int depth)
4943 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_user");
4949 if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
4955 /*******************************************************************
4956 reads or writes a structure.
4957 ********************************************************************/
4959 BOOL samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u,
4960 prs_struct *ps, int depth)
4965 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_user");
4971 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4973 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4979 /*******************************************************************
4980 reads or writes a structure.
4981 ********************************************************************/
4983 void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u,
4985 uint32 access_mask, uint32 rid)
4987 DEBUG(5, ("samr_init_samr_q_open_user\n"));
4989 q_u->domain_pol = *pol;
4990 q_u->access_mask = access_mask;
4991 q_u->user_rid = rid;
4994 /*******************************************************************
4995 reads or writes a structure.
4996 ********************************************************************/
4998 BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u,
4999 prs_struct *ps, int depth)
5004 prs_debug(ps, depth, desc, "samr_io_q_open_user");
5010 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
5013 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
5015 if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid))
5021 /*******************************************************************
5022 reads or writes a structure.
5023 ********************************************************************/
5025 BOOL samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u,
5026 prs_struct *ps, int depth)
5031 prs_debug(ps, depth, desc, "samr_io_r_open_user");
5037 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
5040 if(!prs_ntstatus("status", ps, depth, &r_u->status))
5047 /*******************************************************************
5048 reads or writes a structure.
5049 ********************************************************************/
5051 void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
5054 uint32 acb_info, uint32 access_mask)
5056 DEBUG(5, ("samr_init_samr_q_create_user\n"));
5058 q_u->domain_pol = *pol;
5060 init_unistr2(&q_u->uni_name, name, UNI_FLAGS_NONE);
5061 init_uni_hdr(&q_u->hdr_name, &q_u->uni_name);
5063 q_u->acb_info = acb_info;
5064 q_u->access_mask = access_mask;
5067 /*******************************************************************
5068 reads or writes a structure.
5069 ********************************************************************/
5071 BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u,
5072 prs_struct *ps, int depth)
5077 prs_debug(ps, depth, desc, "samr_io_q_create_user");
5083 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
5086 if(!smb_io_unihdr("hdr_name", &q_u->hdr_name, ps, depth))
5088 if(!smb_io_unistr2("uni_name", &q_u->uni_name, q_u->hdr_name.buffer, ps, depth))
5093 if(!prs_uint32("acb_info ", ps, depth, &q_u->acb_info))
5095 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
5101 /*******************************************************************
5102 reads or writes a structure.
5103 ********************************************************************/
5105 BOOL samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u,
5106 prs_struct *ps, int depth)
5111 prs_debug(ps, depth, desc, "samr_io_r_create_user");
5117 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
5120 if(!prs_uint32("access_granted", ps, depth, &r_u->access_granted))
5122 if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid))
5124 if(!prs_ntstatus("status", ps, depth, &r_u->status))
5130 /*******************************************************************
5131 inits a SAMR_Q_QUERY_USERINFO structure.
5132 ********************************************************************/
5134 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u,
5135 const POLICY_HND *hnd, uint16 switch_value)
5137 DEBUG(5, ("init_samr_q_query_userinfo\n"));
5140 q_u->switch_value = switch_value;
5143 /*******************************************************************
5144 reads or writes a structure.
5145 ********************************************************************/
5147 BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u,
5148 prs_struct *ps, int depth)
5153 prs_debug(ps, depth, desc, "samr_io_q_query_userinfo");
5159 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
5162 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) /* 0x0015 or 0x0011 */
5168 /*******************************************************************
5169 reads or writes a LOGON_HRS structure.
5170 ********************************************************************/
5172 static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs,
5173 prs_struct *ps, int depth)
5178 prs_debug(ps, depth, desc, "sam_io_logon_hrs");
5184 if(!prs_uint32("maxlen", ps, depth, &hrs->max_len))
5187 if(!prs_uint32("offset", ps, depth, &hrs->offset))
5190 if(!prs_uint32("len ", ps, depth, &hrs->len))
5193 if (hrs->len > sizeof(hrs->hours)) {
5194 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs->len));
5195 hrs->len = sizeof(hrs->hours);
5198 if(!prs_uint8s(False, "hours", ps, depth, hrs->hours, hrs->len))
5204 /*******************************************************************
5205 inits a SAM_USER_INFO_18 structure.
5206 ********************************************************************/
5208 void init_sam_user_info18(SAM_USER_INFO_18 * usr,
5209 const uint8 lm_pwd[16], const uint8 nt_pwd[16])
5211 DEBUG(5, ("init_sam_user_info18\n"));
5213 usr->lm_pwd_active =
5214 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)) ? 1 : 0;
5215 usr->nt_pwd_active =
5216 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)) ? 1 : 0;
5219 /*******************************************************************
5220 reads or writes a structure.
5221 ********************************************************************/
5223 static BOOL sam_io_user_info18(const char *desc, SAM_USER_INFO_18 * u,
5224 prs_struct *ps, int depth)
5229 prs_debug(ps, depth, desc, "samr_io_r_user_info18");
5235 if(!prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd)))
5237 if(!prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd)))
5240 if(!prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active))
5242 if(!prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active))
5248 /*******************************************************************
5249 inits a SAM_USER_INFO_7 structure.
5250 ********************************************************************/
5252 void init_sam_user_info7(SAM_USER_INFO_7 * usr, const char *name)
5254 DEBUG(5, ("init_sam_user_info7\n"));
5256 init_unistr2(&usr->uni_name, name, UNI_FLAGS_NONE); /* unicode string for name */
5257 init_uni_hdr(&usr->hdr_name, &usr->uni_name); /* unicode header for name */
5261 /*******************************************************************
5262 reads or writes a structure.
5263 ********************************************************************/
5265 static BOOL sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr,
5266 prs_struct *ps, int depth)
5271 prs_debug(ps, depth, desc, "samr_io_r_user_info7");
5277 if(!smb_io_unihdr("unihdr", &usr->hdr_name, ps, depth))
5280 if(!smb_io_unistr2("unistr2", &usr->uni_name, True, ps, depth))
5286 /*******************************************************************
5287 inits a SAM_USER_INFO_9 structure.
5288 ********************************************************************/
5290 void init_sam_user_info9(SAM_USER_INFO_9 * usr, uint32 rid_group)
5292 DEBUG(5, ("init_sam_user_info9\n"));
5294 usr->rid_group = rid_group;
5297 /*******************************************************************
5298 reads or writes a structure.
5299 ********************************************************************/
5301 static BOOL sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr,
5302 prs_struct *ps, int depth)
5307 prs_debug(ps, depth, desc, "samr_io_r_user_info9");
5313 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
5319 /*******************************************************************
5320 inits a SAM_USER_INFO_16 structure.
5321 ********************************************************************/
5323 void init_sam_user_info16(SAM_USER_INFO_16 * usr, uint32 acb_info)
5325 DEBUG(5, ("init_sam_user_info16\n"));
5327 usr->acb_info = acb_info;
5330 /*******************************************************************
5331 reads or writes a structure.
5332 ********************************************************************/
5334 static BOOL sam_io_user_info16(const char *desc, SAM_USER_INFO_16 * usr,
5335 prs_struct *ps, int depth)
5340 prs_debug(ps, depth, desc, "samr_io_r_user_info16");
5346 if(!prs_uint32("acb_info", ps, depth, &usr->acb_info))
5352 /*******************************************************************
5353 inits a SAM_USER_INFO_17 structure.
5354 ********************************************************************/
5356 void init_sam_user_info17(SAM_USER_INFO_17 * usr,
5359 uint32 rid_user, uint32 rid_group, uint16 acct_ctrl)
5361 DEBUG(5, ("init_sam_user_info17\n"));
5363 memcpy(&usr->expiry, expiry, sizeof(usr->expiry)); /* expiry time or something? */
5364 ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */
5366 usr->padding_2 = 0; /* 0 - padding 4 bytes */
5368 usr->ptr_1 = 1; /* pointer */
5369 ZERO_STRUCT(usr->padding_3); /* 0 - padding 32 bytes */
5370 usr->padding_4 = 0; /* 0 - padding 4 bytes */
5372 usr->ptr_2 = 1; /* pointer */
5373 usr->padding_5 = 0; /* 0 - padding 4 bytes */
5375 usr->ptr_3 = 1; /* pointer */
5376 ZERO_STRUCT(usr->padding_6); /* 0 - padding 32 bytes */
5378 usr->rid_user = rid_user;
5379 usr->rid_group = rid_group;
5381 usr->acct_ctrl = acct_ctrl;
5382 usr->unknown_3 = 0x0000;
5384 usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */
5385 usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */
5387 ZERO_STRUCT(usr->padding_7); /* 0 - padding 16 bytes */
5388 usr->padding_8 = 0; /* 0 - padding 4 bytes */
5390 init_unistr2(&usr->uni_mach_acct, mach_acct, UNI_FLAGS_NONE); /* unicode string for machine account */
5391 init_uni_hdr(&usr->hdr_mach_acct, &usr->uni_mach_acct); /* unicode header for machine account */
5394 /*******************************************************************
5395 reads or writes a structure.
5396 ********************************************************************/
5398 static BOOL sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr,
5399 prs_struct *ps, int depth)
5404 prs_debug(ps, depth, desc, "samr_io_r_unknown_17");
5410 if(!prs_uint8s(False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)))
5413 if(!smb_io_time("time", &usr->expiry, ps, depth))
5416 if(!prs_uint8s(False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)))
5419 if(!smb_io_unihdr("unihdr", &usr->hdr_mach_acct, ps, depth))
5422 if(!prs_uint32("padding_2", ps, depth, &usr->padding_2))
5425 if(!prs_uint32("ptr_1 ", ps, depth, &usr->ptr_1))
5427 if(!prs_uint8s(False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)))
5430 if(!prs_uint32("padding_4", ps, depth, &usr->padding_4))
5433 if(!prs_uint32("ptr_2 ", ps, depth, &usr->ptr_2))
5435 if(!prs_uint32("padding_5", ps, depth, &usr->padding_5))
5438 if(!prs_uint32("ptr_3 ", ps, depth, &usr->ptr_3))
5440 if(!prs_uint8s(False, "padding_6", ps, depth, usr->padding_6,sizeof(usr->padding_6)))
5443 if(!prs_uint32("rid_user ", ps, depth, &usr->rid_user))
5445 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
5447 if(!prs_uint16("acct_ctrl", ps, depth, &usr->acct_ctrl))
5449 if(!prs_uint16("unknown_3", ps, depth, &usr->unknown_3))
5451 if(!prs_uint16("unknown_4", ps, depth, &usr->unknown_4))
5453 if(!prs_uint16("unknown_5", ps, depth, &usr->unknown_5))
5456 if(!prs_uint8s(False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)))
5459 if(!prs_uint32("padding_8", ps, depth, &(usr->padding_8)))
5462 if(!smb_io_unistr2("unistr2", &usr->uni_mach_acct, True, ps, depth))
5468 if(!prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)))
5474 /*************************************************************************
5476 *************************************************************************/
5478 void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_len)
5480 DEBUG(10, ("init_sam_user_info24:\n"));
5481 memcpy(usr->pass, newpass, sizeof(usr->pass));
5482 usr->pw_len = pw_len;
5485 /*******************************************************************
5486 reads or writes a structure.
5487 ********************************************************************/
5489 static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr,
5490 prs_struct *ps, int depth)
5495 prs_debug(ps, depth, desc, "sam_io_user_info24");
5501 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
5505 if (MARSHALLING(ps) && (usr->pw_len != 0)) {
5506 if (!prs_uint16("pw_len", ps, depth, &usr->pw_len))
5508 } else if (UNMARSHALLING(ps)) {
5509 if (!prs_uint16("pw_len", ps, depth, &usr->pw_len))
5516 /*******************************************************************
5517 reads or writes a structure.
5518 ********************************************************************/
5520 static BOOL sam_io_user_info26(const char *desc, SAM_USER_INFO_26 * usr,
5521 prs_struct *ps, int depth)
5526 prs_debug(ps, depth, desc, "sam_io_user_info26");
5532 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
5536 if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
5543 /*************************************************************************
5544 init_sam_user_info23
5546 unknown_6 = 0x0000 04ec
5548 *************************************************************************/
5550 void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
5551 NTTIME * logoff_time, /* all zeros */
5552 NTTIME * kickoff_time, /* all zeros */
5553 NTTIME * pass_last_set_time, /* all zeros */
5554 NTTIME * pass_can_change_time, /* all zeros */
5555 NTTIME * pass_must_change_time, /* all zeros */
5566 uint32 user_rid, /* 0x0000 0000 */
5569 uint32 fields_present,
5572 uint16 bad_password_count,
5576 usr->logon_time = *logon_time; /* all zeros */
5577 usr->logoff_time = *logoff_time; /* all zeros */
5578 usr->kickoff_time = *kickoff_time; /* all zeros */
5579 usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
5580 usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
5581 usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
5583 ZERO_STRUCT(usr->nt_pwd);
5584 ZERO_STRUCT(usr->lm_pwd);
5586 usr->user_rid = user_rid; /* 0x0000 0000 */
5587 usr->group_rid = group_rid;
5588 usr->acb_info = acb_info;
5589 usr->fields_present = fields_present; /* 09f8 27fa */
5591 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
5592 usr->ptr_logon_hrs = hrs ? 1 : 0;
5594 if (nt_time_is_zero(pass_must_change_time)) {
5595 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
5597 usr->passmustchange=0;
5600 ZERO_STRUCT(usr->padding1);
5601 ZERO_STRUCT(usr->padding2);
5603 usr->bad_password_count = bad_password_count;
5604 usr->logon_count = logon_count;
5606 memcpy(usr->pass, newpass, sizeof(usr->pass));
5608 copy_unistr2(&usr->uni_user_name, user_name);
5609 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
5611 copy_unistr2(&usr->uni_full_name, full_name);
5612 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
5614 copy_unistr2(&usr->uni_home_dir, home_dir);
5615 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
5617 copy_unistr2(&usr->uni_dir_drive, dir_drive);
5618 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
5620 copy_unistr2(&usr->uni_logon_script, log_scr);
5621 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
5623 copy_unistr2(&usr->uni_profile_path, prof_path);
5624 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
5626 copy_unistr2(&usr->uni_acct_desc, desc);
5627 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
5629 copy_unistr2(&usr->uni_workstations, wkstas);
5630 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
5632 copy_unistr2(&usr->uni_unknown_str, unk_str);
5633 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
5635 copy_unistr2(&usr->uni_munged_dial, mung_dial);
5636 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
5639 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
5641 ZERO_STRUCT(usr->logon_hrs);
5645 /*************************************************************************
5646 init_sam_user_info23
5648 unknown_6 = 0x0000 04ec
5650 *************************************************************************/
5652 void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
5653 NTTIME * logoff_time, /* all zeros */
5654 NTTIME * kickoff_time, /* all zeros */
5655 NTTIME * pass_last_set_time, /* all zeros */
5656 NTTIME * pass_can_change_time, /* all zeros */
5657 NTTIME * pass_must_change_time, /* all zeros */
5658 char *user_name, /* NULL */
5660 char *home_dir, char *dir_drive, char *log_scr,
5661 char *prof_path, const char *desc, char *wkstas,
5662 char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */
5663 uint32 group_rid, uint32 acb_info,
5664 uint32 fields_present, uint16 logon_divs,
5665 LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count,
5668 DATA_BLOB blob = base64_decode_data_blob(mung_dial);
5670 usr->logon_time = *logon_time; /* all zeros */
5671 usr->logoff_time = *logoff_time; /* all zeros */
5672 usr->kickoff_time = *kickoff_time; /* all zeros */
5673 usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
5674 usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
5675 usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
5677 ZERO_STRUCT(usr->nt_pwd);
5678 ZERO_STRUCT(usr->lm_pwd);
5680 usr->user_rid = user_rid; /* 0x0000 0000 */
5681 usr->group_rid = group_rid;
5682 usr->acb_info = acb_info;
5683 usr->fields_present = fields_present; /* 09f8 27fa */
5685 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
5686 usr->ptr_logon_hrs = hrs ? 1 : 0;
5688 if (nt_time_is_zero(pass_must_change_time)) {
5689 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
5691 usr->passmustchange=0;
5694 ZERO_STRUCT(usr->padding1);
5695 ZERO_STRUCT(usr->padding2);
5697 usr->bad_password_count = bad_password_count;
5698 usr->logon_count = logon_count;
5700 memcpy(usr->pass, newpass, sizeof(usr->pass));
5702 init_unistr2(&usr->uni_user_name, user_name, UNI_FLAGS_NONE);
5703 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
5705 init_unistr2(&usr->uni_full_name, full_name, UNI_FLAGS_NONE);
5706 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
5708 init_unistr2(&usr->uni_home_dir, home_dir, UNI_FLAGS_NONE);
5709 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
5711 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_FLAGS_NONE);
5712 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
5714 init_unistr2(&usr->uni_logon_script, log_scr, UNI_FLAGS_NONE);
5715 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
5717 init_unistr2(&usr->uni_profile_path, prof_path, UNI_FLAGS_NONE);
5718 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
5720 init_unistr2(&usr->uni_acct_desc, desc, UNI_FLAGS_NONE);
5721 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
5723 init_unistr2(&usr->uni_workstations, wkstas, UNI_FLAGS_NONE);
5724 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
5726 init_unistr2(&usr->uni_unknown_str, unk_str, UNI_FLAGS_NONE);
5727 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
5729 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
5730 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
5732 data_blob_free(&blob);
5735 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
5737 ZERO_STRUCT(usr->logon_hrs);
5741 /*******************************************************************
5742 reads or writes a structure.
5743 ********************************************************************/
5745 static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr,
5746 prs_struct *ps, int depth)
5751 prs_debug(ps, depth, desc, "sam_io_user_info23");
5757 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
5759 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
5761 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
5763 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
5765 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
5767 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
5770 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
5772 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
5774 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
5776 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
5778 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
5780 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
5782 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
5784 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
5786 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
5788 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
5791 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
5793 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
5796 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
5798 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
5800 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
5803 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
5805 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
5809 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
5812 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
5814 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
5817 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
5819 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
5821 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
5825 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
5828 /* here begins pointed-to data */
5830 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
5833 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
5836 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
5839 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
5842 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
5845 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
5848 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
5851 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
5854 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
5857 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
5860 /* ok, this is only guess-work (as usual) */
5861 if (usr->ptr_logon_hrs) {
5862 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
5869 /*******************************************************************
5870 reads or writes a structure.
5871 NB. This structure is *definately* incorrect. It's my best guess
5872 currently for W2K SP2. The password field is encrypted in a different
5873 way than normal... And there are definately other problems. JRA.
5874 ********************************************************************/
5876 static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth)
5881 prs_debug(ps, depth, desc, "sam_io_user_info25");
5887 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
5889 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
5891 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
5893 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
5895 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
5897 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
5900 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
5902 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
5904 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
5906 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
5908 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
5910 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
5912 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
5914 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
5916 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
5918 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
5921 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
5923 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
5926 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
5928 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
5930 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
5933 if(!prs_uint32s(False, "unknown_6 ", ps, depth, usr->unknown_6, 6))
5936 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
5939 /* here begins pointed-to data */
5941 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
5944 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
5947 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
5950 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
5953 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
5956 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
5959 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
5962 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
5965 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
5968 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
5971 #if 0 /* JRA - unknown... */
5972 /* ok, this is only guess-work (as usual) */
5973 if (usr->ptr_logon_hrs) {
5974 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
5983 /*************************************************************************
5984 init_sam_user_info21W
5986 unknown_6 = 0x0000 04ec
5988 *************************************************************************/
5990 void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
5991 NTTIME * logon_time,
5992 NTTIME * logoff_time,
5993 NTTIME * kickoff_time,
5994 NTTIME * pass_last_set_time,
5995 NTTIME * pass_can_change_time,
5996 NTTIME * pass_must_change_time,
6012 uint32 fields_present,
6015 uint16 bad_password_count,
6018 usr->logon_time = *logon_time;
6019 usr->logoff_time = *logoff_time;
6020 usr->kickoff_time = *kickoff_time;
6021 usr->pass_last_set_time = *pass_last_set_time;
6022 usr->pass_can_change_time = *pass_can_change_time;
6023 usr->pass_must_change_time = *pass_must_change_time;
6025 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd));
6026 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd));
6028 usr->user_rid = user_rid;
6029 usr->group_rid = group_rid;
6030 usr->acb_info = acb_info;
6031 usr->fields_present = fields_present; /* 0x00ff ffff */
6033 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
6034 usr->ptr_logon_hrs = hrs ? 1 : 0;
6035 usr->bad_password_count = bad_password_count;
6036 usr->logon_count = logon_count;
6038 if (nt_time_is_zero(pass_must_change_time)) {
6039 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
6041 usr->passmustchange=0;
6044 ZERO_STRUCT(usr->padding1);
6045 ZERO_STRUCT(usr->padding2);
6047 copy_unistr2(&usr->uni_user_name, user_name);
6048 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
6050 copy_unistr2(&usr->uni_full_name, full_name);
6051 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
6053 copy_unistr2(&usr->uni_home_dir, home_dir);
6054 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
6056 copy_unistr2(&usr->uni_dir_drive, dir_drive);
6057 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
6059 copy_unistr2(&usr->uni_logon_script, log_scr);
6060 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
6062 copy_unistr2(&usr->uni_profile_path, prof_path);
6063 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
6065 copy_unistr2(&usr->uni_acct_desc, desc);
6066 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
6068 copy_unistr2(&usr->uni_workstations, wkstas);
6069 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
6071 copy_unistr2(&usr->uni_unknown_str, unk_str);
6072 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
6074 copy_unistr2(&usr->uni_munged_dial, mung_dial);
6075 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6078 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
6080 ZERO_STRUCT(usr->logon_hrs);
6084 /*************************************************************************
6085 init_sam_user_info21
6087 unknown_6 = 0x0000 04ec
6089 *************************************************************************/
6091 NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID *domain_sid)
6093 NTTIME logon_time, logoff_time, kickoff_time,
6094 pass_last_set_time, pass_can_change_time,
6095 pass_must_change_time;
6097 const char* user_name = pdb_get_username(pw);
6098 const char* full_name = pdb_get_fullname(pw);
6099 const char* home_dir = pdb_get_homedir(pw);
6100 const char* dir_drive = pdb_get_dir_drive(pw);
6101 const char* logon_script = pdb_get_logon_script(pw);
6102 const char* profile_path = pdb_get_profile_path(pw);
6103 const char* description = pdb_get_acct_desc(pw);
6104 const char* workstations = pdb_get_workstations(pw);
6105 const char* munged_dial = pdb_get_munged_dial(pw);
6106 DATA_BLOB munged_dial_blob;
6109 const DOM_SID *user_sid;
6112 const DOM_SID *group_sid;
6115 munged_dial_blob = base64_decode_data_blob(munged_dial);
6117 munged_dial_blob = data_blob(NULL, 0);
6120 /* Create NTTIME structs */
6121 unix_to_nt_time (&logon_time, pdb_get_logon_time(pw));
6122 unix_to_nt_time (&logoff_time, pdb_get_logoff_time(pw));
6123 unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(pw));
6124 unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(pw));
6125 unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(pw));
6126 unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(pw));
6128 /* structure assignment */
6129 usr->logon_time = logon_time;
6130 usr->logoff_time = logoff_time;
6131 usr->kickoff_time = kickoff_time;
6132 usr->pass_last_set_time = pass_last_set_time;
6133 usr->pass_can_change_time = pass_can_change_time;
6134 usr->pass_must_change_time = pass_must_change_time;
6136 ZERO_STRUCT(usr->nt_pwd);
6137 ZERO_STRUCT(usr->lm_pwd);
6139 user_sid = pdb_get_user_sid(pw);
6141 if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) {
6142 fstring user_sid_string;
6143 fstring domain_sid_string;
6144 DEBUG(0, ("init_sam_user_info_21A: User %s has SID %s, \nwhich conflicts with "
6145 "the domain sid %s. Failing operation.\n",
6147 sid_to_string(user_sid_string, user_sid),
6148 sid_to_string(domain_sid_string, domain_sid)));
6149 data_blob_free(&munged_dial_blob);
6150 return NT_STATUS_UNSUCCESSFUL;
6153 group_sid = pdb_get_group_sid(pw);
6155 if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) {
6156 fstring group_sid_string;
6157 fstring domain_sid_string;
6158 DEBUG(0, ("init_sam_user_info_21A: User %s has Primary Group SID %s, \n"
6159 "which conflicts with the domain sid %s. Failing operation.\n",
6161 sid_to_string(group_sid_string, group_sid),
6162 sid_to_string(domain_sid_string, domain_sid)));
6163 data_blob_free(&munged_dial_blob);
6164 return NT_STATUS_UNSUCCESSFUL;
6167 usr->user_rid = user_rid;
6168 usr->group_rid = group_rid;
6169 usr->acb_info = pdb_get_acct_ctrl(pw);
6172 Look at a user on a real NT4 PDC with usrmgr, press
6173 'ok'. Then you will see that fields_present is set to
6174 0x08f827fa. Look at the user immediately after that again,
6175 and you will see that 0x00fffff is returned. This solves
6176 the problem that you get access denied after having looked
6180 usr->fields_present = pdb_build_fields_present(pw);
6182 usr->logon_divs = pdb_get_logon_divs(pw);
6183 usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0;
6184 usr->bad_password_count = pdb_get_bad_password_count(pw);
6185 usr->logon_count = pdb_get_logon_count(pw);
6187 if (pdb_get_pass_must_change_time(pw) == 0) {
6188 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
6190 usr->passmustchange=0;
6193 ZERO_STRUCT(usr->padding1);
6194 ZERO_STRUCT(usr->padding2);
6196 init_unistr2(&usr->uni_user_name, user_name, UNI_STR_TERMINATE);
6197 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
6199 init_unistr2(&usr->uni_full_name, full_name, UNI_STR_TERMINATE);
6200 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
6202 init_unistr2(&usr->uni_home_dir, home_dir, UNI_STR_TERMINATE);
6203 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
6205 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_STR_TERMINATE);
6206 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
6208 init_unistr2(&usr->uni_logon_script, logon_script, UNI_STR_TERMINATE);
6209 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
6211 init_unistr2(&usr->uni_profile_path, profile_path, UNI_STR_TERMINATE);
6212 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
6214 init_unistr2(&usr->uni_acct_desc, description, UNI_STR_TERMINATE);
6215 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
6217 init_unistr2(&usr->uni_workstations, workstations, UNI_STR_TERMINATE);
6218 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
6220 init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE);
6221 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
6223 init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob);
6224 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6225 data_blob_free(&munged_dial_blob);
6227 if (pdb_get_hours(pw)) {
6228 usr->logon_hrs.max_len = 1260;
6229 usr->logon_hrs.offset = 0;
6230 usr->logon_hrs.len = pdb_get_hours_len(pw);
6231 memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN);
6233 usr->logon_hrs.max_len = 1260;
6234 usr->logon_hrs.offset = 0;
6235 usr->logon_hrs.len = 0;
6236 memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs));
6239 return NT_STATUS_OK;
6242 /*******************************************************************
6243 reads or writes a structure.
6244 ********************************************************************/
6246 static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr,
6247 prs_struct *ps, int depth)
6252 prs_debug(ps, depth, desc, "sam_io_user_info21");
6258 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
6260 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
6262 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps,depth))
6264 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
6266 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps,depth))
6268 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
6271 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
6273 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
6275 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
6277 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
6279 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
6281 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
6283 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
6285 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
6287 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
6289 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
6292 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
6294 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
6297 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
6299 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
6301 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
6304 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
6306 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
6310 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
6313 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
6315 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
6318 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
6320 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
6322 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
6325 /* here begins pointed-to data */
6327 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
6329 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
6331 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
6333 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
6335 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
6337 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
6339 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
6341 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
6343 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
6345 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */
6348 /* ok, this is only guess-work (as usual) */
6349 if (usr->ptr_logon_hrs) {
6350 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
6357 void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw)
6359 const char *munged_dial = pdb_get_munged_dial(pw);
6360 DATA_BLOB blob = base64_decode_data_blob(munged_dial);
6362 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
6363 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6364 data_blob_free(&blob);
6367 /*******************************************************************
6368 reads or writes a structure.
6369 ********************************************************************/
6371 static BOOL sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr,
6372 prs_struct *ps, int depth)
6377 prs_debug(ps, depth, desc, "sam_io_user_info20");
6383 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
6386 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */
6392 /*******************************************************************
6393 inits a SAM_USERINFO_CTR structure.
6394 ********************************************************************/
6396 NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr,
6397 uint16 switch_value,
6398 SAM_USER_INFO_21 * usr)
6400 DEBUG(5, ("make_samr_userinfo_ctr_usr21\n"));
6402 ctr->switch_value = switch_value;
6403 ctr->info.id = NULL;
6405 switch (switch_value) {
6407 ctr->info.id16 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_16);
6408 if (ctr->info.id16 == NULL)
6409 return NT_STATUS_NO_MEMORY;
6411 init_sam_user_info16(ctr->info.id16, usr->acb_info);
6414 /* whoops - got this wrong. i think. or don't understand what's happening. */
6418 info = (void *)&id11;
6420 expire.low = 0xffffffff;
6421 expire.high = 0x7fffffff;
6423 ctr->info.id = TALLOC_ZERO_P(ctx,SAM_USER_INFO_17);
6424 init_sam_user_info11(ctr->info.id17, &expire,
6425 "BROOKFIELDS$", /* name */
6426 0x03ef, /* user rid */
6427 0x201, /* group rid */
6428 0x0080); /* acb info */
6434 ctr->info.id18 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_18);
6435 if (ctr->info.id18 == NULL)
6436 return NT_STATUS_NO_MEMORY;
6438 init_sam_user_info18(ctr->info.id18, usr->lm_pwd, usr->nt_pwd);
6442 SAM_USER_INFO_21 *cusr;
6443 cusr = TALLOC_ZERO_P(ctx,SAM_USER_INFO_21);
6444 ctr->info.id21 = cusr;
6445 if (ctr->info.id21 == NULL)
6446 return NT_STATUS_NO_MEMORY;
6447 memcpy(cusr, usr, sizeof(*usr));
6448 memset(cusr->lm_pwd, 0, sizeof(cusr->lm_pwd));
6449 memset(cusr->nt_pwd, 0, sizeof(cusr->nt_pwd));
6453 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
6454 return NT_STATUS_INVALID_INFO_CLASS;
6457 return NT_STATUS_OK;
6460 /*******************************************************************
6461 inits a SAM_USERINFO_CTR structure.
6462 ********************************************************************/
6464 static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key,
6465 uint16 switch_value, void *info)
6467 DEBUG(5, ("init_samr_userinfo_ctr\n"));
6469 ctr->switch_value = switch_value;
6470 ctr->info.id = info;
6472 switch (switch_value) {
6474 SamOEMhashBlob(ctr->info.id24->pass, 516, sess_key);
6475 dump_data(100, (char *)sess_key->data, sess_key->length);
6476 dump_data(100, (char *)ctr->info.id24->pass, 516);
6479 SamOEMhashBlob(ctr->info.id23->pass, 516, sess_key);
6480 dump_data(100, (char *)sess_key->data, sess_key->length);
6481 dump_data(100, (char *)ctr->info.id23->pass, 516);
6486 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value));
6490 /*******************************************************************
6491 reads or writes a structure.
6492 ********************************************************************/
6494 static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr,
6495 prs_struct *ps, int depth)
6498 SAM_USERINFO_CTR *ctr;
6500 prs_debug(ps, depth, desc, "samr_io_userinfo_ctr");
6503 if (UNMARSHALLING(ps)) {
6504 ctr = PRS_ALLOC_MEM(ps,SAM_USERINFO_CTR,1);
6512 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
6514 if(!prs_uint16("switch_value", ps, depth, &ctr->switch_value))
6521 switch (ctr->switch_value) {
6523 if (UNMARSHALLING(ps))
6524 ctr->info.id7 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_7,1);
6525 if (ctr->info.id7 == NULL) {
6526 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6529 ret = sam_io_user_info7("", ctr->info.id7, ps, depth);
6532 if (UNMARSHALLING(ps))
6533 ctr->info.id9 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_9,1);
6534 if (ctr->info.id9 == NULL) {
6535 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6538 ret = sam_io_user_info9("", ctr->info.id9, ps, depth);
6541 if (UNMARSHALLING(ps))
6542 ctr->info.id16 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_16,1);
6543 if (ctr->info.id16 == NULL) {
6544 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6547 ret = sam_io_user_info16("", ctr->info.id16, ps, depth);
6550 if (UNMARSHALLING(ps))
6551 ctr->info.id17 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_17,1);
6553 if (ctr->info.id17 == NULL) {
6554 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6557 ret = sam_io_user_info17("", ctr->info.id17, ps, depth);
6560 if (UNMARSHALLING(ps))
6561 ctr->info.id18 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_18,1);
6563 if (ctr->info.id18 == NULL) {
6564 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6567 ret = sam_io_user_info18("", ctr->info.id18, ps, depth);
6570 if (UNMARSHALLING(ps))
6571 ctr->info.id20 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_20,1);
6573 if (ctr->info.id20 == NULL) {
6574 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6577 ret = sam_io_user_info20("", ctr->info.id20, ps, depth);
6580 if (UNMARSHALLING(ps))
6581 ctr->info.id21 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_21,1);
6583 if (ctr->info.id21 == NULL) {
6584 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6587 ret = sam_io_user_info21("", ctr->info.id21, ps, depth);
6590 if (UNMARSHALLING(ps))
6591 ctr->info.id23 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_23,1);
6593 if (ctr->info.id23 == NULL) {
6594 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6597 ret = sam_io_user_info23("", ctr->info.id23, ps, depth);
6600 if (UNMARSHALLING(ps))
6601 ctr->info.id24 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_24,1);
6603 if (ctr->info.id24 == NULL) {
6604 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6607 ret = sam_io_user_info24("", ctr->info.id24, ps, depth);
6610 if (UNMARSHALLING(ps))
6611 ctr->info.id25 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_25,1);
6613 if (ctr->info.id25 == NULL) {
6614 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6617 ret = sam_io_user_info25("", ctr->info.id25, ps, depth);
6620 if (UNMARSHALLING(ps))
6621 ctr->info.id26 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_26,1);
6623 if (ctr->info.id26 == NULL) {
6624 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6627 ret = sam_io_user_info26("", ctr->info.id26, ps, depth);
6630 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value));
6638 /*******************************************************************
6639 inits a SAMR_R_QUERY_USERINFO structure.
6640 ********************************************************************/
6642 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u,
6643 SAM_USERINFO_CTR * ctr, NTSTATUS status)
6645 DEBUG(5, ("init_samr_r_query_userinfo\n"));
6650 if (NT_STATUS_IS_OK(status)) {
6655 r_u->status = status; /* return status */
6658 /*******************************************************************
6659 reads or writes a structure.
6660 ********************************************************************/
6662 BOOL samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u,
6663 prs_struct *ps, int depth)
6668 prs_debug(ps, depth, desc, "samr_io_r_query_userinfo");
6674 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
6677 if (r_u->ptr != 0) {
6678 if(!samr_io_userinfo_ctr("ctr", &r_u->ctr, ps, depth))
6684 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6690 /*******************************************************************
6691 inits a SAMR_Q_SET_USERINFO structure.
6692 ********************************************************************/
6694 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u,
6695 const POLICY_HND *hnd, DATA_BLOB *sess_key,
6696 uint16 switch_value, void *info)
6698 DEBUG(5, ("init_samr_q_set_userinfo\n"));
6701 q_u->switch_value = switch_value;
6702 init_samr_userinfo_ctr(q_u->ctr, sess_key, switch_value, info);
6705 /*******************************************************************
6706 reads or writes a structure.
6707 ********************************************************************/
6709 BOOL samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u,
6710 prs_struct *ps, int depth)
6715 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo");
6721 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
6723 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
6725 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
6731 /*******************************************************************
6732 inits a SAMR_R_SET_USERINFO structure.
6733 ********************************************************************/
6735 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status)
6737 DEBUG(5, ("init_samr_r_set_userinfo\n"));
6739 r_u->status = status; /* return status */
6742 /*******************************************************************
6743 reads or writes a structure.
6744 ********************************************************************/
6746 BOOL samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u,
6747 prs_struct *ps, int depth)
6752 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo");
6758 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6764 /*******************************************************************
6765 inits a SAMR_Q_SET_USERINFO2 structure.
6766 ********************************************************************/
6768 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
6769 const POLICY_HND *hnd, DATA_BLOB *sess_key,
6770 uint16 switch_value, SAM_USERINFO_CTR * ctr)
6772 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
6775 q_u->switch_value = switch_value;
6778 if (q_u->ctr != NULL)
6779 q_u->ctr->switch_value = switch_value;
6781 switch (switch_value) {
6783 SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key);
6784 SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key);
6785 dump_data(100, (char *)sess_key->data, sess_key->length);
6786 dump_data(100, (char *)ctr->info.id18->lm_pwd, 16);
6787 dump_data(100, (char *)ctr->info.id18->nt_pwd, 16);
6792 /*******************************************************************
6793 reads or writes a structure.
6794 ********************************************************************/
6796 BOOL samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u,
6797 prs_struct *ps, int depth)
6802 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2");
6808 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
6811 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
6813 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
6819 /*******************************************************************
6820 inits a SAMR_R_SET_USERINFO2 structure.
6821 ********************************************************************/
6823 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status)
6825 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
6827 r_u->status = status; /* return status */
6830 /*******************************************************************
6831 reads or writes a structure.
6832 ********************************************************************/
6834 BOOL samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u,
6835 prs_struct *ps, int depth)
6840 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2");
6846 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6852 /*******************************************************************
6853 inits a SAMR_Q_CONNECT structure.
6854 ********************************************************************/
6856 void init_samr_q_connect(SAMR_Q_CONNECT * q_u,
6857 char *srv_name, uint32 access_mask)
6859 DEBUG(5, ("init_samr_q_connect\n"));
6861 /* make PDC server name \\server */
6862 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
6863 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
6865 /* example values: 0x0000 0002 */
6866 q_u->access_mask = access_mask;
6869 /*******************************************************************
6870 reads or writes a structure.
6871 ********************************************************************/
6873 BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u,
6874 prs_struct *ps, int depth)
6879 prs_debug(ps, depth, desc, "samr_io_q_connect");
6885 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
6887 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
6892 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
6898 /*******************************************************************
6899 reads or writes a structure.
6900 ********************************************************************/
6902 BOOL samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u,
6903 prs_struct *ps, int depth)
6908 prs_debug(ps, depth, desc, "samr_io_r_connect");
6914 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
6917 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6923 /*******************************************************************
6924 inits a SAMR_Q_CONNECT4 structure.
6925 ********************************************************************/
6927 void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u,
6928 char *srv_name, uint32 access_mask)
6930 DEBUG(5, ("init_samr_q_connect4\n"));
6932 /* make PDC server name \\server */
6933 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
6934 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
6936 /* Only value we've seen, possibly an address type ? */
6939 /* example values: 0x0000 0002 */
6940 q_u->access_mask = access_mask;
6943 /*******************************************************************
6944 reads or writes a structure.
6945 ********************************************************************/
6947 BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u,
6948 prs_struct *ps, int depth)
6953 prs_debug(ps, depth, desc, "samr_io_q_connect4");
6959 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
6961 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
6966 if(!prs_uint32("unk_0", ps, depth, &q_u->unk_0))
6968 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
6974 /*******************************************************************
6975 reads or writes a structure.
6976 ********************************************************************/
6978 BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u,
6979 prs_struct *ps, int depth)
6984 prs_debug(ps, depth, desc, "samr_io_r_connect4");
6990 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
6993 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6999 /*******************************************************************
7000 inits a SAMR_Q_CONNECT5 structure.
7001 ********************************************************************/
7003 void init_samr_q_connect5(SAMR_Q_CONNECT5 * q_u,
7004 char *srv_name, uint32 access_mask)
7006 DEBUG(5, ("init_samr_q_connect5\n"));
7008 /* make PDC server name \\server */
7009 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
7010 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
7012 /* example values: 0x0000 0002 */
7013 q_u->access_mask = access_mask;
7016 q_u->info1_unk1 = 3;
7017 q_u->info1_unk2 = 0;
7020 /*******************************************************************
7021 inits a SAMR_R_CONNECT5 structure.
7022 ********************************************************************/
7024 void init_samr_r_connect5(SAMR_R_CONNECT5 * r_u, POLICY_HND *pol, NTSTATUS status)
7026 DEBUG(5, ("init_samr_q_connect5\n"));
7029 r_u->info1_unk1 = 3;
7030 r_u->info1_unk2 = 0;
7032 r_u->connect_pol = *pol;
7033 r_u->status = status;
7036 /*******************************************************************
7037 reads or writes a structure.
7038 ********************************************************************/
7040 BOOL samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u,
7041 prs_struct *ps, int depth)
7046 prs_debug(ps, depth, desc, "samr_io_q_connect5");
7052 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
7054 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
7059 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
7062 if(!prs_uint32("level", ps, depth, &q_u->level))
7064 if(!prs_uint32("level", ps, depth, &q_u->level))
7067 if(!prs_uint32("info1_unk1", ps, depth, &q_u->info1_unk1))
7069 if(!prs_uint32("info1_unk2", ps, depth, &q_u->info1_unk2))
7075 /*******************************************************************
7076 reads or writes a structure.
7077 ********************************************************************/
7079 BOOL samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u,
7080 prs_struct *ps, int depth)
7085 prs_debug(ps, depth, desc, "samr_io_r_connect5");
7091 if(!prs_uint32("level", ps, depth, &r_u->level))
7093 if(!prs_uint32("level", ps, depth, &r_u->level))
7095 if(!prs_uint32("info1_unk1", ps, depth, &r_u->info1_unk1))
7097 if(!prs_uint32("info1_unk2", ps, depth, &r_u->info1_unk2))
7100 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7103 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7109 /*******************************************************************
7110 inits a SAMR_Q_CONNECT_ANON structure.
7111 ********************************************************************/
7113 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u)
7115 DEBUG(5, ("init_samr_q_connect_anon\n"));
7118 q_u->unknown_0 = 0x5c; /* server name (?!!) */
7119 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
7122 /*******************************************************************
7123 reads or writes a structure.
7124 ********************************************************************/
7126 BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u,
7127 prs_struct *ps, int depth)
7132 prs_debug(ps, depth, desc, "samr_io_q_connect_anon");
7138 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
7141 if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0))
7146 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
7152 /*******************************************************************
7153 reads or writes a structure.
7154 ********************************************************************/
7156 BOOL samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u,
7157 prs_struct *ps, int depth)
7162 prs_debug(ps, depth, desc, "samr_io_r_connect_anon");
7168 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7171 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7177 /*******************************************************************
7178 inits a SAMR_Q_GET_DOM_PWINFO structure.
7179 ********************************************************************/
7181 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
7184 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
7187 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_FLAGS_NONE);
7188 init_uni_hdr(&q_u->hdr_srv_name, &q_u->uni_srv_name);
7191 /*******************************************************************
7192 reads or writes a structure.
7193 ********************************************************************/
7195 BOOL samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u,
7196 prs_struct *ps, int depth)
7201 prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo");
7207 if(!prs_uint32("ptr", ps, depth, &q_u->ptr))
7209 if (q_u->ptr != 0) {
7210 if(!smb_io_unihdr("", &q_u->hdr_srv_name, ps, depth))
7212 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth))
7219 /*******************************************************************
7220 reads or writes a structure.
7221 ********************************************************************/
7223 BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u,
7224 prs_struct *ps, int depth)
7229 prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo");
7235 if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
7239 if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
7242 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7248 /*******************************************************************
7249 make a SAMR_ENC_PASSWD structure.
7250 ********************************************************************/
7252 void init_enc_passwd(SAMR_ENC_PASSWD * pwd, const char pass[512])
7260 memcpy(pwd->pass, pass, sizeof(pwd->pass));
7264 /*******************************************************************
7265 reads or writes a SAMR_ENC_PASSWD structure.
7266 ********************************************************************/
7268 BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd,
7269 prs_struct *ps, int depth)
7274 prs_debug(ps, depth, desc, "samr_io_enc_passwd");
7280 if(!prs_uint32("ptr", ps, depth, &pwd->ptr))
7283 if (pwd->ptr != 0) {
7284 if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)))
7291 /*******************************************************************
7292 inits a SAMR_ENC_HASH structure.
7293 ********************************************************************/
7295 void init_enc_hash(SAMR_ENC_HASH * hsh, const uchar hash[16])
7303 memcpy(hsh->hash, hash, sizeof(hsh->hash));
7307 /*******************************************************************
7308 reads or writes a SAMR_ENC_HASH structure.
7309 ********************************************************************/
7311 BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh,
7312 prs_struct *ps, int depth)
7317 prs_debug(ps, depth, desc, "samr_io_enc_hash");
7323 if(!prs_uint32("ptr ", ps, depth, &hsh->ptr))
7325 if (hsh->ptr != 0) {
7326 if(!prs_uint8s(False, "hash", ps, depth, hsh->hash,sizeof(hsh->hash)))
7333 /*******************************************************************
7334 inits a SAMR_Q_CHGPASSWD_USER structure.
7335 ********************************************************************/
7337 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u,
7338 const char *dest_host, const char *user_name,
7339 const uchar nt_newpass[516],
7340 const uchar nt_oldhash[16],
7341 const uchar lm_newpass[516],
7342 const uchar lm_oldhash[16])
7344 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
7347 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
7348 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
7350 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
7351 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
7353 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
7354 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
7356 q_u->unknown = 0x01;
7358 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
7359 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
7362 /*******************************************************************
7363 reads or writes a structure.
7364 ********************************************************************/
7366 BOOL samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u,
7367 prs_struct *ps, int depth)
7372 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user");
7378 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
7381 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
7383 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
7388 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
7390 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
7393 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
7395 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
7398 if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
7401 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
7403 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
7409 /*******************************************************************
7410 inits a SAMR_R_CHGPASSWD_USER structure.
7411 ********************************************************************/
7413 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status)
7415 DEBUG(5, ("init_samr_r_chgpasswd_user\n"));
7417 r_u->status = status;
7420 /*******************************************************************
7421 reads or writes a structure.
7422 ********************************************************************/
7424 BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u,
7425 prs_struct *ps, int depth)
7430 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user");
7436 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7442 /*******************************************************************
7443 inits a SAMR_Q_CHGPASSWD3 structure.
7444 ********************************************************************/
7446 void init_samr_q_chgpasswd_user3(SAMR_Q_CHGPASSWD_USER3 * q_u,
7447 const char *dest_host, const char *user_name,
7448 const uchar nt_newpass[516],
7449 const uchar nt_oldhash[16],
7450 const uchar lm_newpass[516],
7451 const uchar lm_oldhash[16])
7453 DEBUG(5, ("init_samr_q_chgpasswd_user3\n"));
7456 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
7457 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
7459 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
7460 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
7462 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
7463 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
7465 q_u->lm_change = 0x01;
7467 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
7468 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
7470 init_enc_passwd(&q_u->password3, NULL);
7473 /*******************************************************************
7474 reads or writes a structure.
7475 ********************************************************************/
7477 BOOL samr_io_q_chgpasswd_user3(const char *desc, SAMR_Q_CHGPASSWD_USER3 * q_u,
7478 prs_struct *ps, int depth)
7483 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user3");
7489 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
7492 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
7494 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
7499 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
7501 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
7504 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
7506 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
7509 if(!prs_uint32("lm_change", ps, depth, &q_u->lm_change))
7512 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
7514 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
7517 if(!samr_io_enc_passwd("password3", &q_u->password3, ps, depth))
7523 /*******************************************************************
7524 inits a SAMR_R_CHGPASSWD_USER3 structure.
7525 ********************************************************************/
7527 void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3 *r_u, NTSTATUS status,
7528 SAMR_CHANGE_REJECT *reject, SAM_UNK_INFO_1 *info)
7530 DEBUG(5, ("init_samr_r_chgpasswd_user3\n"));
7532 r_u->status = status;
7536 r_u->ptr_reject = 0;
7542 if (reject && (reject->reject_reason != Undefined)) {
7543 r_u->reject = reject;
7544 r_u->ptr_reject = 1;
7548 /*******************************************************************
7549 Reads or writes an SAMR_CHANGE_REJECT structure.
7550 ********************************************************************/
7552 BOOL samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_struct *ps, int depth)
7557 prs_debug(ps, depth, desc, "samr_io_change_reject");
7563 if(UNMARSHALLING(ps))
7564 ZERO_STRUCTP(reject);
7566 if (!prs_uint32("reject_reason", ps, depth, &reject->reject_reason))
7569 if (!prs_uint32("unknown1", ps, depth, &reject->unknown1))
7572 if (!prs_uint32("unknown2", ps, depth, &reject->unknown2))
7578 /*******************************************************************
7579 reads or writes a structure.
7580 ********************************************************************/
7582 BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u,
7583 prs_struct *ps, int depth)
7588 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user3");
7594 if (!prs_uint32("ptr_info", ps, depth, &r_u->ptr_info))
7597 if (r_u->ptr_info && r_u->info != NULL) {
7598 /* SAM_UNK_INFO_1 */
7599 if (!sam_io_unk_info1("info", r_u->info, ps, depth))
7603 if (!prs_uint32("ptr_reject", ps, depth, &r_u->ptr_reject))
7606 if (r_u->ptr_reject && r_u->reject != NULL) {
7607 /* SAMR_CHANGE_REJECT */
7608 if (!samr_io_change_reject("reject", r_u->reject, ps, depth))
7612 if (!prs_ntstatus("status", ps, depth, &r_u->status))
7618 /*******************************************************************
7619 reads or writes a structure.
7620 ********************************************************************/
7622 void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
7623 POLICY_HND *domain_pol, uint16 switch_value)
7625 DEBUG(5, ("init_samr_q_query_domain_info2\n"));
7627 q_u->domain_pol = *domain_pol;
7628 q_u->switch_value = switch_value;
7631 /*******************************************************************
7632 reads or writes a structure.
7633 ********************************************************************/
7635 BOOL samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
7636 prs_struct *ps, int depth)
7641 prs_debug(ps, depth, desc, "samr_io_q_query_domain_info2");
7647 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
7650 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
7656 /*******************************************************************
7657 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7658 ********************************************************************/
7660 void init_samr_r_samr_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
7661 uint16 switch_value, SAM_UNK_CTR * ctr,
7664 DEBUG(5, ("init_samr_r_samr_query_domain_info2\n"));
7667 r_u->switch_value = 0;
7668 r_u->status = status; /* return status */
7670 if (NT_STATUS_IS_OK(status)) {
7671 r_u->switch_value = switch_value;
7677 /*******************************************************************
7678 reads or writes a structure.
7679 ********************************************************************/
7681 BOOL samr_io_r_samr_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
7682 prs_struct *ps, int depth)
7687 prs_debug(ps, depth, desc, "samr_io_r_samr_query_domain_info2");
7693 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
7696 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
7697 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
7702 switch (r_u->switch_value) {
7704 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
7708 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
7712 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
7716 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
7720 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
7724 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
7728 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
7732 DEBUG(0, ("samr_io_r_samr_query_domain_info2: unknown switch level 0x%x\n",
7733 r_u->switch_value));
7734 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
7742 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7749 /*******************************************************************
7750 reads or writes a structure.
7751 ********************************************************************/
7753 void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u,
7754 POLICY_HND *domain_pol, uint16 switch_value, SAM_UNK_CTR *ctr)
7756 DEBUG(5, ("init_samr_q_set_domain_info\n"));
7758 q_u->domain_pol = *domain_pol;
7759 q_u->switch_value0 = switch_value;
7761 q_u->switch_value = switch_value;
7766 /*******************************************************************
7767 reads or writes a structure.
7768 ********************************************************************/
7770 BOOL samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u,
7771 prs_struct *ps, int depth)
7776 prs_debug(ps, depth, desc, "samr_io_q_set_domain_info");
7782 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
7785 if(!prs_uint16("switch_value0", ps, depth, &q_u->switch_value0))
7788 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
7794 if (UNMARSHALLING(ps)) {
7795 if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL)
7799 switch (q_u->switch_value) {
7802 if(!sam_io_unk_info12("unk_inf12", &q_u->ctr->info.inf12, ps, depth))
7806 if(!sam_io_unk_info7("unk_inf7",&q_u->ctr->info.inf7, ps,depth))
7810 if(!sam_io_unk_info6("unk_inf6",&q_u->ctr->info.inf6, ps,depth))
7814 if(!sam_io_unk_info5("unk_inf5",&q_u->ctr->info.inf5, ps,depth))
7818 if(!sam_io_unk_info3("unk_inf3",&q_u->ctr->info.inf3, ps,depth))
7822 if(!sam_io_unk_info2("unk_inf2",&q_u->ctr->info.inf2, ps,depth))
7826 if(!sam_io_unk_info1("unk_inf1",&q_u->ctr->info.inf1, ps,depth))
7830 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
7831 q_u->switch_value));
7838 /*******************************************************************
7839 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7840 ********************************************************************/
7842 void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status)
7844 DEBUG(5, ("init_samr_r_set_domain_info\n"));
7846 r_u->status = status; /* return status */
7849 /*******************************************************************
7850 reads or writes a structure.
7851 ********************************************************************/
7853 BOOL samr_io_r_set_domain_info(const char *desc, SAMR_R_SET_DOMAIN_INFO * r_u,
7854 prs_struct *ps, int depth)
7859 prs_debug(ps, depth, desc, "samr_io_r_samr_unknown_2e");
7865 if(!prs_ntstatus("status", ps, depth, &r_u->status))