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_domain_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u,
465 POLICY_HND *domain_pol, uint16 switch_value)
467 DEBUG(5, ("samr_init_samr_q_query_domain_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_domain_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_domain_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))
498 /*******************************************************************
500 ********************************************************************/
502 void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist,
503 uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age)
505 u_1->min_length_password = min_pass_len;
506 u_1->password_history = pass_hist;
508 if (lp_check_password_script() && *lp_check_password_script()) {
509 password_properties |= DOMAIN_PASSWORD_COMPLEX;
511 u_1->password_properties = password_properties;
513 /* password never expire */
514 u_1->expire.high = nt_expire.high;
515 u_1->expire.low = nt_expire.low;
517 /* can change the password now */
518 u_1->min_passwordage.high = nt_min_age.high;
519 u_1->min_passwordage.low = nt_min_age.low;
523 /*******************************************************************
524 reads or writes a structure.
525 ********************************************************************/
527 static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1,
528 prs_struct *ps, int depth)
533 prs_debug(ps, depth, desc, "sam_io_unk_info1");
536 if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password))
538 if(!prs_uint16("password_history", ps, depth, &u_1->password_history))
540 if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties))
542 if(!smb_io_time("expire", &u_1->expire, ps, depth))
544 if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth))
550 /*******************************************************************
552 ********************************************************************/
554 void init_unk_info2(SAM_UNK_INFO_2 * u_2,
555 const char *comment, const char *domain, const char *server,
556 uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role)
558 u_2->logout.low = nt_logout.low;
559 u_2->logout.high = nt_logout.high;
561 u_2->seq_num.low = seq_num;
562 u_2->seq_num.high = 0x00000000;
565 u_2->unknown_4 = 0x00000001;
566 u_2->server_role = server_role;
567 u_2->unknown_6 = 0x00000001;
568 u_2->num_domain_usrs = num_users;
569 u_2->num_domain_grps = num_groups;
570 u_2->num_local_grps = num_alias;
572 init_unistr2(&u_2->uni_comment, comment, UNI_FLAGS_NONE);
573 init_uni_hdr(&u_2->hdr_comment, &u_2->uni_comment);
574 init_unistr2(&u_2->uni_domain, domain, UNI_FLAGS_NONE);
575 init_uni_hdr(&u_2->hdr_domain, &u_2->uni_domain);
576 init_unistr2(&u_2->uni_server, server, UNI_FLAGS_NONE);
577 init_uni_hdr(&u_2->hdr_server, &u_2->uni_server);
580 /*******************************************************************
581 reads or writes a structure.
582 ********************************************************************/
584 static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2,
585 prs_struct *ps, int depth)
590 prs_debug(ps, depth, desc, "sam_io_unk_info2");
593 if(!smb_io_time("logout", &u_2->logout, ps, depth))
595 if(!smb_io_unihdr("hdr_comment", &u_2->hdr_comment, ps, depth))
597 if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth))
599 if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth))
602 /* put all the data in here, at the moment, including what the above
603 pointer is referring to
606 if(!prs_uint64("seq_num ", ps, depth, &u_2->seq_num))
609 if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4)) /* 0x0000 0001 */
611 if(!prs_uint32("server_role ", ps, depth, &u_2->server_role))
613 if(!prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6)) /* 0x0000 0001 */
615 if(!prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs))
617 if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps))
619 if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps))
622 if(!smb_io_unistr2("uni_comment", &u_2->uni_comment, u_2->hdr_comment.buffer, ps, depth))
624 if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth))
626 if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth))
632 /*******************************************************************
634 ********************************************************************/
636 void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout)
638 u_3->logout.low = nt_logout.low;
639 u_3->logout.high = nt_logout.high;
642 /*******************************************************************
643 reads or writes a structure.
644 ********************************************************************/
646 static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3,
647 prs_struct *ps, int depth)
652 prs_debug(ps, depth, desc, "sam_io_unk_info3");
655 if(!smb_io_time("logout", &u_3->logout, ps, depth))
661 /*******************************************************************
663 ********************************************************************/
665 void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment)
667 init_unistr2(&u_4->uni_comment, comment, UNI_FLAGS_NONE);
668 init_uni_hdr(&u_4->hdr_comment, &u_4->uni_comment);
671 /*******************************************************************
672 reads or writes a structure.
673 ********************************************************************/
675 static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4,
676 prs_struct *ps, int depth)
681 prs_debug(ps, depth, desc, "sam_io_unk_info4");
684 if(!smb_io_unihdr("hdr_comment", &u_4->hdr_comment, ps, depth))
687 if(!smb_io_unistr2("uni_comment", &u_4->uni_comment, u_4->hdr_comment.buffer, ps, depth))
693 /*******************************************************************
695 ********************************************************************/
697 void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain)
699 init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE);
700 init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain);
703 /*******************************************************************
704 reads or writes a structure.
705 ********************************************************************/
707 static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5,
708 prs_struct *ps, int depth)
713 prs_debug(ps, depth, desc, "sam_io_unk_info5");
716 if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth))
719 if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth))
725 /*******************************************************************
727 ********************************************************************/
729 void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server)
731 init_unistr2(&u_6->uni_server, server, UNI_FLAGS_NONE);
732 init_uni_hdr(&u_6->hdr_server, &u_6->uni_server);
735 /*******************************************************************
736 reads or writes a structure.
737 ********************************************************************/
739 static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6,
740 prs_struct *ps, int depth)
745 prs_debug(ps, depth, desc, "sam_io_unk_info6");
748 if(!smb_io_unihdr("hdr_server", &u_6->hdr_server, ps, depth))
751 if(!smb_io_unistr2("uni_server", &u_6->uni_server, u_6->hdr_server.buffer, ps, depth))
757 /*******************************************************************
759 ********************************************************************/
761 void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role)
763 u_7->server_role = server_role;
766 /*******************************************************************
767 reads or writes a structure.
768 ********************************************************************/
770 static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7,
771 prs_struct *ps, int depth)
776 prs_debug(ps, depth, desc, "sam_io_unk_info7");
779 if(!prs_uint16("server_role", ps, depth, &u_7->server_role))
785 /*******************************************************************
787 ********************************************************************/
789 void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num)
791 unix_to_nt_time(&u_8->domain_create_time, 0);
792 u_8->seq_num.low = seq_num;
793 u_8->seq_num.high = 0x0000;
796 /*******************************************************************
797 reads or writes a structure.
798 ********************************************************************/
800 static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8,
801 prs_struct *ps, int depth)
806 prs_debug(ps, depth, desc, "sam_io_unk_info8");
809 if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num))
812 if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth))
818 /*******************************************************************
820 ********************************************************************/
822 void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown)
824 u_9->unknown = unknown;
827 /*******************************************************************
828 reads or writes a structure.
829 ********************************************************************/
831 static BOOL sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9,
832 prs_struct *ps, int depth)
837 prs_debug(ps, depth, desc, "sam_io_unk_info9");
840 if (!prs_uint32("unknown", ps, depth, &u_9->unknown))
846 /*******************************************************************
848 ********************************************************************/
850 void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout)
852 u_12->duration.low = nt_lock_duration.low;
853 u_12->duration.high = nt_lock_duration.high;
854 u_12->reset_count.low = nt_reset_time.low;
855 u_12->reset_count.high = nt_reset_time.high;
857 u_12->bad_attempt_lockout = lockout;
860 /*******************************************************************
861 reads or writes a structure.
862 ********************************************************************/
864 static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12,
865 prs_struct *ps, int depth)
870 prs_debug(ps, depth, desc, "sam_io_unk_info12");
873 if(!smb_io_time("duration", &u_12->duration, ps, depth))
875 if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth))
877 if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout))
883 /*******************************************************************
885 ********************************************************************/
887 void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num)
889 unix_to_nt_time(&u_13->domain_create_time, 0);
890 u_13->seq_num.low = seq_num;
891 u_13->seq_num.high = 0x0000;
896 /*******************************************************************
897 reads or writes a structure.
898 ********************************************************************/
900 static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13,
901 prs_struct *ps, int depth)
906 prs_debug(ps, depth, desc, "sam_io_unk_info13");
909 if (!prs_uint64("seq_num", ps, depth, &u_13->seq_num))
912 if(!smb_io_time("domain_create_time", &u_13->domain_create_time, ps, depth))
915 if (!prs_uint32("unknown1", ps, depth, &u_13->unknown1))
917 if (!prs_uint32("unknown2", ps, depth, &u_13->unknown2))
923 /*******************************************************************
924 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
925 ********************************************************************/
927 void init_samr_r_query_domain_info(SAMR_R_QUERY_DOMAIN_INFO * r_u,
928 uint16 switch_value, SAM_UNK_CTR * ctr,
931 DEBUG(5, ("init_samr_r_query_domain_info\n"));
934 r_u->switch_value = 0;
935 r_u->status = status; /* return status */
937 if (NT_STATUS_IS_OK(status)) {
938 r_u->switch_value = switch_value;
944 /*******************************************************************
945 reads or writes a structure.
946 ********************************************************************/
948 BOOL samr_io_r_query_domain_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u,
949 prs_struct *ps, int depth)
954 prs_debug(ps, depth, desc, "samr_io_r_query_domain_info");
960 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
963 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
964 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
969 switch (r_u->switch_value) {
971 if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth))
975 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
979 if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth))
983 if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
987 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
991 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
995 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
999 if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth))
1003 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
1007 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
1011 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
1015 DEBUG(0, ("samr_io_r_query_domain_info: unknown switch level 0x%x\n",
1016 r_u->switch_value));
1017 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
1025 if(!prs_ntstatus("status", ps, depth, &r_u->status))
1031 /*******************************************************************
1032 reads or writes a structure.
1033 ********************************************************************/
1035 void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ * q_u,
1036 POLICY_HND *pol, uint32 sec_info, SEC_DESC_BUF *buf)
1038 DEBUG(5, ("samr_init_samr_q_set_sec_obj\n"));
1041 q_u->sec_info = sec_info;
1046 /*******************************************************************
1047 reads or writes a SAMR_R_SET_SEC_OBJ structure.
1048 ********************************************************************/
1050 BOOL samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u,
1051 prs_struct *ps, int depth)
1056 prs_debug(ps, depth, desc, "samr_io_r_set_sec_obj");
1062 if(!prs_ntstatus("status", ps, depth, &r_u->status))
1068 /*******************************************************************
1069 reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
1070 ********************************************************************/
1072 BOOL samr_io_r_query_sec_obj(const char *desc, SAMR_R_QUERY_SEC_OBJ * r_u,
1073 prs_struct *ps, int depth)
1078 prs_debug(ps, depth, desc, "samr_io_r_query_sec_obj");
1084 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
1086 if (r_u->ptr != 0) {
1087 if(!sec_io_desc_buf("sec", &r_u->buf, ps, depth))
1091 if(!prs_ntstatus("status", ps, depth, &r_u->status))
1097 /*******************************************************************
1098 reads or writes a SAM_STR1 structure.
1099 ********************************************************************/
1101 static BOOL sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf,
1102 uint32 name_buf, uint32 desc_buf,
1103 prs_struct *ps, int depth)
1108 prs_debug(ps, depth, desc, "sam_io_sam_str1");
1113 if (!smb_io_unistr2("name", &sam->uni_acct_name, acct_buf, ps, depth))
1116 if (!smb_io_unistr2("desc", &sam->uni_acct_desc, desc_buf, ps, depth))
1119 if (!smb_io_unistr2("full", &sam->uni_full_name, name_buf, ps, depth))
1125 /*******************************************************************
1126 inits a SAM_ENTRY1 structure.
1127 ********************************************************************/
1129 static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
1130 UNISTR2 *sam_name, UNISTR2 *sam_full,
1131 UNISTR2 *sam_desc, uint32 rid_user,
1134 DEBUG(5, ("init_sam_entry1\n"));
1138 sam->user_idx = user_idx;
1139 sam->rid_user = rid_user;
1140 sam->acb_info = acb_info;
1142 init_uni_hdr(&sam->hdr_acct_name, sam_name);
1143 init_uni_hdr(&sam->hdr_user_name, sam_full);
1144 init_uni_hdr(&sam->hdr_user_desc, sam_desc);
1147 /*******************************************************************
1148 reads or writes a SAM_ENTRY1 structure.
1149 ********************************************************************/
1151 static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam,
1152 prs_struct *ps, int depth)
1157 prs_debug(ps, depth, desc, "sam_io_sam_entry1");
1163 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
1166 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
1168 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
1171 if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth))
1173 if (!smb_io_unihdr("hdr_user_desc", &sam->hdr_user_desc, ps, depth))
1175 if (!smb_io_unihdr("hdr_user_name", &sam->hdr_user_name, ps, depth))
1181 /*******************************************************************
1182 reads or writes a SAM_STR2 structure.
1183 ********************************************************************/
1185 static BOOL sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf,
1186 uint32 desc_buf, prs_struct *ps, int depth)
1191 prs_debug(ps, depth, desc, "sam_io_sam_str2");
1197 if(!smb_io_unistr2("uni_srv_name", &sam->uni_srv_name, acct_buf, ps, depth)) /* account name unicode string */
1199 if(!smb_io_unistr2("uni_srv_desc", &sam->uni_srv_desc, desc_buf, ps, depth)) /* account desc unicode string */
1205 /*******************************************************************
1206 inits a SAM_ENTRY2 structure.
1207 ********************************************************************/
1208 static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx,
1209 UNISTR2 *sam_name, UNISTR2 *sam_desc,
1210 uint32 rid_user, uint32 acb_info)
1212 DEBUG(5, ("init_sam_entry2\n"));
1214 sam->user_idx = user_idx;
1215 sam->rid_user = rid_user;
1216 sam->acb_info = acb_info;
1218 init_uni_hdr(&sam->hdr_srv_name, sam_name);
1219 init_uni_hdr(&sam->hdr_srv_desc, sam_desc);
1222 /*******************************************************************
1223 reads or writes a SAM_ENTRY2 structure.
1224 ********************************************************************/
1226 static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam,
1227 prs_struct *ps, int depth)
1232 prs_debug(ps, depth, desc, "sam_io_sam_entry2");
1238 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
1241 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
1243 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
1246 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth)) /* account name unicode string header */
1248 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_desc, ps, depth)) /* account name unicode string header */
1254 /*******************************************************************
1255 reads or writes a SAM_STR3 structure.
1256 ********************************************************************/
1258 static BOOL sam_io_sam_str3(const char *desc, SAM_STR3 * sam, uint32 acct_buf,
1259 uint32 desc_buf, prs_struct *ps, int depth)
1264 prs_debug(ps, depth, desc, "sam_io_sam_str3");
1270 if(!smb_io_unistr2("uni_grp_name", &sam->uni_grp_name, acct_buf, ps, depth)) /* account name unicode string */
1272 if(!smb_io_unistr2("uni_grp_desc", &sam->uni_grp_desc, desc_buf, ps, depth)) /* account desc unicode string */
1278 /*******************************************************************
1279 inits a SAM_ENTRY3 structure.
1280 ********************************************************************/
1282 static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx,
1283 UNISTR2 *grp_name, UNISTR2 *grp_desc,
1286 DEBUG(5, ("init_sam_entry3\n"));
1288 sam->grp_idx = grp_idx;
1289 sam->rid_grp = rid_grp;
1290 sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */
1292 init_uni_hdr(&sam->hdr_grp_name, grp_name);
1293 init_uni_hdr(&sam->hdr_grp_desc, grp_desc);
1296 /*******************************************************************
1297 reads or writes a SAM_ENTRY3 structure.
1298 ********************************************************************/
1300 static BOOL sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam,
1301 prs_struct *ps, int depth)
1306 prs_debug(ps, depth, desc, "sam_io_sam_entry3");
1312 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
1315 if(!prs_uint32("rid_grp", ps, depth, &sam->rid_grp))
1317 if(!prs_uint32("attr ", ps, depth, &sam->attr))
1320 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_name, ps, depth)) /* account name unicode string header */
1322 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_desc, ps, depth)) /* account name unicode string header */
1328 /*******************************************************************
1329 inits a SAM_ENTRY4 structure.
1330 ********************************************************************/
1332 static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx,
1333 uint32 len_acct_name)
1335 DEBUG(5, ("init_sam_entry4\n"));
1337 sam->user_idx = user_idx;
1338 init_str_hdr(&sam->hdr_acct_name, len_acct_name+1, len_acct_name, len_acct_name != 0);
1341 /*******************************************************************
1342 reads or writes a SAM_ENTRY4 structure.
1343 ********************************************************************/
1345 static BOOL sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam,
1346 prs_struct *ps, int depth)
1351 prs_debug(ps, depth, desc, "sam_io_sam_entry4");
1357 if(!prs_uint32("user_idx", ps, depth, &sam->user_idx))
1359 if(!smb_io_strhdr("strhdr", &sam->hdr_acct_name, ps, depth))
1365 /*******************************************************************
1366 inits a SAM_ENTRY5 structure.
1367 ********************************************************************/
1369 static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx,
1370 uint32 len_grp_name)
1372 DEBUG(5, ("init_sam_entry5\n"));
1374 sam->grp_idx = grp_idx;
1375 init_str_hdr(&sam->hdr_grp_name, len_grp_name, len_grp_name,
1379 /*******************************************************************
1380 reads or writes a SAM_ENTRY5 structure.
1381 ********************************************************************/
1383 static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam,
1384 prs_struct *ps, int depth)
1389 prs_debug(ps, depth, desc, "sam_io_sam_entry5");
1395 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
1397 if(!smb_io_strhdr("strhdr", &sam->hdr_grp_name, ps, depth))
1403 /*******************************************************************
1404 inits a SAM_ENTRY structure.
1405 ********************************************************************/
1407 void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid)
1409 DEBUG(10, ("init_sam_entry: %d\n", rid));
1412 init_uni_hdr(&sam->hdr_name, uni2);
1415 /*******************************************************************
1416 reads or writes a SAM_ENTRY structure.
1417 ********************************************************************/
1419 static BOOL sam_io_sam_entry(const char *desc, SAM_ENTRY * sam,
1420 prs_struct *ps, int depth)
1425 prs_debug(ps, depth, desc, "sam_io_sam_entry");
1430 if(!prs_uint32("rid", ps, depth, &sam->rid))
1432 if(!smb_io_unihdr("unihdr", &sam->hdr_name, ps, depth)) /* account name unicode string header */
1438 /*******************************************************************
1439 inits a SAMR_Q_ENUM_DOM_USERS structure.
1440 ********************************************************************/
1442 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol,
1444 uint32 acb_mask, uint32 size)
1446 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
1450 q_e->start_idx = start_idx; /* zero indicates lots */
1451 q_e->acb_mask = acb_mask;
1452 q_e->max_size = size;
1455 /*******************************************************************
1456 reads or writes a structure.
1457 ********************************************************************/
1459 BOOL samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e,
1460 prs_struct *ps, int depth)
1465 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
1471 if(!smb_io_pol_hnd("domain_pol", &q_e->pol, ps, depth))
1474 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
1476 if(!prs_uint32("acb_mask ", ps, depth, &q_e->acb_mask))
1479 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
1486 /*******************************************************************
1487 inits a SAMR_R_ENUM_DOM_USERS structure.
1488 ********************************************************************/
1490 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u,
1491 uint32 next_idx, uint32 num_sam_entries)
1493 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
1495 r_u->next_idx = next_idx;
1497 if (num_sam_entries != 0) {
1498 r_u->ptr_entries1 = 1;
1499 r_u->ptr_entries2 = 1;
1500 r_u->num_entries2 = num_sam_entries;
1501 r_u->num_entries3 = num_sam_entries;
1503 r_u->num_entries4 = num_sam_entries;
1505 r_u->ptr_entries1 = 0;
1506 r_u->num_entries2 = num_sam_entries;
1507 r_u->ptr_entries2 = 1;
1511 /*******************************************************************
1512 reads or writes a structure.
1513 ********************************************************************/
1515 BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
1516 prs_struct *ps, int depth)
1523 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
1529 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
1531 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
1534 if (r_u->ptr_entries1 != 0) {
1535 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
1537 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
1539 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
1542 if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) {
1543 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY, r_u->num_entries2);
1544 r_u->uni_acct_name = PRS_ALLOC_MEM(ps,UNISTR2, r_u->num_entries2);
1547 if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) {
1548 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
1549 r_u->num_entries4 = 0;
1550 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
1554 for (i = 0; i < r_u->num_entries2; i++) {
1555 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
1559 for (i = 0; i < r_u->num_entries2; i++) {
1560 if(!smb_io_unistr2("", &r_u->uni_acct_name[i],r_u->sam[i].hdr_name.buffer, ps,depth))
1569 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
1571 if(!prs_ntstatus("status", ps, depth, &r_u->status))
1577 /*******************************************************************
1578 inits a SAMR_Q_QUERY_DISPINFO structure.
1579 ********************************************************************/
1581 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol,
1582 uint16 switch_level, uint32 start_idx,
1583 uint32 max_entries, uint32 max_size)
1585 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
1587 q_e->domain_pol = *pol;
1589 q_e->switch_level = switch_level;
1591 q_e->start_idx = start_idx;
1592 q_e->max_entries = max_entries;
1593 q_e->max_size = max_size;
1596 /*******************************************************************
1597 reads or writes a structure.
1598 ********************************************************************/
1600 BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e,
1601 prs_struct *ps, int depth)
1606 prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo");
1612 if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth))
1615 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
1620 if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx))
1622 if(!prs_uint32("max_entries ", ps, depth, &q_e->max_entries))
1624 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
1630 /*******************************************************************
1631 inits a SAM_DISPINFO_1 structure.
1632 ********************************************************************/
1634 NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam,
1635 uint32 num_entries, uint32 start_idx,
1636 struct samr_displayentry *entries)
1640 DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries));
1643 return NT_STATUS_OK;
1645 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_1, num_entries);
1647 return NT_STATUS_NO_MEMORY;
1649 (*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries);
1650 if ((*sam)->sam == NULL)
1651 return NT_STATUS_NO_MEMORY;
1653 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries);
1654 if ((*sam)->str == NULL)
1655 return NT_STATUS_NO_MEMORY;
1657 for (i = 0; i < num_entries ; i++) {
1658 init_unistr2(&(*sam)->str[i].uni_acct_name,
1659 entries[i].account_name, UNI_FLAGS_NONE);
1660 init_unistr2(&(*sam)->str[i].uni_full_name,
1661 entries[i].fullname, UNI_FLAGS_NONE);
1662 init_unistr2(&(*sam)->str[i].uni_acct_desc,
1663 entries[i].description, UNI_FLAGS_NONE);
1665 init_sam_entry1(&(*sam)->sam[i], start_idx+i+1,
1666 &(*sam)->str[i].uni_acct_name,
1667 &(*sam)->str[i].uni_full_name,
1668 &(*sam)->str[i].uni_acct_desc,
1669 entries[i].rid, entries[i].acct_flags);
1672 return NT_STATUS_OK;
1675 /*******************************************************************
1676 reads or writes a structure.
1677 ********************************************************************/
1679 static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam,
1681 prs_struct *ps, int depth)
1685 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1");
1691 if (UNMARSHALLING(ps) && num_entries > 0) {
1693 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY1, num_entries)) == NULL) {
1694 DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
1698 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR1, num_entries)) == NULL) {
1699 DEBUG(0, ("out of memory allocating SAM_STR1\n"));
1704 for (i = 0; i < num_entries; i++) {
1705 if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth))
1709 for (i = 0; i < num_entries; i++) {
1710 if(!sam_io_sam_str1("", &sam->str[i],
1711 sam->sam[i].hdr_acct_name.buffer,
1712 sam->sam[i].hdr_user_name.buffer,
1713 sam->sam[i].hdr_user_desc.buffer, ps, depth))
1720 /*******************************************************************
1721 inits a SAM_DISPINFO_2 structure.
1722 ********************************************************************/
1724 NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam,
1725 uint32 num_entries, uint32 start_idx,
1726 struct samr_displayentry *entries)
1730 DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries));
1733 return NT_STATUS_OK;
1735 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_2, num_entries);
1737 return NT_STATUS_NO_MEMORY;
1739 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries);
1740 if ((*sam)->sam == NULL)
1741 return NT_STATUS_NO_MEMORY;
1743 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR2, num_entries);
1744 if ((*sam)->str == NULL)
1745 return NT_STATUS_NO_MEMORY;
1747 for (i = 0; i < num_entries; i++) {
1748 init_unistr2(&(*sam)->str[i].uni_srv_name,
1749 entries[i].account_name, UNI_FLAGS_NONE);
1750 init_unistr2(&(*sam)->str[i].uni_srv_desc,
1751 entries[i].description, UNI_FLAGS_NONE);
1753 init_sam_entry2(&(*sam)->sam[i], start_idx + i + 1,
1754 &(*sam)->str[i].uni_srv_name,
1755 &(*sam)->str[i].uni_srv_desc,
1756 entries[i].rid, entries[i].acct_flags);
1759 return NT_STATUS_OK;
1762 /*******************************************************************
1763 reads or writes a structure.
1764 ********************************************************************/
1766 static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam,
1768 prs_struct *ps, int depth)
1775 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2");
1781 if (UNMARSHALLING(ps) && num_entries > 0) {
1783 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY2, num_entries)) == NULL) {
1784 DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
1788 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR2, num_entries)) == NULL) {
1789 DEBUG(0, ("out of memory allocating SAM_STR2\n"));
1794 for (i = 0; i < num_entries; i++) {
1795 if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth))
1799 for (i = 0; i < num_entries; i++) {
1800 if(!sam_io_sam_str2("", &sam->str[i],
1801 sam->sam[i].hdr_srv_name.buffer,
1802 sam->sam[i].hdr_srv_desc.buffer, ps, depth))
1809 /*******************************************************************
1810 inits a SAM_DISPINFO_3 structure.
1811 ********************************************************************/
1813 NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam,
1814 uint32 num_entries, uint32 start_idx,
1815 struct samr_displayentry *entries)
1819 DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries));
1822 return NT_STATUS_OK;
1824 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_3, num_entries);
1826 return NT_STATUS_NO_MEMORY;
1828 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries)))
1829 return NT_STATUS_NO_MEMORY;
1831 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries)))
1832 return NT_STATUS_NO_MEMORY;
1834 for (i = 0; i < num_entries; i++) {
1835 DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i));
1837 init_unistr2(&(*sam)->str[i].uni_grp_name,
1838 entries[i].account_name, UNI_FLAGS_NONE);
1839 init_unistr2(&(*sam)->str[i].uni_grp_desc,
1840 entries[i].description, UNI_FLAGS_NONE);
1842 init_sam_entry3(&(*sam)->sam[i], start_idx+i+1,
1843 &(*sam)->str[i].uni_grp_name,
1844 &(*sam)->str[i].uni_grp_desc,
1848 return NT_STATUS_OK;
1851 /*******************************************************************
1852 reads or writes a structure.
1853 ********************************************************************/
1855 static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam,
1857 prs_struct *ps, int depth)
1864 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3");
1870 if (UNMARSHALLING(ps) && num_entries > 0) {
1872 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY3, num_entries)) == NULL) {
1873 DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
1877 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR3, num_entries)) == NULL) {
1878 DEBUG(0, ("out of memory allocating SAM_STR3\n"));
1883 for (i = 0; i < num_entries; i++) {
1884 if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth))
1888 for (i = 0; i < num_entries; i++) {
1889 if(!sam_io_sam_str3("", &sam->str[i],
1890 sam->sam[i].hdr_grp_name.buffer,
1891 sam->sam[i].hdr_grp_desc.buffer, ps, depth))
1898 /*******************************************************************
1899 inits a SAM_DISPINFO_4 structure.
1900 ********************************************************************/
1902 NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam,
1903 uint32 num_entries, uint32 start_idx,
1904 struct samr_displayentry *entries)
1908 DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries));
1911 return NT_STATUS_OK;
1913 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_4, num_entries);
1915 return NT_STATUS_NO_MEMORY;
1917 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries);
1918 if ((*sam)->sam == NULL)
1919 return NT_STATUS_NO_MEMORY;
1921 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries);
1922 if ((*sam)->str == NULL)
1923 return NT_STATUS_NO_MEMORY;
1925 for (i = 0; i < num_entries; i++) {
1926 size_t len_sam_name = strlen(entries[i].account_name);
1928 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i));
1930 init_sam_entry4(&(*sam)->sam[i], start_idx + i + 1,
1933 init_string2(&(*sam)->str[i].acct_name,
1934 entries[i].account_name, len_sam_name+1,
1938 return NT_STATUS_OK;
1941 /*******************************************************************
1942 reads or writes a structure.
1943 ********************************************************************/
1945 static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam,
1947 prs_struct *ps, int depth)
1954 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4");
1960 if (UNMARSHALLING(ps) && num_entries > 0) {
1962 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY4, num_entries)) == NULL) {
1963 DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
1967 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR4, num_entries)) == NULL) {
1968 DEBUG(0, ("out of memory allocating SAM_STR4\n"));
1973 for (i = 0; i < num_entries; i++) {
1974 if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth))
1978 for (i = 0; i < num_entries; i++) {
1979 if(!smb_io_string2("acct_name", &sam->str[i].acct_name,
1980 sam->sam[i].hdr_acct_name.buffer, ps, depth))
1987 /*******************************************************************
1988 inits a SAM_DISPINFO_5 structure.
1989 ********************************************************************/
1991 NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 **sam,
1992 uint32 num_entries, uint32 start_idx,
1993 struct samr_displayentry *entries)
1995 uint32 len_sam_name;
1998 DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries));
2001 return NT_STATUS_OK;
2003 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_5, num_entries);
2005 return NT_STATUS_NO_MEMORY;
2007 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries)))
2008 return NT_STATUS_NO_MEMORY;
2010 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries)))
2011 return NT_STATUS_NO_MEMORY;
2013 for (i = 0; i < num_entries; i++) {
2014 DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i));
2016 len_sam_name = strlen(entries[i].account_name);
2018 init_sam_entry5(&(*sam)->sam[i], start_idx+i+1, len_sam_name);
2019 init_string2(&(*sam)->str[i].grp_name, entries[i].account_name,
2020 len_sam_name+1, len_sam_name);
2023 return NT_STATUS_OK;
2026 /*******************************************************************
2027 reads or writes a structure.
2028 ********************************************************************/
2030 static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam,
2032 prs_struct *ps, int depth)
2039 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5");
2045 if (UNMARSHALLING(ps) && num_entries > 0) {
2047 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY5, num_entries)) == NULL) {
2048 DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
2052 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR5, num_entries)) == NULL) {
2053 DEBUG(0, ("out of memory allocating SAM_STR5\n"));
2058 for (i = 0; i < num_entries; i++) {
2059 if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth))
2063 for (i = 0; i < num_entries; i++) {
2064 if(!smb_io_string2("grp_name", &sam->str[i].grp_name,
2065 sam->sam[i].hdr_grp_name.buffer, ps, depth))
2072 /*******************************************************************
2073 inits a SAMR_R_QUERY_DISPINFO structure.
2074 ********************************************************************/
2076 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u,
2077 uint32 num_entries, uint32 total_size, uint32 data_size,
2078 uint16 switch_level, SAM_DISPINFO_CTR * ctr,
2081 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level));
2083 r_u->total_size = total_size;
2085 r_u->data_size = data_size;
2087 r_u->switch_level = switch_level;
2088 r_u->num_entries = num_entries;
2091 r_u->ptr_entries = 0;
2093 r_u->ptr_entries = 1;
2095 r_u->num_entries2 = num_entries;
2098 r_u->status = status;
2101 /*******************************************************************
2102 reads or writes a structure.
2103 ********************************************************************/
2105 BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
2106 prs_struct *ps, int depth)
2111 prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo");
2117 if(!prs_uint32("total_size ", ps, depth, &r_u->total_size))
2119 if(!prs_uint32("data_size ", ps, depth, &r_u->data_size))
2121 if(!prs_uint16("switch_level", ps, depth, &r_u->switch_level))
2126 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
2128 if(!prs_uint32("ptr_entries ", ps, depth, &r_u->ptr_entries))
2131 if (r_u->ptr_entries==0) {
2134 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2140 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
2143 switch (r_u->switch_level) {
2145 if(!sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1,
2146 r_u->num_entries, ps, depth))
2150 if(!sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2,
2151 r_u->num_entries, ps, depth))
2155 if(!sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3,
2156 r_u->num_entries, ps, depth))
2160 if(!sam_io_sam_dispinfo_4("user list",
2161 r_u->ctr->sam.info4,
2162 r_u->num_entries, ps, depth))
2166 if(!sam_io_sam_dispinfo_5("group list",
2167 r_u->ctr->sam.info5,
2168 r_u->num_entries, ps, depth))
2172 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
2178 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2184 /*******************************************************************
2185 inits a SAMR_Q_OPEN_GROUP structure.
2186 ********************************************************************/
2188 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c,
2190 uint32 access_mask, uint32 rid)
2192 DEBUG(5, ("init_samr_q_open_group\n"));
2194 q_c->domain_pol = *hnd;
2195 q_c->access_mask = access_mask;
2196 q_c->rid_group = rid;
2199 /*******************************************************************
2200 reads or writes a structure.
2201 ********************************************************************/
2203 BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u,
2204 prs_struct *ps, int depth)
2209 prs_debug(ps, depth, desc, "samr_io_q_open_group");
2215 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
2218 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
2220 if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group))
2226 /*******************************************************************
2227 reads or writes a structure.
2228 ********************************************************************/
2230 BOOL samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u,
2231 prs_struct *ps, int depth)
2236 prs_debug(ps, depth, desc, "samr_io_r_open_group");
2242 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2245 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2251 /*******************************************************************
2252 inits a GROUP_INFO1 structure.
2253 ********************************************************************/
2255 void init_samr_group_info1(GROUP_INFO1 * gr1,
2256 char *acct_name, char *acct_desc,
2259 DEBUG(5, ("init_samr_group_info1\n"));
2261 gr1->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2262 gr1->num_members = num_members;
2264 init_unistr2(&gr1->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2265 init_uni_hdr(&gr1->hdr_acct_name, &gr1->uni_acct_name);
2266 init_unistr2(&gr1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2267 init_uni_hdr(&gr1->hdr_acct_desc, &gr1->uni_acct_desc);
2270 /*******************************************************************
2271 reads or writes a structure.
2272 ********************************************************************/
2274 BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1,
2275 prs_struct *ps, int depth)
2282 prs_debug(ps, depth, desc, "samr_io_group_info1");
2285 if(!prs_uint16("level", ps, depth, &dummy))
2291 if(!smb_io_unihdr("hdr_acct_name", &gr1->hdr_acct_name, ps, depth))
2294 if(!prs_uint32("group_attr", ps, depth, &gr1->group_attr))
2296 if(!prs_uint32("num_members", ps, depth, &gr1->num_members))
2299 if(!smb_io_unihdr("hdr_acct_desc", &gr1->hdr_acct_desc, ps, depth))
2302 if(!smb_io_unistr2("uni_acct_name", &gr1->uni_acct_name,
2303 gr1->hdr_acct_name.buffer, ps, depth))
2306 if(!smb_io_unistr2("uni_acct_desc", &gr1->uni_acct_desc,
2307 gr1->hdr_acct_desc.buffer, ps, depth))
2313 /*******************************************************************
2314 inits a GROUP_INFO2 structure.
2315 ********************************************************************/
2317 void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name)
2319 DEBUG(5, ("init_samr_group_info2\n"));
2322 init_unistr2(&gr2->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2323 init_uni_hdr(&gr2->hdr_acct_name, &gr2->uni_acct_name);
2326 /*******************************************************************
2327 reads or writes a structure.
2328 ********************************************************************/
2330 BOOL samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int depth)
2335 prs_debug(ps, depth, desc, "samr_io_group_info2");
2338 if(!prs_uint16("hdr_level", ps, depth, &gr2->level))
2341 if(!smb_io_unihdr("hdr_acct_name", &gr2->hdr_acct_name, ps, depth))
2343 if(!smb_io_unistr2("uni_acct_name", &gr2->uni_acct_name,
2344 gr2->hdr_acct_name.buffer, ps, depth))
2350 /*******************************************************************
2351 inits a GROUP_INFO3 structure.
2352 ********************************************************************/
2354 void init_samr_group_info3(GROUP_INFO3 *gr3)
2356 DEBUG(5, ("init_samr_group_info3\n"));
2358 gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2361 /*******************************************************************
2362 reads or writes a structure.
2363 ********************************************************************/
2365 BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth)
2370 prs_debug(ps, depth, desc, "samr_io_group_info3");
2376 if(!prs_uint32("group_attr", ps, depth, &gr3->group_attr))
2382 /*******************************************************************
2383 inits a GROUP_INFO4 structure.
2384 ********************************************************************/
2386 void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc)
2388 DEBUG(5, ("init_samr_group_info4\n"));
2391 init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2392 init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc);
2395 /*******************************************************************
2396 reads or writes a structure.
2397 ********************************************************************/
2399 BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4,
2400 prs_struct *ps, int depth)
2405 prs_debug(ps, depth, desc, "samr_io_group_info4");
2408 if(!prs_uint16("hdr_level", ps, depth, &gr4->level))
2410 if(!smb_io_unihdr("hdr_acct_desc", &gr4->hdr_acct_desc, ps, depth))
2412 if(!smb_io_unistr2("uni_acct_desc", &gr4->uni_acct_desc,
2413 gr4->hdr_acct_desc.buffer, ps, depth))
2419 /*******************************************************************
2420 inits a GROUP_INFO5 structure.
2421 ********************************************************************/
2423 void init_samr_group_info5(GROUP_INFO5 * gr5,
2424 char *acct_name, char *acct_desc,
2427 DEBUG(5, ("init_samr_group_info5\n"));
2429 gr5->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2430 gr5->num_members = num_members;
2432 init_unistr2(&gr5->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2433 init_uni_hdr(&gr5->hdr_acct_name, &gr5->uni_acct_name);
2434 init_unistr2(&gr5->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2435 init_uni_hdr(&gr5->hdr_acct_desc, &gr5->uni_acct_desc);
2438 /*******************************************************************
2439 reads or writes a structure.
2440 ********************************************************************/
2442 BOOL samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5,
2443 prs_struct *ps, int depth)
2450 prs_debug(ps, depth, desc, "samr_io_group_info5");
2453 if(!prs_uint16("level", ps, depth, &dummy))
2459 if(!smb_io_unihdr("hdr_acct_name", &gr5->hdr_acct_name, ps, depth))
2462 if(!prs_uint32("group_attr", ps, depth, &gr5->group_attr))
2464 if(!prs_uint32("num_members", ps, depth, &gr5->num_members))
2467 if(!smb_io_unihdr("hdr_acct_desc", &gr5->hdr_acct_desc, ps, depth))
2470 if(!smb_io_unistr2("uni_acct_name", &gr5->uni_acct_name,
2471 gr5->hdr_acct_name.buffer, ps, depth))
2474 if(!smb_io_unistr2("uni_acct_desc", &gr5->uni_acct_desc,
2475 gr5->hdr_acct_desc.buffer, ps, depth))
2482 /*******************************************************************
2483 reads or writes a structure.
2484 ********************************************************************/
2486 static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr,
2487 prs_struct *ps, int depth)
2489 if (UNMARSHALLING(ps))
2490 *ctr = PRS_ALLOC_MEM(ps,GROUP_INFO_CTR,1);
2495 prs_debug(ps, depth, desc, "samr_group_info_ctr");
2498 if(!prs_uint16("switch_value1", ps, depth, &(*ctr)->switch_value1))
2501 switch ((*ctr)->switch_value1) {
2503 if(!samr_io_group_info1("group_info1", &(*ctr)->group.info1, ps, depth))
2507 if(!samr_io_group_info2("group_info2", &(*ctr)->group.info2, ps, depth))
2511 if(!samr_io_group_info3("group_info3", &(*ctr)->group.info3, ps, depth))
2515 if(!samr_io_group_info4("group_info4", &(*ctr)->group.info4, ps, depth))
2519 if(!samr_io_group_info5("group_info5", &(*ctr)->group.info5, ps, depth))
2523 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2530 /*******************************************************************
2531 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2532 ********************************************************************/
2534 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
2535 POLICY_HND *pol, const char *acct_desc,
2538 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2542 init_unistr2(&q_e->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2543 init_uni_hdr(&q_e->hdr_acct_desc, &q_e->uni_acct_desc);
2545 q_e->access_mask = access_mask;
2548 /*******************************************************************
2549 reads or writes a structure.
2550 ********************************************************************/
2552 BOOL samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
2553 prs_struct *ps, int depth)
2558 prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
2564 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2567 if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth))
2569 if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc,
2570 q_e->hdr_acct_desc.buffer, ps, depth))
2575 if(!prs_uint32("access", ps, depth, &q_e->access_mask))
2581 /*******************************************************************
2582 reads or writes a structure.
2583 ********************************************************************/
2585 BOOL samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u,
2586 prs_struct *ps, int depth)
2591 prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
2597 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2600 if(!prs_uint32("rid ", ps, depth, &r_u->rid))
2602 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2608 /*******************************************************************
2609 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2610 ********************************************************************/
2612 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c,
2615 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2617 q_c->group_pol = *hnd;
2620 /*******************************************************************
2621 reads or writes a structure.
2622 ********************************************************************/
2624 BOOL samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u,
2625 prs_struct *ps, int depth)
2630 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
2636 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
2642 /*******************************************************************
2643 reads or writes a structure.
2644 ********************************************************************/
2646 BOOL samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u,
2647 prs_struct *ps, int depth)
2652 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
2658 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2661 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2667 /*******************************************************************
2668 inits a SAMR_Q_DEL_GROUPMEM structure.
2669 ********************************************************************/
2671 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e,
2672 POLICY_HND *pol, uint32 rid)
2674 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2680 /*******************************************************************
2681 reads or writes a structure.
2682 ********************************************************************/
2684 BOOL samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e,
2685 prs_struct *ps, int depth)
2690 prs_debug(ps, depth, desc, "samr_io_q_del_groupmem");
2696 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2699 if(!prs_uint32("rid", ps, depth, &q_e->rid))
2705 /*******************************************************************
2706 inits a SAMR_R_DEL_GROUPMEM structure.
2707 ********************************************************************/
2709 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol,
2712 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2714 r_u->status = status;
2717 /*******************************************************************
2718 reads or writes a structure.
2719 ********************************************************************/
2721 BOOL samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u,
2722 prs_struct *ps, int depth)
2727 prs_debug(ps, depth, desc, "samr_io_r_del_groupmem");
2733 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2739 /*******************************************************************
2740 inits a SAMR_Q_ADD_GROUPMEM structure.
2741 ********************************************************************/
2743 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e,
2744 POLICY_HND *pol, uint32 rid)
2746 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2750 q_e->unknown = 0x0005;
2753 /*******************************************************************
2754 reads or writes a structure.
2755 ********************************************************************/
2757 BOOL samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e,
2758 prs_struct *ps, int depth)
2763 prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
2769 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2772 if(!prs_uint32("rid ", ps, depth, &q_e->rid))
2774 if(!prs_uint32("unknown", ps, depth, &q_e->unknown))
2780 /*******************************************************************
2781 inits a SAMR_R_ADD_GROUPMEM structure.
2782 ********************************************************************/
2784 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol,
2787 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2789 r_u->status = status;
2792 /*******************************************************************
2793 reads or writes a structure.
2794 ********************************************************************/
2796 BOOL samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u,
2797 prs_struct *ps, int depth)
2802 prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
2808 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2814 /*******************************************************************
2815 inits a SAMR_Q_SET_GROUPINFO structure.
2816 ********************************************************************/
2818 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e,
2819 POLICY_HND *pol, GROUP_INFO_CTR * ctr)
2821 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2827 /*******************************************************************
2828 reads or writes a structure.
2829 ********************************************************************/
2831 BOOL samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e,
2832 prs_struct *ps, int depth)
2837 prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
2843 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2846 if(!samr_group_info_ctr("ctr", &q_e->ctr, ps, depth))
2852 /*******************************************************************
2853 inits a SAMR_R_SET_GROUPINFO structure.
2854 ********************************************************************/
2856 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status)
2858 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2860 r_u->status = status;
2863 /*******************************************************************
2864 reads or writes a structure.
2865 ********************************************************************/
2867 BOOL samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u,
2868 prs_struct *ps, int depth)
2873 prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
2879 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2885 /*******************************************************************
2886 inits a SAMR_Q_QUERY_GROUPINFO structure.
2887 ********************************************************************/
2889 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e,
2890 POLICY_HND *pol, uint16 switch_level)
2892 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2896 q_e->switch_level = switch_level;
2899 /*******************************************************************
2900 reads or writes a structure.
2901 ********************************************************************/
2903 BOOL samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e,
2904 prs_struct *ps, int depth)
2909 prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
2915 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2918 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
2924 /*******************************************************************
2925 inits a SAMR_R_QUERY_GROUPINFO structure.
2926 ********************************************************************/
2928 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u,
2929 GROUP_INFO_CTR * ctr, NTSTATUS status)
2931 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2933 r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0;
2935 r_u->status = status;
2938 /*******************************************************************
2939 reads or writes a structure.
2940 ********************************************************************/
2942 BOOL samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u,
2943 prs_struct *ps, int depth)
2948 prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
2954 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
2957 if (r_u->ptr != 0) {
2958 if(!samr_group_info_ctr("ctr", &r_u->ctr, ps, depth))
2964 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2970 /*******************************************************************
2971 inits a SAMR_Q_QUERY_GROUPMEM structure.
2972 ********************************************************************/
2974 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd)
2976 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2978 q_c->group_pol = *hnd;
2981 /*******************************************************************
2982 reads or writes a structure.
2983 ********************************************************************/
2985 BOOL samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u,
2986 prs_struct *ps, int depth)
2991 prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
2997 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
3003 /*******************************************************************
3004 inits a SAMR_R_QUERY_GROUPMEM structure.
3005 ********************************************************************/
3007 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u,
3008 uint32 num_entries, uint32 *rid,
3009 uint32 *attr, NTSTATUS status)
3011 DEBUG(5, ("init_samr_r_query_groupmem\n"));
3013 if (NT_STATUS_IS_OK(status)) {
3015 r_u->num_entries = num_entries;
3017 r_u->ptr_attrs = attr != NULL ? 1 : 0;
3018 r_u->ptr_rids = rid != NULL ? 1 : 0;
3020 r_u->num_rids = num_entries;
3023 r_u->num_attrs = num_entries;
3027 r_u->num_entries = 0;
3030 r_u->status = status;
3033 /*******************************************************************
3034 reads or writes a structure.
3035 ********************************************************************/
3037 BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u,
3038 prs_struct *ps, int depth)
3045 if (UNMARSHALLING(ps))
3048 prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
3054 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
3056 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
3059 if (r_u->ptr != 0) {
3060 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
3062 if(!prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs))
3065 if (r_u->ptr_rids != 0) {
3066 if(!prs_uint32("num_rids", ps, depth, &r_u->num_rids))
3068 if (UNMARSHALLING(ps) && r_u->num_rids != 0) {
3069 r_u->rid = PRS_ALLOC_MEM(ps,uint32,r_u->num_rids);
3070 if (r_u->rid == NULL)
3074 for (i = 0; i < r_u->num_rids; i++) {
3075 if(!prs_uint32("", ps, depth, &r_u->rid[i]))
3080 if (r_u->ptr_attrs != 0) {
3081 if(!prs_uint32("num_attrs", ps, depth, &r_u->num_attrs))
3084 if (UNMARSHALLING(ps) && r_u->num_attrs != 0) {
3085 r_u->attr = PRS_ALLOC_MEM(ps,uint32,r_u->num_attrs);
3086 if (r_u->attr == NULL)
3090 for (i = 0; i < r_u->num_attrs; i++) {
3091 if(!prs_uint32("", ps, depth, &r_u->attr[i]))
3097 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3103 /*******************************************************************
3104 inits a SAMR_Q_QUERY_USERGROUPS structure.
3105 ********************************************************************/
3107 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u,
3110 DEBUG(5, ("init_samr_q_query_usergroups\n"));
3115 /*******************************************************************
3116 reads or writes a structure.
3117 ********************************************************************/
3119 BOOL samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u,
3120 prs_struct *ps, int depth)
3125 prs_debug(ps, depth, desc, "samr_io_q_query_usergroups");
3131 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
3137 /*******************************************************************
3138 inits a SAMR_R_QUERY_USERGROUPS structure.
3139 ********************************************************************/
3141 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u,
3142 uint32 num_gids, DOM_GID * gid,
3145 DEBUG(5, ("init_samr_r_query_usergroups\n"));
3147 if (NT_STATUS_IS_OK(status)) {
3149 r_u->num_entries = num_gids;
3150 r_u->ptr_1 = (num_gids != 0) ? 1 : 0;
3151 r_u->num_entries2 = num_gids;
3156 r_u->num_entries = 0;
3161 r_u->status = status;
3164 /*******************************************************************
3165 reads or writes a structure.
3166 ********************************************************************/
3168 BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid,
3169 prs_struct *ps, int depth)
3175 prs_debug(ps, depth, desc, "samr_io_gids");
3181 if(!prs_uint32("num_gids", ps, depth, num_gids))
3184 if ((*num_gids) != 0) {
3185 if (UNMARSHALLING(ps)) {
3186 (*gid) = PRS_ALLOC_MEM(ps,DOM_GID,*num_gids);
3189 if ((*gid) == NULL) {
3193 for (i = 0; i < (*num_gids); i++) {
3194 if(!smb_io_gid("gids", &(*gid)[i], ps, depth))
3202 /*******************************************************************
3203 reads or writes a structure.
3204 ********************************************************************/
3206 BOOL samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u,
3207 prs_struct *ps, int depth)
3212 prs_debug(ps, depth, desc, "samr_io_r_query_usergroups");
3218 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
3221 if (r_u->ptr_0 != 0) {
3222 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
3224 if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1))
3227 if (r_u->num_entries != 0 && r_u->ptr_1 != 0) {
3228 if(!samr_io_gids("gids", &r_u->num_entries2, &r_u->gid, ps, depth))
3235 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3241 /*******************************************************************
3242 inits a SAMR_Q_ENUM_DOMAINS structure.
3243 ********************************************************************/
3245 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e,
3247 uint32 start_idx, uint32 size)
3249 DEBUG(5, ("init_samr_q_enum_domains\n"));
3253 q_e->start_idx = start_idx;
3254 q_e->max_size = size;
3257 /*******************************************************************
3258 reads or writes a structure.
3259 ********************************************************************/
3261 BOOL samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e,
3262 prs_struct *ps, int depth)
3267 prs_debug(ps, depth, desc, "samr_io_q_enum_domains");
3273 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
3276 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3278 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3284 /*******************************************************************
3285 inits a SAMR_R_ENUM_DOMAINS structure.
3286 ********************************************************************/
3288 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u,
3289 uint32 next_idx, uint32 num_sam_entries)
3291 DEBUG(5, ("init_samr_r_enum_domains\n"));
3293 r_u->next_idx = next_idx;
3295 if (num_sam_entries != 0) {
3296 r_u->ptr_entries1 = 1;
3297 r_u->ptr_entries2 = 1;
3298 r_u->num_entries2 = num_sam_entries;
3299 r_u->num_entries3 = num_sam_entries;
3301 r_u->num_entries4 = num_sam_entries;
3303 r_u->ptr_entries1 = 0;
3304 r_u->num_entries2 = num_sam_entries;
3305 r_u->ptr_entries2 = 1;
3309 /*******************************************************************
3310 reads or writes a structure.
3311 ********************************************************************/
3313 BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u,
3314 prs_struct *ps, int depth)
3321 prs_debug(ps, depth, desc, "samr_io_r_enum_domains");
3327 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3329 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3332 if (r_u->ptr_entries1 != 0) {
3333 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3335 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3337 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3340 if (UNMARSHALLING(ps)) {
3341 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3342 r_u->uni_dom_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3345 if ((r_u->sam == NULL || r_u->uni_dom_name == NULL) && r_u->num_entries2 != 0) {
3346 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
3347 r_u->num_entries4 = 0;
3348 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3352 for (i = 0; i < r_u->num_entries2; i++) {
3354 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
3355 if(!sam_io_sam_entry(tmp, &r_u->sam[i], ps, depth))
3359 for (i = 0; i < r_u->num_entries2; i++) {
3361 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
3362 if(!smb_io_unistr2(tmp, &r_u->uni_dom_name[i],
3363 r_u->sam[i].hdr_name.buffer, ps,
3372 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3374 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3380 /*******************************************************************
3381 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
3382 ********************************************************************/
3384 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e,
3386 uint32 start_idx, uint32 size)
3388 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
3392 q_e->start_idx = start_idx;
3393 q_e->max_size = size;
3396 /*******************************************************************
3397 reads or writes a structure.
3398 ********************************************************************/
3400 BOOL samr_io_q_enum_dom_groups(const char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e,
3401 prs_struct *ps, int depth)
3406 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups");
3412 if(!smb_io_pol_hnd("pol", &(q_e->pol), ps, depth))
3415 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3417 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3423 /*******************************************************************
3424 inits a SAMR_R_ENUM_DOM_GROUPS structure.
3425 ********************************************************************/
3427 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u,
3428 uint32 next_idx, uint32 num_sam_entries)
3430 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
3432 r_u->next_idx = next_idx;
3434 if (num_sam_entries != 0) {
3435 r_u->ptr_entries1 = 1;
3436 r_u->ptr_entries2 = 1;
3437 r_u->num_entries2 = num_sam_entries;
3438 r_u->num_entries3 = num_sam_entries;
3440 r_u->num_entries4 = num_sam_entries;
3442 r_u->ptr_entries1 = 0;
3443 r_u->num_entries2 = num_sam_entries;
3444 r_u->ptr_entries2 = 1;
3448 /*******************************************************************
3449 reads or writes a structure.
3450 ********************************************************************/
3452 BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u,
3453 prs_struct *ps, int depth)
3460 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups");
3466 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3468 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3471 if (r_u->ptr_entries1 != 0) {
3472 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3474 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3476 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3479 if (UNMARSHALLING(ps)) {
3480 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3481 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3484 if ((r_u->sam == NULL || r_u->uni_grp_name == NULL) && r_u->num_entries2 != 0) {
3486 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3487 r_u->num_entries4 = 0;
3488 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3492 for (i = 0; i < r_u->num_entries2; i++) {
3493 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
3497 for (i = 0; i < r_u->num_entries2; i++) {
3498 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
3499 r_u->sam[i].hdr_name.buffer, ps, depth))
3506 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3508 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3514 /*******************************************************************
3515 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3516 ********************************************************************/
3518 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e,
3519 POLICY_HND *pol, uint32 start_idx,
3522 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3526 q_e->start_idx = start_idx;
3527 q_e->max_size = size;
3531 /*******************************************************************
3532 reads or writes a structure.
3533 ********************************************************************/
3535 BOOL samr_io_q_enum_dom_aliases(const char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e,
3536 prs_struct *ps, int depth)
3541 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases");
3547 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
3550 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3552 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3558 /*******************************************************************
3559 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3560 ********************************************************************/
3562 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, uint32 num_sam_entries)
3564 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3566 r_u->next_idx = next_idx;
3568 if (num_sam_entries != 0) {
3569 r_u->ptr_entries1 = 1;
3570 r_u->ptr_entries2 = 1;
3571 r_u->num_entries2 = num_sam_entries;
3572 r_u->num_entries3 = num_sam_entries;
3574 r_u->num_entries4 = num_sam_entries;
3576 r_u->ptr_entries1 = 0;
3577 r_u->num_entries2 = num_sam_entries;
3578 r_u->ptr_entries2 = 1;
3582 /*******************************************************************
3583 reads or writes a structure.
3584 ********************************************************************/
3586 BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
3587 prs_struct *ps, int depth)
3594 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases");
3600 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3602 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3605 if (r_u->ptr_entries1 != 0) {
3606 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3608 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3610 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3613 if (UNMARSHALLING(ps) && (r_u->num_entries2 > 0)) {
3614 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3615 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3618 if (r_u->num_entries2 != 0 &&
3619 (r_u->sam == NULL || r_u->uni_grp_name == NULL)) {
3620 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3621 r_u->num_entries4 = 0;
3622 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3626 for (i = 0; i < r_u->num_entries2; i++) {
3627 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
3631 for (i = 0; i < r_u->num_entries2; i++) {
3632 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
3633 r_u->sam[i].hdr_name.buffer, ps,
3641 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3643 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3649 /*******************************************************************
3650 inits a ALIAS_INFO1 structure.
3651 ********************************************************************/
3653 void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc)
3655 DEBUG(5, ("init_samr_alias_info1\n"));
3657 init_unistr4(&al1->name, acct_name, UNI_FLAGS_NONE);
3658 al1->num_member = num_member;
3659 init_unistr4(&al1->description, acct_desc, UNI_FLAGS_NONE);
3662 /*******************************************************************
3663 reads or writes a structure.
3664 ********************************************************************/
3666 BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1,
3667 prs_struct *ps, int depth)
3672 prs_debug(ps, depth, desc, "samr_io_alias_info1");
3678 if ( !prs_unistr4_hdr("name", ps, depth, &al1->name) )
3680 if ( !prs_uint32("num_member", ps, depth, &al1->num_member) )
3682 if ( !prs_unistr4_hdr("description", ps, depth, &al1->description) )
3685 if ( !prs_unistr4_str("name", ps, depth, &al1->name) )
3687 if ( !prs_align(ps) )
3689 if ( !prs_unistr4_str("description", ps, depth, &al1->description) )
3691 if ( !prs_align(ps) )
3697 /*******************************************************************
3698 inits a ALIAS_INFO3 structure.
3699 ********************************************************************/
3701 void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc)
3703 DEBUG(5, ("init_samr_alias_info3\n"));
3705 init_unistr4(&al3->description, acct_desc, UNI_FLAGS_NONE);
3708 /*******************************************************************
3709 reads or writes a structure.
3710 ********************************************************************/
3712 BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3,
3713 prs_struct *ps, int depth)
3718 prs_debug(ps, depth, desc, "samr_io_alias_info3");
3724 if (!prs_unistr4("description", ps, depth, &al3->description))
3730 /*******************************************************************
3731 reads or writes a structure.
3732 ********************************************************************/
3734 BOOL samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2,
3735 prs_struct *ps, int depth)
3740 prs_debug(ps, depth, desc, "samr_io_alias_info2");
3746 if (!prs_unistr4("name", ps, depth, &al2->name))
3752 /*******************************************************************
3753 reads or writes a structure.
3754 ********************************************************************/
3756 BOOL samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr)
3761 prs_debug(ps, depth, desc, "samr_alias_info_ctr");
3764 if ( !prs_uint16("level", ps, depth, &ctr->level) )
3769 switch (ctr->level) {
3771 if(!samr_io_alias_info1("alias_info1", &ctr->alias.info1, ps, depth))
3775 if(!samr_io_alias_info2("alias_info2", &ctr->alias.info2, ps, depth))
3779 if(!samr_io_alias_info3("alias_info3", &ctr->alias.info3, ps, depth))
3783 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3790 /*******************************************************************
3791 inits a SAMR_Q_QUERY_ALIASINFO structure.
3792 ********************************************************************/
3794 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e,
3795 POLICY_HND *pol, uint32 switch_level)
3797 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3800 q_e->level = switch_level;
3803 /*******************************************************************
3804 reads or writes a structure.
3805 ********************************************************************/
3807 BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in,
3808 prs_struct *ps, int depth)
3813 prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo");
3819 if ( !smb_io_pol_hnd("pol", &(in->pol), ps, depth) )
3822 if ( !prs_uint16("level", ps, depth, &in->level) )
3828 /*******************************************************************
3829 inits a SAMR_R_QUERY_ALIASINFO structure.
3830 ********************************************************************/
3832 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *out,
3833 ALIAS_INFO_CTR * ctr, NTSTATUS status)
3835 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3838 out->status = status;
3841 /*******************************************************************
3842 reads or writes a structure.
3843 ********************************************************************/
3845 BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out,
3846 prs_struct *ps, int depth)
3851 prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo");
3857 if ( !prs_pointer("alias", ps, depth, (void**)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr))
3862 if(!prs_ntstatus("status", ps, depth, &out->status))
3868 /*******************************************************************
3869 inits a SAMR_Q_SET_ALIASINFO structure.
3870 ********************************************************************/
3872 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u,
3873 POLICY_HND *hnd, ALIAS_INFO_CTR * ctr)
3875 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3877 q_u->alias_pol = *hnd;
3881 /*******************************************************************
3882 reads or writes a structure.
3883 ********************************************************************/
3885 BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u,
3886 prs_struct *ps, int depth)
3891 prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo");
3897 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
3899 if(!samr_alias_info_ctr("ctr", ps, depth, &q_u->ctr))
3905 /*******************************************************************
3906 reads or writes a structure.
3907 ********************************************************************/
3909 BOOL samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u,
3910 prs_struct *ps, int depth)
3915 prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo");
3920 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3926 /*******************************************************************
3927 inits a SAMR_Q_QUERY_USERALIASES structure.
3928 ********************************************************************/
3930 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u,
3933 uint32 *ptr_sid, DOM_SID2 * sid)
3935 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3939 q_u->num_sids1 = num_sids;
3941 q_u->num_sids2 = num_sids;
3943 q_u->ptr_sid = ptr_sid;
3947 /*******************************************************************
3948 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3949 ********************************************************************/
3951 BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u,
3952 prs_struct *ps, int depth)
3960 prs_debug(ps, depth, desc, "samr_io_q_query_useraliases");
3966 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
3969 if(!prs_uint32("num_sids1", ps, depth, &q_u->num_sids1))
3971 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
3977 if(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2))
3980 if (UNMARSHALLING(ps) && (q_u->num_sids2 != 0)) {
3981 q_u->ptr_sid = PRS_ALLOC_MEM(ps,uint32,q_u->num_sids2);
3982 if (q_u->ptr_sid == NULL)
3985 q_u->sid = PRS_ALLOC_MEM(ps, DOM_SID2, q_u->num_sids2);
3986 if (q_u->sid == NULL)
3990 for (i = 0; i < q_u->num_sids2; i++) {
3991 slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i);
3992 if(!prs_uint32(tmp, ps, depth, &q_u->ptr_sid[i]))
3996 for (i = 0; i < q_u->num_sids2; i++) {
3997 if (q_u->ptr_sid[i] != 0) {
3998 slprintf(tmp, sizeof(tmp) - 1, "sid[%02d]", i);
3999 if(!smb_io_dom_sid2(tmp, &q_u->sid[i], ps, depth))
4007 /*******************************************************************
4008 inits a SAMR_R_QUERY_USERALIASES structure.
4009 ********************************************************************/
4011 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u,
4012 uint32 num_rids, uint32 *rid,
4015 DEBUG(5, ("init_samr_r_query_useraliases\n"));
4017 if (NT_STATUS_IS_OK(status)) {
4018 r_u->num_entries = num_rids;
4020 r_u->num_entries2 = num_rids;
4024 r_u->num_entries = 0;
4026 r_u->num_entries2 = 0;
4029 r_u->status = status;
4032 /*******************************************************************
4033 reads or writes a structure.
4034 ********************************************************************/
4036 BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid,
4037 prs_struct *ps, int depth)
4044 prs_debug(ps, depth, desc, "samr_io_rids");
4050 if(!prs_uint32("num_rids", ps, depth, num_rids))
4053 if ((*num_rids) != 0) {
4054 if (UNMARSHALLING(ps)) {
4056 (*rid) = PRS_ALLOC_MEM(ps,uint32, *num_rids);
4061 for (i = 0; i < (*num_rids); i++) {
4062 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d]", i);
4063 if(!prs_uint32(tmp, ps, depth, &((*rid)[i])))
4071 /*******************************************************************
4072 reads or writes a structure.
4073 ********************************************************************/
4075 BOOL samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u,
4076 prs_struct *ps, int depth)
4081 prs_debug(ps, depth, desc, "samr_io_r_query_useraliases");
4087 if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries))
4089 if(!prs_uint32("ptr ", ps, depth, &r_u->ptr))
4092 if (r_u->ptr != 0) {
4093 if(!samr_io_rids("rids", &r_u->num_entries2, &r_u->rid, ps, depth))
4099 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4105 /*******************************************************************
4106 inits a SAMR_Q_OPEN_ALIAS structure.
4107 ********************************************************************/
4109 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol,
4110 uint32 access_mask, uint32 rid)
4112 DEBUG(5, ("init_samr_q_open_alias\n"));
4114 q_u->dom_pol = *pol;
4115 q_u->access_mask = access_mask;
4116 q_u->rid_alias = rid;
4119 /*******************************************************************
4120 reads or writes a structure.
4121 ********************************************************************/
4123 BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u,
4124 prs_struct *ps, int depth)
4129 prs_debug(ps, depth, desc, "samr_io_q_open_alias");
4135 if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
4138 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
4140 if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias))
4146 /*******************************************************************
4147 reads or writes a structure.
4148 ********************************************************************/
4150 BOOL samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u,
4151 prs_struct *ps, int depth)
4156 prs_debug(ps, depth, desc, "samr_io_r_open_alias");
4162 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4165 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4171 /*******************************************************************
4172 inits a SAMR_Q_LOOKUP_RIDS structure.
4173 ********************************************************************/
4175 void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u,
4176 POLICY_HND *pol, uint32 flags,
4177 uint32 num_rids, uint32 *rid)
4179 DEBUG(5, ("init_samr_q_lookup_rids\n"));
4183 q_u->num_rids1 = num_rids;
4186 q_u->num_rids2 = num_rids;
4187 q_u->rid = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids );
4188 if (q_u->rid == NULL) {
4192 memcpy(q_u->rid, rid, num_rids * sizeof(q_u->rid[0]));
4196 /*******************************************************************
4197 reads or writes a structure.
4198 ********************************************************************/
4200 BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u,
4201 prs_struct *ps, int depth)
4209 prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
4212 if (UNMARSHALLING(ps))
4218 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
4221 if(!prs_uint32("num_rids1", ps, depth, &q_u->num_rids1))
4223 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
4225 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
4227 if(!prs_uint32("num_rids2", ps, depth, &q_u->num_rids2))
4230 if (UNMARSHALLING(ps) && (q_u->num_rids2 != 0)) {
4231 q_u->rid = PRS_ALLOC_MEM(ps, uint32, q_u->num_rids2);
4232 if (q_u->rid == NULL)
4236 for (i = 0; i < q_u->num_rids2; i++) {
4237 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
4238 if(!prs_uint32(tmp, ps, depth, &q_u->rid[i]))
4245 /*******************************************************************
4246 inits a SAMR_R_LOOKUP_RIDS structure.
4247 ********************************************************************/
4249 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u,
4250 uint32 num_names, UNIHDR * hdr_name,
4251 UNISTR2 *uni_name, uint32 *type)
4253 DEBUG(5, ("init_samr_r_lookup_rids\n"));
4255 r_u->hdr_name = NULL;
4256 r_u->uni_name = NULL;
4259 if (num_names != 0) {
4260 r_u->num_names1 = num_names;
4262 r_u->num_names2 = num_names;
4264 r_u->num_types1 = num_names;
4266 r_u->num_types2 = num_names;
4268 r_u->hdr_name = hdr_name;
4269 r_u->uni_name = uni_name;
4272 r_u->num_names1 = num_names;
4274 r_u->num_names2 = num_names;
4276 r_u->num_types1 = num_names;
4278 r_u->num_types2 = num_names;
4282 /*******************************************************************
4283 reads or writes a structure.
4284 ********************************************************************/
4286 BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u,
4287 prs_struct *ps, int depth)
4294 prs_debug(ps, depth, desc, "samr_io_r_lookup_rids");
4300 if(!prs_uint32("num_names1", ps, depth, &r_u->num_names1))
4302 if(!prs_uint32("ptr_names ", ps, depth, &r_u->ptr_names))
4305 if (r_u->ptr_names != 0) {
4307 if(!prs_uint32("num_names2", ps, depth, &r_u->num_names2))
4311 if (UNMARSHALLING(ps) && (r_u->num_names2 != 0)) {
4312 r_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, r_u->num_names2);
4313 if (r_u->hdr_name == NULL)
4316 r_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, r_u->num_names2);
4317 if (r_u->uni_name == NULL)
4321 for (i = 0; i < r_u->num_names2; i++) {
4322 slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
4323 if(!smb_io_unihdr("", &r_u->hdr_name[i], ps, depth))
4326 for (i = 0; i < r_u->num_names2; i++) {
4327 slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
4328 if(!smb_io_unistr2("", &r_u->uni_name[i], r_u->hdr_name[i].buffer, ps, depth))
4336 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
4338 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
4341 if (r_u->ptr_types != 0) {
4343 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
4346 if (UNMARSHALLING(ps) && (r_u->num_types2 != 0)) {
4347 r_u->type = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
4348 if (r_u->type == NULL)
4352 for (i = 0; i < r_u->num_types2; i++) {
4353 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
4354 if(!prs_uint32(tmp, ps, depth, &r_u->type[i]))
4359 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4365 /*******************************************************************
4366 inits a SAMR_Q_OPEN_ALIAS structure.
4367 ********************************************************************/
4369 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd)
4371 DEBUG(5, ("init_samr_q_delete_alias\n"));
4373 q_u->alias_pol = *hnd;
4376 /*******************************************************************
4377 reads or writes a structure.
4378 ********************************************************************/
4380 BOOL samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
4381 prs_struct *ps, int depth)
4386 prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
4392 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4398 /*******************************************************************
4399 reads or writes a structure.
4400 ********************************************************************/
4402 BOOL samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
4403 prs_struct *ps, int depth)
4408 prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
4414 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4416 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4422 /*******************************************************************
4423 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
4424 ********************************************************************/
4426 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
4427 POLICY_HND *hnd, const char *acct_desc)
4429 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
4431 q_u->dom_pol = *hnd;
4433 init_unistr2(&q_u->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
4434 init_uni_hdr(&q_u->hdr_acct_desc, &q_u->uni_acct_desc);
4436 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
4439 /*******************************************************************
4440 reads or writes a structure.
4441 ********************************************************************/
4443 BOOL samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u,
4444 prs_struct *ps, int depth)
4449 prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
4455 if(!smb_io_pol_hnd("dom_pol", &q_u->dom_pol, ps, depth))
4458 if(!smb_io_unihdr("hdr_acct_desc", &q_u->hdr_acct_desc, ps, depth))
4460 if(!smb_io_unistr2("uni_acct_desc", &q_u->uni_acct_desc,
4461 q_u->hdr_acct_desc.buffer, ps, depth))
4466 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
4472 /*******************************************************************
4473 reads or writes a structure.
4474 ********************************************************************/
4476 BOOL samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u,
4477 prs_struct *ps, int depth)
4482 prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
4488 if(!smb_io_pol_hnd("alias_pol", &r_u->alias_pol, ps, depth))
4491 if(!prs_uint32("rid", ps, depth, &r_u->rid))
4494 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4500 /*******************************************************************
4501 inits a SAMR_Q_ADD_ALIASMEM structure.
4502 ********************************************************************/
4504 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd,
4507 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
4509 q_u->alias_pol = *hnd;
4510 init_dom_sid2(&q_u->sid, sid);
4513 /*******************************************************************
4514 reads or writes a structure.
4515 ********************************************************************/
4517 BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u,
4518 prs_struct *ps, int depth)
4523 prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
4529 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4531 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
4537 /*******************************************************************
4538 reads or writes a structure.
4539 ********************************************************************/
4541 BOOL samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u,
4542 prs_struct *ps, int depth)
4547 prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
4553 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4559 /*******************************************************************
4560 inits a SAMR_Q_DEL_ALIASMEM structure.
4561 ********************************************************************/
4563 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd,
4566 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4568 q_u->alias_pol = *hnd;
4569 init_dom_sid2(&q_u->sid, sid);
4572 /*******************************************************************
4573 reads or writes a structure.
4574 ********************************************************************/
4576 BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u,
4577 prs_struct *ps, int depth)
4582 prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
4588 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4590 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
4596 /*******************************************************************
4597 reads or writes a structure.
4598 ********************************************************************/
4600 BOOL samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
4601 prs_struct *ps, int depth)
4606 prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
4612 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4618 /*******************************************************************
4619 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4620 ********************************************************************/
4622 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c,
4625 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4627 q_c->alias_pol = *hnd;
4630 /*******************************************************************
4631 reads or writes a structure.
4632 ********************************************************************/
4634 BOOL samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
4635 prs_struct *ps, int depth)
4640 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
4646 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4652 /*******************************************************************
4653 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4654 ********************************************************************/
4656 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u,
4659 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4661 r_u->status = status;
4664 /*******************************************************************
4665 reads or writes a structure.
4666 ********************************************************************/
4668 BOOL samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
4669 prs_struct *ps, int depth)
4674 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
4680 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4683 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4689 /*******************************************************************
4690 inits a SAMR_Q_QUERY_ALIASMEM structure.
4691 ********************************************************************/
4693 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c,
4696 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4698 q_c->alias_pol = *hnd;
4701 /*******************************************************************
4702 reads or writes a structure.
4703 ********************************************************************/
4705 BOOL samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u,
4706 prs_struct *ps, int depth)
4711 prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem");
4717 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4723 /*******************************************************************
4724 inits a SAMR_R_QUERY_ALIASMEM structure.
4725 ********************************************************************/
4727 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u,
4728 uint32 num_sids, DOM_SID2 * sid,
4731 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4733 if (NT_STATUS_IS_OK(status)) {
4734 r_u->num_sids = num_sids;
4735 r_u->ptr = (num_sids != 0) ? 1 : 0;
4736 r_u->num_sids1 = num_sids;
4744 r_u->status = status;
4747 /*******************************************************************
4748 reads or writes a structure.
4749 ********************************************************************/
4751 BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u,
4752 prs_struct *ps, int depth)
4759 prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem");
4765 if(!prs_uint32("num_sids ", ps, depth, &r_u->num_sids))
4767 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
4770 if (r_u->ptr != 0 && r_u->num_sids != 0) {
4771 uint32 *ptr_sid = NULL;
4773 if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1))
4776 ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1);
4781 for (i = 0; i < r_u->num_sids1; i++) {
4783 if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i]))
4787 if (UNMARSHALLING(ps)) {
4788 r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1);
4791 for (i = 0; i < r_u->num_sids1; i++) {
4792 if (ptr_sid[i] != 0) {
4793 if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth))
4801 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4807 /*******************************************************************
4808 inits a SAMR_Q_LOOKUP_NAMES structure.
4809 ********************************************************************/
4811 NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
4812 POLICY_HND *pol, uint32 flags,
4813 uint32 num_names, const char **name)
4817 DEBUG(5, ("init_samr_q_lookup_names\n"));
4821 q_u->num_names1 = num_names;
4824 q_u->num_names2 = num_names;
4826 if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names)))
4827 return NT_STATUS_NO_MEMORY;
4829 if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names)))
4830 return NT_STATUS_NO_MEMORY;
4832 for (i = 0; i < num_names; i++) {
4833 init_unistr2(&q_u->uni_name[i], name[i], UNI_FLAGS_NONE); /* unicode string for machine account */
4834 init_uni_hdr(&q_u->hdr_name[i], &q_u->uni_name[i]); /* unicode header for user_name */
4837 return NT_STATUS_OK;
4840 /*******************************************************************
4841 reads or writes a structure.
4842 ********************************************************************/
4844 BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
4845 prs_struct *ps, int depth)
4852 prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
4855 if (UNMARSHALLING(ps))
4861 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
4864 if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1))
4866 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
4868 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
4870 if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2))
4873 if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) {
4874 q_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_u->num_names2);
4875 q_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_u->num_names2);
4876 if (!q_u->hdr_name || !q_u->uni_name)
4880 for (i = 0; i < q_u->num_names2; i++) {
4881 if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth))
4885 for (i = 0; i < q_u->num_names2; i++) {
4886 if(!smb_io_unistr2("", &q_u->uni_name[i], q_u->hdr_name[i].buffer, ps, depth))
4893 /*******************************************************************
4894 inits a SAMR_R_LOOKUP_NAMES structure.
4895 ********************************************************************/
4897 NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
4899 uint32 *rid, uint32 *type,
4902 DEBUG(5, ("init_samr_r_lookup_names\n"));
4904 if (NT_STATUS_IS_OK(status) && (num_rids != 0)) {
4907 r_u->num_types1 = num_rids;
4909 r_u->num_types2 = num_rids;
4911 r_u->num_rids1 = num_rids;
4913 r_u->num_rids2 = num_rids;
4915 if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
4916 return NT_STATUS_NO_MEMORY;
4917 if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
4918 return NT_STATUS_NO_MEMORY;
4920 if (!r_u->rids || !r_u->types)
4923 for (i = 0; i < num_rids; i++) {
4924 r_u->rids[i] = rid[i];
4925 r_u->types[i] = type[i];
4930 r_u->num_types1 = 0;
4932 r_u->num_types2 = 0;
4942 r_u->status = status;
4944 return NT_STATUS_OK;
4947 /*******************************************************************
4948 reads or writes a structure.
4949 ********************************************************************/
4951 BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u,
4952 prs_struct *ps, int depth)
4960 prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
4963 if (UNMARSHALLING(ps))
4969 if(!prs_uint32("num_rids1", ps, depth, &r_u->num_rids1))
4971 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
4974 if (r_u->ptr_rids != 0) {
4975 if(!prs_uint32("num_rids2", ps, depth, &r_u->num_rids2))
4978 if (r_u->num_rids2 != r_u->num_rids1) {
4983 if (UNMARSHALLING(ps))
4984 r_u->rids = PRS_ALLOC_MEM(ps, uint32, r_u->num_rids2);
4987 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
4991 for (i = 0; i < r_u->num_rids2; i++) {
4992 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
4993 if(!prs_uint32(tmp, ps, depth, &r_u->rids[i]))
4998 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
5000 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
5003 if (r_u->ptr_types != 0) {
5004 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
5007 if (r_u->num_types2 != r_u->num_types1) {
5012 if (UNMARSHALLING(ps))
5013 r_u->types = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
5016 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
5020 for (i = 0; i < r_u->num_types2; i++) {
5021 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
5022 if(!prs_uint32(tmp, ps, depth, &r_u->types[i]))
5027 if(!prs_ntstatus("status", ps, depth, &r_u->status))
5033 /*******************************************************************
5034 inits a SAMR_Q_DELETE_DOM_USER structure.
5035 ********************************************************************/
5037 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c,
5040 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
5042 q_c->user_pol = *hnd;
5045 /*******************************************************************
5046 reads or writes a structure.
5047 ********************************************************************/
5049 BOOL samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u,
5050 prs_struct *ps, int depth)
5055 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_user");
5061 if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
5067 /*******************************************************************
5068 reads or writes a structure.
5069 ********************************************************************/
5071 BOOL samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u,
5072 prs_struct *ps, int depth)
5077 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_user");
5083 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
5085 if(!prs_ntstatus("status", ps, depth, &r_u->status))
5091 /*******************************************************************
5092 reads or writes a structure.
5093 ********************************************************************/
5095 void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u,
5097 uint32 access_mask, uint32 rid)
5099 DEBUG(5, ("samr_init_samr_q_open_user\n"));
5101 q_u->domain_pol = *pol;
5102 q_u->access_mask = access_mask;
5103 q_u->user_rid = rid;
5106 /*******************************************************************
5107 reads or writes a structure.
5108 ********************************************************************/
5110 BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u,
5111 prs_struct *ps, int depth)
5116 prs_debug(ps, depth, desc, "samr_io_q_open_user");
5122 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
5125 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
5127 if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid))
5133 /*******************************************************************
5134 reads or writes a structure.
5135 ********************************************************************/
5137 BOOL samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u,
5138 prs_struct *ps, int depth)
5143 prs_debug(ps, depth, desc, "samr_io_r_open_user");
5149 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
5152 if(!prs_ntstatus("status", ps, depth, &r_u->status))
5159 /*******************************************************************
5160 reads or writes a structure.
5161 ********************************************************************/
5163 void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
5166 uint32 acb_info, uint32 access_mask)
5168 DEBUG(5, ("samr_init_samr_q_create_user\n"));
5170 q_u->domain_pol = *pol;
5172 init_unistr2(&q_u->uni_name, name, UNI_FLAGS_NONE);
5173 init_uni_hdr(&q_u->hdr_name, &q_u->uni_name);
5175 q_u->acb_info = acb_info;
5176 q_u->access_mask = access_mask;
5179 /*******************************************************************
5180 reads or writes a structure.
5181 ********************************************************************/
5183 BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u,
5184 prs_struct *ps, int depth)
5189 prs_debug(ps, depth, desc, "samr_io_q_create_user");
5195 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
5198 if(!smb_io_unihdr("hdr_name", &q_u->hdr_name, ps, depth))
5200 if(!smb_io_unistr2("uni_name", &q_u->uni_name, q_u->hdr_name.buffer, ps, depth))
5205 if(!prs_uint32("acb_info ", ps, depth, &q_u->acb_info))
5207 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
5213 /*******************************************************************
5214 reads or writes a structure.
5215 ********************************************************************/
5217 BOOL samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u,
5218 prs_struct *ps, int depth)
5223 prs_debug(ps, depth, desc, "samr_io_r_create_user");
5229 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
5232 if(!prs_uint32("access_granted", ps, depth, &r_u->access_granted))
5234 if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid))
5236 if(!prs_ntstatus("status", ps, depth, &r_u->status))
5242 /*******************************************************************
5243 inits a SAMR_Q_QUERY_USERINFO structure.
5244 ********************************************************************/
5246 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u,
5247 const POLICY_HND *hnd, uint16 switch_value)
5249 DEBUG(5, ("init_samr_q_query_userinfo\n"));
5252 q_u->switch_value = switch_value;
5255 /*******************************************************************
5256 reads or writes a structure.
5257 ********************************************************************/
5259 BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u,
5260 prs_struct *ps, int depth)
5265 prs_debug(ps, depth, desc, "samr_io_q_query_userinfo");
5271 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
5274 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) /* 0x0015 or 0x0011 */
5280 /*******************************************************************
5281 reads or writes a LOGON_HRS structure.
5282 ********************************************************************/
5284 static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs,
5285 prs_struct *ps, int depth)
5290 prs_debug(ps, depth, desc, "sam_io_logon_hrs");
5296 if(!prs_uint32("maxlen", ps, depth, &hrs->max_len))
5299 if(!prs_uint32("offset", ps, depth, &hrs->offset))
5302 if(!prs_uint32("len ", ps, depth, &hrs->len))
5305 if (hrs->len > sizeof(hrs->hours)) {
5306 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs->len));
5307 hrs->len = sizeof(hrs->hours);
5310 if(!prs_uint8s(False, "hours", ps, depth, hrs->hours, hrs->len))
5316 /*******************************************************************
5317 inits a SAM_USER_INFO_18 structure.
5318 ********************************************************************/
5320 void init_sam_user_info18(SAM_USER_INFO_18 * usr,
5321 const uint8 lm_pwd[16], const uint8 nt_pwd[16])
5323 DEBUG(5, ("init_sam_user_info18\n"));
5325 usr->lm_pwd_active =
5326 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)) ? 1 : 0;
5327 usr->nt_pwd_active =
5328 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)) ? 1 : 0;
5331 /*******************************************************************
5332 reads or writes a structure.
5333 ********************************************************************/
5335 static BOOL sam_io_user_info18(const char *desc, SAM_USER_INFO_18 * u,
5336 prs_struct *ps, int depth)
5341 prs_debug(ps, depth, desc, "samr_io_r_user_info18");
5347 if(!prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd)))
5349 if(!prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd)))
5352 if(!prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active))
5354 if(!prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active))
5360 /*******************************************************************
5361 inits a SAM_USER_INFO_7 structure.
5362 ********************************************************************/
5364 void init_sam_user_info7(SAM_USER_INFO_7 * usr, const char *name)
5366 DEBUG(5, ("init_sam_user_info7\n"));
5368 init_unistr2(&usr->uni_name, name, UNI_FLAGS_NONE); /* unicode string for name */
5369 init_uni_hdr(&usr->hdr_name, &usr->uni_name); /* unicode header for name */
5373 /*******************************************************************
5374 reads or writes a structure.
5375 ********************************************************************/
5377 static BOOL sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr,
5378 prs_struct *ps, int depth)
5383 prs_debug(ps, depth, desc, "samr_io_r_user_info7");
5389 if(!smb_io_unihdr("unihdr", &usr->hdr_name, ps, depth))
5392 if(!smb_io_unistr2("unistr2", &usr->uni_name, True, ps, depth))
5398 /*******************************************************************
5399 inits a SAM_USER_INFO_9 structure.
5400 ********************************************************************/
5402 void init_sam_user_info9(SAM_USER_INFO_9 * usr, uint32 rid_group)
5404 DEBUG(5, ("init_sam_user_info9\n"));
5406 usr->rid_group = rid_group;
5409 /*******************************************************************
5410 reads or writes a structure.
5411 ********************************************************************/
5413 static BOOL sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr,
5414 prs_struct *ps, int depth)
5419 prs_debug(ps, depth, desc, "samr_io_r_user_info9");
5425 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
5431 /*******************************************************************
5432 inits a SAM_USER_INFO_16 structure.
5433 ********************************************************************/
5435 void init_sam_user_info16(SAM_USER_INFO_16 * usr, uint32 acb_info)
5437 DEBUG(5, ("init_sam_user_info16\n"));
5439 usr->acb_info = acb_info;
5442 /*******************************************************************
5443 reads or writes a structure.
5444 ********************************************************************/
5446 static BOOL sam_io_user_info16(const char *desc, SAM_USER_INFO_16 * usr,
5447 prs_struct *ps, int depth)
5452 prs_debug(ps, depth, desc, "samr_io_r_user_info16");
5458 if(!prs_uint32("acb_info", ps, depth, &usr->acb_info))
5464 /*******************************************************************
5465 inits a SAM_USER_INFO_17 structure.
5466 ********************************************************************/
5468 void init_sam_user_info17(SAM_USER_INFO_17 * usr,
5471 uint32 rid_user, uint32 rid_group, uint16 acct_ctrl)
5473 DEBUG(5, ("init_sam_user_info17\n"));
5475 memcpy(&usr->expiry, expiry, sizeof(usr->expiry)); /* expiry time or something? */
5476 ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */
5478 usr->padding_2 = 0; /* 0 - padding 4 bytes */
5480 usr->ptr_1 = 1; /* pointer */
5481 ZERO_STRUCT(usr->padding_3); /* 0 - padding 32 bytes */
5482 usr->padding_4 = 0; /* 0 - padding 4 bytes */
5484 usr->ptr_2 = 1; /* pointer */
5485 usr->padding_5 = 0; /* 0 - padding 4 bytes */
5487 usr->ptr_3 = 1; /* pointer */
5488 ZERO_STRUCT(usr->padding_6); /* 0 - padding 32 bytes */
5490 usr->rid_user = rid_user;
5491 usr->rid_group = rid_group;
5493 usr->acct_ctrl = acct_ctrl;
5494 usr->unknown_3 = 0x0000;
5496 usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */
5497 usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */
5499 ZERO_STRUCT(usr->padding_7); /* 0 - padding 16 bytes */
5500 usr->padding_8 = 0; /* 0 - padding 4 bytes */
5502 init_unistr2(&usr->uni_mach_acct, mach_acct, UNI_FLAGS_NONE); /* unicode string for machine account */
5503 init_uni_hdr(&usr->hdr_mach_acct, &usr->uni_mach_acct); /* unicode header for machine account */
5506 /*******************************************************************
5507 reads or writes a structure.
5508 ********************************************************************/
5510 static BOOL sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr,
5511 prs_struct *ps, int depth)
5516 prs_debug(ps, depth, desc, "samr_io_r_unknown_17");
5522 if(!prs_uint8s(False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)))
5525 if(!smb_io_time("time", &usr->expiry, ps, depth))
5528 if(!prs_uint8s(False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)))
5531 if(!smb_io_unihdr("unihdr", &usr->hdr_mach_acct, ps, depth))
5534 if(!prs_uint32("padding_2", ps, depth, &usr->padding_2))
5537 if(!prs_uint32("ptr_1 ", ps, depth, &usr->ptr_1))
5539 if(!prs_uint8s(False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)))
5542 if(!prs_uint32("padding_4", ps, depth, &usr->padding_4))
5545 if(!prs_uint32("ptr_2 ", ps, depth, &usr->ptr_2))
5547 if(!prs_uint32("padding_5", ps, depth, &usr->padding_5))
5550 if(!prs_uint32("ptr_3 ", ps, depth, &usr->ptr_3))
5552 if(!prs_uint8s(False, "padding_6", ps, depth, usr->padding_6,sizeof(usr->padding_6)))
5555 if(!prs_uint32("rid_user ", ps, depth, &usr->rid_user))
5557 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
5559 if(!prs_uint16("acct_ctrl", ps, depth, &usr->acct_ctrl))
5561 if(!prs_uint16("unknown_3", ps, depth, &usr->unknown_3))
5563 if(!prs_uint16("unknown_4", ps, depth, &usr->unknown_4))
5565 if(!prs_uint16("unknown_5", ps, depth, &usr->unknown_5))
5568 if(!prs_uint8s(False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)))
5571 if(!prs_uint32("padding_8", ps, depth, &(usr->padding_8)))
5574 if(!smb_io_unistr2("unistr2", &usr->uni_mach_acct, True, ps, depth))
5580 if(!prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)))
5586 /*************************************************************************
5588 *************************************************************************/
5590 void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_len)
5592 DEBUG(10, ("init_sam_user_info24:\n"));
5593 memcpy(usr->pass, newpass, sizeof(usr->pass));
5594 usr->pw_len = pw_len;
5597 /*******************************************************************
5598 reads or writes a structure.
5599 ********************************************************************/
5601 static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr,
5602 prs_struct *ps, int depth)
5607 prs_debug(ps, depth, desc, "sam_io_user_info24");
5613 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
5617 if (MARSHALLING(ps) && (usr->pw_len != 0)) {
5618 if (!prs_uint16("pw_len", ps, depth, &usr->pw_len))
5620 } else if (UNMARSHALLING(ps)) {
5621 if (!prs_uint16("pw_len", ps, depth, &usr->pw_len))
5628 /*******************************************************************
5629 reads or writes a structure.
5630 ********************************************************************/
5632 static BOOL sam_io_user_info26(const char *desc, SAM_USER_INFO_26 * usr,
5633 prs_struct *ps, int depth)
5638 prs_debug(ps, depth, desc, "sam_io_user_info26");
5644 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
5648 if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
5655 /*************************************************************************
5656 init_sam_user_info23
5658 unknown_6 = 0x0000 04ec
5660 *************************************************************************/
5662 void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
5663 NTTIME * logoff_time, /* all zeros */
5664 NTTIME * kickoff_time, /* all zeros */
5665 NTTIME * pass_last_set_time, /* all zeros */
5666 NTTIME * pass_can_change_time, /* all zeros */
5667 NTTIME * pass_must_change_time, /* all zeros */
5678 uint32 user_rid, /* 0x0000 0000 */
5681 uint32 fields_present,
5684 uint16 bad_password_count,
5688 usr->logon_time = *logon_time; /* all zeros */
5689 usr->logoff_time = *logoff_time; /* all zeros */
5690 usr->kickoff_time = *kickoff_time; /* all zeros */
5691 usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
5692 usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
5693 usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
5695 ZERO_STRUCT(usr->nt_pwd);
5696 ZERO_STRUCT(usr->lm_pwd);
5698 usr->user_rid = user_rid; /* 0x0000 0000 */
5699 usr->group_rid = group_rid;
5700 usr->acb_info = acb_info;
5701 usr->fields_present = fields_present; /* 09f8 27fa */
5703 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
5704 usr->ptr_logon_hrs = hrs ? 1 : 0;
5706 if (nt_time_is_zero(pass_must_change_time)) {
5707 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
5709 usr->passmustchange=0;
5712 ZERO_STRUCT(usr->padding1);
5713 ZERO_STRUCT(usr->padding2);
5715 usr->bad_password_count = bad_password_count;
5716 usr->logon_count = logon_count;
5718 memcpy(usr->pass, newpass, sizeof(usr->pass));
5720 copy_unistr2(&usr->uni_user_name, user_name);
5721 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
5723 copy_unistr2(&usr->uni_full_name, full_name);
5724 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
5726 copy_unistr2(&usr->uni_home_dir, home_dir);
5727 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
5729 copy_unistr2(&usr->uni_dir_drive, dir_drive);
5730 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
5732 copy_unistr2(&usr->uni_logon_script, log_scr);
5733 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
5735 copy_unistr2(&usr->uni_profile_path, prof_path);
5736 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
5738 copy_unistr2(&usr->uni_acct_desc, desc);
5739 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
5741 copy_unistr2(&usr->uni_workstations, wkstas);
5742 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
5744 copy_unistr2(&usr->uni_unknown_str, unk_str);
5745 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
5747 copy_unistr2(&usr->uni_munged_dial, mung_dial);
5748 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
5751 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
5753 ZERO_STRUCT(usr->logon_hrs);
5757 /*************************************************************************
5758 init_sam_user_info23
5760 unknown_6 = 0x0000 04ec
5762 *************************************************************************/
5764 void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
5765 NTTIME * logoff_time, /* all zeros */
5766 NTTIME * kickoff_time, /* all zeros */
5767 NTTIME * pass_last_set_time, /* all zeros */
5768 NTTIME * pass_can_change_time, /* all zeros */
5769 NTTIME * pass_must_change_time, /* all zeros */
5770 char *user_name, /* NULL */
5772 char *home_dir, char *dir_drive, char *log_scr,
5773 char *prof_path, const char *desc, char *wkstas,
5774 char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */
5775 uint32 group_rid, uint32 acb_info,
5776 uint32 fields_present, uint16 logon_divs,
5777 LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count,
5780 DATA_BLOB blob = base64_decode_data_blob(mung_dial);
5782 usr->logon_time = *logon_time; /* all zeros */
5783 usr->logoff_time = *logoff_time; /* all zeros */
5784 usr->kickoff_time = *kickoff_time; /* all zeros */
5785 usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
5786 usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
5787 usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
5789 ZERO_STRUCT(usr->nt_pwd);
5790 ZERO_STRUCT(usr->lm_pwd);
5792 usr->user_rid = user_rid; /* 0x0000 0000 */
5793 usr->group_rid = group_rid;
5794 usr->acb_info = acb_info;
5795 usr->fields_present = fields_present; /* 09f8 27fa */
5797 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
5798 usr->ptr_logon_hrs = hrs ? 1 : 0;
5800 if (nt_time_is_zero(pass_must_change_time)) {
5801 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
5803 usr->passmustchange=0;
5806 ZERO_STRUCT(usr->padding1);
5807 ZERO_STRUCT(usr->padding2);
5809 usr->bad_password_count = bad_password_count;
5810 usr->logon_count = logon_count;
5812 memcpy(usr->pass, newpass, sizeof(usr->pass));
5814 init_unistr2(&usr->uni_user_name, user_name, UNI_FLAGS_NONE);
5815 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
5817 init_unistr2(&usr->uni_full_name, full_name, UNI_FLAGS_NONE);
5818 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
5820 init_unistr2(&usr->uni_home_dir, home_dir, UNI_FLAGS_NONE);
5821 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
5823 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_FLAGS_NONE);
5824 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
5826 init_unistr2(&usr->uni_logon_script, log_scr, UNI_FLAGS_NONE);
5827 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
5829 init_unistr2(&usr->uni_profile_path, prof_path, UNI_FLAGS_NONE);
5830 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
5832 init_unistr2(&usr->uni_acct_desc, desc, UNI_FLAGS_NONE);
5833 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
5835 init_unistr2(&usr->uni_workstations, wkstas, UNI_FLAGS_NONE);
5836 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
5838 init_unistr2(&usr->uni_unknown_str, unk_str, UNI_FLAGS_NONE);
5839 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
5841 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
5842 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
5844 data_blob_free(&blob);
5847 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
5849 ZERO_STRUCT(usr->logon_hrs);
5853 /*******************************************************************
5854 reads or writes a structure.
5855 ********************************************************************/
5857 static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr,
5858 prs_struct *ps, int depth)
5863 prs_debug(ps, depth, desc, "sam_io_user_info23");
5869 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
5871 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
5873 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
5875 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
5877 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
5879 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
5882 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
5884 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
5886 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
5888 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
5890 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
5892 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
5894 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
5896 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
5898 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
5900 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
5903 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
5905 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
5908 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
5910 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
5912 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
5915 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
5917 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
5921 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
5924 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
5926 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
5929 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
5931 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
5933 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
5937 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
5940 /* here begins pointed-to data */
5942 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
5945 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
5948 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
5951 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
5954 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
5957 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
5960 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
5963 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
5966 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
5969 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
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))
5981 /*******************************************************************
5982 reads or writes a structure.
5983 NB. This structure is *definately* incorrect. It's my best guess
5984 currently for W2K SP2. The password field is encrypted in a different
5985 way than normal... And there are definately other problems. JRA.
5986 ********************************************************************/
5988 static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth)
5993 prs_debug(ps, depth, desc, "sam_io_user_info25");
5999 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
6001 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
6003 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
6005 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
6007 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
6009 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
6012 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
6014 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
6016 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
6018 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
6020 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
6022 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
6024 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
6026 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
6028 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
6030 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
6033 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
6035 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
6038 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
6040 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
6042 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
6045 if(!prs_uint32s(False, "unknown_6 ", ps, depth, usr->unknown_6, 6))
6048 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
6051 /* here begins pointed-to data */
6053 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
6056 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
6059 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
6062 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
6065 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
6068 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
6071 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
6074 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
6077 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
6080 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
6083 #if 0 /* JRA - unknown... */
6084 /* ok, this is only guess-work (as usual) */
6085 if (usr->ptr_logon_hrs) {
6086 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
6095 /*************************************************************************
6096 init_sam_user_info21W
6098 unknown_6 = 0x0000 04ec
6100 *************************************************************************/
6102 void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
6103 NTTIME * logon_time,
6104 NTTIME * logoff_time,
6105 NTTIME * kickoff_time,
6106 NTTIME * pass_last_set_time,
6107 NTTIME * pass_can_change_time,
6108 NTTIME * pass_must_change_time,
6124 uint32 fields_present,
6127 uint16 bad_password_count,
6130 usr->logon_time = *logon_time;
6131 usr->logoff_time = *logoff_time;
6132 usr->kickoff_time = *kickoff_time;
6133 usr->pass_last_set_time = *pass_last_set_time;
6134 usr->pass_can_change_time = *pass_can_change_time;
6135 usr->pass_must_change_time = *pass_must_change_time;
6137 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd));
6138 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd));
6140 usr->user_rid = user_rid;
6141 usr->group_rid = group_rid;
6142 usr->acb_info = acb_info;
6143 usr->fields_present = fields_present; /* 0x00ff ffff */
6145 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
6146 usr->ptr_logon_hrs = hrs ? 1 : 0;
6147 usr->bad_password_count = bad_password_count;
6148 usr->logon_count = logon_count;
6150 if (nt_time_is_zero(pass_must_change_time)) {
6151 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
6153 usr->passmustchange=0;
6156 ZERO_STRUCT(usr->padding1);
6157 ZERO_STRUCT(usr->padding2);
6159 copy_unistr2(&usr->uni_user_name, user_name);
6160 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
6162 copy_unistr2(&usr->uni_full_name, full_name);
6163 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
6165 copy_unistr2(&usr->uni_home_dir, home_dir);
6166 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
6168 copy_unistr2(&usr->uni_dir_drive, dir_drive);
6169 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
6171 copy_unistr2(&usr->uni_logon_script, log_scr);
6172 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
6174 copy_unistr2(&usr->uni_profile_path, prof_path);
6175 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
6177 copy_unistr2(&usr->uni_acct_desc, desc);
6178 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
6180 copy_unistr2(&usr->uni_workstations, wkstas);
6181 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
6183 copy_unistr2(&usr->uni_unknown_str, unk_str);
6184 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
6186 copy_unistr2(&usr->uni_munged_dial, mung_dial);
6187 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6190 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
6192 ZERO_STRUCT(usr->logon_hrs);
6196 /*************************************************************************
6197 init_sam_user_info21
6199 unknown_6 = 0x0000 04ec
6201 *************************************************************************/
6203 NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID *domain_sid)
6205 NTTIME logon_time, logoff_time, kickoff_time,
6206 pass_last_set_time, pass_can_change_time,
6207 pass_must_change_time;
6209 const char* user_name = pdb_get_username(pw);
6210 const char* full_name = pdb_get_fullname(pw);
6211 const char* home_dir = pdb_get_homedir(pw);
6212 const char* dir_drive = pdb_get_dir_drive(pw);
6213 const char* logon_script = pdb_get_logon_script(pw);
6214 const char* profile_path = pdb_get_profile_path(pw);
6215 const char* description = pdb_get_acct_desc(pw);
6216 const char* workstations = pdb_get_workstations(pw);
6217 const char* munged_dial = pdb_get_munged_dial(pw);
6218 DATA_BLOB munged_dial_blob;
6221 const DOM_SID *user_sid;
6224 const DOM_SID *group_sid;
6227 munged_dial_blob = base64_decode_data_blob(munged_dial);
6229 munged_dial_blob = data_blob(NULL, 0);
6232 /* Create NTTIME structs */
6233 unix_to_nt_time (&logon_time, pdb_get_logon_time(pw));
6234 unix_to_nt_time (&logoff_time, pdb_get_logoff_time(pw));
6235 unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(pw));
6236 unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(pw));
6237 unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(pw));
6238 unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(pw));
6240 /* structure assignment */
6241 usr->logon_time = logon_time;
6242 usr->logoff_time = logoff_time;
6243 usr->kickoff_time = kickoff_time;
6244 usr->pass_last_set_time = pass_last_set_time;
6245 usr->pass_can_change_time = pass_can_change_time;
6246 usr->pass_must_change_time = pass_must_change_time;
6248 ZERO_STRUCT(usr->nt_pwd);
6249 ZERO_STRUCT(usr->lm_pwd);
6251 user_sid = pdb_get_user_sid(pw);
6253 if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) {
6254 fstring user_sid_string;
6255 fstring domain_sid_string;
6256 DEBUG(0, ("init_sam_user_info_21A: User %s has SID %s, \nwhich conflicts with "
6257 "the domain sid %s. Failing operation.\n",
6259 sid_to_string(user_sid_string, user_sid),
6260 sid_to_string(domain_sid_string, domain_sid)));
6261 data_blob_free(&munged_dial_blob);
6262 return NT_STATUS_UNSUCCESSFUL;
6265 group_sid = pdb_get_group_sid(pw);
6267 if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) {
6268 fstring group_sid_string;
6269 fstring domain_sid_string;
6270 DEBUG(0, ("init_sam_user_info_21A: User %s has Primary Group SID %s, \n"
6271 "which conflicts with the domain sid %s. Failing operation.\n",
6273 sid_to_string(group_sid_string, group_sid),
6274 sid_to_string(domain_sid_string, domain_sid)));
6275 data_blob_free(&munged_dial_blob);
6276 return NT_STATUS_UNSUCCESSFUL;
6279 usr->user_rid = user_rid;
6280 usr->group_rid = group_rid;
6281 usr->acb_info = pdb_get_acct_ctrl(pw);
6284 Look at a user on a real NT4 PDC with usrmgr, press
6285 'ok'. Then you will see that fields_present is set to
6286 0x08f827fa. Look at the user immediately after that again,
6287 and you will see that 0x00fffff is returned. This solves
6288 the problem that you get access denied after having looked
6292 usr->fields_present = pdb_build_fields_present(pw);
6294 usr->logon_divs = pdb_get_logon_divs(pw);
6295 usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0;
6296 usr->bad_password_count = pdb_get_bad_password_count(pw);
6297 usr->logon_count = pdb_get_logon_count(pw);
6299 if (pdb_get_pass_must_change_time(pw) == 0) {
6300 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
6302 usr->passmustchange=0;
6305 ZERO_STRUCT(usr->padding1);
6306 ZERO_STRUCT(usr->padding2);
6308 init_unistr2(&usr->uni_user_name, user_name, UNI_STR_TERMINATE);
6309 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
6311 init_unistr2(&usr->uni_full_name, full_name, UNI_STR_TERMINATE);
6312 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
6314 init_unistr2(&usr->uni_home_dir, home_dir, UNI_STR_TERMINATE);
6315 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
6317 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_STR_TERMINATE);
6318 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
6320 init_unistr2(&usr->uni_logon_script, logon_script, UNI_STR_TERMINATE);
6321 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
6323 init_unistr2(&usr->uni_profile_path, profile_path, UNI_STR_TERMINATE);
6324 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
6326 init_unistr2(&usr->uni_acct_desc, description, UNI_STR_TERMINATE);
6327 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
6329 init_unistr2(&usr->uni_workstations, workstations, UNI_STR_TERMINATE);
6330 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
6332 init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE);
6333 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
6335 init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob);
6336 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6337 data_blob_free(&munged_dial_blob);
6339 if (pdb_get_hours(pw)) {
6340 usr->logon_hrs.max_len = 1260;
6341 usr->logon_hrs.offset = 0;
6342 usr->logon_hrs.len = pdb_get_hours_len(pw);
6343 memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN);
6345 usr->logon_hrs.max_len = 1260;
6346 usr->logon_hrs.offset = 0;
6347 usr->logon_hrs.len = 0;
6348 memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs));
6351 return NT_STATUS_OK;
6354 /*******************************************************************
6355 reads or writes a structure.
6356 ********************************************************************/
6358 static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr,
6359 prs_struct *ps, int depth)
6364 prs_debug(ps, depth, desc, "sam_io_user_info21");
6370 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
6372 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
6374 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps,depth))
6376 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
6378 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps,depth))
6380 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
6383 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
6385 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
6387 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
6389 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
6391 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
6393 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
6395 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
6397 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
6399 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
6401 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
6404 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
6406 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
6409 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
6411 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
6413 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
6416 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
6418 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
6422 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
6425 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
6427 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
6430 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
6432 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
6434 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
6437 /* here begins pointed-to data */
6439 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
6441 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
6443 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
6445 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
6447 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
6449 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
6451 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
6453 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
6455 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
6457 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */
6460 /* ok, this is only guess-work (as usual) */
6461 if (usr->ptr_logon_hrs) {
6462 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
6469 void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw)
6471 const char *munged_dial = pdb_get_munged_dial(pw);
6472 DATA_BLOB blob = base64_decode_data_blob(munged_dial);
6474 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
6475 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6476 data_blob_free(&blob);
6479 /*******************************************************************
6480 reads or writes a structure.
6481 ********************************************************************/
6483 static BOOL sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr,
6484 prs_struct *ps, int depth)
6489 prs_debug(ps, depth, desc, "sam_io_user_info20");
6495 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
6498 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */
6504 /*******************************************************************
6505 inits a SAM_USERINFO_CTR structure.
6506 ********************************************************************/
6508 NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr,
6509 uint16 switch_value,
6510 SAM_USER_INFO_21 * usr)
6512 DEBUG(5, ("make_samr_userinfo_ctr_usr21\n"));
6514 ctr->switch_value = switch_value;
6515 ctr->info.id = NULL;
6517 switch (switch_value) {
6519 ctr->info.id16 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_16);
6520 if (ctr->info.id16 == NULL)
6521 return NT_STATUS_NO_MEMORY;
6523 init_sam_user_info16(ctr->info.id16, usr->acb_info);
6526 /* whoops - got this wrong. i think. or don't understand what's happening. */
6530 info = (void *)&id11;
6532 expire.low = 0xffffffff;
6533 expire.high = 0x7fffffff;
6535 ctr->info.id = TALLOC_ZERO_P(ctx,SAM_USER_INFO_17);
6536 init_sam_user_info11(ctr->info.id17, &expire,
6537 "BROOKFIELDS$", /* name */
6538 0x03ef, /* user rid */
6539 0x201, /* group rid */
6540 0x0080); /* acb info */
6546 ctr->info.id18 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_18);
6547 if (ctr->info.id18 == NULL)
6548 return NT_STATUS_NO_MEMORY;
6550 init_sam_user_info18(ctr->info.id18, usr->lm_pwd, usr->nt_pwd);
6554 SAM_USER_INFO_21 *cusr;
6555 cusr = TALLOC_ZERO_P(ctx,SAM_USER_INFO_21);
6556 ctr->info.id21 = cusr;
6557 if (ctr->info.id21 == NULL)
6558 return NT_STATUS_NO_MEMORY;
6559 memcpy(cusr, usr, sizeof(*usr));
6560 memset(cusr->lm_pwd, 0, sizeof(cusr->lm_pwd));
6561 memset(cusr->nt_pwd, 0, sizeof(cusr->nt_pwd));
6565 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
6566 return NT_STATUS_INVALID_INFO_CLASS;
6569 return NT_STATUS_OK;
6572 /*******************************************************************
6573 inits a SAM_USERINFO_CTR structure.
6574 ********************************************************************/
6576 static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key,
6577 uint16 switch_value, void *info)
6579 DEBUG(5, ("init_samr_userinfo_ctr\n"));
6581 ctr->switch_value = switch_value;
6582 ctr->info.id = info;
6584 switch (switch_value) {
6586 SamOEMhashBlob(ctr->info.id24->pass, 516, sess_key);
6587 dump_data(100, (char *)sess_key->data, sess_key->length);
6588 dump_data(100, (char *)ctr->info.id24->pass, 516);
6591 SamOEMhashBlob(ctr->info.id23->pass, 516, sess_key);
6592 dump_data(100, (char *)sess_key->data, sess_key->length);
6593 dump_data(100, (char *)ctr->info.id23->pass, 516);
6598 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value));
6602 /*******************************************************************
6603 reads or writes a structure.
6604 ********************************************************************/
6606 static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr,
6607 prs_struct *ps, int depth)
6610 SAM_USERINFO_CTR *ctr;
6612 prs_debug(ps, depth, desc, "samr_io_userinfo_ctr");
6615 if (UNMARSHALLING(ps)) {
6616 ctr = PRS_ALLOC_MEM(ps,SAM_USERINFO_CTR,1);
6624 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
6626 if(!prs_uint16("switch_value", ps, depth, &ctr->switch_value))
6633 switch (ctr->switch_value) {
6635 if (UNMARSHALLING(ps))
6636 ctr->info.id7 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_7,1);
6637 if (ctr->info.id7 == NULL) {
6638 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6641 ret = sam_io_user_info7("", ctr->info.id7, ps, depth);
6644 if (UNMARSHALLING(ps))
6645 ctr->info.id9 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_9,1);
6646 if (ctr->info.id9 == NULL) {
6647 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6650 ret = sam_io_user_info9("", ctr->info.id9, ps, depth);
6653 if (UNMARSHALLING(ps))
6654 ctr->info.id16 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_16,1);
6655 if (ctr->info.id16 == NULL) {
6656 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6659 ret = sam_io_user_info16("", ctr->info.id16, ps, depth);
6662 if (UNMARSHALLING(ps))
6663 ctr->info.id17 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_17,1);
6665 if (ctr->info.id17 == NULL) {
6666 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6669 ret = sam_io_user_info17("", ctr->info.id17, ps, depth);
6672 if (UNMARSHALLING(ps))
6673 ctr->info.id18 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_18,1);
6675 if (ctr->info.id18 == NULL) {
6676 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6679 ret = sam_io_user_info18("", ctr->info.id18, ps, depth);
6682 if (UNMARSHALLING(ps))
6683 ctr->info.id20 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_20,1);
6685 if (ctr->info.id20 == NULL) {
6686 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6689 ret = sam_io_user_info20("", ctr->info.id20, ps, depth);
6692 if (UNMARSHALLING(ps))
6693 ctr->info.id21 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_21,1);
6695 if (ctr->info.id21 == NULL) {
6696 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6699 ret = sam_io_user_info21("", ctr->info.id21, ps, depth);
6702 if (UNMARSHALLING(ps))
6703 ctr->info.id23 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_23,1);
6705 if (ctr->info.id23 == NULL) {
6706 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6709 ret = sam_io_user_info23("", ctr->info.id23, ps, depth);
6712 if (UNMARSHALLING(ps))
6713 ctr->info.id24 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_24,1);
6715 if (ctr->info.id24 == NULL) {
6716 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6719 ret = sam_io_user_info24("", ctr->info.id24, ps, depth);
6722 if (UNMARSHALLING(ps))
6723 ctr->info.id25 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_25,1);
6725 if (ctr->info.id25 == NULL) {
6726 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6729 ret = sam_io_user_info25("", ctr->info.id25, ps, depth);
6732 if (UNMARSHALLING(ps))
6733 ctr->info.id26 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_26,1);
6735 if (ctr->info.id26 == NULL) {
6736 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6739 ret = sam_io_user_info26("", ctr->info.id26, ps, depth);
6742 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value));
6750 /*******************************************************************
6751 inits a SAMR_R_QUERY_USERINFO structure.
6752 ********************************************************************/
6754 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u,
6755 SAM_USERINFO_CTR * ctr, NTSTATUS status)
6757 DEBUG(5, ("init_samr_r_query_userinfo\n"));
6762 if (NT_STATUS_IS_OK(status)) {
6767 r_u->status = status; /* return status */
6770 /*******************************************************************
6771 reads or writes a structure.
6772 ********************************************************************/
6774 BOOL samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u,
6775 prs_struct *ps, int depth)
6780 prs_debug(ps, depth, desc, "samr_io_r_query_userinfo");
6786 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
6789 if (r_u->ptr != 0) {
6790 if(!samr_io_userinfo_ctr("ctr", &r_u->ctr, ps, depth))
6796 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6802 /*******************************************************************
6803 inits a SAMR_Q_SET_USERINFO structure.
6804 ********************************************************************/
6806 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u,
6807 const POLICY_HND *hnd, DATA_BLOB *sess_key,
6808 uint16 switch_value, void *info)
6810 DEBUG(5, ("init_samr_q_set_userinfo\n"));
6813 q_u->switch_value = switch_value;
6814 init_samr_userinfo_ctr(q_u->ctr, sess_key, switch_value, info);
6817 /*******************************************************************
6818 reads or writes a structure.
6819 ********************************************************************/
6821 BOOL samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u,
6822 prs_struct *ps, int depth)
6827 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo");
6833 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
6835 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
6837 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
6843 /*******************************************************************
6844 inits a SAMR_R_SET_USERINFO structure.
6845 ********************************************************************/
6847 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status)
6849 DEBUG(5, ("init_samr_r_set_userinfo\n"));
6851 r_u->status = status; /* return status */
6854 /*******************************************************************
6855 reads or writes a structure.
6856 ********************************************************************/
6858 BOOL samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u,
6859 prs_struct *ps, int depth)
6864 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo");
6870 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6876 /*******************************************************************
6877 inits a SAMR_Q_SET_USERINFO2 structure.
6878 ********************************************************************/
6880 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
6881 const POLICY_HND *hnd, DATA_BLOB *sess_key,
6882 uint16 switch_value, SAM_USERINFO_CTR * ctr)
6884 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
6887 q_u->switch_value = switch_value;
6890 if (q_u->ctr != NULL)
6891 q_u->ctr->switch_value = switch_value;
6893 switch (switch_value) {
6895 SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key);
6896 SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key);
6897 dump_data(100, (char *)sess_key->data, sess_key->length);
6898 dump_data(100, (char *)ctr->info.id18->lm_pwd, 16);
6899 dump_data(100, (char *)ctr->info.id18->nt_pwd, 16);
6904 /*******************************************************************
6905 reads or writes a structure.
6906 ********************************************************************/
6908 BOOL samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u,
6909 prs_struct *ps, int depth)
6914 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2");
6920 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
6923 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
6925 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
6931 /*******************************************************************
6932 inits a SAMR_R_SET_USERINFO2 structure.
6933 ********************************************************************/
6935 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status)
6937 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
6939 r_u->status = status; /* return status */
6942 /*******************************************************************
6943 reads or writes a structure.
6944 ********************************************************************/
6946 BOOL samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u,
6947 prs_struct *ps, int depth)
6952 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2");
6958 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6964 /*******************************************************************
6965 inits a SAMR_Q_CONNECT structure.
6966 ********************************************************************/
6968 void init_samr_q_connect(SAMR_Q_CONNECT * q_u,
6969 char *srv_name, uint32 access_mask)
6971 DEBUG(5, ("init_samr_q_connect\n"));
6973 /* make PDC server name \\server */
6974 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
6975 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
6977 /* example values: 0x0000 0002 */
6978 q_u->access_mask = access_mask;
6981 /*******************************************************************
6982 reads or writes a structure.
6983 ********************************************************************/
6985 BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u,
6986 prs_struct *ps, int depth)
6991 prs_debug(ps, depth, desc, "samr_io_q_connect");
6997 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
6999 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
7004 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
7010 /*******************************************************************
7011 reads or writes a structure.
7012 ********************************************************************/
7014 BOOL samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u,
7015 prs_struct *ps, int depth)
7020 prs_debug(ps, depth, desc, "samr_io_r_connect");
7026 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7029 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7035 /*******************************************************************
7036 inits a SAMR_Q_CONNECT4 structure.
7037 ********************************************************************/
7039 void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u,
7040 char *srv_name, uint32 access_mask)
7042 DEBUG(5, ("init_samr_q_connect4\n"));
7044 /* make PDC server name \\server */
7045 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
7046 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
7048 /* Only value we've seen, possibly an address type ? */
7051 /* example values: 0x0000 0002 */
7052 q_u->access_mask = access_mask;
7055 /*******************************************************************
7056 reads or writes a structure.
7057 ********************************************************************/
7059 BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u,
7060 prs_struct *ps, int depth)
7065 prs_debug(ps, depth, desc, "samr_io_q_connect4");
7071 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
7073 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
7078 if(!prs_uint32("unk_0", ps, depth, &q_u->unk_0))
7080 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
7086 /*******************************************************************
7087 reads or writes a structure.
7088 ********************************************************************/
7090 BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u,
7091 prs_struct *ps, int depth)
7096 prs_debug(ps, depth, desc, "samr_io_r_connect4");
7102 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7105 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7111 /*******************************************************************
7112 inits a SAMR_Q_CONNECT5 structure.
7113 ********************************************************************/
7115 void init_samr_q_connect5(SAMR_Q_CONNECT5 * q_u,
7116 char *srv_name, uint32 access_mask)
7118 DEBUG(5, ("init_samr_q_connect5\n"));
7120 /* make PDC server name \\server */
7121 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
7122 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
7124 /* example values: 0x0000 0002 */
7125 q_u->access_mask = access_mask;
7128 q_u->info1_unk1 = 3;
7129 q_u->info1_unk2 = 0;
7132 /*******************************************************************
7133 inits a SAMR_R_CONNECT5 structure.
7134 ********************************************************************/
7136 void init_samr_r_connect5(SAMR_R_CONNECT5 * r_u, POLICY_HND *pol, NTSTATUS status)
7138 DEBUG(5, ("init_samr_q_connect5\n"));
7141 r_u->info1_unk1 = 3;
7142 r_u->info1_unk2 = 0;
7144 r_u->connect_pol = *pol;
7145 r_u->status = status;
7148 /*******************************************************************
7149 reads or writes a structure.
7150 ********************************************************************/
7152 BOOL samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u,
7153 prs_struct *ps, int depth)
7158 prs_debug(ps, depth, desc, "samr_io_q_connect5");
7164 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
7166 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
7171 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
7174 if(!prs_uint32("level", ps, depth, &q_u->level))
7176 if(!prs_uint32("level", ps, depth, &q_u->level))
7179 if(!prs_uint32("info1_unk1", ps, depth, &q_u->info1_unk1))
7181 if(!prs_uint32("info1_unk2", ps, depth, &q_u->info1_unk2))
7187 /*******************************************************************
7188 reads or writes a structure.
7189 ********************************************************************/
7191 BOOL samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u,
7192 prs_struct *ps, int depth)
7197 prs_debug(ps, depth, desc, "samr_io_r_connect5");
7203 if(!prs_uint32("level", ps, depth, &r_u->level))
7205 if(!prs_uint32("level", ps, depth, &r_u->level))
7207 if(!prs_uint32("info1_unk1", ps, depth, &r_u->info1_unk1))
7209 if(!prs_uint32("info1_unk2", ps, depth, &r_u->info1_unk2))
7212 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7215 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7221 /*******************************************************************
7222 inits a SAMR_Q_CONNECT_ANON structure.
7223 ********************************************************************/
7225 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u)
7227 DEBUG(5, ("init_samr_q_connect_anon\n"));
7230 q_u->unknown_0 = 0x5c; /* server name (?!!) */
7231 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
7234 /*******************************************************************
7235 reads or writes a structure.
7236 ********************************************************************/
7238 BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u,
7239 prs_struct *ps, int depth)
7244 prs_debug(ps, depth, desc, "samr_io_q_connect_anon");
7250 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
7253 if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0))
7258 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
7264 /*******************************************************************
7265 reads or writes a structure.
7266 ********************************************************************/
7268 BOOL samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u,
7269 prs_struct *ps, int depth)
7274 prs_debug(ps, depth, desc, "samr_io_r_connect_anon");
7280 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7283 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7289 /*******************************************************************
7290 inits a SAMR_Q_GET_DOM_PWINFO structure.
7291 ********************************************************************/
7293 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
7296 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
7299 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_FLAGS_NONE);
7300 init_uni_hdr(&q_u->hdr_srv_name, &q_u->uni_srv_name);
7303 /*******************************************************************
7304 reads or writes a structure.
7305 ********************************************************************/
7307 BOOL samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u,
7308 prs_struct *ps, int depth)
7313 prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo");
7319 if(!prs_uint32("ptr", ps, depth, &q_u->ptr))
7321 if (q_u->ptr != 0) {
7322 if(!smb_io_unihdr("", &q_u->hdr_srv_name, ps, depth))
7324 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth))
7331 /*******************************************************************
7332 reads or writes a structure.
7333 ********************************************************************/
7335 BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u,
7336 prs_struct *ps, int depth)
7341 prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo");
7347 if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
7351 if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
7354 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7360 /*******************************************************************
7361 make a SAMR_ENC_PASSWD structure.
7362 ********************************************************************/
7364 void init_enc_passwd(SAMR_ENC_PASSWD * pwd, const char pass[512])
7372 memcpy(pwd->pass, pass, sizeof(pwd->pass));
7376 /*******************************************************************
7377 reads or writes a SAMR_ENC_PASSWD structure.
7378 ********************************************************************/
7380 BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd,
7381 prs_struct *ps, int depth)
7386 prs_debug(ps, depth, desc, "samr_io_enc_passwd");
7392 if(!prs_uint32("ptr", ps, depth, &pwd->ptr))
7395 if (pwd->ptr != 0) {
7396 if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)))
7403 /*******************************************************************
7404 inits a SAMR_ENC_HASH structure.
7405 ********************************************************************/
7407 void init_enc_hash(SAMR_ENC_HASH * hsh, const uchar hash[16])
7415 memcpy(hsh->hash, hash, sizeof(hsh->hash));
7419 /*******************************************************************
7420 reads or writes a SAMR_ENC_HASH structure.
7421 ********************************************************************/
7423 BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh,
7424 prs_struct *ps, int depth)
7429 prs_debug(ps, depth, desc, "samr_io_enc_hash");
7435 if(!prs_uint32("ptr ", ps, depth, &hsh->ptr))
7437 if (hsh->ptr != 0) {
7438 if(!prs_uint8s(False, "hash", ps, depth, hsh->hash,sizeof(hsh->hash)))
7445 /*******************************************************************
7446 inits a SAMR_Q_CHGPASSWD_USER structure.
7447 ********************************************************************/
7449 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u,
7450 const char *dest_host, const char *user_name,
7451 const uchar nt_newpass[516],
7452 const uchar nt_oldhash[16],
7453 const uchar lm_newpass[516],
7454 const uchar lm_oldhash[16])
7456 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
7459 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
7460 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
7462 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
7463 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
7465 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
7466 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
7468 q_u->unknown = 0x01;
7470 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
7471 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
7474 /*******************************************************************
7475 reads or writes a structure.
7476 ********************************************************************/
7478 BOOL samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u,
7479 prs_struct *ps, int depth)
7484 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user");
7490 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
7493 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
7495 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
7500 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
7502 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
7505 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
7507 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
7510 if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
7513 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
7515 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
7521 /*******************************************************************
7522 inits a SAMR_R_CHGPASSWD_USER structure.
7523 ********************************************************************/
7525 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status)
7527 DEBUG(5, ("init_samr_r_chgpasswd_user\n"));
7529 r_u->status = status;
7532 /*******************************************************************
7533 reads or writes a structure.
7534 ********************************************************************/
7536 BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u,
7537 prs_struct *ps, int depth)
7542 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user");
7548 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7554 /*******************************************************************
7555 inits a SAMR_Q_CHGPASSWD3 structure.
7556 ********************************************************************/
7558 void init_samr_q_chgpasswd_user3(SAMR_Q_CHGPASSWD_USER3 * q_u,
7559 const char *dest_host, const char *user_name,
7560 const uchar nt_newpass[516],
7561 const uchar nt_oldhash[16],
7562 const uchar lm_newpass[516],
7563 const uchar lm_oldhash[16])
7565 DEBUG(5, ("init_samr_q_chgpasswd_user3\n"));
7568 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
7569 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
7571 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
7572 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
7574 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
7575 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
7577 q_u->lm_change = 0x01;
7579 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
7580 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
7582 init_enc_passwd(&q_u->password3, NULL);
7585 /*******************************************************************
7586 reads or writes a structure.
7587 ********************************************************************/
7589 BOOL samr_io_q_chgpasswd_user3(const char *desc, SAMR_Q_CHGPASSWD_USER3 * q_u,
7590 prs_struct *ps, int depth)
7595 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user3");
7601 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
7604 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
7606 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
7611 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
7613 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
7616 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
7618 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
7621 if(!prs_uint32("lm_change", ps, depth, &q_u->lm_change))
7624 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
7626 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
7629 if(!samr_io_enc_passwd("password3", &q_u->password3, ps, depth))
7635 /*******************************************************************
7636 inits a SAMR_R_CHGPASSWD_USER3 structure.
7637 ********************************************************************/
7639 void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3 *r_u, NTSTATUS status,
7640 SAMR_CHANGE_REJECT *reject, SAM_UNK_INFO_1 *info)
7642 DEBUG(5, ("init_samr_r_chgpasswd_user3\n"));
7644 r_u->status = status;
7648 r_u->ptr_reject = 0;
7654 if (reject && (reject->reject_reason != Undefined)) {
7655 r_u->reject = reject;
7656 r_u->ptr_reject = 1;
7660 /*******************************************************************
7661 Reads or writes an SAMR_CHANGE_REJECT structure.
7662 ********************************************************************/
7664 BOOL samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_struct *ps, int depth)
7669 prs_debug(ps, depth, desc, "samr_io_change_reject");
7675 if(UNMARSHALLING(ps))
7676 ZERO_STRUCTP(reject);
7678 if (!prs_uint32("reject_reason", ps, depth, &reject->reject_reason))
7681 if (!prs_uint32("unknown1", ps, depth, &reject->unknown1))
7684 if (!prs_uint32("unknown2", ps, depth, &reject->unknown2))
7690 /*******************************************************************
7691 reads or writes a structure.
7692 ********************************************************************/
7694 BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u,
7695 prs_struct *ps, int depth)
7700 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user3");
7706 if (!prs_uint32("ptr_info", ps, depth, &r_u->ptr_info))
7709 if (r_u->ptr_info && r_u->info != NULL) {
7710 /* SAM_UNK_INFO_1 */
7711 if (!sam_io_unk_info1("info", r_u->info, ps, depth))
7715 if (!prs_uint32("ptr_reject", ps, depth, &r_u->ptr_reject))
7718 if (r_u->ptr_reject && r_u->reject != NULL) {
7719 /* SAMR_CHANGE_REJECT */
7720 if (!samr_io_change_reject("reject", r_u->reject, ps, depth))
7724 if (!prs_ntstatus("status", ps, depth, &r_u->status))
7730 /*******************************************************************
7731 reads or writes a structure.
7732 ********************************************************************/
7734 void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
7735 POLICY_HND *domain_pol, uint16 switch_value)
7737 DEBUG(5, ("init_samr_q_query_domain_info2\n"));
7739 q_u->domain_pol = *domain_pol;
7740 q_u->switch_value = switch_value;
7743 /*******************************************************************
7744 reads or writes a structure.
7745 ********************************************************************/
7747 BOOL samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
7748 prs_struct *ps, int depth)
7753 prs_debug(ps, depth, desc, "samr_io_q_query_domain_info2");
7759 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
7762 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
7768 /*******************************************************************
7769 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7770 ********************************************************************/
7772 void init_samr_r_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
7773 uint16 switch_value, SAM_UNK_CTR * ctr,
7776 DEBUG(5, ("init_samr_r_query_domain_info2\n"));
7779 r_u->switch_value = 0;
7780 r_u->status = status; /* return status */
7782 if (NT_STATUS_IS_OK(status)) {
7783 r_u->switch_value = switch_value;
7789 /*******************************************************************
7790 reads or writes a structure.
7791 ********************************************************************/
7793 BOOL samr_io_r_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
7794 prs_struct *ps, int depth)
7799 prs_debug(ps, depth, desc, "samr_io_r_query_domain_info2");
7805 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
7808 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
7809 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
7814 switch (r_u->switch_value) {
7816 if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth))
7820 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
7824 if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth))
7828 if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
7832 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
7836 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
7840 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
7844 if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth))
7848 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
7852 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
7856 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
7860 DEBUG(0, ("samr_io_r_query_domain_info2: unknown switch level 0x%x\n",
7861 r_u->switch_value));
7862 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
7870 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7877 /*******************************************************************
7878 reads or writes a structure.
7879 ********************************************************************/
7881 void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u,
7882 POLICY_HND *domain_pol, uint16 switch_value, SAM_UNK_CTR *ctr)
7884 DEBUG(5, ("init_samr_q_set_domain_info\n"));
7886 q_u->domain_pol = *domain_pol;
7887 q_u->switch_value0 = switch_value;
7889 q_u->switch_value = switch_value;
7894 /*******************************************************************
7895 reads or writes a structure.
7896 ********************************************************************/
7898 BOOL samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u,
7899 prs_struct *ps, int depth)
7904 prs_debug(ps, depth, desc, "samr_io_q_set_domain_info");
7910 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
7913 if(!prs_uint16("switch_value0", ps, depth, &q_u->switch_value0))
7916 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
7922 if (UNMARSHALLING(ps)) {
7923 if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL)
7927 switch (q_u->switch_value) {
7930 if(!sam_io_unk_info12("unk_inf12", &q_u->ctr->info.inf12, ps, depth))
7934 if(!sam_io_unk_info7("unk_inf7",&q_u->ctr->info.inf7, ps,depth))
7938 if(!sam_io_unk_info6("unk_inf6",&q_u->ctr->info.inf6, ps,depth))
7942 if(!sam_io_unk_info5("unk_inf5",&q_u->ctr->info.inf5, ps,depth))
7946 if(!sam_io_unk_info3("unk_inf3",&q_u->ctr->info.inf3, ps,depth))
7950 if(!sam_io_unk_info2("unk_inf2",&q_u->ctr->info.inf2, ps,depth))
7954 if(!sam_io_unk_info1("unk_inf1",&q_u->ctr->info.inf1, ps,depth))
7958 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
7959 q_u->switch_value));
7966 /*******************************************************************
7967 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7968 ********************************************************************/
7970 void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status)
7972 DEBUG(5, ("init_samr_r_set_domain_info\n"));
7974 r_u->status = status; /* return status */
7977 /*******************************************************************
7978 reads or writes a structure.
7979 ********************************************************************/
7981 BOOL samr_io_r_set_domain_info(const char *desc, SAMR_R_SET_DOMAIN_INFO * r_u,
7982 prs_struct *ps, int depth)
7987 prs_debug(ps, depth, desc, "samr_io_r_samr_unknown_2e");
7993 if(!prs_ntstatus("status", ps, depth, &r_u->status))