2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2000,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6 * Copyright (C) Paul Ashton 1997-2000,
7 * Copyright (C) Elrond 2000,
8 * Copyright (C) Jeremy Allison 2001,
9 * Copyright (C) Jean François Micouleau 1998-2001,
10 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #define DBGC_CLASS DBGC_RPC_PARSE
32 /*******************************************************************
33 inits a SAMR_Q_CLOSE_HND structure.
34 ********************************************************************/
36 void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd)
38 DEBUG(5, ("init_samr_q_close_hnd\n"));
43 /*******************************************************************
44 reads or writes a structure.
45 ********************************************************************/
47 BOOL samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u,
48 prs_struct *ps, int depth)
53 prs_debug(ps, depth, desc, "samr_io_q_close_hnd");
59 return smb_io_pol_hnd("pol", &q_u->pol, ps, depth);
62 /*******************************************************************
63 reads or writes a structure.
64 ********************************************************************/
66 BOOL samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u,
67 prs_struct *ps, int depth)
72 prs_debug(ps, depth, desc, "samr_io_r_close_hnd");
78 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
81 if(!prs_ntstatus("status", ps, depth, &r_u->status))
87 /*******************************************************************
88 inits a SAMR_Q_LOOKUP_DOMAIN structure.
89 ********************************************************************/
91 void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u,
92 POLICY_HND *pol, char *dom_name)
94 DEBUG(5, ("init_samr_q_lookup_domain\n"));
96 q_u->connect_pol = *pol;
98 init_unistr2(&q_u->uni_domain, dom_name, UNI_FLAGS_NONE);
99 init_uni_hdr(&q_u->hdr_domain, &q_u->uni_domain);
102 /*******************************************************************
103 reads or writes a structure.
104 ********************************************************************/
105 BOOL samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u,
106 prs_struct *ps, int depth)
111 prs_debug(ps, depth, desc, "samr_io_q_lookup_domain");
117 if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth))
120 if(!smb_io_unihdr("hdr_domain", &q_u->hdr_domain, ps, depth))
123 if(!smb_io_unistr2("uni_domain", &q_u->uni_domain, q_u->hdr_domain.buffer, ps, depth))
129 /*******************************************************************
130 inits a SAMR_R_LOOKUP_DOMAIN structure.
131 ********************************************************************/
133 void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u,
134 DOM_SID *dom_sid, NTSTATUS status)
136 DEBUG(5, ("init_samr_r_lookup_domain\n"));
138 r_u->status = status;
140 if (NT_STATUS_IS_OK(status)) {
142 init_dom_sid2(&r_u->dom_sid, dom_sid);
146 /*******************************************************************
147 reads or writes a structure.
148 ********************************************************************/
150 BOOL samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u,
151 prs_struct *ps, int depth)
156 prs_debug(ps, depth, desc, "samr_io_r_lookup_domain");
162 if(!prs_uint32("ptr", ps, depth, &r_u->ptr_sid))
165 if (r_u->ptr_sid != 0) {
166 if(!smb_io_dom_sid2("sid", &r_u->dom_sid, ps, depth))
172 if(!prs_ntstatus("status", ps, depth, &r_u->status))
178 /*******************************************************************
179 reads or writes a structure.
180 ********************************************************************/
182 void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid)
184 DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n"));
186 q_u->dom_pol = *dom_pol;
187 init_dom_sid2(&q_u->sid, sid);
190 /*******************************************************************
191 reads or writes a structure.
192 ********************************************************************/
194 BOOL samr_io_q_remove_sid_foreign_domain(const char *desc, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u,
195 prs_struct *ps, int depth)
200 prs_debug(ps, depth, desc, "samr_io_q_remove_sid_foreign_domain");
206 if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
209 if(!smb_io_dom_sid2("sid", &q_u->sid, ps, depth))
218 /*******************************************************************
219 reads or writes a structure.
220 ********************************************************************/
222 BOOL samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN * r_u,
223 prs_struct *ps, int depth)
228 prs_debug(ps, depth, desc, "samr_io_r_remove_sid_foreign_domain");
234 if(!prs_ntstatus("status", ps, depth, &r_u->status))
240 /*******************************************************************
241 reads or writes a structure.
242 ********************************************************************/
244 void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u,
245 POLICY_HND *pol, uint32 flags,
248 DEBUG(5, ("samr_init_samr_q_open_domain\n"));
252 init_dom_sid2(&q_u->dom_sid, sid);
255 /*******************************************************************
256 reads or writes a structure.
257 ********************************************************************/
259 BOOL samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u,
260 prs_struct *ps, int depth)
265 prs_debug(ps, depth, desc, "samr_io_q_open_domain");
271 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
274 if(!prs_uint32("flags", ps, depth, &q_u->flags))
277 if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth))
283 /*******************************************************************
284 reads or writes a structure.
285 ********************************************************************/
287 BOOL samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u,
288 prs_struct *ps, int depth)
293 prs_debug(ps, depth, desc, "samr_io_r_open_domain");
299 if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth))
302 if(!prs_ntstatus("status", ps, depth, &r_u->status))
308 /*******************************************************************
309 reads or writes a structure.
310 ********************************************************************/
312 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u,
313 POLICY_HND *user_pol)
315 DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
317 q_u->user_pol = *user_pol;
320 /*******************************************************************
321 reads or writes a structure.
322 ********************************************************************/
324 BOOL samr_io_q_get_usrdom_pwinfo(const char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u,
325 prs_struct *ps, int depth)
330 prs_debug(ps, depth, desc, "samr_io_q_get_usrdom_pwinfo");
336 return smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth);
339 /*******************************************************************
341 ********************************************************************/
343 void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS status)
345 DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
347 r_u->min_pwd_length = 0x0000;
351 * r_u->unknown_1 = 0x0015;
354 r_u->unknown_1 = 0x01D1;
355 r_u->unknown_1 = 0x0015;
357 r_u->password_properties = 0x00000000;
359 r_u->status = status;
362 /*******************************************************************
363 reads or writes a structure.
364 ********************************************************************/
366 BOOL samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u,
367 prs_struct *ps, int depth)
372 prs_debug(ps, depth, desc, "samr_io_r_get_usrdom_pwinfo");
378 if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
380 if(!prs_uint16("unknown_1", ps, depth, &r_u->unknown_1))
382 if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
385 if(!prs_ntstatus("status ", ps, depth, &r_u->status))
392 /*******************************************************************
393 reads or writes a structure.
394 ********************************************************************/
396 BOOL samr_io_q_set_sec_obj(const char *desc, SAMR_Q_SET_SEC_OBJ * q_u,
397 prs_struct *ps, int depth)
402 prs_debug(ps, depth, desc, "samr_io_q_set_sec_obj");
408 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
411 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
414 if(!sec_io_desc_buf("sec_desc", &q_u->buf, ps, depth))
421 /*******************************************************************
422 reads or writes a structure.
423 ********************************************************************/
425 void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u,
426 POLICY_HND *user_pol, uint32 sec_info)
428 DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
430 q_u->user_pol = *user_pol;
431 q_u->sec_info = sec_info;
435 /*******************************************************************
436 reads or writes a structure.
437 ********************************************************************/
439 BOOL samr_io_q_query_sec_obj(const char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u,
440 prs_struct *ps, int depth)
445 prs_debug(ps, depth, desc, "samr_io_q_query_sec_obj");
451 if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
454 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
460 /*******************************************************************
461 reads or writes a structure.
462 ********************************************************************/
464 void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u,
465 POLICY_HND *domain_pol, uint16 switch_value)
467 DEBUG(5, ("samr_init_samr_q_query_dom_info\n"));
469 q_u->domain_pol = *domain_pol;
470 q_u->switch_value = switch_value;
473 /*******************************************************************
474 reads or writes a structure.
475 ********************************************************************/
477 BOOL samr_io_q_query_dom_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u,
478 prs_struct *ps, int depth)
483 prs_debug(ps, depth, desc, "samr_io_q_query_dom_info");
489 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
492 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
499 /*******************************************************************
501 ********************************************************************/
503 void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout)
505 u_3->logout.low = nt_logout.low;
506 u_3->logout.high = nt_logout.high;
509 /*******************************************************************
510 reads or writes a structure.
511 ********************************************************************/
513 static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3,
514 prs_struct *ps, int depth)
519 prs_debug(ps, depth, desc, "sam_io_unk_info3");
522 if(!smb_io_time("logout", &u_3->logout, ps, depth))
528 /*******************************************************************
530 ********************************************************************/
532 void init_unk_info6(SAM_UNK_INFO_6 * u_6)
534 u_6->unknown_0 = 0x00000000;
536 memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */
539 /*******************************************************************
540 reads or writes a structure.
541 ********************************************************************/
543 static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6,
544 prs_struct *ps, int depth)
549 prs_debug(ps, depth, desc, "sam_io_unk_info6");
552 if(!prs_uint32("unknown_0", ps, depth, &u_6->unknown_0)) /* 0x0000 0000 */
554 if(!prs_uint32("ptr_0", ps, depth, &u_6->ptr_0)) /* pointer to unknown structure */
556 if(!prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding))) /* 12 bytes zeros */
562 /*******************************************************************
564 ********************************************************************/
566 void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role)
568 u_7->server_role = server_role;
571 /*******************************************************************
572 reads or writes a structure.
573 ********************************************************************/
575 static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7,
576 prs_struct *ps, int depth)
581 prs_debug(ps, depth, desc, "sam_io_unk_info7");
584 if(!prs_uint16("server_role", ps, depth, &u_7->server_role))
590 /*******************************************************************
592 ********************************************************************/
594 void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num)
596 unix_to_nt_time(&u_8->domain_create_time, 0);
597 u_8->seq_num.low = seq_num;
598 u_8->seq_num.high = 0x0000;
601 /*******************************************************************
602 reads or writes a structure.
603 ********************************************************************/
605 static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8,
606 prs_struct *ps, int depth)
611 prs_debug(ps, depth, desc, "sam_io_unk_info8");
614 if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num))
617 if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth))
624 /*******************************************************************
626 ********************************************************************/
628 void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout)
630 u_12->duration.low = nt_lock_duration.low;
631 u_12->duration.high = nt_lock_duration.high;
632 u_12->reset_count.low = nt_reset_time.low;
633 u_12->reset_count.high = nt_reset_time.high;
635 u_12->bad_attempt_lockout = lockout;
638 /*******************************************************************
639 reads or writes a structure.
640 ********************************************************************/
642 static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12,
643 prs_struct *ps, int depth)
648 prs_debug(ps, depth, desc, "sam_io_unk_info12");
651 if(!smb_io_time("duration", &u_12->duration, ps, depth))
653 if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth))
655 if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout))
661 /*******************************************************************
663 ********************************************************************/
665 void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *server)
667 init_unistr2(&u_5->uni_server, server, UNI_FLAGS_NONE);
668 init_uni_hdr(&u_5->hdr_server, &u_5->uni_server);
671 /*******************************************************************
672 reads or writes a structure.
673 ********************************************************************/
675 static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5,
676 prs_struct *ps, int depth)
681 prs_debug(ps, depth, desc, "sam_io_unk_info5");
684 if(!smb_io_unihdr("hdr_server", &u_5->hdr_server, ps, depth))
687 if(!smb_io_unistr2("uni_server", &u_5->uni_server, u_5->hdr_server.buffer, ps, depth))
693 /*******************************************************************
695 ********************************************************************/
697 void init_unk_info2(SAM_UNK_INFO_2 * u_2,
698 const char *comment, const char *domain, const char *server,
699 uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role)
701 u_2->logout.low = nt_logout.low;
702 u_2->logout.high = nt_logout.high;
704 u_2->seq_num.low = seq_num;
705 u_2->seq_num.high = 0x00000000;
708 u_2->unknown_4 = 0x00000001;
709 u_2->server_role = server_role;
710 u_2->unknown_6 = 0x00000001;
711 u_2->num_domain_usrs = num_users;
712 u_2->num_domain_grps = num_groups;
713 u_2->num_local_grps = num_alias;
715 memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */
717 init_unistr2(&u_2->uni_comment, comment, UNI_FLAGS_NONE);
718 init_uni_hdr(&u_2->hdr_comment, &u_2->uni_comment);
719 init_unistr2(&u_2->uni_domain, domain, UNI_FLAGS_NONE);
720 init_uni_hdr(&u_2->hdr_domain, &u_2->uni_domain);
721 init_unistr2(&u_2->uni_server, server, UNI_FLAGS_NONE);
722 init_uni_hdr(&u_2->hdr_server, &u_2->uni_server);
725 /*******************************************************************
726 reads or writes a structure.
727 ********************************************************************/
729 static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2,
730 prs_struct *ps, int depth)
735 prs_debug(ps, depth, desc, "sam_io_unk_info2");
738 if(!smb_io_time("logout", &u_2->logout, ps, depth))
740 if(!smb_io_unihdr("hdr_comment", &u_2->hdr_comment, ps, depth))
742 if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth))
744 if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth))
747 /* put all the data in here, at the moment, including what the above
748 pointer is referring to
751 if(!prs_uint64("seq_num ", ps, depth, &u_2->seq_num))
754 if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4)) /* 0x0000 0001 */
756 if(!prs_uint32("server_role ", ps, depth, &u_2->server_role))
758 if(!prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6)) /* 0x0000 0001 */
760 if(!prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs))
762 if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps))
764 if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps))
767 if(!smb_io_unistr2("uni_comment", &u_2->uni_comment, u_2->hdr_comment.buffer, ps, depth))
769 if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth))
771 if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth))
777 /*******************************************************************
779 ********************************************************************/
781 void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist,
782 uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age)
784 u_1->min_length_password = min_pass_len;
785 u_1->password_history = pass_hist;
786 u_1->password_properties = password_properties;
788 /* password never expire */
789 u_1->expire.high = nt_expire.high;
790 u_1->expire.low = nt_expire.low;
792 /* can change the password now */
793 u_1->min_passwordage.high = nt_min_age.high;
794 u_1->min_passwordage.low = nt_min_age.low;
798 /*******************************************************************
799 reads or writes a structure.
800 ********************************************************************/
802 static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1,
803 prs_struct *ps, int depth)
808 prs_debug(ps, depth, desc, "sam_io_unk_info1");
811 if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password))
813 if(!prs_uint16("password_history", ps, depth, &u_1->password_history))
815 if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties))
817 if(!smb_io_time("expire", &u_1->expire, ps, depth))
819 if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth))
825 /*******************************************************************
826 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
827 ********************************************************************/
829 void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO * r_u,
830 uint16 switch_value, SAM_UNK_CTR * ctr,
833 DEBUG(5, ("init_samr_r_query_dom_info\n"));
836 r_u->switch_value = 0;
837 r_u->status = status; /* return status */
839 if (NT_STATUS_IS_OK(status)) {
840 r_u->switch_value = switch_value;
846 /*******************************************************************
847 reads or writes a structure.
848 ********************************************************************/
850 BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u,
851 prs_struct *ps, int depth)
856 prs_debug(ps, depth, desc, "samr_io_r_query_dom_info");
862 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
865 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
866 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
871 switch (r_u->switch_value) {
873 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
877 if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
881 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
885 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
889 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
893 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
897 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
901 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
905 DEBUG(0, ("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
907 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
915 if(!prs_ntstatus("status", ps, depth, &r_u->status))
921 /*******************************************************************
922 reads or writes a structure.
923 ********************************************************************/
925 void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ * q_u,
926 POLICY_HND *pol, uint32 sec_info, SEC_DESC_BUF *buf)
928 DEBUG(5, ("samr_init_samr_q_set_sec_obj\n"));
931 q_u->sec_info = sec_info;
936 /*******************************************************************
937 reads or writes a SAMR_R_SET_SEC_OBJ structure.
938 ********************************************************************/
940 BOOL samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u,
941 prs_struct *ps, int depth)
946 prs_debug(ps, depth, desc, "samr_io_r_set_sec_obj");
952 if(!prs_ntstatus("status", ps, depth, &r_u->status))
958 /*******************************************************************
959 reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
960 ********************************************************************/
962 BOOL samr_io_r_query_sec_obj(const char *desc, SAMR_R_QUERY_SEC_OBJ * r_u,
963 prs_struct *ps, int depth)
968 prs_debug(ps, depth, desc, "samr_io_r_query_sec_obj");
974 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
977 if(!sec_io_desc_buf("sec", &r_u->buf, ps, depth))
981 if(!prs_ntstatus("status", ps, depth, &r_u->status))
987 /*******************************************************************
988 reads or writes a SAM_STR1 structure.
989 ********************************************************************/
991 static BOOL sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf,
992 uint32 name_buf, uint32 desc_buf,
993 prs_struct *ps, int depth)
998 prs_debug(ps, depth, desc, "sam_io_sam_str1");
1003 if (!smb_io_unistr2("name", &sam->uni_acct_name, acct_buf, ps, depth))
1006 if (!smb_io_unistr2("desc", &sam->uni_acct_desc, desc_buf, ps, depth))
1009 if (!smb_io_unistr2("full", &sam->uni_full_name, name_buf, ps, depth))
1015 /*******************************************************************
1016 inits a SAM_ENTRY1 structure.
1017 ********************************************************************/
1019 static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
1020 UNISTR2 *sam_name, UNISTR2 *sam_full,
1021 UNISTR2 *sam_desc, uint32 rid_user,
1024 DEBUG(5, ("init_sam_entry1\n"));
1028 sam->user_idx = user_idx;
1029 sam->rid_user = rid_user;
1030 sam->acb_info = acb_info;
1032 init_uni_hdr(&sam->hdr_acct_name, sam_name);
1033 init_uni_hdr(&sam->hdr_user_name, sam_full);
1034 init_uni_hdr(&sam->hdr_user_desc, sam_desc);
1037 /*******************************************************************
1038 reads or writes a SAM_ENTRY1 structure.
1039 ********************************************************************/
1041 static BOOL sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam,
1042 prs_struct *ps, int depth)
1047 prs_debug(ps, depth, desc, "sam_io_sam_entry1");
1053 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
1056 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
1058 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
1061 if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth))
1063 if (!smb_io_unihdr("hdr_user_desc", &sam->hdr_user_desc, ps, depth))
1065 if (!smb_io_unihdr("hdr_user_name", &sam->hdr_user_name, ps, depth))
1071 /*******************************************************************
1072 reads or writes a SAM_STR2 structure.
1073 ********************************************************************/
1075 static BOOL sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf,
1076 uint32 desc_buf, prs_struct *ps, int depth)
1081 prs_debug(ps, depth, desc, "sam_io_sam_str2");
1087 if(!smb_io_unistr2("uni_srv_name", &sam->uni_srv_name, acct_buf, ps, depth)) /* account name unicode string */
1089 if(!smb_io_unistr2("uni_srv_desc", &sam->uni_srv_desc, desc_buf, ps, depth)) /* account desc unicode string */
1095 /*******************************************************************
1096 inits a SAM_ENTRY2 structure.
1097 ********************************************************************/
1098 static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx,
1099 UNISTR2 *sam_name, UNISTR2 *sam_desc,
1100 uint32 rid_user, uint32 acb_info)
1102 DEBUG(5, ("init_sam_entry2\n"));
1104 sam->user_idx = user_idx;
1105 sam->rid_user = rid_user;
1106 sam->acb_info = acb_info;
1108 init_uni_hdr(&sam->hdr_srv_name, sam_name);
1109 init_uni_hdr(&sam->hdr_srv_desc, sam_desc);
1112 /*******************************************************************
1113 reads or writes a SAM_ENTRY2 structure.
1114 ********************************************************************/
1116 static BOOL sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam,
1117 prs_struct *ps, int depth)
1122 prs_debug(ps, depth, desc, "sam_io_sam_entry2");
1128 if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
1131 if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
1133 if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
1136 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth)) /* account name unicode string header */
1138 if(!smb_io_unihdr("unihdr", &sam->hdr_srv_desc, ps, depth)) /* account name unicode string header */
1144 /*******************************************************************
1145 reads or writes a SAM_STR3 structure.
1146 ********************************************************************/
1148 static BOOL sam_io_sam_str3(const char *desc, SAM_STR3 * sam, uint32 acct_buf,
1149 uint32 desc_buf, prs_struct *ps, int depth)
1154 prs_debug(ps, depth, desc, "sam_io_sam_str3");
1160 if(!smb_io_unistr2("uni_grp_name", &sam->uni_grp_name, acct_buf, ps, depth)) /* account name unicode string */
1162 if(!smb_io_unistr2("uni_grp_desc", &sam->uni_grp_desc, desc_buf, ps, depth)) /* account desc unicode string */
1168 /*******************************************************************
1169 inits a SAM_ENTRY3 structure.
1170 ********************************************************************/
1172 static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx,
1173 UNISTR2 *grp_name, UNISTR2 *grp_desc,
1176 DEBUG(5, ("init_sam_entry3\n"));
1178 sam->grp_idx = grp_idx;
1179 sam->rid_grp = rid_grp;
1180 sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */
1182 init_uni_hdr(&sam->hdr_grp_name, grp_name);
1183 init_uni_hdr(&sam->hdr_grp_desc, grp_desc);
1186 /*******************************************************************
1187 reads or writes a SAM_ENTRY3 structure.
1188 ********************************************************************/
1190 static BOOL sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam,
1191 prs_struct *ps, int depth)
1196 prs_debug(ps, depth, desc, "sam_io_sam_entry3");
1202 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
1205 if(!prs_uint32("rid_grp", ps, depth, &sam->rid_grp))
1207 if(!prs_uint32("attr ", ps, depth, &sam->attr))
1210 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_name, ps, depth)) /* account name unicode string header */
1212 if(!smb_io_unihdr("unihdr", &sam->hdr_grp_desc, ps, depth)) /* account name unicode string header */
1218 /*******************************************************************
1219 inits a SAM_ENTRY4 structure.
1220 ********************************************************************/
1222 static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx,
1223 uint32 len_acct_name)
1225 DEBUG(5, ("init_sam_entry4\n"));
1227 sam->user_idx = user_idx;
1228 init_str_hdr(&sam->hdr_acct_name, len_acct_name+1, len_acct_name, len_acct_name != 0);
1231 /*******************************************************************
1232 reads or writes a SAM_ENTRY4 structure.
1233 ********************************************************************/
1235 static BOOL sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam,
1236 prs_struct *ps, int depth)
1241 prs_debug(ps, depth, desc, "sam_io_sam_entry4");
1247 if(!prs_uint32("user_idx", ps, depth, &sam->user_idx))
1249 if(!smb_io_strhdr("strhdr", &sam->hdr_acct_name, ps, depth))
1255 /*******************************************************************
1256 inits a SAM_ENTRY5 structure.
1257 ********************************************************************/
1259 static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx,
1260 uint32 len_grp_name)
1262 DEBUG(5, ("init_sam_entry5\n"));
1264 sam->grp_idx = grp_idx;
1265 init_str_hdr(&sam->hdr_grp_name, len_grp_name, len_grp_name,
1269 /*******************************************************************
1270 reads or writes a SAM_ENTRY5 structure.
1271 ********************************************************************/
1273 static BOOL sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam,
1274 prs_struct *ps, int depth)
1279 prs_debug(ps, depth, desc, "sam_io_sam_entry5");
1285 if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
1287 if(!smb_io_strhdr("strhdr", &sam->hdr_grp_name, ps, depth))
1293 /*******************************************************************
1294 inits a SAM_ENTRY structure.
1295 ********************************************************************/
1297 void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid)
1299 DEBUG(10, ("init_sam_entry: %d\n", rid));
1302 init_uni_hdr(&sam->hdr_name, uni2);
1305 /*******************************************************************
1306 reads or writes a SAM_ENTRY structure.
1307 ********************************************************************/
1309 static BOOL sam_io_sam_entry(const char *desc, SAM_ENTRY * sam,
1310 prs_struct *ps, int depth)
1315 prs_debug(ps, depth, desc, "sam_io_sam_entry");
1320 if(!prs_uint32("rid", ps, depth, &sam->rid))
1322 if(!smb_io_unihdr("unihdr", &sam->hdr_name, ps, depth)) /* account name unicode string header */
1328 /*******************************************************************
1329 inits a SAMR_Q_ENUM_DOM_USERS structure.
1330 ********************************************************************/
1332 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol,
1334 uint32 acb_mask, uint32 size)
1336 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
1340 q_e->start_idx = start_idx; /* zero indicates lots */
1341 q_e->acb_mask = acb_mask;
1342 q_e->max_size = size;
1345 /*******************************************************************
1346 reads or writes a structure.
1347 ********************************************************************/
1349 BOOL samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e,
1350 prs_struct *ps, int depth)
1355 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
1361 if(!smb_io_pol_hnd("domain_pol", &q_e->pol, ps, depth))
1364 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
1366 if(!prs_uint32("acb_mask ", ps, depth, &q_e->acb_mask))
1369 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
1376 /*******************************************************************
1377 inits a SAMR_R_ENUM_DOM_USERS structure.
1378 ********************************************************************/
1380 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u,
1381 uint32 next_idx, uint32 num_sam_entries)
1383 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
1385 r_u->next_idx = next_idx;
1387 if (num_sam_entries != 0) {
1388 r_u->ptr_entries1 = 1;
1389 r_u->ptr_entries2 = 1;
1390 r_u->num_entries2 = num_sam_entries;
1391 r_u->num_entries3 = num_sam_entries;
1393 r_u->num_entries4 = num_sam_entries;
1395 r_u->ptr_entries1 = 0;
1396 r_u->num_entries2 = num_sam_entries;
1397 r_u->ptr_entries2 = 1;
1401 /*******************************************************************
1402 reads or writes a structure.
1403 ********************************************************************/
1405 BOOL samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
1406 prs_struct *ps, int depth)
1413 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
1419 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
1421 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
1424 if (r_u->ptr_entries1 != 0) {
1425 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
1427 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
1429 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
1432 if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) {
1433 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY, r_u->num_entries2);
1434 r_u->uni_acct_name = PRS_ALLOC_MEM(ps,UNISTR2, r_u->num_entries2);
1437 if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) {
1438 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
1439 r_u->num_entries4 = 0;
1440 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
1444 for (i = 0; i < r_u->num_entries2; i++) {
1445 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
1449 for (i = 0; i < r_u->num_entries2; i++) {
1450 if(!smb_io_unistr2("", &r_u->uni_acct_name[i],r_u->sam[i].hdr_name.buffer, ps,depth))
1459 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
1461 if(!prs_ntstatus("status", ps, depth, &r_u->status))
1467 /*******************************************************************
1468 inits a SAMR_Q_QUERY_DISPINFO structure.
1469 ********************************************************************/
1471 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol,
1472 uint16 switch_level, uint32 start_idx,
1473 uint32 max_entries, uint32 max_size)
1475 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
1477 q_e->domain_pol = *pol;
1479 q_e->switch_level = switch_level;
1481 q_e->start_idx = start_idx;
1482 q_e->max_entries = max_entries;
1483 q_e->max_size = max_size;
1486 /*******************************************************************
1487 reads or writes a structure.
1488 ********************************************************************/
1490 BOOL samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e,
1491 prs_struct *ps, int depth)
1496 prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo");
1502 if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth))
1505 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
1510 if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx))
1512 if(!prs_uint32("max_entries ", ps, depth, &q_e->max_entries))
1514 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
1520 /*******************************************************************
1521 inits a SAM_DISPINFO_1 structure.
1522 ********************************************************************/
1524 NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam,
1525 uint32 num_entries, uint32 start_idx,
1526 struct samr_displayentry *entries)
1530 DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries));
1533 return NT_STATUS_OK;
1535 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_1, num_entries);
1537 return NT_STATUS_NO_MEMORY;
1539 (*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries);
1540 if ((*sam)->sam == NULL)
1541 return NT_STATUS_NO_MEMORY;
1543 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries);
1544 if ((*sam)->str == NULL)
1545 return NT_STATUS_NO_MEMORY;
1547 for (i = 0; i < num_entries ; i++) {
1548 init_unistr2(&(*sam)->str[i].uni_acct_name,
1549 entries[i].account_name, UNI_FLAGS_NONE);
1550 init_unistr2(&(*sam)->str[i].uni_full_name,
1551 entries[i].fullname, UNI_FLAGS_NONE);
1552 init_unistr2(&(*sam)->str[i].uni_acct_desc,
1553 entries[i].description, UNI_FLAGS_NONE);
1555 init_sam_entry1(&(*sam)->sam[i], start_idx+i+1,
1556 &(*sam)->str[i].uni_acct_name,
1557 &(*sam)->str[i].uni_full_name,
1558 &(*sam)->str[i].uni_acct_desc,
1559 entries[i].rid, entries[i].acct_flags);
1562 return NT_STATUS_OK;
1565 /*******************************************************************
1566 reads or writes a structure.
1567 ********************************************************************/
1569 static BOOL sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam,
1571 prs_struct *ps, int depth)
1575 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1");
1581 if (UNMARSHALLING(ps) && num_entries > 0) {
1583 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY1, num_entries)) == NULL) {
1584 DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
1588 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR1, num_entries)) == NULL) {
1589 DEBUG(0, ("out of memory allocating SAM_STR1\n"));
1594 for (i = 0; i < num_entries; i++) {
1595 if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth))
1599 for (i = 0; i < num_entries; i++) {
1600 if(!sam_io_sam_str1("", &sam->str[i],
1601 sam->sam[i].hdr_acct_name.buffer,
1602 sam->sam[i].hdr_user_name.buffer,
1603 sam->sam[i].hdr_user_desc.buffer, ps, depth))
1610 /*******************************************************************
1611 inits a SAM_DISPINFO_2 structure.
1612 ********************************************************************/
1614 NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam,
1615 uint32 num_entries, uint32 start_idx,
1616 struct samr_displayentry *entries)
1620 DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries));
1623 return NT_STATUS_OK;
1625 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_2, num_entries);
1627 return NT_STATUS_NO_MEMORY;
1629 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries);
1630 if ((*sam)->sam == NULL)
1631 return NT_STATUS_NO_MEMORY;
1633 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR2, num_entries);
1634 if ((*sam)->str == NULL)
1635 return NT_STATUS_NO_MEMORY;
1637 for (i = 0; i < num_entries; i++) {
1638 init_unistr2(&(*sam)->str[i].uni_srv_name,
1639 entries[i].account_name, UNI_FLAGS_NONE);
1640 init_unistr2(&(*sam)->str[i].uni_srv_desc,
1641 entries[i].description, UNI_FLAGS_NONE);
1643 init_sam_entry2(&(*sam)->sam[i], start_idx + i + 1,
1644 &(*sam)->str[i].uni_srv_name,
1645 &(*sam)->str[i].uni_srv_desc,
1646 entries[i].rid, entries[i].acct_flags);
1649 return NT_STATUS_OK;
1652 /*******************************************************************
1653 reads or writes a structure.
1654 ********************************************************************/
1656 static BOOL sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam,
1658 prs_struct *ps, int depth)
1665 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2");
1671 if (UNMARSHALLING(ps) && num_entries > 0) {
1673 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY2, num_entries)) == NULL) {
1674 DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
1678 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR2, num_entries)) == NULL) {
1679 DEBUG(0, ("out of memory allocating SAM_STR2\n"));
1684 for (i = 0; i < num_entries; i++) {
1685 if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth))
1689 for (i = 0; i < num_entries; i++) {
1690 if(!sam_io_sam_str2("", &sam->str[i],
1691 sam->sam[i].hdr_srv_name.buffer,
1692 sam->sam[i].hdr_srv_desc.buffer, ps, depth))
1699 /*******************************************************************
1700 inits a SAM_DISPINFO_3 structure.
1701 ********************************************************************/
1703 NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam,
1704 uint32 num_entries, uint32 start_idx,
1705 struct samr_displayentry *entries)
1709 DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries));
1712 return NT_STATUS_OK;
1714 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_3, num_entries);
1716 return NT_STATUS_NO_MEMORY;
1718 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries)))
1719 return NT_STATUS_NO_MEMORY;
1721 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries)))
1722 return NT_STATUS_NO_MEMORY;
1724 for (i = 0; i < num_entries; i++) {
1725 DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i));
1727 init_unistr2(&(*sam)->str[i].uni_grp_name,
1728 entries[i].account_name, UNI_FLAGS_NONE);
1729 init_unistr2(&(*sam)->str[i].uni_grp_desc,
1730 entries[i].description, UNI_FLAGS_NONE);
1732 init_sam_entry3(&(*sam)->sam[i], start_idx+i+1,
1733 &(*sam)->str[i].uni_grp_name,
1734 &(*sam)->str[i].uni_grp_desc,
1738 return NT_STATUS_OK;
1741 /*******************************************************************
1742 reads or writes a structure.
1743 ********************************************************************/
1745 static BOOL sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam,
1747 prs_struct *ps, int depth)
1754 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3");
1760 if (UNMARSHALLING(ps) && num_entries > 0) {
1762 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY3, num_entries)) == NULL) {
1763 DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
1767 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR3, num_entries)) == NULL) {
1768 DEBUG(0, ("out of memory allocating SAM_STR3\n"));
1773 for (i = 0; i < num_entries; i++) {
1774 if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth))
1778 for (i = 0; i < num_entries; i++) {
1779 if(!sam_io_sam_str3("", &sam->str[i],
1780 sam->sam[i].hdr_grp_name.buffer,
1781 sam->sam[i].hdr_grp_desc.buffer, ps, depth))
1788 /*******************************************************************
1789 inits a SAM_DISPINFO_4 structure.
1790 ********************************************************************/
1792 NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam,
1793 uint32 num_entries, uint32 start_idx,
1794 struct samr_displayentry *entries)
1798 DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries));
1801 return NT_STATUS_OK;
1803 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_4, num_entries);
1805 return NT_STATUS_NO_MEMORY;
1807 (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries);
1808 if ((*sam)->sam == NULL)
1809 return NT_STATUS_NO_MEMORY;
1811 (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries);
1812 if ((*sam)->str == NULL)
1813 return NT_STATUS_NO_MEMORY;
1815 for (i = 0; i < num_entries; i++) {
1816 size_t len_sam_name = strlen(entries[i].account_name);
1818 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i));
1820 init_sam_entry4(&(*sam)->sam[i], start_idx + i + 1,
1823 init_string2(&(*sam)->str[i].acct_name,
1824 entries[i].account_name, len_sam_name+1,
1828 return NT_STATUS_OK;
1831 /*******************************************************************
1832 reads or writes a structure.
1833 ********************************************************************/
1835 static BOOL sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam,
1837 prs_struct *ps, int depth)
1844 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4");
1850 if (UNMARSHALLING(ps) && num_entries > 0) {
1852 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY4, num_entries)) == NULL) {
1853 DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
1857 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR4, num_entries)) == NULL) {
1858 DEBUG(0, ("out of memory allocating SAM_STR4\n"));
1863 for (i = 0; i < num_entries; i++) {
1864 if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth))
1868 for (i = 0; i < num_entries; i++) {
1869 if(!smb_io_string2("acct_name", &sam->str[i].acct_name,
1870 sam->sam[i].hdr_acct_name.buffer, ps, depth))
1877 /*******************************************************************
1878 inits a SAM_DISPINFO_5 structure.
1879 ********************************************************************/
1881 NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 **sam,
1882 uint32 num_entries, uint32 start_idx,
1883 struct samr_displayentry *entries)
1885 uint32 len_sam_name;
1888 DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries));
1891 return NT_STATUS_OK;
1893 *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_5, num_entries);
1895 return NT_STATUS_NO_MEMORY;
1897 if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries)))
1898 return NT_STATUS_NO_MEMORY;
1900 if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries)))
1901 return NT_STATUS_NO_MEMORY;
1903 for (i = 0; i < num_entries; i++) {
1904 DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i));
1906 len_sam_name = strlen(entries[i].account_name);
1908 init_sam_entry5(&(*sam)->sam[i], start_idx+i+1, len_sam_name);
1909 init_string2(&(*sam)->str[i].grp_name, entries[i].account_name,
1910 len_sam_name+1, len_sam_name);
1913 return NT_STATUS_OK;
1916 /*******************************************************************
1917 reads or writes a structure.
1918 ********************************************************************/
1920 static BOOL sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam,
1922 prs_struct *ps, int depth)
1929 prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5");
1935 if (UNMARSHALLING(ps) && num_entries > 0) {
1937 if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY5, num_entries)) == NULL) {
1938 DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
1942 if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR5, num_entries)) == NULL) {
1943 DEBUG(0, ("out of memory allocating SAM_STR5\n"));
1948 for (i = 0; i < num_entries; i++) {
1949 if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth))
1953 for (i = 0; i < num_entries; i++) {
1954 if(!smb_io_string2("grp_name", &sam->str[i].grp_name,
1955 sam->sam[i].hdr_grp_name.buffer, ps, depth))
1962 /*******************************************************************
1963 inits a SAMR_R_QUERY_DISPINFO structure.
1964 ********************************************************************/
1966 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u,
1967 uint32 num_entries, uint32 total_size, uint32 data_size,
1968 uint16 switch_level, SAM_DISPINFO_CTR * ctr,
1971 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level));
1973 r_u->total_size = total_size;
1975 r_u->data_size = data_size;
1977 r_u->switch_level = switch_level;
1978 r_u->num_entries = num_entries;
1981 r_u->ptr_entries = 0;
1983 r_u->ptr_entries = 1;
1985 r_u->num_entries2 = num_entries;
1988 r_u->status = status;
1991 /*******************************************************************
1992 reads or writes a structure.
1993 ********************************************************************/
1995 BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
1996 prs_struct *ps, int depth)
2001 prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo");
2007 if(!prs_uint32("total_size ", ps, depth, &r_u->total_size))
2009 if(!prs_uint32("data_size ", ps, depth, &r_u->data_size))
2011 if(!prs_uint16("switch_level", ps, depth, &r_u->switch_level))
2016 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
2018 if(!prs_uint32("ptr_entries ", ps, depth, &r_u->ptr_entries))
2021 if (r_u->ptr_entries==0) {
2024 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2030 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
2033 switch (r_u->switch_level) {
2035 if(!sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1,
2036 r_u->num_entries, ps, depth))
2040 if(!sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2,
2041 r_u->num_entries, ps, depth))
2045 if(!sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3,
2046 r_u->num_entries, ps, depth))
2050 if(!sam_io_sam_dispinfo_4("user list",
2051 r_u->ctr->sam.info4,
2052 r_u->num_entries, ps, depth))
2056 if(!sam_io_sam_dispinfo_5("group list",
2057 r_u->ctr->sam.info5,
2058 r_u->num_entries, ps, depth))
2062 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
2068 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2074 /*******************************************************************
2075 inits a SAMR_Q_OPEN_GROUP structure.
2076 ********************************************************************/
2078 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c,
2080 uint32 access_mask, uint32 rid)
2082 DEBUG(5, ("init_samr_q_open_group\n"));
2084 q_c->domain_pol = *hnd;
2085 q_c->access_mask = access_mask;
2086 q_c->rid_group = rid;
2089 /*******************************************************************
2090 reads or writes a structure.
2091 ********************************************************************/
2093 BOOL samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u,
2094 prs_struct *ps, int depth)
2099 prs_debug(ps, depth, desc, "samr_io_q_open_group");
2105 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
2108 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
2110 if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group))
2116 /*******************************************************************
2117 reads or writes a structure.
2118 ********************************************************************/
2120 BOOL samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u,
2121 prs_struct *ps, int depth)
2126 prs_debug(ps, depth, desc, "samr_io_r_open_group");
2132 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2135 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2141 /*******************************************************************
2142 inits a GROUP_INFO1 structure.
2143 ********************************************************************/
2145 void init_samr_group_info1(GROUP_INFO1 * gr1,
2146 char *acct_name, char *acct_desc,
2149 DEBUG(5, ("init_samr_group_info1\n"));
2151 gr1->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2152 gr1->num_members = num_members;
2154 init_unistr2(&gr1->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2155 init_uni_hdr(&gr1->hdr_acct_name, &gr1->uni_acct_name);
2156 init_unistr2(&gr1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2157 init_uni_hdr(&gr1->hdr_acct_desc, &gr1->uni_acct_desc);
2160 /*******************************************************************
2161 reads or writes a structure.
2162 ********************************************************************/
2164 BOOL samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1,
2165 prs_struct *ps, int depth)
2172 prs_debug(ps, depth, desc, "samr_io_group_info1");
2175 if(!prs_uint16("level", ps, depth, &dummy))
2181 if(!smb_io_unihdr("hdr_acct_name", &gr1->hdr_acct_name, ps, depth))
2184 if(!prs_uint32("group_attr", ps, depth, &gr1->group_attr))
2186 if(!prs_uint32("num_members", ps, depth, &gr1->num_members))
2189 if(!smb_io_unihdr("hdr_acct_desc", &gr1->hdr_acct_desc, ps, depth))
2192 if(!smb_io_unistr2("uni_acct_name", &gr1->uni_acct_name,
2193 gr1->hdr_acct_name.buffer, ps, depth))
2196 if(!smb_io_unistr2("uni_acct_desc", &gr1->uni_acct_desc,
2197 gr1->hdr_acct_desc.buffer, ps, depth))
2203 /*******************************************************************
2204 inits a GROUP_INFO2 structure.
2205 ********************************************************************/
2207 void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name)
2209 DEBUG(5, ("init_samr_group_info2\n"));
2212 init_unistr2(&gr2->uni_acct_name, acct_name, UNI_FLAGS_NONE);
2213 init_uni_hdr(&gr2->hdr_acct_name, &gr2->uni_acct_name);
2216 /*******************************************************************
2217 reads or writes a structure.
2218 ********************************************************************/
2220 BOOL samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int depth)
2225 prs_debug(ps, depth, desc, "samr_io_group_info2");
2228 if(!prs_uint16("hdr_level", ps, depth, &gr2->level))
2231 if(!smb_io_unihdr("hdr_acct_name", &gr2->hdr_acct_name, ps, depth))
2233 if(!smb_io_unistr2("uni_acct_name", &gr2->uni_acct_name,
2234 gr2->hdr_acct_name.buffer, ps, depth))
2240 /*******************************************************************
2241 inits a GROUP_INFO3 structure.
2242 ********************************************************************/
2244 void init_samr_group_info3(GROUP_INFO3 *gr3)
2246 DEBUG(5, ("init_samr_group_info3\n"));
2248 gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
2251 /*******************************************************************
2252 reads or writes a structure.
2253 ********************************************************************/
2255 BOOL samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth)
2260 prs_debug(ps, depth, desc, "samr_io_group_info3");
2266 if(!prs_uint32("group_attr", ps, depth, &gr3->group_attr))
2272 /*******************************************************************
2273 inits a GROUP_INFO4 structure.
2274 ********************************************************************/
2276 void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc)
2278 DEBUG(5, ("init_samr_group_info4\n"));
2281 init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2282 init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc);
2285 /*******************************************************************
2286 reads or writes a structure.
2287 ********************************************************************/
2289 BOOL samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4,
2290 prs_struct *ps, int depth)
2295 prs_debug(ps, depth, desc, "samr_io_group_info4");
2298 if(!prs_uint16("hdr_level", ps, depth, &gr4->level))
2300 if(!smb_io_unihdr("hdr_acct_desc", &gr4->hdr_acct_desc, ps, depth))
2302 if(!smb_io_unistr2("uni_acct_desc", &gr4->uni_acct_desc,
2303 gr4->hdr_acct_desc.buffer, ps, depth))
2309 /*******************************************************************
2310 reads or writes a structure.
2311 ********************************************************************/
2313 static BOOL samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr,
2314 prs_struct *ps, int depth)
2316 if (UNMARSHALLING(ps))
2317 *ctr = PRS_ALLOC_MEM(ps,GROUP_INFO_CTR,1);
2322 prs_debug(ps, depth, desc, "samr_group_info_ctr");
2325 if(!prs_uint16("switch_value1", ps, depth, &(*ctr)->switch_value1))
2328 switch ((*ctr)->switch_value1) {
2330 if(!samr_io_group_info1("group_info1", &(*ctr)->group.info1, ps, depth))
2334 if(!samr_io_group_info2("group_info2", &(*ctr)->group.info2, ps, depth))
2338 if(!samr_io_group_info3("group_info3", &(*ctr)->group.info3, ps, depth))
2342 if(!samr_io_group_info4("group_info4", &(*ctr)->group.info4, ps, depth))
2346 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2353 /*******************************************************************
2354 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2355 ********************************************************************/
2357 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
2358 POLICY_HND *pol, const char *acct_desc,
2361 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2365 init_unistr2(&q_e->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
2366 init_uni_hdr(&q_e->hdr_acct_desc, &q_e->uni_acct_desc);
2368 q_e->access_mask = access_mask;
2371 /*******************************************************************
2372 reads or writes a structure.
2373 ********************************************************************/
2375 BOOL samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
2376 prs_struct *ps, int depth)
2381 prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
2387 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2390 if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth))
2392 if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc,
2393 q_e->hdr_acct_desc.buffer, ps, depth))
2398 if(!prs_uint32("access", ps, depth, &q_e->access_mask))
2404 /*******************************************************************
2405 reads or writes a structure.
2406 ********************************************************************/
2408 BOOL samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u,
2409 prs_struct *ps, int depth)
2414 prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
2420 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2423 if(!prs_uint32("rid ", ps, depth, &r_u->rid))
2425 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2431 /*******************************************************************
2432 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2433 ********************************************************************/
2435 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c,
2438 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2440 q_c->group_pol = *hnd;
2443 /*******************************************************************
2444 reads or writes a structure.
2445 ********************************************************************/
2447 BOOL samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u,
2448 prs_struct *ps, int depth)
2453 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
2459 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
2465 /*******************************************************************
2466 reads or writes a structure.
2467 ********************************************************************/
2469 BOOL samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u,
2470 prs_struct *ps, int depth)
2475 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
2481 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
2484 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2490 /*******************************************************************
2491 inits a SAMR_Q_DEL_GROUPMEM structure.
2492 ********************************************************************/
2494 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e,
2495 POLICY_HND *pol, uint32 rid)
2497 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2503 /*******************************************************************
2504 reads or writes a structure.
2505 ********************************************************************/
2507 BOOL samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e,
2508 prs_struct *ps, int depth)
2513 prs_debug(ps, depth, desc, "samr_io_q_del_groupmem");
2519 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2522 if(!prs_uint32("rid", ps, depth, &q_e->rid))
2528 /*******************************************************************
2529 inits a SAMR_R_DEL_GROUPMEM structure.
2530 ********************************************************************/
2532 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol,
2535 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2537 r_u->status = status;
2540 /*******************************************************************
2541 reads or writes a structure.
2542 ********************************************************************/
2544 BOOL samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u,
2545 prs_struct *ps, int depth)
2550 prs_debug(ps, depth, desc, "samr_io_r_del_groupmem");
2556 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2562 /*******************************************************************
2563 inits a SAMR_Q_ADD_GROUPMEM structure.
2564 ********************************************************************/
2566 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e,
2567 POLICY_HND *pol, uint32 rid)
2569 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2573 q_e->unknown = 0x0005;
2576 /*******************************************************************
2577 reads or writes a structure.
2578 ********************************************************************/
2580 BOOL samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e,
2581 prs_struct *ps, int depth)
2586 prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
2592 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2595 if(!prs_uint32("rid ", ps, depth, &q_e->rid))
2597 if(!prs_uint32("unknown", ps, depth, &q_e->unknown))
2603 /*******************************************************************
2604 inits a SAMR_R_ADD_GROUPMEM structure.
2605 ********************************************************************/
2607 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol,
2610 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2612 r_u->status = status;
2615 /*******************************************************************
2616 reads or writes a structure.
2617 ********************************************************************/
2619 BOOL samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u,
2620 prs_struct *ps, int depth)
2625 prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
2631 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2637 /*******************************************************************
2638 inits a SAMR_Q_SET_GROUPINFO structure.
2639 ********************************************************************/
2641 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e,
2642 POLICY_HND *pol, GROUP_INFO_CTR * ctr)
2644 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2650 /*******************************************************************
2651 reads or writes a structure.
2652 ********************************************************************/
2654 BOOL samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e,
2655 prs_struct *ps, int depth)
2660 prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
2666 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2669 if(!samr_group_info_ctr("ctr", &q_e->ctr, ps, depth))
2675 /*******************************************************************
2676 inits a SAMR_R_SET_GROUPINFO structure.
2677 ********************************************************************/
2679 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status)
2681 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2683 r_u->status = status;
2686 /*******************************************************************
2687 reads or writes a structure.
2688 ********************************************************************/
2690 BOOL samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u,
2691 prs_struct *ps, int depth)
2696 prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
2702 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2708 /*******************************************************************
2709 inits a SAMR_Q_QUERY_GROUPINFO structure.
2710 ********************************************************************/
2712 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e,
2713 POLICY_HND *pol, uint16 switch_level)
2715 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2719 q_e->switch_level = switch_level;
2722 /*******************************************************************
2723 reads or writes a structure.
2724 ********************************************************************/
2726 BOOL samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e,
2727 prs_struct *ps, int depth)
2732 prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
2738 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
2741 if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
2747 /*******************************************************************
2748 inits a SAMR_R_QUERY_GROUPINFO structure.
2749 ********************************************************************/
2751 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u,
2752 GROUP_INFO_CTR * ctr, NTSTATUS status)
2754 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2756 r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0;
2758 r_u->status = status;
2761 /*******************************************************************
2762 reads or writes a structure.
2763 ********************************************************************/
2765 BOOL samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u,
2766 prs_struct *ps, int depth)
2771 prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
2777 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
2780 if (r_u->ptr != 0) {
2781 if(!samr_group_info_ctr("ctr", &r_u->ctr, ps, depth))
2787 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2793 /*******************************************************************
2794 inits a SAMR_Q_QUERY_GROUPMEM structure.
2795 ********************************************************************/
2797 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd)
2799 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2801 q_c->group_pol = *hnd;
2804 /*******************************************************************
2805 reads or writes a structure.
2806 ********************************************************************/
2808 BOOL samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u,
2809 prs_struct *ps, int depth)
2814 prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
2820 if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
2826 /*******************************************************************
2827 inits a SAMR_R_QUERY_GROUPMEM structure.
2828 ********************************************************************/
2830 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u,
2831 uint32 num_entries, uint32 *rid,
2832 uint32 *attr, NTSTATUS status)
2834 DEBUG(5, ("init_samr_r_query_groupmem\n"));
2836 if (NT_STATUS_IS_OK(status)) {
2838 r_u->num_entries = num_entries;
2840 r_u->ptr_attrs = attr != NULL ? 1 : 0;
2841 r_u->ptr_rids = rid != NULL ? 1 : 0;
2843 r_u->num_rids = num_entries;
2846 r_u->num_attrs = num_entries;
2850 r_u->num_entries = 0;
2853 r_u->status = status;
2856 /*******************************************************************
2857 reads or writes a structure.
2858 ********************************************************************/
2860 BOOL samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u,
2861 prs_struct *ps, int depth)
2868 if (UNMARSHALLING(ps))
2871 prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
2877 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
2879 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
2882 if (r_u->ptr != 0) {
2883 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
2885 if(!prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs))
2888 if (r_u->ptr_rids != 0) {
2889 if(!prs_uint32("num_rids", ps, depth, &r_u->num_rids))
2891 if (UNMARSHALLING(ps) && r_u->num_rids != 0) {
2892 r_u->rid = PRS_ALLOC_MEM(ps,uint32,r_u->num_rids);
2893 if (r_u->rid == NULL)
2897 for (i = 0; i < r_u->num_rids; i++) {
2898 if(!prs_uint32("", ps, depth, &r_u->rid[i]))
2903 if (r_u->ptr_attrs != 0) {
2904 if(!prs_uint32("num_attrs", ps, depth, &r_u->num_attrs))
2907 if (UNMARSHALLING(ps) && r_u->num_attrs != 0) {
2908 r_u->attr = PRS_ALLOC_MEM(ps,uint32,r_u->num_attrs);
2909 if (r_u->attr == NULL)
2913 for (i = 0; i < r_u->num_attrs; i++) {
2914 if(!prs_uint32("", ps, depth, &r_u->attr[i]))
2920 if(!prs_ntstatus("status", ps, depth, &r_u->status))
2926 /*******************************************************************
2927 inits a SAMR_Q_QUERY_USERGROUPS structure.
2928 ********************************************************************/
2930 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u,
2933 DEBUG(5, ("init_samr_q_query_usergroups\n"));
2938 /*******************************************************************
2939 reads or writes a structure.
2940 ********************************************************************/
2942 BOOL samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u,
2943 prs_struct *ps, int depth)
2948 prs_debug(ps, depth, desc, "samr_io_q_query_usergroups");
2954 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
2960 /*******************************************************************
2961 inits a SAMR_R_QUERY_USERGROUPS structure.
2962 ********************************************************************/
2964 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u,
2965 uint32 num_gids, DOM_GID * gid,
2968 DEBUG(5, ("init_samr_r_query_usergroups\n"));
2970 if (NT_STATUS_IS_OK(status)) {
2972 r_u->num_entries = num_gids;
2973 r_u->ptr_1 = (num_gids != 0) ? 1 : 0;
2974 r_u->num_entries2 = num_gids;
2979 r_u->num_entries = 0;
2984 r_u->status = status;
2987 /*******************************************************************
2988 reads or writes a structure.
2989 ********************************************************************/
2991 BOOL samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid,
2992 prs_struct *ps, int depth)
2998 prs_debug(ps, depth, desc, "samr_io_gids");
3004 if(!prs_uint32("num_gids", ps, depth, num_gids))
3007 if ((*num_gids) != 0) {
3008 if (UNMARSHALLING(ps)) {
3009 (*gid) = PRS_ALLOC_MEM(ps,DOM_GID,*num_gids);
3012 if ((*gid) == NULL) {
3016 for (i = 0; i < (*num_gids); i++) {
3017 if(!smb_io_gid("gids", &(*gid)[i], ps, depth))
3025 /*******************************************************************
3026 reads or writes a structure.
3027 ********************************************************************/
3029 BOOL samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u,
3030 prs_struct *ps, int depth)
3035 prs_debug(ps, depth, desc, "samr_io_r_query_usergroups");
3041 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
3044 if (r_u->ptr_0 != 0) {
3045 if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
3047 if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1))
3050 if (r_u->num_entries != 0 && r_u->ptr_1 != 0) {
3051 if(!samr_io_gids("gids", &r_u->num_entries2, &r_u->gid, ps, depth))
3058 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3064 /*******************************************************************
3065 inits a SAMR_Q_ENUM_DOMAINS structure.
3066 ********************************************************************/
3068 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e,
3070 uint32 start_idx, uint32 size)
3072 DEBUG(5, ("init_samr_q_enum_domains\n"));
3076 q_e->start_idx = start_idx;
3077 q_e->max_size = size;
3080 /*******************************************************************
3081 reads or writes a structure.
3082 ********************************************************************/
3084 BOOL samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e,
3085 prs_struct *ps, int depth)
3090 prs_debug(ps, depth, desc, "samr_io_q_enum_domains");
3096 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
3099 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3101 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3107 /*******************************************************************
3108 inits a SAMR_R_ENUM_DOMAINS structure.
3109 ********************************************************************/
3111 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u,
3112 uint32 next_idx, uint32 num_sam_entries)
3114 DEBUG(5, ("init_samr_r_enum_domains\n"));
3116 r_u->next_idx = next_idx;
3118 if (num_sam_entries != 0) {
3119 r_u->ptr_entries1 = 1;
3120 r_u->ptr_entries2 = 1;
3121 r_u->num_entries2 = num_sam_entries;
3122 r_u->num_entries3 = num_sam_entries;
3124 r_u->num_entries4 = num_sam_entries;
3126 r_u->ptr_entries1 = 0;
3127 r_u->num_entries2 = num_sam_entries;
3128 r_u->ptr_entries2 = 1;
3132 /*******************************************************************
3133 reads or writes a structure.
3134 ********************************************************************/
3136 BOOL samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u,
3137 prs_struct *ps, int depth)
3144 prs_debug(ps, depth, desc, "samr_io_r_enum_domains");
3150 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3152 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3155 if (r_u->ptr_entries1 != 0) {
3156 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3158 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3160 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3163 if (UNMARSHALLING(ps)) {
3164 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3165 r_u->uni_dom_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3168 if ((r_u->sam == NULL || r_u->uni_dom_name == NULL) && r_u->num_entries2 != 0) {
3169 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
3170 r_u->num_entries4 = 0;
3171 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3175 for (i = 0; i < r_u->num_entries2; i++) {
3177 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
3178 if(!sam_io_sam_entry(tmp, &r_u->sam[i], ps, depth))
3182 for (i = 0; i < r_u->num_entries2; i++) {
3184 slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
3185 if(!smb_io_unistr2(tmp, &r_u->uni_dom_name[i],
3186 r_u->sam[i].hdr_name.buffer, ps,
3195 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3197 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3203 /*******************************************************************
3204 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
3205 ********************************************************************/
3207 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e,
3209 uint32 start_idx, uint32 size)
3211 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
3215 q_e->start_idx = start_idx;
3216 q_e->max_size = size;
3219 /*******************************************************************
3220 reads or writes a structure.
3221 ********************************************************************/
3223 BOOL samr_io_q_enum_dom_groups(const char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e,
3224 prs_struct *ps, int depth)
3229 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups");
3235 if(!smb_io_pol_hnd("pol", &(q_e->pol), ps, depth))
3238 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3240 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3246 /*******************************************************************
3247 inits a SAMR_R_ENUM_DOM_GROUPS structure.
3248 ********************************************************************/
3250 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u,
3251 uint32 next_idx, uint32 num_sam_entries)
3253 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
3255 r_u->next_idx = next_idx;
3257 if (num_sam_entries != 0) {
3258 r_u->ptr_entries1 = 1;
3259 r_u->ptr_entries2 = 1;
3260 r_u->num_entries2 = num_sam_entries;
3261 r_u->num_entries3 = num_sam_entries;
3263 r_u->num_entries4 = num_sam_entries;
3265 r_u->ptr_entries1 = 0;
3266 r_u->num_entries2 = num_sam_entries;
3267 r_u->ptr_entries2 = 1;
3271 /*******************************************************************
3272 reads or writes a structure.
3273 ********************************************************************/
3275 BOOL samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u,
3276 prs_struct *ps, int depth)
3283 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups");
3289 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3291 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3294 if (r_u->ptr_entries1 != 0) {
3295 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3297 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3299 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3302 if (UNMARSHALLING(ps)) {
3303 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3304 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3307 if ((r_u->sam == NULL || r_u->uni_grp_name == NULL) && r_u->num_entries2 != 0) {
3309 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3310 r_u->num_entries4 = 0;
3311 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3315 for (i = 0; i < r_u->num_entries2; i++) {
3316 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
3320 for (i = 0; i < r_u->num_entries2; i++) {
3321 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
3322 r_u->sam[i].hdr_name.buffer, ps, depth))
3329 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3331 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3337 /*******************************************************************
3338 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3339 ********************************************************************/
3341 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e,
3342 POLICY_HND *pol, uint32 start_idx,
3345 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3349 q_e->start_idx = start_idx;
3350 q_e->max_size = size;
3354 /*******************************************************************
3355 reads or writes a structure.
3356 ********************************************************************/
3358 BOOL samr_io_q_enum_dom_aliases(const char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e,
3359 prs_struct *ps, int depth)
3364 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases");
3370 if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
3373 if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
3375 if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
3381 /*******************************************************************
3382 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3383 ********************************************************************/
3385 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, uint32 num_sam_entries)
3387 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3389 r_u->next_idx = next_idx;
3391 if (num_sam_entries != 0) {
3392 r_u->ptr_entries1 = 1;
3393 r_u->ptr_entries2 = 1;
3394 r_u->num_entries2 = num_sam_entries;
3395 r_u->num_entries3 = num_sam_entries;
3397 r_u->num_entries4 = num_sam_entries;
3399 r_u->ptr_entries1 = 0;
3400 r_u->num_entries2 = num_sam_entries;
3401 r_u->ptr_entries2 = 1;
3405 /*******************************************************************
3406 reads or writes a structure.
3407 ********************************************************************/
3409 BOOL samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
3410 prs_struct *ps, int depth)
3417 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases");
3423 if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
3425 if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
3428 if (r_u->ptr_entries1 != 0) {
3429 if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
3431 if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
3433 if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
3436 if (UNMARSHALLING(ps) && (r_u->num_entries2 > 0)) {
3437 r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
3438 r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
3441 if (r_u->num_entries2 != 0 &&
3442 (r_u->sam == NULL || r_u->uni_grp_name == NULL)) {
3443 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3444 r_u->num_entries4 = 0;
3445 r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
3449 for (i = 0; i < r_u->num_entries2; i++) {
3450 if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
3454 for (i = 0; i < r_u->num_entries2; i++) {
3455 if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
3456 r_u->sam[i].hdr_name.buffer, ps,
3464 if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
3466 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3472 /*******************************************************************
3473 inits a ALIAS_INFO1 structure.
3474 ********************************************************************/
3476 void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc)
3478 DEBUG(5, ("init_samr_alias_info1\n"));
3480 init_unistr4(&al1->name, acct_name, UNI_FLAGS_NONE);
3481 al1->num_member = num_member;
3482 init_unistr4(&al1->description, acct_desc, UNI_FLAGS_NONE);
3485 /*******************************************************************
3486 reads or writes a structure.
3487 ********************************************************************/
3489 BOOL samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1,
3490 prs_struct *ps, int depth)
3495 prs_debug(ps, depth, desc, "samr_io_alias_info1");
3501 if ( !prs_unistr4_hdr("name", ps, depth, &al1->name) )
3503 if ( !prs_uint32("num_member", ps, depth, &al1->num_member) )
3505 if ( !prs_unistr4_hdr("description", ps, depth, &al1->description) )
3508 if ( !prs_unistr4_str("name", ps, depth, &al1->name) )
3510 if ( !prs_align(ps) )
3512 if ( !prs_unistr4_str("description", ps, depth, &al1->description) )
3514 if ( !prs_align(ps) )
3520 /*******************************************************************
3521 inits a ALIAS_INFO3 structure.
3522 ********************************************************************/
3524 void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc)
3526 DEBUG(5, ("init_samr_alias_info3\n"));
3528 init_unistr4(&al3->description, acct_desc, UNI_FLAGS_NONE);
3531 /*******************************************************************
3532 reads or writes a structure.
3533 ********************************************************************/
3535 BOOL samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3,
3536 prs_struct *ps, int depth)
3541 prs_debug(ps, depth, desc, "samr_io_alias_info3");
3547 if (!prs_unistr4("description", ps, depth, &al3->description))
3553 /*******************************************************************
3554 reads or writes a structure.
3555 ********************************************************************/
3557 BOOL samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2,
3558 prs_struct *ps, int depth)
3563 prs_debug(ps, depth, desc, "samr_io_alias_info2");
3569 if (!prs_unistr4("name", ps, depth, &al2->name))
3575 /*******************************************************************
3576 reads or writes a structure.
3577 ********************************************************************/
3579 BOOL samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr)
3584 prs_debug(ps, depth, desc, "samr_alias_info_ctr");
3587 if ( !prs_uint16("level", ps, depth, &ctr->level) )
3592 switch (ctr->level) {
3594 if(!samr_io_alias_info1("alias_info1", &ctr->alias.info1, ps, depth))
3598 if(!samr_io_alias_info2("alias_info2", &ctr->alias.info2, ps, depth))
3602 if(!samr_io_alias_info3("alias_info3", &ctr->alias.info3, ps, depth))
3606 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3613 /*******************************************************************
3614 inits a SAMR_Q_QUERY_ALIASINFO structure.
3615 ********************************************************************/
3617 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e,
3618 POLICY_HND *pol, uint32 switch_level)
3620 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3623 q_e->level = switch_level;
3626 /*******************************************************************
3627 reads or writes a structure.
3628 ********************************************************************/
3630 BOOL samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in,
3631 prs_struct *ps, int depth)
3636 prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo");
3642 if ( !smb_io_pol_hnd("pol", &(in->pol), ps, depth) )
3645 if ( !prs_uint16("level", ps, depth, &in->level) )
3651 /*******************************************************************
3652 inits a SAMR_R_QUERY_ALIASINFO structure.
3653 ********************************************************************/
3655 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *out,
3656 ALIAS_INFO_CTR * ctr, NTSTATUS status)
3658 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3661 out->status = status;
3664 /*******************************************************************
3665 reads or writes a structure.
3666 ********************************************************************/
3668 BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out,
3669 prs_struct *ps, int depth)
3674 prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo");
3680 if ( !prs_pointer("alias", ps, depth, (void**)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr))
3685 if(!prs_ntstatus("status", ps, depth, &out->status))
3691 /*******************************************************************
3692 inits a SAMR_Q_SET_ALIASINFO structure.
3693 ********************************************************************/
3695 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u,
3696 POLICY_HND *hnd, ALIAS_INFO_CTR * ctr)
3698 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3700 q_u->alias_pol = *hnd;
3704 /*******************************************************************
3705 reads or writes a structure.
3706 ********************************************************************/
3708 BOOL samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u,
3709 prs_struct *ps, int depth)
3714 prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo");
3720 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
3722 if(!samr_alias_info_ctr("ctr", ps, depth, &q_u->ctr))
3728 /*******************************************************************
3729 reads or writes a structure.
3730 ********************************************************************/
3732 BOOL samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u,
3733 prs_struct *ps, int depth)
3738 prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo");
3743 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3749 /*******************************************************************
3750 inits a SAMR_Q_QUERY_USERALIASES structure.
3751 ********************************************************************/
3753 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u,
3756 uint32 *ptr_sid, DOM_SID2 * sid)
3758 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3762 q_u->num_sids1 = num_sids;
3764 q_u->num_sids2 = num_sids;
3766 q_u->ptr_sid = ptr_sid;
3770 /*******************************************************************
3771 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3772 ********************************************************************/
3774 BOOL samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u,
3775 prs_struct *ps, int depth)
3783 prs_debug(ps, depth, desc, "samr_io_q_query_useraliases");
3789 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
3792 if(!prs_uint32("num_sids1", ps, depth, &q_u->num_sids1))
3794 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
3800 if(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2))
3803 if (UNMARSHALLING(ps) && (q_u->num_sids2 != 0)) {
3804 q_u->ptr_sid = PRS_ALLOC_MEM(ps,uint32,q_u->num_sids2);
3805 if (q_u->ptr_sid == NULL)
3808 q_u->sid = PRS_ALLOC_MEM(ps, DOM_SID2, q_u->num_sids2);
3809 if (q_u->sid == NULL)
3813 for (i = 0; i < q_u->num_sids2; i++) {
3814 slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i);
3815 if(!prs_uint32(tmp, ps, depth, &q_u->ptr_sid[i]))
3819 for (i = 0; i < q_u->num_sids2; i++) {
3820 if (q_u->ptr_sid[i] != 0) {
3821 slprintf(tmp, sizeof(tmp) - 1, "sid[%02d]", i);
3822 if(!smb_io_dom_sid2(tmp, &q_u->sid[i], ps, depth))
3830 /*******************************************************************
3831 inits a SAMR_R_QUERY_USERALIASES structure.
3832 ********************************************************************/
3834 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u,
3835 uint32 num_rids, uint32 *rid,
3838 DEBUG(5, ("init_samr_r_query_useraliases\n"));
3840 if (NT_STATUS_IS_OK(status)) {
3841 r_u->num_entries = num_rids;
3843 r_u->num_entries2 = num_rids;
3847 r_u->num_entries = 0;
3849 r_u->num_entries2 = 0;
3852 r_u->status = status;
3855 /*******************************************************************
3856 reads or writes a structure.
3857 ********************************************************************/
3859 BOOL samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid,
3860 prs_struct *ps, int depth)
3867 prs_debug(ps, depth, desc, "samr_io_rids");
3873 if(!prs_uint32("num_rids", ps, depth, num_rids))
3876 if ((*num_rids) != 0) {
3877 if (UNMARSHALLING(ps)) {
3879 (*rid) = PRS_ALLOC_MEM(ps,uint32, *num_rids);
3884 for (i = 0; i < (*num_rids); i++) {
3885 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d]", i);
3886 if(!prs_uint32(tmp, ps, depth, &((*rid)[i])))
3894 /*******************************************************************
3895 reads or writes a structure.
3896 ********************************************************************/
3898 BOOL samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u,
3899 prs_struct *ps, int depth)
3904 prs_debug(ps, depth, desc, "samr_io_r_query_useraliases");
3910 if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries))
3912 if(!prs_uint32("ptr ", ps, depth, &r_u->ptr))
3915 if (r_u->ptr != 0) {
3916 if(!samr_io_rids("rids", &r_u->num_entries2, &r_u->rid, ps, depth))
3922 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3928 /*******************************************************************
3929 inits a SAMR_Q_OPEN_ALIAS structure.
3930 ********************************************************************/
3932 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol,
3933 uint32 access_mask, uint32 rid)
3935 DEBUG(5, ("init_samr_q_open_alias\n"));
3937 q_u->dom_pol = *pol;
3938 q_u->access_mask = access_mask;
3939 q_u->rid_alias = rid;
3942 /*******************************************************************
3943 reads or writes a structure.
3944 ********************************************************************/
3946 BOOL samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u,
3947 prs_struct *ps, int depth)
3952 prs_debug(ps, depth, desc, "samr_io_q_open_alias");
3958 if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
3961 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
3963 if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias))
3969 /*******************************************************************
3970 reads or writes a structure.
3971 ********************************************************************/
3973 BOOL samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u,
3974 prs_struct *ps, int depth)
3979 prs_debug(ps, depth, desc, "samr_io_r_open_alias");
3985 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
3988 if(!prs_ntstatus("status", ps, depth, &r_u->status))
3994 /*******************************************************************
3995 inits a SAMR_Q_LOOKUP_RIDS structure.
3996 ********************************************************************/
3998 void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u,
3999 POLICY_HND *pol, uint32 flags,
4000 uint32 num_rids, uint32 *rid)
4002 DEBUG(5, ("init_samr_q_lookup_rids\n"));
4006 q_u->num_rids1 = num_rids;
4009 q_u->num_rids2 = num_rids;
4010 q_u->rid = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids );
4011 if (q_u->rid == NULL) {
4015 memcpy(q_u->rid, rid, num_rids * sizeof(q_u->rid[0]));
4019 /*******************************************************************
4020 reads or writes a structure.
4021 ********************************************************************/
4023 BOOL samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u,
4024 prs_struct *ps, int depth)
4032 prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
4035 if (UNMARSHALLING(ps))
4041 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
4044 if(!prs_uint32("num_rids1", ps, depth, &q_u->num_rids1))
4046 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
4048 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
4050 if(!prs_uint32("num_rids2", ps, depth, &q_u->num_rids2))
4053 if (UNMARSHALLING(ps) && (q_u->num_rids2 != 0)) {
4054 q_u->rid = PRS_ALLOC_MEM(ps, uint32, q_u->num_rids2);
4055 if (q_u->rid == NULL)
4059 for (i = 0; i < q_u->num_rids2; i++) {
4060 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
4061 if(!prs_uint32(tmp, ps, depth, &q_u->rid[i]))
4068 /*******************************************************************
4069 inits a SAMR_R_LOOKUP_RIDS structure.
4070 ********************************************************************/
4072 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u,
4073 uint32 num_names, UNIHDR * hdr_name,
4074 UNISTR2 *uni_name, uint32 *type)
4076 DEBUG(5, ("init_samr_r_lookup_rids\n"));
4078 r_u->hdr_name = NULL;
4079 r_u->uni_name = NULL;
4082 if (num_names != 0) {
4083 r_u->num_names1 = num_names;
4085 r_u->num_names2 = num_names;
4087 r_u->num_types1 = num_names;
4089 r_u->num_types2 = num_names;
4091 r_u->hdr_name = hdr_name;
4092 r_u->uni_name = uni_name;
4095 r_u->num_names1 = num_names;
4097 r_u->num_names2 = num_names;
4099 r_u->num_types1 = num_names;
4101 r_u->num_types2 = num_names;
4105 /*******************************************************************
4106 reads or writes a structure.
4107 ********************************************************************/
4109 BOOL samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u,
4110 prs_struct *ps, int depth)
4117 prs_debug(ps, depth, desc, "samr_io_r_lookup_rids");
4123 if(!prs_uint32("num_names1", ps, depth, &r_u->num_names1))
4125 if(!prs_uint32("ptr_names ", ps, depth, &r_u->ptr_names))
4128 if (r_u->ptr_names != 0) {
4130 if(!prs_uint32("num_names2", ps, depth, &r_u->num_names2))
4134 if (UNMARSHALLING(ps) && (r_u->num_names2 != 0)) {
4135 r_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, r_u->num_names2);
4136 if (r_u->hdr_name == NULL)
4139 r_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, r_u->num_names2);
4140 if (r_u->uni_name == NULL)
4144 for (i = 0; i < r_u->num_names2; i++) {
4145 slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
4146 if(!smb_io_unihdr("", &r_u->hdr_name[i], ps, depth))
4149 for (i = 0; i < r_u->num_names2; i++) {
4150 slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
4151 if(!smb_io_unistr2("", &r_u->uni_name[i], r_u->hdr_name[i].buffer, ps, depth))
4159 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
4161 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
4164 if (r_u->ptr_types != 0) {
4166 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
4169 if (UNMARSHALLING(ps) && (r_u->num_types2 != 0)) {
4170 r_u->type = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
4171 if (r_u->type == NULL)
4175 for (i = 0; i < r_u->num_types2; i++) {
4176 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
4177 if(!prs_uint32(tmp, ps, depth, &r_u->type[i]))
4182 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4188 /*******************************************************************
4189 inits a SAMR_Q_OPEN_ALIAS structure.
4190 ********************************************************************/
4192 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd)
4194 DEBUG(5, ("init_samr_q_delete_alias\n"));
4196 q_u->alias_pol = *hnd;
4199 /*******************************************************************
4200 reads or writes a structure.
4201 ********************************************************************/
4203 BOOL samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
4204 prs_struct *ps, int depth)
4209 prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
4215 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4221 /*******************************************************************
4222 reads or writes a structure.
4223 ********************************************************************/
4225 BOOL samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
4226 prs_struct *ps, int depth)
4231 prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
4237 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4239 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4245 /*******************************************************************
4246 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
4247 ********************************************************************/
4249 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
4250 POLICY_HND *hnd, const char *acct_desc)
4252 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
4254 q_u->dom_pol = *hnd;
4256 init_unistr2(&q_u->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
4257 init_uni_hdr(&q_u->hdr_acct_desc, &q_u->uni_acct_desc);
4259 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
4262 /*******************************************************************
4263 reads or writes a structure.
4264 ********************************************************************/
4266 BOOL samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u,
4267 prs_struct *ps, int depth)
4272 prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
4278 if(!smb_io_pol_hnd("dom_pol", &q_u->dom_pol, ps, depth))
4281 if(!smb_io_unihdr("hdr_acct_desc", &q_u->hdr_acct_desc, ps, depth))
4283 if(!smb_io_unistr2("uni_acct_desc", &q_u->uni_acct_desc,
4284 q_u->hdr_acct_desc.buffer, ps, depth))
4289 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
4295 /*******************************************************************
4296 reads or writes a structure.
4297 ********************************************************************/
4299 BOOL samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u,
4300 prs_struct *ps, int depth)
4305 prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
4311 if(!smb_io_pol_hnd("alias_pol", &r_u->alias_pol, ps, depth))
4314 if(!prs_uint32("rid", ps, depth, &r_u->rid))
4317 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4323 /*******************************************************************
4324 inits a SAMR_Q_ADD_ALIASMEM structure.
4325 ********************************************************************/
4327 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd,
4330 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
4332 q_u->alias_pol = *hnd;
4333 init_dom_sid2(&q_u->sid, sid);
4336 /*******************************************************************
4337 reads or writes a structure.
4338 ********************************************************************/
4340 BOOL samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u,
4341 prs_struct *ps, int depth)
4346 prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
4352 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4354 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
4360 /*******************************************************************
4361 reads or writes a structure.
4362 ********************************************************************/
4364 BOOL samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u,
4365 prs_struct *ps, int depth)
4370 prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
4376 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4382 /*******************************************************************
4383 inits a SAMR_Q_DEL_ALIASMEM structure.
4384 ********************************************************************/
4386 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd,
4389 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4391 q_u->alias_pol = *hnd;
4392 init_dom_sid2(&q_u->sid, sid);
4395 /*******************************************************************
4396 reads or writes a structure.
4397 ********************************************************************/
4399 BOOL samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u,
4400 prs_struct *ps, int depth)
4405 prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
4411 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4413 if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
4419 /*******************************************************************
4420 reads or writes a structure.
4421 ********************************************************************/
4423 BOOL samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
4424 prs_struct *ps, int depth)
4429 prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
4435 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4441 /*******************************************************************
4442 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4443 ********************************************************************/
4445 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c,
4448 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4450 q_c->alias_pol = *hnd;
4453 /*******************************************************************
4454 reads or writes a structure.
4455 ********************************************************************/
4457 BOOL samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
4458 prs_struct *ps, int depth)
4463 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
4469 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4475 /*******************************************************************
4476 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4477 ********************************************************************/
4479 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u,
4482 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4484 r_u->status = status;
4487 /*******************************************************************
4488 reads or writes a structure.
4489 ********************************************************************/
4491 BOOL samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
4492 prs_struct *ps, int depth)
4497 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
4503 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4506 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4512 /*******************************************************************
4513 inits a SAMR_Q_QUERY_ALIASMEM structure.
4514 ********************************************************************/
4516 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c,
4519 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4521 q_c->alias_pol = *hnd;
4524 /*******************************************************************
4525 reads or writes a structure.
4526 ********************************************************************/
4528 BOOL samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u,
4529 prs_struct *ps, int depth)
4534 prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem");
4540 if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
4546 /*******************************************************************
4547 inits a SAMR_R_QUERY_ALIASMEM structure.
4548 ********************************************************************/
4550 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u,
4551 uint32 num_sids, DOM_SID2 * sid,
4554 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4556 if (NT_STATUS_IS_OK(status)) {
4557 r_u->num_sids = num_sids;
4558 r_u->ptr = (num_sids != 0) ? 1 : 0;
4559 r_u->num_sids1 = num_sids;
4567 r_u->status = status;
4570 /*******************************************************************
4571 reads or writes a structure.
4572 ********************************************************************/
4574 BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u,
4575 prs_struct *ps, int depth)
4582 prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem");
4588 if(!prs_uint32("num_sids ", ps, depth, &r_u->num_sids))
4590 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
4593 if (r_u->ptr != 0 && r_u->num_sids != 0) {
4594 uint32 *ptr_sid = NULL;
4596 if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1))
4599 ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1);
4604 for (i = 0; i < r_u->num_sids1; i++) {
4606 if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i]))
4610 if (UNMARSHALLING(ps)) {
4611 r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1);
4614 for (i = 0; i < r_u->num_sids1; i++) {
4615 if (ptr_sid[i] != 0) {
4616 if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth))
4624 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4630 /*******************************************************************
4631 inits a SAMR_Q_LOOKUP_NAMES structure.
4632 ********************************************************************/
4634 NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
4635 POLICY_HND *pol, uint32 flags,
4636 uint32 num_names, const char **name)
4640 DEBUG(5, ("init_samr_q_lookup_names\n"));
4644 q_u->num_names1 = num_names;
4647 q_u->num_names2 = num_names;
4649 if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names)))
4650 return NT_STATUS_NO_MEMORY;
4652 if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names)))
4653 return NT_STATUS_NO_MEMORY;
4655 for (i = 0; i < num_names; i++) {
4656 init_unistr2(&q_u->uni_name[i], name[i], UNI_FLAGS_NONE); /* unicode string for machine account */
4657 init_uni_hdr(&q_u->hdr_name[i], &q_u->uni_name[i]); /* unicode header for user_name */
4660 return NT_STATUS_OK;
4663 /*******************************************************************
4664 reads or writes a structure.
4665 ********************************************************************/
4667 BOOL samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
4668 prs_struct *ps, int depth)
4675 prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
4678 if (UNMARSHALLING(ps))
4684 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
4687 if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1))
4689 if(!prs_uint32("flags ", ps, depth, &q_u->flags))
4691 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
4693 if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2))
4696 if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) {
4697 q_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_u->num_names2);
4698 q_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_u->num_names2);
4699 if (!q_u->hdr_name || !q_u->uni_name)
4703 for (i = 0; i < q_u->num_names2; i++) {
4704 if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth))
4708 for (i = 0; i < q_u->num_names2; i++) {
4709 if(!smb_io_unistr2("", &q_u->uni_name[i], q_u->hdr_name[i].buffer, ps, depth))
4716 /*******************************************************************
4717 inits a SAMR_R_LOOKUP_NAMES structure.
4718 ********************************************************************/
4720 NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
4722 uint32 *rid, uint32 *type,
4725 DEBUG(5, ("init_samr_r_lookup_names\n"));
4727 if (NT_STATUS_IS_OK(status) && (num_rids != 0)) {
4730 r_u->num_types1 = num_rids;
4732 r_u->num_types2 = num_rids;
4734 r_u->num_rids1 = num_rids;
4736 r_u->num_rids2 = num_rids;
4738 if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
4739 return NT_STATUS_NO_MEMORY;
4740 if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
4741 return NT_STATUS_NO_MEMORY;
4743 if (!r_u->rids || !r_u->types)
4746 for (i = 0; i < num_rids; i++) {
4747 r_u->rids[i] = rid[i];
4748 r_u->types[i] = type[i];
4753 r_u->num_types1 = 0;
4755 r_u->num_types2 = 0;
4765 r_u->status = status;
4767 return NT_STATUS_OK;
4770 /*******************************************************************
4771 reads or writes a structure.
4772 ********************************************************************/
4774 BOOL samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u,
4775 prs_struct *ps, int depth)
4783 prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
4786 if (UNMARSHALLING(ps))
4792 if(!prs_uint32("num_rids1", ps, depth, &r_u->num_rids1))
4794 if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
4797 if (r_u->ptr_rids != 0) {
4798 if(!prs_uint32("num_rids2", ps, depth, &r_u->num_rids2))
4801 if (r_u->num_rids2 != r_u->num_rids1) {
4806 if (UNMARSHALLING(ps))
4807 r_u->rids = PRS_ALLOC_MEM(ps, uint32, r_u->num_rids2);
4810 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
4814 for (i = 0; i < r_u->num_rids2; i++) {
4815 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
4816 if(!prs_uint32(tmp, ps, depth, &r_u->rids[i]))
4821 if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
4823 if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
4826 if (r_u->ptr_types != 0) {
4827 if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
4830 if (r_u->num_types2 != r_u->num_types1) {
4835 if (UNMARSHALLING(ps))
4836 r_u->types = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
4839 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
4843 for (i = 0; i < r_u->num_types2; i++) {
4844 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
4845 if(!prs_uint32(tmp, ps, depth, &r_u->types[i]))
4850 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4856 /*******************************************************************
4857 inits a SAMR_Q_DELETE_DOM_USER structure.
4858 ********************************************************************/
4860 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c,
4863 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
4865 q_c->user_pol = *hnd;
4868 /*******************************************************************
4869 reads or writes a structure.
4870 ********************************************************************/
4872 BOOL samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u,
4873 prs_struct *ps, int depth)
4878 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_user");
4884 if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
4890 /*******************************************************************
4891 reads or writes a structure.
4892 ********************************************************************/
4894 BOOL samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u,
4895 prs_struct *ps, int depth)
4900 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_user");
4906 if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
4908 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4914 /*******************************************************************
4915 reads or writes a structure.
4916 ********************************************************************/
4918 void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u,
4920 uint32 access_mask, uint32 rid)
4922 DEBUG(5, ("samr_init_samr_q_open_user\n"));
4924 q_u->domain_pol = *pol;
4925 q_u->access_mask = access_mask;
4926 q_u->user_rid = rid;
4929 /*******************************************************************
4930 reads or writes a structure.
4931 ********************************************************************/
4933 BOOL samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u,
4934 prs_struct *ps, int depth)
4939 prs_debug(ps, depth, desc, "samr_io_q_open_user");
4945 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
4948 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
4950 if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid))
4956 /*******************************************************************
4957 reads or writes a structure.
4958 ********************************************************************/
4960 BOOL samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u,
4961 prs_struct *ps, int depth)
4966 prs_debug(ps, depth, desc, "samr_io_r_open_user");
4972 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
4975 if(!prs_ntstatus("status", ps, depth, &r_u->status))
4982 /*******************************************************************
4983 reads or writes a structure.
4984 ********************************************************************/
4986 void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
4989 uint32 acb_info, uint32 access_mask)
4991 DEBUG(5, ("samr_init_samr_q_create_user\n"));
4993 q_u->domain_pol = *pol;
4995 init_unistr2(&q_u->uni_name, name, UNI_FLAGS_NONE);
4996 init_uni_hdr(&q_u->hdr_name, &q_u->uni_name);
4998 q_u->acb_info = acb_info;
4999 q_u->access_mask = access_mask;
5002 /*******************************************************************
5003 reads or writes a structure.
5004 ********************************************************************/
5006 BOOL samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u,
5007 prs_struct *ps, int depth)
5012 prs_debug(ps, depth, desc, "samr_io_q_create_user");
5018 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
5021 if(!smb_io_unihdr("hdr_name", &q_u->hdr_name, ps, depth))
5023 if(!smb_io_unistr2("uni_name", &q_u->uni_name, q_u->hdr_name.buffer, ps, depth))
5028 if(!prs_uint32("acb_info ", ps, depth, &q_u->acb_info))
5030 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
5036 /*******************************************************************
5037 reads or writes a structure.
5038 ********************************************************************/
5040 BOOL samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u,
5041 prs_struct *ps, int depth)
5046 prs_debug(ps, depth, desc, "samr_io_r_create_user");
5052 if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
5055 if(!prs_uint32("access_granted", ps, depth, &r_u->access_granted))
5057 if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid))
5059 if(!prs_ntstatus("status", ps, depth, &r_u->status))
5065 /*******************************************************************
5066 inits a SAMR_Q_QUERY_USERINFO structure.
5067 ********************************************************************/
5069 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u,
5070 const POLICY_HND *hnd, uint16 switch_value)
5072 DEBUG(5, ("init_samr_q_query_userinfo\n"));
5075 q_u->switch_value = switch_value;
5078 /*******************************************************************
5079 reads or writes a structure.
5080 ********************************************************************/
5082 BOOL samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u,
5083 prs_struct *ps, int depth)
5088 prs_debug(ps, depth, desc, "samr_io_q_query_userinfo");
5094 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
5097 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) /* 0x0015 or 0x0011 */
5103 /*******************************************************************
5104 reads or writes a LOGON_HRS structure.
5105 ********************************************************************/
5107 static BOOL sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs,
5108 prs_struct *ps, int depth)
5113 prs_debug(ps, depth, desc, "sam_io_logon_hrs");
5119 if(!prs_uint32("maxlen", ps, depth, &hrs->max_len))
5122 if(!prs_uint32("offset", ps, depth, &hrs->offset))
5125 if(!prs_uint32("len ", ps, depth, &hrs->len))
5128 if (hrs->len > sizeof(hrs->hours)) {
5129 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs->len));
5130 hrs->len = sizeof(hrs->hours);
5133 if(!prs_uint8s(False, "hours", ps, depth, hrs->hours, hrs->len))
5139 /*******************************************************************
5140 inits a SAM_USER_INFO_18 structure.
5141 ********************************************************************/
5143 void init_sam_user_info18(SAM_USER_INFO_18 * usr,
5144 const uint8 lm_pwd[16], const uint8 nt_pwd[16])
5146 DEBUG(5, ("init_sam_user_info18\n"));
5148 usr->lm_pwd_active =
5149 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)) ? 1 : 0;
5150 usr->nt_pwd_active =
5151 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)) ? 1 : 0;
5154 /*******************************************************************
5155 reads or writes a structure.
5156 ********************************************************************/
5158 static BOOL sam_io_user_info18(const char *desc, SAM_USER_INFO_18 * u,
5159 prs_struct *ps, int depth)
5164 prs_debug(ps, depth, desc, "samr_io_r_user_info18");
5170 if(!prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd)))
5172 if(!prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd)))
5175 if(!prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active))
5177 if(!prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active))
5183 /*******************************************************************
5184 inits a SAM_USER_INFO_7 structure.
5185 ********************************************************************/
5187 void init_sam_user_info7(SAM_USER_INFO_7 * usr, const char *name)
5189 DEBUG(5, ("init_sam_user_info7\n"));
5191 init_unistr2(&usr->uni_name, name, UNI_FLAGS_NONE); /* unicode string for name */
5192 init_uni_hdr(&usr->hdr_name, &usr->uni_name); /* unicode header for name */
5196 /*******************************************************************
5197 reads or writes a structure.
5198 ********************************************************************/
5200 static BOOL sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr,
5201 prs_struct *ps, int depth)
5206 prs_debug(ps, depth, desc, "samr_io_r_user_info7");
5212 if(!smb_io_unihdr("unihdr", &usr->hdr_name, ps, depth))
5215 if(!smb_io_unistr2("unistr2", &usr->uni_name, True, ps, depth))
5221 /*******************************************************************
5222 inits a SAM_USER_INFO_9 structure.
5223 ********************************************************************/
5225 void init_sam_user_info9(SAM_USER_INFO_9 * usr, uint32 rid_group)
5227 DEBUG(5, ("init_sam_user_info9\n"));
5229 usr->rid_group = rid_group;
5232 /*******************************************************************
5233 reads or writes a structure.
5234 ********************************************************************/
5236 static BOOL sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr,
5237 prs_struct *ps, int depth)
5242 prs_debug(ps, depth, desc, "samr_io_r_user_info9");
5248 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
5254 /*******************************************************************
5255 inits a SAM_USER_INFO_16 structure.
5256 ********************************************************************/
5258 void init_sam_user_info16(SAM_USER_INFO_16 * usr, uint32 acb_info)
5260 DEBUG(5, ("init_sam_user_info16\n"));
5262 usr->acb_info = acb_info;
5265 /*******************************************************************
5266 reads or writes a structure.
5267 ********************************************************************/
5269 static BOOL sam_io_user_info16(const char *desc, SAM_USER_INFO_16 * usr,
5270 prs_struct *ps, int depth)
5275 prs_debug(ps, depth, desc, "samr_io_r_user_info16");
5281 if(!prs_uint32("acb_info", ps, depth, &usr->acb_info))
5287 /*******************************************************************
5288 inits a SAM_USER_INFO_17 structure.
5289 ********************************************************************/
5291 void init_sam_user_info17(SAM_USER_INFO_17 * usr,
5294 uint32 rid_user, uint32 rid_group, uint16 acct_ctrl)
5296 DEBUG(5, ("init_sam_user_info17\n"));
5298 memcpy(&usr->expiry, expiry, sizeof(usr->expiry)); /* expiry time or something? */
5299 ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */
5301 usr->padding_2 = 0; /* 0 - padding 4 bytes */
5303 usr->ptr_1 = 1; /* pointer */
5304 ZERO_STRUCT(usr->padding_3); /* 0 - padding 32 bytes */
5305 usr->padding_4 = 0; /* 0 - padding 4 bytes */
5307 usr->ptr_2 = 1; /* pointer */
5308 usr->padding_5 = 0; /* 0 - padding 4 bytes */
5310 usr->ptr_3 = 1; /* pointer */
5311 ZERO_STRUCT(usr->padding_6); /* 0 - padding 32 bytes */
5313 usr->rid_user = rid_user;
5314 usr->rid_group = rid_group;
5316 usr->acct_ctrl = acct_ctrl;
5317 usr->unknown_3 = 0x0000;
5319 usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */
5320 usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */
5322 ZERO_STRUCT(usr->padding_7); /* 0 - padding 16 bytes */
5323 usr->padding_8 = 0; /* 0 - padding 4 bytes */
5325 init_unistr2(&usr->uni_mach_acct, mach_acct, UNI_FLAGS_NONE); /* unicode string for machine account */
5326 init_uni_hdr(&usr->hdr_mach_acct, &usr->uni_mach_acct); /* unicode header for machine account */
5329 /*******************************************************************
5330 reads or writes a structure.
5331 ********************************************************************/
5333 static BOOL sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr,
5334 prs_struct *ps, int depth)
5339 prs_debug(ps, depth, desc, "samr_io_r_unknown_17");
5345 if(!prs_uint8s(False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)))
5348 if(!smb_io_time("time", &usr->expiry, ps, depth))
5351 if(!prs_uint8s(False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)))
5354 if(!smb_io_unihdr("unihdr", &usr->hdr_mach_acct, ps, depth))
5357 if(!prs_uint32("padding_2", ps, depth, &usr->padding_2))
5360 if(!prs_uint32("ptr_1 ", ps, depth, &usr->ptr_1))
5362 if(!prs_uint8s(False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)))
5365 if(!prs_uint32("padding_4", ps, depth, &usr->padding_4))
5368 if(!prs_uint32("ptr_2 ", ps, depth, &usr->ptr_2))
5370 if(!prs_uint32("padding_5", ps, depth, &usr->padding_5))
5373 if(!prs_uint32("ptr_3 ", ps, depth, &usr->ptr_3))
5375 if(!prs_uint8s(False, "padding_6", ps, depth, usr->padding_6,sizeof(usr->padding_6)))
5378 if(!prs_uint32("rid_user ", ps, depth, &usr->rid_user))
5380 if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
5382 if(!prs_uint16("acct_ctrl", ps, depth, &usr->acct_ctrl))
5384 if(!prs_uint16("unknown_3", ps, depth, &usr->unknown_3))
5386 if(!prs_uint16("unknown_4", ps, depth, &usr->unknown_4))
5388 if(!prs_uint16("unknown_5", ps, depth, &usr->unknown_5))
5391 if(!prs_uint8s(False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)))
5394 if(!prs_uint32("padding_8", ps, depth, &(usr->padding_8)))
5397 if(!smb_io_unistr2("unistr2", &usr->uni_mach_acct, True, ps, depth))
5403 if(!prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)))
5409 /*************************************************************************
5411 *************************************************************************/
5413 void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516], uint16 pw_len)
5415 DEBUG(10, ("init_sam_user_info24:\n"));
5416 memcpy(usr->pass, newpass, sizeof(usr->pass));
5417 usr->pw_len = pw_len;
5420 /*******************************************************************
5421 reads or writes a structure.
5422 ********************************************************************/
5424 static BOOL sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr,
5425 prs_struct *ps, int depth)
5430 prs_debug(ps, depth, desc, "sam_io_user_info24");
5436 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
5440 if (MARSHALLING(ps) && (usr->pw_len != 0)) {
5441 if (!prs_uint16("pw_len", ps, depth, &usr->pw_len))
5443 } else if (UNMARSHALLING(ps)) {
5444 if (!prs_uint16("pw_len", ps, depth, &usr->pw_len))
5451 /*******************************************************************
5452 reads or writes a structure.
5453 ********************************************************************/
5455 static BOOL sam_io_user_info26(const char *desc, SAM_USER_INFO_26 * usr,
5456 prs_struct *ps, int depth)
5461 prs_debug(ps, depth, desc, "sam_io_user_info26");
5467 if(!prs_uint8s(False, "password", ps, depth, usr->pass,
5471 if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
5478 /*************************************************************************
5479 init_sam_user_info23
5481 unknown_6 = 0x0000 04ec
5483 *************************************************************************/
5485 void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
5486 NTTIME * logoff_time, /* all zeros */
5487 NTTIME * kickoff_time, /* all zeros */
5488 NTTIME * pass_last_set_time, /* all zeros */
5489 NTTIME * pass_can_change_time, /* all zeros */
5490 NTTIME * pass_must_change_time, /* all zeros */
5501 uint32 user_rid, /* 0x0000 0000 */
5504 uint32 fields_present,
5507 uint16 bad_password_count,
5511 usr->logon_time = *logon_time; /* all zeros */
5512 usr->logoff_time = *logoff_time; /* all zeros */
5513 usr->kickoff_time = *kickoff_time; /* all zeros */
5514 usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
5515 usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
5516 usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
5518 ZERO_STRUCT(usr->nt_pwd);
5519 ZERO_STRUCT(usr->lm_pwd);
5521 usr->user_rid = user_rid; /* 0x0000 0000 */
5522 usr->group_rid = group_rid;
5523 usr->acb_info = acb_info;
5524 usr->fields_present = fields_present; /* 09f8 27fa */
5526 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
5527 usr->ptr_logon_hrs = hrs ? 1 : 0;
5529 if (nt_time_is_zero(pass_must_change_time)) {
5530 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
5532 usr->passmustchange=0;
5535 ZERO_STRUCT(usr->padding1);
5536 ZERO_STRUCT(usr->padding2);
5538 usr->bad_password_count = bad_password_count;
5539 usr->logon_count = logon_count;
5541 memcpy(usr->pass, newpass, sizeof(usr->pass));
5543 copy_unistr2(&usr->uni_user_name, user_name);
5544 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
5546 copy_unistr2(&usr->uni_full_name, full_name);
5547 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
5549 copy_unistr2(&usr->uni_home_dir, home_dir);
5550 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
5552 copy_unistr2(&usr->uni_dir_drive, dir_drive);
5553 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
5555 copy_unistr2(&usr->uni_logon_script, log_scr);
5556 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
5558 copy_unistr2(&usr->uni_profile_path, prof_path);
5559 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
5561 copy_unistr2(&usr->uni_acct_desc, desc);
5562 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
5564 copy_unistr2(&usr->uni_workstations, wkstas);
5565 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
5567 copy_unistr2(&usr->uni_unknown_str, unk_str);
5568 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
5570 copy_unistr2(&usr->uni_munged_dial, mung_dial);
5571 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
5574 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
5576 ZERO_STRUCT(usr->logon_hrs);
5580 /*************************************************************************
5581 init_sam_user_info23
5583 unknown_6 = 0x0000 04ec
5585 *************************************************************************/
5587 void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
5588 NTTIME * logoff_time, /* all zeros */
5589 NTTIME * kickoff_time, /* all zeros */
5590 NTTIME * pass_last_set_time, /* all zeros */
5591 NTTIME * pass_can_change_time, /* all zeros */
5592 NTTIME * pass_must_change_time, /* all zeros */
5593 char *user_name, /* NULL */
5595 char *home_dir, char *dir_drive, char *log_scr,
5596 char *prof_path, const char *desc, char *wkstas,
5597 char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */
5598 uint32 group_rid, uint32 acb_info,
5599 uint32 fields_present, uint16 logon_divs,
5600 LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count,
5603 DATA_BLOB blob = base64_decode_data_blob(mung_dial);
5605 usr->logon_time = *logon_time; /* all zeros */
5606 usr->logoff_time = *logoff_time; /* all zeros */
5607 usr->kickoff_time = *kickoff_time; /* all zeros */
5608 usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
5609 usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
5610 usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
5612 ZERO_STRUCT(usr->nt_pwd);
5613 ZERO_STRUCT(usr->lm_pwd);
5615 usr->user_rid = user_rid; /* 0x0000 0000 */
5616 usr->group_rid = group_rid;
5617 usr->acb_info = acb_info;
5618 usr->fields_present = fields_present; /* 09f8 27fa */
5620 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
5621 usr->ptr_logon_hrs = hrs ? 1 : 0;
5623 if (nt_time_is_zero(pass_must_change_time)) {
5624 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
5626 usr->passmustchange=0;
5629 ZERO_STRUCT(usr->padding1);
5630 ZERO_STRUCT(usr->padding2);
5632 usr->bad_password_count = bad_password_count;
5633 usr->logon_count = logon_count;
5635 memcpy(usr->pass, newpass, sizeof(usr->pass));
5637 init_unistr2(&usr->uni_user_name, user_name, UNI_FLAGS_NONE);
5638 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
5640 init_unistr2(&usr->uni_full_name, full_name, UNI_FLAGS_NONE);
5641 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
5643 init_unistr2(&usr->uni_home_dir, home_dir, UNI_FLAGS_NONE);
5644 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
5646 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_FLAGS_NONE);
5647 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
5649 init_unistr2(&usr->uni_logon_script, log_scr, UNI_FLAGS_NONE);
5650 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
5652 init_unistr2(&usr->uni_profile_path, prof_path, UNI_FLAGS_NONE);
5653 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
5655 init_unistr2(&usr->uni_acct_desc, desc, UNI_FLAGS_NONE);
5656 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
5658 init_unistr2(&usr->uni_workstations, wkstas, UNI_FLAGS_NONE);
5659 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
5661 init_unistr2(&usr->uni_unknown_str, unk_str, UNI_FLAGS_NONE);
5662 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
5664 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
5665 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
5667 data_blob_free(&blob);
5670 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
5672 ZERO_STRUCT(usr->logon_hrs);
5676 /*******************************************************************
5677 reads or writes a structure.
5678 ********************************************************************/
5680 static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr,
5681 prs_struct *ps, int depth)
5686 prs_debug(ps, depth, desc, "sam_io_user_info23");
5692 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
5694 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
5696 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
5698 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
5700 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
5702 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
5705 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
5707 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
5709 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
5711 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
5713 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
5715 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
5717 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
5719 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
5721 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
5723 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
5726 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
5728 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
5731 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
5733 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
5735 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
5738 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
5740 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
5744 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
5747 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
5749 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
5752 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
5754 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
5756 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
5760 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
5763 /* here begins pointed-to data */
5765 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
5768 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
5771 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
5774 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
5777 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
5780 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
5783 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
5786 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
5789 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
5792 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
5795 /* ok, this is only guess-work (as usual) */
5796 if (usr->ptr_logon_hrs) {
5797 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
5804 /*******************************************************************
5805 reads or writes a structure.
5806 NB. This structure is *definately* incorrect. It's my best guess
5807 currently for W2K SP2. The password field is encrypted in a different
5808 way than normal... And there are definately other problems. JRA.
5809 ********************************************************************/
5811 static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth)
5816 prs_debug(ps, depth, desc, "sam_io_user_info25");
5822 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
5824 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
5826 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
5828 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
5830 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
5832 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
5835 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
5837 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
5839 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
5841 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
5843 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
5845 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
5847 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
5849 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
5851 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
5853 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
5856 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
5858 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
5861 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
5863 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
5865 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
5868 if(!prs_uint32s(False, "unknown_6 ", ps, depth, usr->unknown_6, 6))
5871 if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
5874 /* here begins pointed-to data */
5876 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
5879 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
5882 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
5885 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
5888 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
5891 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
5894 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
5897 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
5900 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
5903 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
5906 #if 0 /* JRA - unknown... */
5907 /* ok, this is only guess-work (as usual) */
5908 if (usr->ptr_logon_hrs) {
5909 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
5918 /*************************************************************************
5919 init_sam_user_info21W
5921 unknown_6 = 0x0000 04ec
5923 *************************************************************************/
5925 void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
5926 NTTIME * logon_time,
5927 NTTIME * logoff_time,
5928 NTTIME * kickoff_time,
5929 NTTIME * pass_last_set_time,
5930 NTTIME * pass_can_change_time,
5931 NTTIME * pass_must_change_time,
5947 uint32 fields_present,
5950 uint16 bad_password_count,
5953 usr->logon_time = *logon_time;
5954 usr->logoff_time = *logoff_time;
5955 usr->kickoff_time = *kickoff_time;
5956 usr->pass_last_set_time = *pass_last_set_time;
5957 usr->pass_can_change_time = *pass_can_change_time;
5958 usr->pass_must_change_time = *pass_must_change_time;
5960 memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd));
5961 memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd));
5963 usr->user_rid = user_rid;
5964 usr->group_rid = group_rid;
5965 usr->acb_info = acb_info;
5966 usr->fields_present = fields_present; /* 0x00ff ffff */
5968 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
5969 usr->ptr_logon_hrs = hrs ? 1 : 0;
5970 usr->bad_password_count = bad_password_count;
5971 usr->logon_count = logon_count;
5973 if (nt_time_is_zero(pass_must_change_time)) {
5974 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
5976 usr->passmustchange=0;
5979 ZERO_STRUCT(usr->padding1);
5980 ZERO_STRUCT(usr->padding2);
5982 copy_unistr2(&usr->uni_user_name, user_name);
5983 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
5985 copy_unistr2(&usr->uni_full_name, full_name);
5986 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
5988 copy_unistr2(&usr->uni_home_dir, home_dir);
5989 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
5991 copy_unistr2(&usr->uni_dir_drive, dir_drive);
5992 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
5994 copy_unistr2(&usr->uni_logon_script, log_scr);
5995 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
5997 copy_unistr2(&usr->uni_profile_path, prof_path);
5998 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
6000 copy_unistr2(&usr->uni_acct_desc, desc);
6001 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
6003 copy_unistr2(&usr->uni_workstations, wkstas);
6004 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
6006 copy_unistr2(&usr->uni_unknown_str, unk_str);
6007 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
6009 copy_unistr2(&usr->uni_munged_dial, mung_dial);
6010 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6013 memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
6015 ZERO_STRUCT(usr->logon_hrs);
6019 /*************************************************************************
6020 init_sam_user_info21
6022 unknown_6 = 0x0000 04ec
6024 *************************************************************************/
6026 NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID *domain_sid)
6028 NTTIME logon_time, logoff_time, kickoff_time,
6029 pass_last_set_time, pass_can_change_time,
6030 pass_must_change_time;
6032 const char* user_name = pdb_get_username(pw);
6033 const char* full_name = pdb_get_fullname(pw);
6034 const char* home_dir = pdb_get_homedir(pw);
6035 const char* dir_drive = pdb_get_dir_drive(pw);
6036 const char* logon_script = pdb_get_logon_script(pw);
6037 const char* profile_path = pdb_get_profile_path(pw);
6038 const char* description = pdb_get_acct_desc(pw);
6039 const char* workstations = pdb_get_workstations(pw);
6040 const char* munged_dial = pdb_get_munged_dial(pw);
6041 DATA_BLOB munged_dial_blob;
6044 const DOM_SID *user_sid;
6047 const DOM_SID *group_sid;
6050 munged_dial_blob = base64_decode_data_blob(munged_dial);
6052 munged_dial_blob = data_blob(NULL, 0);
6055 /* Create NTTIME structs */
6056 unix_to_nt_time (&logon_time, pdb_get_logon_time(pw));
6057 unix_to_nt_time (&logoff_time, pdb_get_logoff_time(pw));
6058 unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(pw));
6059 unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(pw));
6060 unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(pw));
6061 unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(pw));
6063 /* structure assignment */
6064 usr->logon_time = logon_time;
6065 usr->logoff_time = logoff_time;
6066 usr->kickoff_time = kickoff_time;
6067 usr->pass_last_set_time = pass_last_set_time;
6068 usr->pass_can_change_time = pass_can_change_time;
6069 usr->pass_must_change_time = pass_must_change_time;
6071 ZERO_STRUCT(usr->nt_pwd);
6072 ZERO_STRUCT(usr->lm_pwd);
6074 user_sid = pdb_get_user_sid(pw);
6076 if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) {
6077 fstring user_sid_string;
6078 fstring domain_sid_string;
6079 DEBUG(0, ("init_sam_user_info_21A: User %s has SID %s, \nwhich conflicts with "
6080 "the domain sid %s. Failing operation.\n",
6082 sid_to_string(user_sid_string, user_sid),
6083 sid_to_string(domain_sid_string, domain_sid)));
6084 data_blob_free(&munged_dial_blob);
6085 return NT_STATUS_UNSUCCESSFUL;
6088 group_sid = pdb_get_group_sid(pw);
6090 if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) {
6091 fstring group_sid_string;
6092 fstring domain_sid_string;
6093 DEBUG(0, ("init_sam_user_info_21A: User %s has Primary Group SID %s, \n"
6094 "which conflicts with the domain sid %s. Failing operation.\n",
6096 sid_to_string(group_sid_string, group_sid),
6097 sid_to_string(domain_sid_string, domain_sid)));
6098 data_blob_free(&munged_dial_blob);
6099 return NT_STATUS_UNSUCCESSFUL;
6102 usr->user_rid = user_rid;
6103 usr->group_rid = group_rid;
6104 usr->acb_info = pdb_get_acct_ctrl(pw);
6107 Look at a user on a real NT4 PDC with usrmgr, press
6108 'ok'. Then you will see that fields_present is set to
6109 0x08f827fa. Look at the user immediately after that again,
6110 and you will see that 0x00fffff is returned. This solves
6111 the problem that you get access denied after having looked
6115 usr->fields_present = pdb_build_fields_present(pw);
6117 usr->logon_divs = pdb_get_logon_divs(pw);
6118 usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0;
6119 usr->bad_password_count = pdb_get_bad_password_count(pw);
6120 usr->logon_count = pdb_get_logon_count(pw);
6122 if (pdb_get_pass_must_change_time(pw) == 0) {
6123 usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
6125 usr->passmustchange=0;
6128 ZERO_STRUCT(usr->padding1);
6129 ZERO_STRUCT(usr->padding2);
6131 init_unistr2(&usr->uni_user_name, user_name, UNI_STR_TERMINATE);
6132 init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
6134 init_unistr2(&usr->uni_full_name, full_name, UNI_STR_TERMINATE);
6135 init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
6137 init_unistr2(&usr->uni_home_dir, home_dir, UNI_STR_TERMINATE);
6138 init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
6140 init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_STR_TERMINATE);
6141 init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
6143 init_unistr2(&usr->uni_logon_script, logon_script, UNI_STR_TERMINATE);
6144 init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
6146 init_unistr2(&usr->uni_profile_path, profile_path, UNI_STR_TERMINATE);
6147 init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
6149 init_unistr2(&usr->uni_acct_desc, description, UNI_STR_TERMINATE);
6150 init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
6152 init_unistr2(&usr->uni_workstations, workstations, UNI_STR_TERMINATE);
6153 init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
6155 init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE);
6156 init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str);
6158 init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob);
6159 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6160 data_blob_free(&munged_dial_blob);
6162 if (pdb_get_hours(pw)) {
6163 usr->logon_hrs.max_len = 1260;
6164 usr->logon_hrs.offset = 0;
6165 usr->logon_hrs.len = pdb_get_hours_len(pw);
6166 memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN);
6168 usr->logon_hrs.max_len = 1260;
6169 usr->logon_hrs.offset = 0;
6170 usr->logon_hrs.len = 0;
6171 memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs));
6174 return NT_STATUS_OK;
6177 /*******************************************************************
6178 reads or writes a structure.
6179 ********************************************************************/
6181 static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr,
6182 prs_struct *ps, int depth)
6187 prs_debug(ps, depth, desc, "sam_io_user_info21");
6193 if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
6195 if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
6197 if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps,depth))
6199 if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
6201 if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps,depth))
6203 if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
6206 if(!smb_io_unihdr("hdr_user_name ", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
6208 if(!smb_io_unihdr("hdr_full_name ", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
6210 if(!smb_io_unihdr("hdr_home_dir ", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
6212 if(!smb_io_unihdr("hdr_dir_drive ", &usr->hdr_dir_drive, ps, depth)) /* home directory drive */
6214 if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
6216 if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
6218 if(!smb_io_unihdr("hdr_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
6220 if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
6222 if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */
6224 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
6227 if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
6229 if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
6232 if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
6234 if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
6236 if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
6239 if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
6241 if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
6245 if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
6248 if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
6250 if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
6253 if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
6255 if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
6257 if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
6260 /* here begins pointed-to data */
6262 if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
6264 if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
6266 if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
6268 if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
6270 if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
6272 if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
6274 if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
6276 if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
6278 if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */
6280 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */
6283 /* ok, this is only guess-work (as usual) */
6284 if (usr->ptr_logon_hrs) {
6285 if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
6292 void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw)
6294 const char *munged_dial = pdb_get_munged_dial(pw);
6295 DATA_BLOB blob = base64_decode_data_blob(munged_dial);
6297 init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
6298 init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
6299 data_blob_free(&blob);
6302 /*******************************************************************
6303 reads or writes a structure.
6304 ********************************************************************/
6306 static BOOL sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr,
6307 prs_struct *ps, int depth)
6312 prs_debug(ps, depth, desc, "sam_io_user_info20");
6318 if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
6321 if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */
6327 /*******************************************************************
6328 inits a SAM_USERINFO_CTR structure.
6329 ********************************************************************/
6331 NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr,
6332 uint16 switch_value,
6333 SAM_USER_INFO_21 * usr)
6335 DEBUG(5, ("make_samr_userinfo_ctr_usr21\n"));
6337 ctr->switch_value = switch_value;
6338 ctr->info.id = NULL;
6340 switch (switch_value) {
6342 ctr->info.id16 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_16);
6343 if (ctr->info.id16 == NULL)
6344 return NT_STATUS_NO_MEMORY;
6346 init_sam_user_info16(ctr->info.id16, usr->acb_info);
6349 /* whoops - got this wrong. i think. or don't understand what's happening. */
6353 info = (void *)&id11;
6355 expire.low = 0xffffffff;
6356 expire.high = 0x7fffffff;
6358 ctr->info.id = TALLOC_ZERO_P(ctx,SAM_USER_INFO_17);
6359 init_sam_user_info11(ctr->info.id17, &expire,
6360 "BROOKFIELDS$", /* name */
6361 0x03ef, /* user rid */
6362 0x201, /* group rid */
6363 0x0080); /* acb info */
6369 ctr->info.id18 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_18);
6370 if (ctr->info.id18 == NULL)
6371 return NT_STATUS_NO_MEMORY;
6373 init_sam_user_info18(ctr->info.id18, usr->lm_pwd, usr->nt_pwd);
6377 SAM_USER_INFO_21 *cusr;
6378 cusr = TALLOC_ZERO_P(ctx,SAM_USER_INFO_21);
6379 ctr->info.id21 = cusr;
6380 if (ctr->info.id21 == NULL)
6381 return NT_STATUS_NO_MEMORY;
6382 memcpy(cusr, usr, sizeof(*usr));
6383 memset(cusr->lm_pwd, 0, sizeof(cusr->lm_pwd));
6384 memset(cusr->nt_pwd, 0, sizeof(cusr->nt_pwd));
6388 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
6389 return NT_STATUS_INVALID_INFO_CLASS;
6392 return NT_STATUS_OK;
6395 /*******************************************************************
6396 inits a SAM_USERINFO_CTR structure.
6397 ********************************************************************/
6399 static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key,
6400 uint16 switch_value, void *info)
6402 DEBUG(5, ("init_samr_userinfo_ctr\n"));
6404 ctr->switch_value = switch_value;
6405 ctr->info.id = info;
6407 switch (switch_value) {
6409 SamOEMhashBlob(ctr->info.id24->pass, 516, sess_key);
6410 dump_data(100, (char *)sess_key->data, sess_key->length);
6411 dump_data(100, (char *)ctr->info.id24->pass, 516);
6414 SamOEMhashBlob(ctr->info.id23->pass, 516, sess_key);
6415 dump_data(100, (char *)sess_key->data, sess_key->length);
6416 dump_data(100, (char *)ctr->info.id23->pass, 516);
6421 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value));
6425 /*******************************************************************
6426 reads or writes a structure.
6427 ********************************************************************/
6429 static BOOL samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr,
6430 prs_struct *ps, int depth)
6433 SAM_USERINFO_CTR *ctr;
6435 prs_debug(ps, depth, desc, "samr_io_userinfo_ctr");
6438 if (UNMARSHALLING(ps)) {
6439 ctr = PRS_ALLOC_MEM(ps,SAM_USERINFO_CTR,1);
6447 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
6449 if(!prs_uint16("switch_value", ps, depth, &ctr->switch_value))
6456 switch (ctr->switch_value) {
6458 if (UNMARSHALLING(ps))
6459 ctr->info.id7 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_7,1);
6460 if (ctr->info.id7 == NULL) {
6461 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6464 ret = sam_io_user_info7("", ctr->info.id7, ps, depth);
6467 if (UNMARSHALLING(ps))
6468 ctr->info.id9 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_9,1);
6469 if (ctr->info.id9 == NULL) {
6470 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6473 ret = sam_io_user_info9("", ctr->info.id9, ps, depth);
6476 if (UNMARSHALLING(ps))
6477 ctr->info.id16 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_16,1);
6478 if (ctr->info.id16 == NULL) {
6479 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6482 ret = sam_io_user_info16("", ctr->info.id16, ps, depth);
6485 if (UNMARSHALLING(ps))
6486 ctr->info.id17 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_17,1);
6488 if (ctr->info.id17 == NULL) {
6489 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6492 ret = sam_io_user_info17("", ctr->info.id17, ps, depth);
6495 if (UNMARSHALLING(ps))
6496 ctr->info.id18 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_18,1);
6498 if (ctr->info.id18 == NULL) {
6499 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6502 ret = sam_io_user_info18("", ctr->info.id18, ps, depth);
6505 if (UNMARSHALLING(ps))
6506 ctr->info.id20 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_20,1);
6508 if (ctr->info.id20 == NULL) {
6509 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6512 ret = sam_io_user_info20("", ctr->info.id20, ps, depth);
6515 if (UNMARSHALLING(ps))
6516 ctr->info.id21 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_21,1);
6518 if (ctr->info.id21 == NULL) {
6519 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6522 ret = sam_io_user_info21("", ctr->info.id21, ps, depth);
6525 if (UNMARSHALLING(ps))
6526 ctr->info.id23 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_23,1);
6528 if (ctr->info.id23 == NULL) {
6529 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6532 ret = sam_io_user_info23("", ctr->info.id23, ps, depth);
6535 if (UNMARSHALLING(ps))
6536 ctr->info.id24 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_24,1);
6538 if (ctr->info.id24 == NULL) {
6539 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6542 ret = sam_io_user_info24("", ctr->info.id24, ps, depth);
6545 if (UNMARSHALLING(ps))
6546 ctr->info.id25 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_25,1);
6548 if (ctr->info.id25 == NULL) {
6549 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6552 ret = sam_io_user_info25("", ctr->info.id25, ps, depth);
6555 if (UNMARSHALLING(ps))
6556 ctr->info.id26 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_26,1);
6558 if (ctr->info.id26 == NULL) {
6559 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6562 ret = sam_io_user_info26("", ctr->info.id26, ps, depth);
6565 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value));
6573 /*******************************************************************
6574 inits a SAMR_R_QUERY_USERINFO structure.
6575 ********************************************************************/
6577 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u,
6578 SAM_USERINFO_CTR * ctr, NTSTATUS status)
6580 DEBUG(5, ("init_samr_r_query_userinfo\n"));
6585 if (NT_STATUS_IS_OK(status)) {
6590 r_u->status = status; /* return status */
6593 /*******************************************************************
6594 reads or writes a structure.
6595 ********************************************************************/
6597 BOOL samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u,
6598 prs_struct *ps, int depth)
6603 prs_debug(ps, depth, desc, "samr_io_r_query_userinfo");
6609 if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
6612 if (r_u->ptr != 0) {
6613 if(!samr_io_userinfo_ctr("ctr", &r_u->ctr, ps, depth))
6619 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6625 /*******************************************************************
6626 inits a SAMR_Q_SET_USERINFO structure.
6627 ********************************************************************/
6629 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u,
6630 const POLICY_HND *hnd, DATA_BLOB *sess_key,
6631 uint16 switch_value, void *info)
6633 DEBUG(5, ("init_samr_q_set_userinfo\n"));
6636 q_u->switch_value = switch_value;
6637 init_samr_userinfo_ctr(q_u->ctr, sess_key, switch_value, info);
6640 /*******************************************************************
6641 reads or writes a structure.
6642 ********************************************************************/
6644 BOOL samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u,
6645 prs_struct *ps, int depth)
6650 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo");
6656 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
6658 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
6660 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
6666 /*******************************************************************
6667 inits a SAMR_R_SET_USERINFO structure.
6668 ********************************************************************/
6670 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status)
6672 DEBUG(5, ("init_samr_r_set_userinfo\n"));
6674 r_u->status = status; /* return status */
6677 /*******************************************************************
6678 reads or writes a structure.
6679 ********************************************************************/
6681 BOOL samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u,
6682 prs_struct *ps, int depth)
6687 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo");
6693 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6699 /*******************************************************************
6700 inits a SAMR_Q_SET_USERINFO2 structure.
6701 ********************************************************************/
6703 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
6704 const POLICY_HND *hnd, DATA_BLOB *sess_key,
6705 uint16 switch_value, SAM_USERINFO_CTR * ctr)
6707 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
6710 q_u->switch_value = switch_value;
6713 if (q_u->ctr != NULL)
6714 q_u->ctr->switch_value = switch_value;
6716 switch (switch_value) {
6718 SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key);
6719 SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key);
6720 dump_data(100, (char *)sess_key->data, sess_key->length);
6721 dump_data(100, (char *)ctr->info.id18->lm_pwd, 16);
6722 dump_data(100, (char *)ctr->info.id18->nt_pwd, 16);
6727 /*******************************************************************
6728 reads or writes a structure.
6729 ********************************************************************/
6731 BOOL samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u,
6732 prs_struct *ps, int depth)
6737 prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2");
6743 if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
6746 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
6748 if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
6754 /*******************************************************************
6755 inits a SAMR_R_SET_USERINFO2 structure.
6756 ********************************************************************/
6758 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status)
6760 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
6762 r_u->status = status; /* return status */
6765 /*******************************************************************
6766 reads or writes a structure.
6767 ********************************************************************/
6769 BOOL samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u,
6770 prs_struct *ps, int depth)
6775 prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2");
6781 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6787 /*******************************************************************
6788 inits a SAMR_Q_CONNECT structure.
6789 ********************************************************************/
6791 void init_samr_q_connect(SAMR_Q_CONNECT * q_u,
6792 char *srv_name, uint32 access_mask)
6794 DEBUG(5, ("init_samr_q_connect\n"));
6796 /* make PDC server name \\server */
6797 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
6798 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
6800 /* example values: 0x0000 0002 */
6801 q_u->access_mask = access_mask;
6804 /*******************************************************************
6805 reads or writes a structure.
6806 ********************************************************************/
6808 BOOL samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u,
6809 prs_struct *ps, int depth)
6814 prs_debug(ps, depth, desc, "samr_io_q_connect");
6820 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
6822 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
6827 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
6833 /*******************************************************************
6834 reads or writes a structure.
6835 ********************************************************************/
6837 BOOL samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u,
6838 prs_struct *ps, int depth)
6843 prs_debug(ps, depth, desc, "samr_io_r_connect");
6849 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
6852 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6858 /*******************************************************************
6859 inits a SAMR_Q_CONNECT4 structure.
6860 ********************************************************************/
6862 void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u,
6863 char *srv_name, uint32 access_mask)
6865 DEBUG(5, ("init_samr_q_connect4\n"));
6867 /* make PDC server name \\server */
6868 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
6869 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
6871 /* Only value we've seen, possibly an address type ? */
6874 /* example values: 0x0000 0002 */
6875 q_u->access_mask = access_mask;
6878 /*******************************************************************
6879 reads or writes a structure.
6880 ********************************************************************/
6882 BOOL samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u,
6883 prs_struct *ps, int depth)
6888 prs_debug(ps, depth, desc, "samr_io_q_connect4");
6894 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
6896 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
6901 if(!prs_uint32("unk_0", ps, depth, &q_u->unk_0))
6903 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
6909 /*******************************************************************
6910 reads or writes a structure.
6911 ********************************************************************/
6913 BOOL samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u,
6914 prs_struct *ps, int depth)
6919 prs_debug(ps, depth, desc, "samr_io_r_connect4");
6925 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
6928 if(!prs_ntstatus("status", ps, depth, &r_u->status))
6934 /*******************************************************************
6935 inits a SAMR_Q_CONNECT5 structure.
6936 ********************************************************************/
6938 void init_samr_q_connect5(SAMR_Q_CONNECT5 * q_u,
6939 char *srv_name, uint32 access_mask)
6941 DEBUG(5, ("init_samr_q_connect5\n"));
6943 /* make PDC server name \\server */
6944 q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
6945 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
6947 /* example values: 0x0000 0002 */
6948 q_u->access_mask = access_mask;
6951 q_u->info1_unk1 = 3;
6952 q_u->info1_unk2 = 0;
6955 /*******************************************************************
6956 inits a SAMR_R_CONNECT5 structure.
6957 ********************************************************************/
6959 void init_samr_r_connect5(SAMR_R_CONNECT5 * r_u, POLICY_HND *pol, NTSTATUS status)
6961 DEBUG(5, ("init_samr_q_connect5\n"));
6964 r_u->info1_unk1 = 3;
6965 r_u->info1_unk2 = 0;
6967 r_u->connect_pol = *pol;
6968 r_u->status = status;
6971 /*******************************************************************
6972 reads or writes a structure.
6973 ********************************************************************/
6975 BOOL samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u,
6976 prs_struct *ps, int depth)
6981 prs_debug(ps, depth, desc, "samr_io_q_connect5");
6987 if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
6989 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
6994 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
6997 if(!prs_uint32("level", ps, depth, &q_u->level))
6999 if(!prs_uint32("level", ps, depth, &q_u->level))
7002 if(!prs_uint32("info1_unk1", ps, depth, &q_u->info1_unk1))
7004 if(!prs_uint32("info1_unk2", ps, depth, &q_u->info1_unk2))
7010 /*******************************************************************
7011 reads or writes a structure.
7012 ********************************************************************/
7014 BOOL samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u,
7015 prs_struct *ps, int depth)
7020 prs_debug(ps, depth, desc, "samr_io_r_connect5");
7026 if(!prs_uint32("level", ps, depth, &r_u->level))
7028 if(!prs_uint32("level", ps, depth, &r_u->level))
7030 if(!prs_uint32("info1_unk1", ps, depth, &r_u->info1_unk1))
7032 if(!prs_uint32("info1_unk2", ps, depth, &r_u->info1_unk2))
7035 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7038 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7044 /*******************************************************************
7045 inits a SAMR_Q_CONNECT_ANON structure.
7046 ********************************************************************/
7048 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u)
7050 DEBUG(5, ("init_samr_q_connect_anon\n"));
7053 q_u->unknown_0 = 0x5c; /* server name (?!!) */
7054 q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
7057 /*******************************************************************
7058 reads or writes a structure.
7059 ********************************************************************/
7061 BOOL samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u,
7062 prs_struct *ps, int depth)
7067 prs_debug(ps, depth, desc, "samr_io_q_connect_anon");
7073 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
7076 if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0))
7081 if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
7087 /*******************************************************************
7088 reads or writes a structure.
7089 ********************************************************************/
7091 BOOL samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u,
7092 prs_struct *ps, int depth)
7097 prs_debug(ps, depth, desc, "samr_io_r_connect_anon");
7103 if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
7106 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7112 /*******************************************************************
7113 inits a SAMR_Q_GET_DOM_PWINFO structure.
7114 ********************************************************************/
7116 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
7119 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
7122 init_unistr2(&q_u->uni_srv_name, srv_name, UNI_FLAGS_NONE);
7123 init_uni_hdr(&q_u->hdr_srv_name, &q_u->uni_srv_name);
7126 /*******************************************************************
7127 reads or writes a structure.
7128 ********************************************************************/
7130 BOOL samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u,
7131 prs_struct *ps, int depth)
7136 prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo");
7142 if(!prs_uint32("ptr", ps, depth, &q_u->ptr))
7144 if (q_u->ptr != 0) {
7145 if(!smb_io_unihdr("", &q_u->hdr_srv_name, ps, depth))
7147 if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth))
7154 /*******************************************************************
7155 reads or writes a structure.
7156 ********************************************************************/
7158 BOOL samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u,
7159 prs_struct *ps, int depth)
7164 prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo");
7170 if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
7174 if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
7177 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7183 /*******************************************************************
7184 make a SAMR_ENC_PASSWD structure.
7185 ********************************************************************/
7187 void init_enc_passwd(SAMR_ENC_PASSWD * pwd, const char pass[512])
7195 memcpy(pwd->pass, pass, sizeof(pwd->pass));
7199 /*******************************************************************
7200 reads or writes a SAMR_ENC_PASSWD structure.
7201 ********************************************************************/
7203 BOOL samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd,
7204 prs_struct *ps, int depth)
7209 prs_debug(ps, depth, desc, "samr_io_enc_passwd");
7215 if(!prs_uint32("ptr", ps, depth, &pwd->ptr))
7218 if (pwd->ptr != 0) {
7219 if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)))
7226 /*******************************************************************
7227 inits a SAMR_ENC_HASH structure.
7228 ********************************************************************/
7230 void init_enc_hash(SAMR_ENC_HASH * hsh, const uchar hash[16])
7238 memcpy(hsh->hash, hash, sizeof(hsh->hash));
7242 /*******************************************************************
7243 reads or writes a SAMR_ENC_HASH structure.
7244 ********************************************************************/
7246 BOOL samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh,
7247 prs_struct *ps, int depth)
7252 prs_debug(ps, depth, desc, "samr_io_enc_hash");
7258 if(!prs_uint32("ptr ", ps, depth, &hsh->ptr))
7260 if (hsh->ptr != 0) {
7261 if(!prs_uint8s(False, "hash", ps, depth, hsh->hash,sizeof(hsh->hash)))
7268 /*******************************************************************
7269 inits a SAMR_Q_CHGPASSWD_USER structure.
7270 ********************************************************************/
7272 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u,
7273 const char *dest_host, const char *user_name,
7274 const uchar nt_newpass[516],
7275 const uchar nt_oldhash[16],
7276 const uchar lm_newpass[516],
7277 const uchar lm_oldhash[16])
7279 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
7282 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
7283 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
7285 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
7286 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
7288 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
7289 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
7291 q_u->unknown = 0x01;
7293 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
7294 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
7297 /*******************************************************************
7298 reads or writes a structure.
7299 ********************************************************************/
7301 BOOL samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u,
7302 prs_struct *ps, int depth)
7307 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user");
7313 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
7316 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
7318 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
7323 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
7325 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
7328 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
7330 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
7333 if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
7336 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
7338 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
7344 /*******************************************************************
7345 inits a SAMR_R_CHGPASSWD_USER structure.
7346 ********************************************************************/
7348 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status)
7350 DEBUG(5, ("init_samr_r_chgpasswd_user\n"));
7352 r_u->status = status;
7355 /*******************************************************************
7356 reads or writes a structure.
7357 ********************************************************************/
7359 BOOL samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u,
7360 prs_struct *ps, int depth)
7365 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user");
7371 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7377 /*******************************************************************
7378 inits a SAMR_Q_CHGPASSWD3 structure.
7379 ********************************************************************/
7381 void init_samr_q_chgpasswd_user3(SAMR_Q_CHGPASSWD_USER3 * q_u,
7382 const char *dest_host, const char *user_name,
7383 const uchar nt_newpass[516],
7384 const uchar nt_oldhash[16],
7385 const uchar lm_newpass[516],
7386 const uchar lm_oldhash[16])
7388 DEBUG(5, ("init_samr_q_chgpasswd_user3\n"));
7391 init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
7392 init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
7394 init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
7395 init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
7397 init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
7398 init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
7400 q_u->lm_change = 0x01;
7402 init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
7403 init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
7405 init_enc_passwd(&q_u->password3, NULL);
7408 /*******************************************************************
7409 reads or writes a structure.
7410 ********************************************************************/
7412 BOOL samr_io_q_chgpasswd_user3(const char *desc, SAMR_Q_CHGPASSWD_USER3 * q_u,
7413 prs_struct *ps, int depth)
7418 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user3");
7424 if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
7427 if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
7429 if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
7434 if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
7436 if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
7439 if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
7441 if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
7444 if(!prs_uint32("lm_change", ps, depth, &q_u->lm_change))
7447 if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
7449 if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
7452 if(!samr_io_enc_passwd("password3", &q_u->password3, ps, depth))
7458 /*******************************************************************
7459 inits a SAMR_R_CHGPASSWD_USER3 structure.
7460 ********************************************************************/
7462 void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3 *r_u, NTSTATUS status,
7463 SAMR_CHANGE_REJECT *reject, SAM_UNK_INFO_1 *info)
7465 DEBUG(5, ("init_samr_r_chgpasswd_user3\n"));
7467 r_u->status = status;
7471 r_u->ptr_reject = 0;
7477 if (reject && (reject->reject_reason != Undefined)) {
7478 r_u->reject = reject;
7479 r_u->ptr_reject = 1;
7483 /*******************************************************************
7484 Reads or writes an SAMR_CHANGE_REJECT structure.
7485 ********************************************************************/
7487 BOOL samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_struct *ps, int depth)
7492 prs_debug(ps, depth, desc, "samr_io_change_reject");
7498 if(UNMARSHALLING(ps))
7499 ZERO_STRUCTP(reject);
7501 if (!prs_uint32("reject_reason", ps, depth, &reject->reject_reason))
7504 if (!prs_uint32("unknown1", ps, depth, &reject->unknown1))
7507 if (!prs_uint32("unknown2", ps, depth, &reject->unknown2))
7513 /*******************************************************************
7514 reads or writes a structure.
7515 ********************************************************************/
7517 BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u,
7518 prs_struct *ps, int depth)
7523 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user3");
7529 if (!prs_uint32("ptr_info", ps, depth, &r_u->ptr_info))
7532 if (r_u->ptr_info && r_u->info != NULL) {
7533 /* SAM_UNK_INFO_1 */
7534 if (!sam_io_unk_info1("info", r_u->info, ps, depth))
7538 if (!prs_uint32("ptr_reject", ps, depth, &r_u->ptr_reject))
7541 if (r_u->ptr_reject && r_u->reject != NULL) {
7542 /* SAMR_CHANGE_REJECT */
7543 if (!samr_io_change_reject("reject", r_u->reject, ps, depth))
7547 if (!prs_ntstatus("status", ps, depth, &r_u->status))
7553 /*******************************************************************
7554 reads or writes a structure.
7555 ********************************************************************/
7557 void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
7558 POLICY_HND *domain_pol, uint16 switch_value)
7560 DEBUG(5, ("init_samr_q_query_domain_info2\n"));
7562 q_u->domain_pol = *domain_pol;
7563 q_u->switch_value = switch_value;
7566 /*******************************************************************
7567 reads or writes a structure.
7568 ********************************************************************/
7570 BOOL samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
7571 prs_struct *ps, int depth)
7576 prs_debug(ps, depth, desc, "samr_io_q_query_domain_info2");
7582 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
7585 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
7591 /*******************************************************************
7592 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7593 ********************************************************************/
7595 void init_samr_r_samr_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
7596 uint16 switch_value, SAM_UNK_CTR * ctr,
7599 DEBUG(5, ("init_samr_r_samr_query_domain_info2\n"));
7602 r_u->switch_value = 0;
7603 r_u->status = status; /* return status */
7605 if (NT_STATUS_IS_OK(status)) {
7606 r_u->switch_value = switch_value;
7612 /*******************************************************************
7613 reads or writes a structure.
7614 ********************************************************************/
7616 BOOL samr_io_r_samr_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
7617 prs_struct *ps, int depth)
7622 prs_debug(ps, depth, desc, "samr_io_r_samr_query_domain_info2");
7628 if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
7631 if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
7632 if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
7637 switch (r_u->switch_value) {
7639 if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
7643 if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
7647 if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
7651 if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
7655 if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
7659 if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
7663 if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
7667 DEBUG(0, ("samr_io_r_samr_query_domain_info2: unknown switch level 0x%x\n",
7668 r_u->switch_value));
7669 r_u->status = NT_STATUS_INVALID_INFO_CLASS;
7677 if(!prs_ntstatus("status", ps, depth, &r_u->status))
7684 /*******************************************************************
7685 reads or writes a structure.
7686 ********************************************************************/
7688 void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u,
7689 POLICY_HND *domain_pol, uint16 switch_value, SAM_UNK_CTR *ctr)
7691 DEBUG(5, ("init_samr_q_set_domain_info\n"));
7693 q_u->domain_pol = *domain_pol;
7694 q_u->switch_value0 = switch_value;
7696 q_u->switch_value = switch_value;
7701 /*******************************************************************
7702 reads or writes a structure.
7703 ********************************************************************/
7705 BOOL samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u,
7706 prs_struct *ps, int depth)
7711 prs_debug(ps, depth, desc, "samr_io_q_set_domain_info");
7717 if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
7720 if(!prs_uint16("switch_value0", ps, depth, &q_u->switch_value0))
7723 if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
7729 if (UNMARSHALLING(ps)) {
7730 if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL)
7734 switch (q_u->switch_value) {
7737 if(!sam_io_unk_info12("unk_inf12", &q_u->ctr->info.inf12, ps, depth))
7741 if(!sam_io_unk_info7("unk_inf7",&q_u->ctr->info.inf7, ps,depth))
7745 if(!sam_io_unk_info6("unk_inf6",&q_u->ctr->info.inf6, ps,depth))
7749 if(!sam_io_unk_info5("unk_inf5",&q_u->ctr->info.inf5, ps,depth))
7753 if(!sam_io_unk_info3("unk_inf3",&q_u->ctr->info.inf3, ps,depth))
7757 if(!sam_io_unk_info2("unk_inf2",&q_u->ctr->info.inf2, ps,depth))
7761 if(!sam_io_unk_info1("unk_inf1",&q_u->ctr->info.inf1, ps,depth))
7765 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
7766 q_u->switch_value));
7773 /*******************************************************************
7774 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7775 ********************************************************************/
7777 void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status)
7779 DEBUG(5, ("init_samr_r_set_domain_info\n"));
7781 r_u->status = status; /* return status */
7784 /*******************************************************************
7785 reads or writes a structure.
7786 ********************************************************************/
7788 BOOL samr_io_r_set_domain_info(const char *desc, SAMR_R_SET_DOMAIN_INFO * r_u,
7789 prs_struct *ps, int depth)
7794 prs_debug(ps, depth, desc, "samr_io_r_samr_unknown_2e");
7800 if(!prs_ntstatus("status", ps, depth, &r_u->status))