2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2000,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6 * Copyright (C) Paul Ashton 1997-2000,
7 * Copyright (C) Elrond 2000,
8 * Copyright (C) Jeremy Allison 2001,
9 * Copyright (C) Jean François Micouleau 1998-2001,
10 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #define DBGC_CLASS DBGC_RPC_PARSE
32 /*******************************************************************
33 inits a SAMR_Q_CLOSE_HND structure.
34 ********************************************************************/
36 void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND
* q_c
, POLICY_HND
*hnd
)
38 DEBUG(5, ("init_samr_q_close_hnd\n"));
43 /*******************************************************************
44 reads or writes a structure.
45 ********************************************************************/
47 BOOL
samr_io_q_close_hnd(const char *desc
, SAMR_Q_CLOSE_HND
* q_u
,
48 prs_struct
*ps
, int depth
)
53 prs_debug(ps
, depth
, desc
, "samr_io_q_close_hnd");
59 return smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
);
62 /*******************************************************************
63 reads or writes a structure.
64 ********************************************************************/
66 BOOL
samr_io_r_close_hnd(const char *desc
, SAMR_R_CLOSE_HND
* r_u
,
67 prs_struct
*ps
, int depth
)
72 prs_debug(ps
, depth
, desc
, "samr_io_r_close_hnd");
78 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
81 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
87 /*******************************************************************
88 inits a SAMR_Q_LOOKUP_DOMAIN structure.
89 ********************************************************************/
91 void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN
* q_u
,
92 POLICY_HND
*pol
, char *dom_name
)
94 DEBUG(5, ("init_samr_q_lookup_domain\n"));
96 q_u
->connect_pol
= *pol
;
98 init_unistr2(&q_u
->uni_domain
, dom_name
, UNI_FLAGS_NONE
);
99 init_uni_hdr(&q_u
->hdr_domain
, &q_u
->uni_domain
);
102 /*******************************************************************
103 reads or writes a structure.
104 ********************************************************************/
105 BOOL
samr_io_q_lookup_domain(const char *desc
, SAMR_Q_LOOKUP_DOMAIN
* q_u
,
106 prs_struct
*ps
, int depth
)
111 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_domain");
117 if(!smb_io_pol_hnd("connect_pol", &q_u
->connect_pol
, ps
, depth
))
120 if(!smb_io_unihdr("hdr_domain", &q_u
->hdr_domain
, ps
, depth
))
123 if(!smb_io_unistr2("uni_domain", &q_u
->uni_domain
, q_u
->hdr_domain
.buffer
, ps
, depth
))
129 /*******************************************************************
130 inits a SAMR_R_LOOKUP_DOMAIN structure.
131 ********************************************************************/
133 void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN
* r_u
,
134 DOM_SID
*dom_sid
, NTSTATUS status
)
136 DEBUG(5, ("init_samr_r_lookup_domain\n"));
138 r_u
->status
= status
;
140 if (NT_STATUS_IS_OK(status
)) {
142 init_dom_sid2(&r_u
->dom_sid
, dom_sid
);
146 /*******************************************************************
147 reads or writes a structure.
148 ********************************************************************/
150 BOOL
samr_io_r_lookup_domain(const char *desc
, SAMR_R_LOOKUP_DOMAIN
* r_u
,
151 prs_struct
*ps
, int depth
)
156 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_domain");
162 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr_sid
))
165 if (r_u
->ptr_sid
!= 0) {
166 if(!smb_io_dom_sid2("sid", &r_u
->dom_sid
, ps
, depth
))
172 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
178 /*******************************************************************
179 reads or writes a structure.
180 ********************************************************************/
182 void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN
* q_u
, POLICY_HND
*dom_pol
, DOM_SID
*sid
)
184 DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n"));
186 q_u
->dom_pol
= *dom_pol
;
187 init_dom_sid2(&q_u
->sid
, sid
);
190 /*******************************************************************
191 reads or writes a structure.
192 ********************************************************************/
194 BOOL
samr_io_q_remove_sid_foreign_domain(const char *desc
, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN
* q_u
,
195 prs_struct
*ps
, int depth
)
200 prs_debug(ps
, depth
, desc
, "samr_io_q_remove_sid_foreign_domain");
206 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
209 if(!smb_io_dom_sid2("sid", &q_u
->sid
, ps
, depth
))
218 /*******************************************************************
219 reads or writes a structure.
220 ********************************************************************/
222 BOOL
samr_io_r_remove_sid_foreign_domain(const char *desc
, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN
* r_u
,
223 prs_struct
*ps
, int depth
)
228 prs_debug(ps
, depth
, desc
, "samr_io_r_remove_sid_foreign_domain");
234 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
240 /*******************************************************************
241 reads or writes a structure.
242 ********************************************************************/
244 void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN
* q_u
,
245 POLICY_HND
*pol
, uint32 flags
,
248 DEBUG(5, ("samr_init_samr_q_open_domain\n"));
252 init_dom_sid2(&q_u
->dom_sid
, sid
);
255 /*******************************************************************
256 reads or writes a structure.
257 ********************************************************************/
259 BOOL
samr_io_q_open_domain(const char *desc
, SAMR_Q_OPEN_DOMAIN
* q_u
,
260 prs_struct
*ps
, int depth
)
265 prs_debug(ps
, depth
, desc
, "samr_io_q_open_domain");
271 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
274 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
277 if(!smb_io_dom_sid2("sid", &q_u
->dom_sid
, ps
, depth
))
283 /*******************************************************************
284 reads or writes a structure.
285 ********************************************************************/
287 BOOL
samr_io_r_open_domain(const char *desc
, SAMR_R_OPEN_DOMAIN
* r_u
,
288 prs_struct
*ps
, int depth
)
293 prs_debug(ps
, depth
, desc
, "samr_io_r_open_domain");
299 if(!smb_io_pol_hnd("domain_pol", &r_u
->domain_pol
, ps
, depth
))
302 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
308 /*******************************************************************
309 reads or writes a structure.
310 ********************************************************************/
312 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
313 POLICY_HND
*user_pol
)
315 DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
317 q_u
->user_pol
= *user_pol
;
320 /*******************************************************************
321 reads or writes a structure.
322 ********************************************************************/
324 BOOL
samr_io_q_get_usrdom_pwinfo(const char *desc
, SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
325 prs_struct
*ps
, int depth
)
330 prs_debug(ps
, depth
, desc
, "samr_io_q_get_usrdom_pwinfo");
336 return smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
);
339 /*******************************************************************
341 ********************************************************************/
343 void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO
*r_u
, NTSTATUS status
)
345 DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
347 r_u
->min_pwd_length
= 0x0000;
351 * r_u->unknown_1 = 0x0015;
354 r_u
->unknown_1
= 0x01D1;
355 r_u
->unknown_1
= 0x0015;
357 r_u
->password_properties
= 0x00000000;
359 r_u
->status
= status
;
362 /*******************************************************************
363 reads or writes a structure.
364 ********************************************************************/
366 BOOL
samr_io_r_get_usrdom_pwinfo(const char *desc
, SAMR_R_GET_USRDOM_PWINFO
* r_u
,
367 prs_struct
*ps
, int depth
)
372 prs_debug(ps
, depth
, desc
, "samr_io_r_get_usrdom_pwinfo");
378 if(!prs_uint16("min_pwd_length", ps
, depth
, &r_u
->min_pwd_length
))
380 if(!prs_uint16("unknown_1", ps
, depth
, &r_u
->unknown_1
))
382 if(!prs_uint32("password_properties", ps
, depth
, &r_u
->password_properties
))
385 if(!prs_ntstatus("status ", ps
, depth
, &r_u
->status
))
392 /*******************************************************************
393 reads or writes a structure.
394 ********************************************************************/
396 BOOL
samr_io_q_set_sec_obj(const char *desc
, SAMR_Q_SET_SEC_OBJ
* q_u
,
397 prs_struct
*ps
, int depth
)
402 prs_debug(ps
, depth
, desc
, "samr_io_q_set_sec_obj");
408 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
411 if(!prs_uint32("sec_info", ps
, depth
, &q_u
->sec_info
))
414 if(!sec_io_desc_buf("sec_desc", &q_u
->buf
, ps
, depth
))
421 /*******************************************************************
422 reads or writes a structure.
423 ********************************************************************/
425 void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ
* q_u
,
426 POLICY_HND
*user_pol
, uint32 sec_info
)
428 DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
430 q_u
->user_pol
= *user_pol
;
431 q_u
->sec_info
= sec_info
;
435 /*******************************************************************
436 reads or writes a structure.
437 ********************************************************************/
439 BOOL
samr_io_q_query_sec_obj(const char *desc
, SAMR_Q_QUERY_SEC_OBJ
* q_u
,
440 prs_struct
*ps
, int depth
)
445 prs_debug(ps
, depth
, desc
, "samr_io_q_query_sec_obj");
451 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
454 if(!prs_uint32("sec_info", ps
, depth
, &q_u
->sec_info
))
460 /*******************************************************************
461 reads or writes a structure.
462 ********************************************************************/
464 void init_samr_q_query_domain_info(SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
465 POLICY_HND
*domain_pol
, uint16 switch_value
)
467 DEBUG(5, ("samr_init_samr_q_query_domain_info\n"));
469 q_u
->domain_pol
= *domain_pol
;
470 q_u
->switch_value
= switch_value
;
473 /*******************************************************************
474 reads or writes a structure.
475 ********************************************************************/
477 BOOL
samr_io_q_query_domain_info(const char *desc
, SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
478 prs_struct
*ps
, int depth
)
483 prs_debug(ps
, depth
, desc
, "samr_io_q_query_domain_info");
489 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
492 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
498 /*******************************************************************
500 ********************************************************************/
502 void init_unk_info1(SAM_UNK_INFO_1
*u_1
, uint16 min_pass_len
, uint16 pass_hist
,
503 uint32 password_properties
, NTTIME nt_expire
, NTTIME nt_min_age
)
505 u_1
->min_length_password
= min_pass_len
;
506 u_1
->password_history
= pass_hist
;
508 if (lp_check_password_script() && *lp_check_password_script()) {
509 password_properties
|= DOMAIN_PASSWORD_COMPLEX
;
511 u_1
->password_properties
= password_properties
;
513 /* password never expire */
514 u_1
->expire
= nt_expire
;
516 /* can change the password now */
517 u_1
->min_passwordage
= nt_min_age
;
521 /*******************************************************************
522 reads or writes a structure.
523 ********************************************************************/
525 static BOOL
sam_io_unk_info1(const char *desc
, SAM_UNK_INFO_1
* u_1
,
526 prs_struct
*ps
, int depth
)
531 prs_debug(ps
, depth
, desc
, "sam_io_unk_info1");
534 if(!prs_uint16("min_length_password", ps
, depth
, &u_1
->min_length_password
))
536 if(!prs_uint16("password_history", ps
, depth
, &u_1
->password_history
))
538 if(!prs_uint32("password_properties", ps
, depth
, &u_1
->password_properties
))
540 if(!smb_io_time("expire", &u_1
->expire
, ps
, depth
))
542 if(!smb_io_time("min_passwordage", &u_1
->min_passwordage
, ps
, depth
))
548 /*******************************************************************
550 ********************************************************************/
552 void init_unk_info2(SAM_UNK_INFO_2
* u_2
,
553 const char *comment
, const char *domain
, const char *server
,
554 uint32 seq_num
, uint32 num_users
, uint32 num_groups
, uint32 num_alias
, NTTIME nt_logout
, uint32 server_role
)
556 u_2
->logout
= nt_logout
;
558 u_2
->seq_num
= seq_num
;
561 u_2
->unknown_4
= 0x00000001;
562 u_2
->server_role
= server_role
;
563 u_2
->unknown_6
= 0x00000001;
564 u_2
->num_domain_usrs
= num_users
;
565 u_2
->num_domain_grps
= num_groups
;
566 u_2
->num_local_grps
= num_alias
;
568 init_unistr2(&u_2
->uni_comment
, comment
, UNI_FLAGS_NONE
);
569 init_uni_hdr(&u_2
->hdr_comment
, &u_2
->uni_comment
);
570 init_unistr2(&u_2
->uni_domain
, domain
, UNI_FLAGS_NONE
);
571 init_uni_hdr(&u_2
->hdr_domain
, &u_2
->uni_domain
);
572 init_unistr2(&u_2
->uni_server
, server
, UNI_FLAGS_NONE
);
573 init_uni_hdr(&u_2
->hdr_server
, &u_2
->uni_server
);
576 /*******************************************************************
577 reads or writes a structure.
578 ********************************************************************/
580 static BOOL
sam_io_unk_info2(const char *desc
, SAM_UNK_INFO_2
* u_2
,
581 prs_struct
*ps
, int depth
)
586 prs_debug(ps
, depth
, desc
, "sam_io_unk_info2");
589 if(!smb_io_time("logout", &u_2
->logout
, ps
, depth
))
591 if(!smb_io_unihdr("hdr_comment", &u_2
->hdr_comment
, ps
, depth
))
593 if(!smb_io_unihdr("hdr_domain", &u_2
->hdr_domain
, ps
, depth
))
595 if(!smb_io_unihdr("hdr_server", &u_2
->hdr_server
, ps
, depth
))
598 /* put all the data in here, at the moment, including what the above
599 pointer is referring to
602 if(!prs_uint64("seq_num ", ps
, depth
, &u_2
->seq_num
))
605 if(!prs_uint32("unknown_4 ", ps
, depth
, &u_2
->unknown_4
)) /* 0x0000 0001 */
607 if(!prs_uint32("server_role ", ps
, depth
, &u_2
->server_role
))
609 if(!prs_uint32("unknown_6 ", ps
, depth
, &u_2
->unknown_6
)) /* 0x0000 0001 */
611 if(!prs_uint32("num_domain_usrs ", ps
, depth
, &u_2
->num_domain_usrs
))
613 if(!prs_uint32("num_domain_grps", ps
, depth
, &u_2
->num_domain_grps
))
615 if(!prs_uint32("num_local_grps", ps
, depth
, &u_2
->num_local_grps
))
618 if(!smb_io_unistr2("uni_comment", &u_2
->uni_comment
, u_2
->hdr_comment
.buffer
, ps
, depth
))
620 if(!smb_io_unistr2("uni_domain", &u_2
->uni_domain
, u_2
->hdr_domain
.buffer
, ps
, depth
))
622 if(!smb_io_unistr2("uni_server", &u_2
->uni_server
, u_2
->hdr_server
.buffer
, ps
, depth
))
628 /*******************************************************************
630 ********************************************************************/
632 void init_unk_info3(SAM_UNK_INFO_3
*u_3
, NTTIME nt_logout
)
634 u_3
->logout
= nt_logout
;
637 /*******************************************************************
638 reads or writes a structure.
639 ********************************************************************/
641 static BOOL
sam_io_unk_info3(const char *desc
, SAM_UNK_INFO_3
* u_3
,
642 prs_struct
*ps
, int depth
)
647 prs_debug(ps
, depth
, desc
, "sam_io_unk_info3");
650 if(!smb_io_time("logout", &u_3
->logout
, ps
, depth
))
656 /*******************************************************************
658 ********************************************************************/
660 void init_unk_info4(SAM_UNK_INFO_4
* u_4
,const char *comment
)
662 init_unistr2(&u_4
->uni_comment
, comment
, UNI_FLAGS_NONE
);
663 init_uni_hdr(&u_4
->hdr_comment
, &u_4
->uni_comment
);
666 /*******************************************************************
667 reads or writes a structure.
668 ********************************************************************/
670 static BOOL
sam_io_unk_info4(const char *desc
, SAM_UNK_INFO_4
* u_4
,
671 prs_struct
*ps
, int depth
)
676 prs_debug(ps
, depth
, desc
, "sam_io_unk_info4");
679 if(!smb_io_unihdr("hdr_comment", &u_4
->hdr_comment
, ps
, depth
))
682 if(!smb_io_unistr2("uni_comment", &u_4
->uni_comment
, u_4
->hdr_comment
.buffer
, ps
, depth
))
688 /*******************************************************************
690 ********************************************************************/
692 void init_unk_info5(SAM_UNK_INFO_5
* u_5
,const char *domain
)
694 init_unistr2(&u_5
->uni_domain
, domain
, UNI_FLAGS_NONE
);
695 init_uni_hdr(&u_5
->hdr_domain
, &u_5
->uni_domain
);
698 /*******************************************************************
699 reads or writes a structure.
700 ********************************************************************/
702 static BOOL
sam_io_unk_info5(const char *desc
, SAM_UNK_INFO_5
* u_5
,
703 prs_struct
*ps
, int depth
)
708 prs_debug(ps
, depth
, desc
, "sam_io_unk_info5");
711 if(!smb_io_unihdr("hdr_domain", &u_5
->hdr_domain
, ps
, depth
))
714 if(!smb_io_unistr2("uni_domain", &u_5
->uni_domain
, u_5
->hdr_domain
.buffer
, ps
, depth
))
720 /*******************************************************************
722 ********************************************************************/
724 void init_unk_info6(SAM_UNK_INFO_6
* u_6
, const char *server
)
726 init_unistr2(&u_6
->uni_server
, server
, UNI_FLAGS_NONE
);
727 init_uni_hdr(&u_6
->hdr_server
, &u_6
->uni_server
);
730 /*******************************************************************
731 reads or writes a structure.
732 ********************************************************************/
734 static BOOL
sam_io_unk_info6(const char *desc
, SAM_UNK_INFO_6
* u_6
,
735 prs_struct
*ps
, int depth
)
740 prs_debug(ps
, depth
, desc
, "sam_io_unk_info6");
743 if(!smb_io_unihdr("hdr_server", &u_6
->hdr_server
, ps
, depth
))
746 if(!smb_io_unistr2("uni_server", &u_6
->uni_server
, u_6
->hdr_server
.buffer
, ps
, depth
))
752 /*******************************************************************
754 ********************************************************************/
756 void init_unk_info7(SAM_UNK_INFO_7
* u_7
, uint32 server_role
)
758 u_7
->server_role
= server_role
;
761 /*******************************************************************
762 reads or writes a structure.
763 ********************************************************************/
765 static BOOL
sam_io_unk_info7(const char *desc
, SAM_UNK_INFO_7
* u_7
,
766 prs_struct
*ps
, int depth
)
771 prs_debug(ps
, depth
, desc
, "sam_io_unk_info7");
774 if(!prs_uint16("server_role", ps
, depth
, &u_7
->server_role
))
780 /*******************************************************************
782 ********************************************************************/
784 void init_unk_info8(SAM_UNK_INFO_8
* u_8
, uint32 seq_num
)
786 unix_to_nt_time(&u_8
->domain_create_time
, 0);
787 u_8
->seq_num
= seq_num
;
790 /*******************************************************************
791 reads or writes a structure.
792 ********************************************************************/
794 static BOOL
sam_io_unk_info8(const char *desc
, SAM_UNK_INFO_8
* u_8
,
795 prs_struct
*ps
, int depth
)
800 prs_debug(ps
, depth
, desc
, "sam_io_unk_info8");
803 if (!prs_uint64("seq_num", ps
, depth
, &u_8
->seq_num
))
806 if(!smb_io_time("domain_create_time", &u_8
->domain_create_time
, ps
, depth
))
812 /*******************************************************************
814 ********************************************************************/
816 void init_unk_info9(SAM_UNK_INFO_9
* u_9
, uint32 unknown
)
818 u_9
->unknown
= unknown
;
821 /*******************************************************************
822 reads or writes a structure.
823 ********************************************************************/
825 static BOOL
sam_io_unk_info9(const char *desc
, SAM_UNK_INFO_9
* u_9
,
826 prs_struct
*ps
, int depth
)
831 prs_debug(ps
, depth
, desc
, "sam_io_unk_info9");
834 if (!prs_uint32("unknown", ps
, depth
, &u_9
->unknown
))
840 /*******************************************************************
842 ********************************************************************/
844 void init_unk_info12(SAM_UNK_INFO_12
* u_12
, NTTIME nt_lock_duration
, NTTIME nt_reset_time
, uint16 lockout
)
846 u_12
->duration
= nt_lock_duration
;
847 u_12
->reset_count
= nt_reset_time
;
849 u_12
->bad_attempt_lockout
= lockout
;
852 /*******************************************************************
853 reads or writes a structure.
854 ********************************************************************/
856 static BOOL
sam_io_unk_info12(const char *desc
, SAM_UNK_INFO_12
* u_12
,
857 prs_struct
*ps
, int depth
)
862 prs_debug(ps
, depth
, desc
, "sam_io_unk_info12");
865 if(!smb_io_time("duration", &u_12
->duration
, ps
, depth
))
867 if(!smb_io_time("reset_count", &u_12
->reset_count
, ps
, depth
))
869 if(!prs_uint16("bad_attempt_lockout", ps
, depth
, &u_12
->bad_attempt_lockout
))
875 /*******************************************************************
877 ********************************************************************/
879 void init_unk_info13(SAM_UNK_INFO_13
* u_13
, uint32 seq_num
)
881 unix_to_nt_time(&u_13
->domain_create_time
, 0);
882 u_13
->seq_num
= seq_num
;
887 /*******************************************************************
888 reads or writes a structure.
889 ********************************************************************/
891 static BOOL
sam_io_unk_info13(const char *desc
, SAM_UNK_INFO_13
* u_13
,
892 prs_struct
*ps
, int depth
)
897 prs_debug(ps
, depth
, desc
, "sam_io_unk_info13");
900 if (!prs_uint64("seq_num", ps
, depth
, &u_13
->seq_num
))
903 if(!smb_io_time("domain_create_time", &u_13
->domain_create_time
, ps
, depth
))
906 if (!prs_uint32("unknown1", ps
, depth
, &u_13
->unknown1
))
908 if (!prs_uint32("unknown2", ps
, depth
, &u_13
->unknown2
))
914 /*******************************************************************
915 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
916 ********************************************************************/
918 void init_samr_r_query_domain_info(SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
919 uint16 switch_value
, SAM_UNK_CTR
* ctr
,
922 DEBUG(5, ("init_samr_r_query_domain_info\n"));
925 r_u
->switch_value
= 0;
926 r_u
->status
= status
; /* return status */
928 if (NT_STATUS_IS_OK(status
)) {
929 r_u
->switch_value
= switch_value
;
935 /*******************************************************************
936 reads or writes a structure.
937 ********************************************************************/
939 BOOL
samr_io_r_query_domain_info(const char *desc
, SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
940 prs_struct
*ps
, int depth
)
945 prs_debug(ps
, depth
, desc
, "samr_io_r_query_domain_info");
951 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
954 if (r_u
->ptr_0
!= 0 && r_u
->ctr
!= NULL
) {
955 if(!prs_uint16("switch_value", ps
, depth
, &r_u
->switch_value
))
960 switch (r_u
->switch_value
) {
962 if(!sam_io_unk_info13("unk_inf13", &r_u
->ctr
->info
.inf13
, ps
, depth
))
966 if(!sam_io_unk_info12("unk_inf12", &r_u
->ctr
->info
.inf12
, ps
, depth
))
970 if(!sam_io_unk_info9("unk_inf9",&r_u
->ctr
->info
.inf9
, ps
,depth
))
974 if(!sam_io_unk_info8("unk_inf8",&r_u
->ctr
->info
.inf8
, ps
,depth
))
978 if(!sam_io_unk_info7("unk_inf7",&r_u
->ctr
->info
.inf7
, ps
,depth
))
982 if(!sam_io_unk_info6("unk_inf6",&r_u
->ctr
->info
.inf6
, ps
,depth
))
986 if(!sam_io_unk_info5("unk_inf5",&r_u
->ctr
->info
.inf5
, ps
,depth
))
990 if(!sam_io_unk_info4("unk_inf4",&r_u
->ctr
->info
.inf4
, ps
,depth
))
994 if(!sam_io_unk_info3("unk_inf3",&r_u
->ctr
->info
.inf3
, ps
,depth
))
998 if(!sam_io_unk_info2("unk_inf2",&r_u
->ctr
->info
.inf2
, ps
,depth
))
1002 if(!sam_io_unk_info1("unk_inf1",&r_u
->ctr
->info
.inf1
, ps
,depth
))
1006 DEBUG(0, ("samr_io_r_query_domain_info: unknown switch level 0x%x\n",
1007 r_u
->switch_value
));
1008 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
1016 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
1022 /*******************************************************************
1023 reads or writes a structure.
1024 ********************************************************************/
1026 void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ
* q_u
,
1027 POLICY_HND
*pol
, uint32 sec_info
, SEC_DESC_BUF
*buf
)
1029 DEBUG(5, ("samr_init_samr_q_set_sec_obj\n"));
1032 q_u
->sec_info
= sec_info
;
1037 /*******************************************************************
1038 reads or writes a SAMR_R_SET_SEC_OBJ structure.
1039 ********************************************************************/
1041 BOOL
samr_io_r_set_sec_obj(const char *desc
, SAMR_R_SET_SEC_OBJ
* r_u
,
1042 prs_struct
*ps
, int depth
)
1047 prs_debug(ps
, depth
, desc
, "samr_io_r_set_sec_obj");
1053 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
1059 /*******************************************************************
1060 reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
1061 ********************************************************************/
1063 BOOL
samr_io_r_query_sec_obj(const char *desc
, SAMR_R_QUERY_SEC_OBJ
* r_u
,
1064 prs_struct
*ps
, int depth
)
1069 prs_debug(ps
, depth
, desc
, "samr_io_r_query_sec_obj");
1075 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
1077 if (r_u
->ptr
!= 0) {
1078 if(!sec_io_desc_buf("sec", &r_u
->buf
, ps
, depth
))
1082 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
1088 /*******************************************************************
1089 reads or writes a SAM_STR1 structure.
1090 ********************************************************************/
1092 static BOOL
sam_io_sam_str1(const char *desc
, SAM_STR1
* sam
, uint32 acct_buf
,
1093 uint32 name_buf
, uint32 desc_buf
,
1094 prs_struct
*ps
, int depth
)
1099 prs_debug(ps
, depth
, desc
, "sam_io_sam_str1");
1104 if (!smb_io_unistr2("name", &sam
->uni_acct_name
, acct_buf
, ps
, depth
))
1107 if (!smb_io_unistr2("desc", &sam
->uni_acct_desc
, desc_buf
, ps
, depth
))
1110 if (!smb_io_unistr2("full", &sam
->uni_full_name
, name_buf
, ps
, depth
))
1116 /*******************************************************************
1117 inits a SAM_ENTRY1 structure.
1118 ********************************************************************/
1120 static void init_sam_entry1(SAM_ENTRY1
*sam
, uint32 user_idx
,
1121 UNISTR2
*sam_name
, UNISTR2
*sam_full
,
1122 UNISTR2
*sam_desc
, uint32 rid_user
,
1125 DEBUG(5, ("init_sam_entry1\n"));
1129 sam
->user_idx
= user_idx
;
1130 sam
->rid_user
= rid_user
;
1131 sam
->acb_info
= acb_info
;
1133 init_uni_hdr(&sam
->hdr_acct_name
, sam_name
);
1134 init_uni_hdr(&sam
->hdr_user_name
, sam_full
);
1135 init_uni_hdr(&sam
->hdr_user_desc
, sam_desc
);
1138 /*******************************************************************
1139 reads or writes a SAM_ENTRY1 structure.
1140 ********************************************************************/
1142 static BOOL
sam_io_sam_entry1(const char *desc
, SAM_ENTRY1
* sam
,
1143 prs_struct
*ps
, int depth
)
1148 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry1");
1154 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
1157 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
1159 if(!prs_uint32("acb_info ", ps
, depth
, &sam
->acb_info
))
1162 if (!smb_io_unihdr("hdr_acct_name", &sam
->hdr_acct_name
, ps
, depth
))
1164 if (!smb_io_unihdr("hdr_user_desc", &sam
->hdr_user_desc
, ps
, depth
))
1166 if (!smb_io_unihdr("hdr_user_name", &sam
->hdr_user_name
, ps
, depth
))
1172 /*******************************************************************
1173 reads or writes a SAM_STR2 structure.
1174 ********************************************************************/
1176 static BOOL
sam_io_sam_str2(const char *desc
, SAM_STR2
* sam
, uint32 acct_buf
,
1177 uint32 desc_buf
, prs_struct
*ps
, int depth
)
1182 prs_debug(ps
, depth
, desc
, "sam_io_sam_str2");
1188 if(!smb_io_unistr2("uni_srv_name", &sam
->uni_srv_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
1190 if(!smb_io_unistr2("uni_srv_desc", &sam
->uni_srv_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
1196 /*******************************************************************
1197 inits a SAM_ENTRY2 structure.
1198 ********************************************************************/
1199 static void init_sam_entry2(SAM_ENTRY2
* sam
, uint32 user_idx
,
1200 UNISTR2
*sam_name
, UNISTR2
*sam_desc
,
1201 uint32 rid_user
, uint32 acb_info
)
1203 DEBUG(5, ("init_sam_entry2\n"));
1205 sam
->user_idx
= user_idx
;
1206 sam
->rid_user
= rid_user
;
1207 sam
->acb_info
= acb_info
;
1209 init_uni_hdr(&sam
->hdr_srv_name
, sam_name
);
1210 init_uni_hdr(&sam
->hdr_srv_desc
, sam_desc
);
1213 /*******************************************************************
1214 reads or writes a SAM_ENTRY2 structure.
1215 ********************************************************************/
1217 static BOOL
sam_io_sam_entry2(const char *desc
, SAM_ENTRY2
* sam
,
1218 prs_struct
*ps
, int depth
)
1223 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry2");
1229 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
1232 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
1234 if(!prs_uint32("acb_info ", ps
, depth
, &sam
->acb_info
))
1237 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_name
, ps
, depth
)) /* account name unicode string header */
1239 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_desc
, ps
, depth
)) /* account name unicode string header */
1245 /*******************************************************************
1246 reads or writes a SAM_STR3 structure.
1247 ********************************************************************/
1249 static BOOL
sam_io_sam_str3(const char *desc
, SAM_STR3
* sam
, uint32 acct_buf
,
1250 uint32 desc_buf
, prs_struct
*ps
, int depth
)
1255 prs_debug(ps
, depth
, desc
, "sam_io_sam_str3");
1261 if(!smb_io_unistr2("uni_grp_name", &sam
->uni_grp_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
1263 if(!smb_io_unistr2("uni_grp_desc", &sam
->uni_grp_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
1269 /*******************************************************************
1270 inits a SAM_ENTRY3 structure.
1271 ********************************************************************/
1273 static void init_sam_entry3(SAM_ENTRY3
* sam
, uint32 grp_idx
,
1274 UNISTR2
*grp_name
, UNISTR2
*grp_desc
,
1277 DEBUG(5, ("init_sam_entry3\n"));
1279 sam
->grp_idx
= grp_idx
;
1280 sam
->rid_grp
= rid_grp
;
1281 sam
->attr
= 0x07; /* group rid attributes - gets ignored by nt 4.0 */
1283 init_uni_hdr(&sam
->hdr_grp_name
, grp_name
);
1284 init_uni_hdr(&sam
->hdr_grp_desc
, grp_desc
);
1287 /*******************************************************************
1288 reads or writes a SAM_ENTRY3 structure.
1289 ********************************************************************/
1291 static BOOL
sam_io_sam_entry3(const char *desc
, SAM_ENTRY3
* sam
,
1292 prs_struct
*ps
, int depth
)
1297 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry3");
1303 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1306 if(!prs_uint32("rid_grp", ps
, depth
, &sam
->rid_grp
))
1308 if(!prs_uint32("attr ", ps
, depth
, &sam
->attr
))
1311 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_name
, ps
, depth
)) /* account name unicode string header */
1313 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_desc
, ps
, depth
)) /* account name unicode string header */
1319 /*******************************************************************
1320 inits a SAM_ENTRY4 structure.
1321 ********************************************************************/
1323 static void init_sam_entry4(SAM_ENTRY4
* sam
, uint32 user_idx
,
1324 uint32 len_acct_name
)
1326 DEBUG(5, ("init_sam_entry4\n"));
1328 sam
->user_idx
= user_idx
;
1329 init_str_hdr(&sam
->hdr_acct_name
, len_acct_name
+1, len_acct_name
, len_acct_name
!= 0);
1332 /*******************************************************************
1333 reads or writes a SAM_ENTRY4 structure.
1334 ********************************************************************/
1336 static BOOL
sam_io_sam_entry4(const char *desc
, SAM_ENTRY4
* sam
,
1337 prs_struct
*ps
, int depth
)
1342 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry4");
1348 if(!prs_uint32("user_idx", ps
, depth
, &sam
->user_idx
))
1350 if(!smb_io_strhdr("strhdr", &sam
->hdr_acct_name
, ps
, depth
))
1356 /*******************************************************************
1357 inits a SAM_ENTRY5 structure.
1358 ********************************************************************/
1360 static void init_sam_entry5(SAM_ENTRY5
* sam
, uint32 grp_idx
,
1361 uint32 len_grp_name
)
1363 DEBUG(5, ("init_sam_entry5\n"));
1365 sam
->grp_idx
= grp_idx
;
1366 init_str_hdr(&sam
->hdr_grp_name
, len_grp_name
, len_grp_name
,
1370 /*******************************************************************
1371 reads or writes a SAM_ENTRY5 structure.
1372 ********************************************************************/
1374 static BOOL
sam_io_sam_entry5(const char *desc
, SAM_ENTRY5
* sam
,
1375 prs_struct
*ps
, int depth
)
1380 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry5");
1386 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1388 if(!smb_io_strhdr("strhdr", &sam
->hdr_grp_name
, ps
, depth
))
1394 /*******************************************************************
1395 inits a SAM_ENTRY structure.
1396 ********************************************************************/
1398 void init_sam_entry(SAM_ENTRY
*sam
, UNISTR2
*uni2
, uint32 rid
)
1400 DEBUG(10, ("init_sam_entry: %d\n", rid
));
1403 init_uni_hdr(&sam
->hdr_name
, uni2
);
1406 /*******************************************************************
1407 reads or writes a SAM_ENTRY structure.
1408 ********************************************************************/
1410 static BOOL
sam_io_sam_entry(const char *desc
, SAM_ENTRY
* sam
,
1411 prs_struct
*ps
, int depth
)
1416 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry");
1421 if(!prs_uint32("rid", ps
, depth
, &sam
->rid
))
1423 if(!smb_io_unihdr("unihdr", &sam
->hdr_name
, ps
, depth
)) /* account name unicode string header */
1429 /*******************************************************************
1430 inits a SAMR_Q_ENUM_DOM_USERS structure.
1431 ********************************************************************/
1433 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS
* q_e
, POLICY_HND
*pol
,
1435 uint32 acb_mask
, uint32 size
)
1437 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
1441 q_e
->start_idx
= start_idx
; /* zero indicates lots */
1442 q_e
->acb_mask
= acb_mask
;
1443 q_e
->max_size
= size
;
1446 /*******************************************************************
1447 reads or writes a structure.
1448 ********************************************************************/
1450 BOOL
samr_io_q_enum_dom_users(const char *desc
, SAMR_Q_ENUM_DOM_USERS
* q_e
,
1451 prs_struct
*ps
, int depth
)
1456 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_users");
1462 if(!smb_io_pol_hnd("domain_pol", &q_e
->pol
, ps
, depth
))
1465 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
1467 if(!prs_uint32("acb_mask ", ps
, depth
, &q_e
->acb_mask
))
1470 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1477 /*******************************************************************
1478 inits a SAMR_R_ENUM_DOM_USERS structure.
1479 ********************************************************************/
1481 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS
* r_u
,
1482 uint32 next_idx
, uint32 num_sam_entries
)
1484 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
1486 r_u
->next_idx
= next_idx
;
1488 if (num_sam_entries
!= 0) {
1489 r_u
->ptr_entries1
= 1;
1490 r_u
->ptr_entries2
= 1;
1491 r_u
->num_entries2
= num_sam_entries
;
1492 r_u
->num_entries3
= num_sam_entries
;
1494 r_u
->num_entries4
= num_sam_entries
;
1496 r_u
->ptr_entries1
= 0;
1497 r_u
->num_entries2
= num_sam_entries
;
1498 r_u
->ptr_entries2
= 1;
1502 /*******************************************************************
1503 reads or writes a structure.
1504 ********************************************************************/
1506 BOOL
samr_io_r_enum_dom_users(const char *desc
, SAMR_R_ENUM_DOM_USERS
* r_u
,
1507 prs_struct
*ps
, int depth
)
1514 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_users");
1520 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
1522 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
1525 if (r_u
->ptr_entries1
!= 0) {
1526 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
1528 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
1530 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
1533 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
!= 0)) {
1534 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
, r_u
->num_entries2
);
1535 r_u
->uni_acct_name
= PRS_ALLOC_MEM(ps
,UNISTR2
, r_u
->num_entries2
);
1538 if ((r_u
->sam
== NULL
|| r_u
->uni_acct_name
== NULL
) && r_u
->num_entries2
!= 0) {
1539 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
1540 r_u
->num_entries4
= 0;
1541 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
1545 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1546 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
1550 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1551 if(!smb_io_unistr2("", &r_u
->uni_acct_name
[i
],r_u
->sam
[i
].hdr_name
.buffer
, ps
,depth
))
1560 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
1562 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
1568 /*******************************************************************
1569 inits a SAMR_Q_QUERY_DISPINFO structure.
1570 ********************************************************************/
1572 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO
* q_e
, POLICY_HND
*pol
,
1573 uint16 switch_level
, uint32 start_idx
,
1574 uint32 max_entries
, uint32 max_size
)
1576 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
1578 q_e
->domain_pol
= *pol
;
1580 q_e
->switch_level
= switch_level
;
1582 q_e
->start_idx
= start_idx
;
1583 q_e
->max_entries
= max_entries
;
1584 q_e
->max_size
= max_size
;
1587 /*******************************************************************
1588 reads or writes a structure.
1589 ********************************************************************/
1591 BOOL
samr_io_q_query_dispinfo(const char *desc
, SAMR_Q_QUERY_DISPINFO
* q_e
,
1592 prs_struct
*ps
, int depth
)
1597 prs_debug(ps
, depth
, desc
, "samr_io_q_query_dispinfo");
1603 if(!smb_io_pol_hnd("domain_pol", &q_e
->domain_pol
, ps
, depth
))
1606 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
1611 if(!prs_uint32("start_idx ", ps
, depth
, &q_e
->start_idx
))
1613 if(!prs_uint32("max_entries ", ps
, depth
, &q_e
->max_entries
))
1615 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1621 /*******************************************************************
1622 inits a SAM_DISPINFO_1 structure.
1623 ********************************************************************/
1625 NTSTATUS
init_sam_dispinfo_1(TALLOC_CTX
*ctx
, SAM_DISPINFO_1
**sam
,
1626 uint32 num_entries
, uint32 start_idx
,
1627 struct samr_displayentry
*entries
)
1631 DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries
));
1634 return NT_STATUS_OK
;
1636 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_1
, num_entries
);
1638 return NT_STATUS_NO_MEMORY
;
1640 (*sam
)->sam
=TALLOC_ARRAY(ctx
, SAM_ENTRY1
, num_entries
);
1641 if ((*sam
)->sam
== NULL
)
1642 return NT_STATUS_NO_MEMORY
;
1644 (*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR1
, num_entries
);
1645 if ((*sam
)->str
== NULL
)
1646 return NT_STATUS_NO_MEMORY
;
1648 for (i
= 0; i
< num_entries
; i
++) {
1649 init_unistr2(&(*sam
)->str
[i
].uni_acct_name
,
1650 entries
[i
].account_name
, UNI_FLAGS_NONE
);
1651 init_unistr2(&(*sam
)->str
[i
].uni_full_name
,
1652 entries
[i
].fullname
, UNI_FLAGS_NONE
);
1653 init_unistr2(&(*sam
)->str
[i
].uni_acct_desc
,
1654 entries
[i
].description
, UNI_FLAGS_NONE
);
1656 init_sam_entry1(&(*sam
)->sam
[i
], start_idx
+i
+1,
1657 &(*sam
)->str
[i
].uni_acct_name
,
1658 &(*sam
)->str
[i
].uni_full_name
,
1659 &(*sam
)->str
[i
].uni_acct_desc
,
1660 entries
[i
].rid
, entries
[i
].acct_flags
);
1663 return NT_STATUS_OK
;
1666 /*******************************************************************
1667 reads or writes a structure.
1668 ********************************************************************/
1670 static BOOL
sam_io_sam_dispinfo_1(const char *desc
, SAM_DISPINFO_1
* sam
,
1672 prs_struct
*ps
, int depth
)
1676 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_1");
1682 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1684 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY1
, num_entries
)) == NULL
) {
1685 DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
1689 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR1
, num_entries
)) == NULL
) {
1690 DEBUG(0, ("out of memory allocating SAM_STR1\n"));
1695 for (i
= 0; i
< num_entries
; i
++) {
1696 if(!sam_io_sam_entry1("", &sam
->sam
[i
], ps
, depth
))
1700 for (i
= 0; i
< num_entries
; i
++) {
1701 if(!sam_io_sam_str1("", &sam
->str
[i
],
1702 sam
->sam
[i
].hdr_acct_name
.buffer
,
1703 sam
->sam
[i
].hdr_user_name
.buffer
,
1704 sam
->sam
[i
].hdr_user_desc
.buffer
, ps
, depth
))
1711 /*******************************************************************
1712 inits a SAM_DISPINFO_2 structure.
1713 ********************************************************************/
1715 NTSTATUS
init_sam_dispinfo_2(TALLOC_CTX
*ctx
, SAM_DISPINFO_2
**sam
,
1716 uint32 num_entries
, uint32 start_idx
,
1717 struct samr_displayentry
*entries
)
1721 DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries
));
1724 return NT_STATUS_OK
;
1726 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_2
, num_entries
);
1728 return NT_STATUS_NO_MEMORY
;
1730 (*sam
)->sam
= TALLOC_ARRAY(ctx
, SAM_ENTRY2
, num_entries
);
1731 if ((*sam
)->sam
== NULL
)
1732 return NT_STATUS_NO_MEMORY
;
1734 (*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR2
, num_entries
);
1735 if ((*sam
)->str
== NULL
)
1736 return NT_STATUS_NO_MEMORY
;
1738 for (i
= 0; i
< num_entries
; i
++) {
1739 init_unistr2(&(*sam
)->str
[i
].uni_srv_name
,
1740 entries
[i
].account_name
, UNI_FLAGS_NONE
);
1741 init_unistr2(&(*sam
)->str
[i
].uni_srv_desc
,
1742 entries
[i
].description
, UNI_FLAGS_NONE
);
1744 init_sam_entry2(&(*sam
)->sam
[i
], start_idx
+ i
+ 1,
1745 &(*sam
)->str
[i
].uni_srv_name
,
1746 &(*sam
)->str
[i
].uni_srv_desc
,
1747 entries
[i
].rid
, entries
[i
].acct_flags
);
1750 return NT_STATUS_OK
;
1753 /*******************************************************************
1754 reads or writes a structure.
1755 ********************************************************************/
1757 static BOOL
sam_io_sam_dispinfo_2(const char *desc
, SAM_DISPINFO_2
* sam
,
1759 prs_struct
*ps
, int depth
)
1766 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_2");
1772 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1774 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY2
, num_entries
)) == NULL
) {
1775 DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
1779 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR2
, num_entries
)) == NULL
) {
1780 DEBUG(0, ("out of memory allocating SAM_STR2\n"));
1785 for (i
= 0; i
< num_entries
; i
++) {
1786 if(!sam_io_sam_entry2("", &sam
->sam
[i
], ps
, depth
))
1790 for (i
= 0; i
< num_entries
; i
++) {
1791 if(!sam_io_sam_str2("", &sam
->str
[i
],
1792 sam
->sam
[i
].hdr_srv_name
.buffer
,
1793 sam
->sam
[i
].hdr_srv_desc
.buffer
, ps
, depth
))
1800 /*******************************************************************
1801 inits a SAM_DISPINFO_3 structure.
1802 ********************************************************************/
1804 NTSTATUS
init_sam_dispinfo_3(TALLOC_CTX
*ctx
, SAM_DISPINFO_3
**sam
,
1805 uint32 num_entries
, uint32 start_idx
,
1806 struct samr_displayentry
*entries
)
1810 DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries
));
1813 return NT_STATUS_OK
;
1815 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_3
, num_entries
);
1817 return NT_STATUS_NO_MEMORY
;
1819 if (!((*sam
)->sam
=TALLOC_ARRAY(ctx
, SAM_ENTRY3
, num_entries
)))
1820 return NT_STATUS_NO_MEMORY
;
1822 if (!((*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR3
, num_entries
)))
1823 return NT_STATUS_NO_MEMORY
;
1825 for (i
= 0; i
< num_entries
; i
++) {
1826 DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i
));
1828 init_unistr2(&(*sam
)->str
[i
].uni_grp_name
,
1829 entries
[i
].account_name
, UNI_FLAGS_NONE
);
1830 init_unistr2(&(*sam
)->str
[i
].uni_grp_desc
,
1831 entries
[i
].description
, UNI_FLAGS_NONE
);
1833 init_sam_entry3(&(*sam
)->sam
[i
], start_idx
+i
+1,
1834 &(*sam
)->str
[i
].uni_grp_name
,
1835 &(*sam
)->str
[i
].uni_grp_desc
,
1839 return NT_STATUS_OK
;
1842 /*******************************************************************
1843 reads or writes a structure.
1844 ********************************************************************/
1846 static BOOL
sam_io_sam_dispinfo_3(const char *desc
, SAM_DISPINFO_3
* sam
,
1848 prs_struct
*ps
, int depth
)
1855 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_3");
1861 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1863 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY3
, num_entries
)) == NULL
) {
1864 DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
1868 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR3
, num_entries
)) == NULL
) {
1869 DEBUG(0, ("out of memory allocating SAM_STR3\n"));
1874 for (i
= 0; i
< num_entries
; i
++) {
1875 if(!sam_io_sam_entry3("", &sam
->sam
[i
], ps
, depth
))
1879 for (i
= 0; i
< num_entries
; i
++) {
1880 if(!sam_io_sam_str3("", &sam
->str
[i
],
1881 sam
->sam
[i
].hdr_grp_name
.buffer
,
1882 sam
->sam
[i
].hdr_grp_desc
.buffer
, ps
, depth
))
1889 /*******************************************************************
1890 inits a SAM_DISPINFO_4 structure.
1891 ********************************************************************/
1893 NTSTATUS
init_sam_dispinfo_4(TALLOC_CTX
*ctx
, SAM_DISPINFO_4
**sam
,
1894 uint32 num_entries
, uint32 start_idx
,
1895 struct samr_displayentry
*entries
)
1899 DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries
));
1902 return NT_STATUS_OK
;
1904 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_4
, num_entries
);
1906 return NT_STATUS_NO_MEMORY
;
1908 (*sam
)->sam
= TALLOC_ARRAY(ctx
, SAM_ENTRY4
, num_entries
);
1909 if ((*sam
)->sam
== NULL
)
1910 return NT_STATUS_NO_MEMORY
;
1912 (*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR4
, num_entries
);
1913 if ((*sam
)->str
== NULL
)
1914 return NT_STATUS_NO_MEMORY
;
1916 for (i
= 0; i
< num_entries
; i
++) {
1917 size_t len_sam_name
= strlen(entries
[i
].account_name
);
1919 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i
));
1921 init_sam_entry4(&(*sam
)->sam
[i
], start_idx
+ i
+ 1,
1924 init_string2(&(*sam
)->str
[i
].acct_name
,
1925 entries
[i
].account_name
, len_sam_name
+1,
1929 return NT_STATUS_OK
;
1932 /*******************************************************************
1933 reads or writes a structure.
1934 ********************************************************************/
1936 static BOOL
sam_io_sam_dispinfo_4(const char *desc
, SAM_DISPINFO_4
* sam
,
1938 prs_struct
*ps
, int depth
)
1945 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_4");
1951 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1953 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY4
, num_entries
)) == NULL
) {
1954 DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
1958 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR4
, num_entries
)) == NULL
) {
1959 DEBUG(0, ("out of memory allocating SAM_STR4\n"));
1964 for (i
= 0; i
< num_entries
; i
++) {
1965 if(!sam_io_sam_entry4("", &sam
->sam
[i
], ps
, depth
))
1969 for (i
= 0; i
< num_entries
; i
++) {
1970 if(!smb_io_string2("acct_name", &sam
->str
[i
].acct_name
,
1971 sam
->sam
[i
].hdr_acct_name
.buffer
, ps
, depth
))
1978 /*******************************************************************
1979 inits a SAM_DISPINFO_5 structure.
1980 ********************************************************************/
1982 NTSTATUS
init_sam_dispinfo_5(TALLOC_CTX
*ctx
, SAM_DISPINFO_5
**sam
,
1983 uint32 num_entries
, uint32 start_idx
,
1984 struct samr_displayentry
*entries
)
1986 uint32 len_sam_name
;
1989 DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries
));
1992 return NT_STATUS_OK
;
1994 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_5
, num_entries
);
1996 return NT_STATUS_NO_MEMORY
;
1998 if (!((*sam
)->sam
=TALLOC_ARRAY(ctx
, SAM_ENTRY5
, num_entries
)))
1999 return NT_STATUS_NO_MEMORY
;
2001 if (!((*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR5
, num_entries
)))
2002 return NT_STATUS_NO_MEMORY
;
2004 for (i
= 0; i
< num_entries
; i
++) {
2005 DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i
));
2007 len_sam_name
= strlen(entries
[i
].account_name
);
2009 init_sam_entry5(&(*sam
)->sam
[i
], start_idx
+i
+1, len_sam_name
);
2010 init_string2(&(*sam
)->str
[i
].grp_name
, entries
[i
].account_name
,
2011 len_sam_name
+1, len_sam_name
);
2014 return NT_STATUS_OK
;
2017 /*******************************************************************
2018 reads or writes a structure.
2019 ********************************************************************/
2021 static BOOL
sam_io_sam_dispinfo_5(const char *desc
, SAM_DISPINFO_5
* sam
,
2023 prs_struct
*ps
, int depth
)
2030 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_5");
2036 if (UNMARSHALLING(ps
) && num_entries
> 0) {
2038 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY5
, num_entries
)) == NULL
) {
2039 DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
2043 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR5
, num_entries
)) == NULL
) {
2044 DEBUG(0, ("out of memory allocating SAM_STR5\n"));
2049 for (i
= 0; i
< num_entries
; i
++) {
2050 if(!sam_io_sam_entry5("", &sam
->sam
[i
], ps
, depth
))
2054 for (i
= 0; i
< num_entries
; i
++) {
2055 if(!smb_io_string2("grp_name", &sam
->str
[i
].grp_name
,
2056 sam
->sam
[i
].hdr_grp_name
.buffer
, ps
, depth
))
2063 /*******************************************************************
2064 inits a SAMR_R_QUERY_DISPINFO structure.
2065 ********************************************************************/
2067 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO
* r_u
,
2068 uint32 num_entries
, uint32 total_size
, uint32 data_size
,
2069 uint16 switch_level
, SAM_DISPINFO_CTR
* ctr
,
2072 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level
));
2074 r_u
->total_size
= total_size
;
2076 r_u
->data_size
= data_size
;
2078 r_u
->switch_level
= switch_level
;
2079 r_u
->num_entries
= num_entries
;
2082 r_u
->ptr_entries
= 0;
2084 r_u
->ptr_entries
= 1;
2086 r_u
->num_entries2
= num_entries
;
2089 r_u
->status
= status
;
2092 /*******************************************************************
2093 reads or writes a structure.
2094 ********************************************************************/
2096 BOOL
samr_io_r_query_dispinfo(const char *desc
, SAMR_R_QUERY_DISPINFO
* r_u
,
2097 prs_struct
*ps
, int depth
)
2102 prs_debug(ps
, depth
, desc
, "samr_io_r_query_dispinfo");
2108 if(!prs_uint32("total_size ", ps
, depth
, &r_u
->total_size
))
2110 if(!prs_uint32("data_size ", ps
, depth
, &r_u
->data_size
))
2112 if(!prs_uint16("switch_level", ps
, depth
, &r_u
->switch_level
))
2117 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2119 if(!prs_uint32("ptr_entries ", ps
, depth
, &r_u
->ptr_entries
))
2122 if (r_u
->ptr_entries
==0) {
2125 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2131 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
2134 switch (r_u
->switch_level
) {
2136 if(!sam_io_sam_dispinfo_1("users", r_u
->ctr
->sam
.info1
,
2137 r_u
->num_entries
, ps
, depth
))
2141 if(!sam_io_sam_dispinfo_2("servers", r_u
->ctr
->sam
.info2
,
2142 r_u
->num_entries
, ps
, depth
))
2146 if(!sam_io_sam_dispinfo_3("groups", r_u
->ctr
->sam
.info3
,
2147 r_u
->num_entries
, ps
, depth
))
2151 if(!sam_io_sam_dispinfo_4("user list",
2152 r_u
->ctr
->sam
.info4
,
2153 r_u
->num_entries
, ps
, depth
))
2157 if(!sam_io_sam_dispinfo_5("group list",
2158 r_u
->ctr
->sam
.info5
,
2159 r_u
->num_entries
, ps
, depth
))
2163 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
2169 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2175 /*******************************************************************
2176 inits a SAMR_Q_OPEN_GROUP structure.
2177 ********************************************************************/
2179 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP
* q_c
,
2181 uint32 access_mask
, uint32 rid
)
2183 DEBUG(5, ("init_samr_q_open_group\n"));
2185 q_c
->domain_pol
= *hnd
;
2186 q_c
->access_mask
= access_mask
;
2187 q_c
->rid_group
= rid
;
2190 /*******************************************************************
2191 reads or writes a structure.
2192 ********************************************************************/
2194 BOOL
samr_io_q_open_group(const char *desc
, SAMR_Q_OPEN_GROUP
* q_u
,
2195 prs_struct
*ps
, int depth
)
2200 prs_debug(ps
, depth
, desc
, "samr_io_q_open_group");
2206 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
2209 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
2211 if(!prs_uint32("rid_group", ps
, depth
, &q_u
->rid_group
))
2217 /*******************************************************************
2218 reads or writes a structure.
2219 ********************************************************************/
2221 BOOL
samr_io_r_open_group(const char *desc
, SAMR_R_OPEN_GROUP
* r_u
,
2222 prs_struct
*ps
, int depth
)
2227 prs_debug(ps
, depth
, desc
, "samr_io_r_open_group");
2233 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2236 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2242 /*******************************************************************
2243 inits a GROUP_INFO1 structure.
2244 ********************************************************************/
2246 void init_samr_group_info1(GROUP_INFO1
* gr1
,
2247 char *acct_name
, char *acct_desc
,
2250 DEBUG(5, ("init_samr_group_info1\n"));
2252 gr1
->group_attr
= (SE_GROUP_MANDATORY
|SE_GROUP_ENABLED_BY_DEFAULT
); /* why not | SE_GROUP_ENABLED ? */
2253 gr1
->num_members
= num_members
;
2255 init_unistr2(&gr1
->uni_acct_name
, acct_name
, UNI_FLAGS_NONE
);
2256 init_uni_hdr(&gr1
->hdr_acct_name
, &gr1
->uni_acct_name
);
2257 init_unistr2(&gr1
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
2258 init_uni_hdr(&gr1
->hdr_acct_desc
, &gr1
->uni_acct_desc
);
2261 /*******************************************************************
2262 reads or writes a structure.
2263 ********************************************************************/
2265 BOOL
samr_io_group_info1(const char *desc
, GROUP_INFO1
* gr1
,
2266 prs_struct
*ps
, int depth
)
2273 prs_debug(ps
, depth
, desc
, "samr_io_group_info1");
2276 if(!prs_uint16("level", ps
, depth
, &dummy
))
2282 if(!smb_io_unihdr("hdr_acct_name", &gr1
->hdr_acct_name
, ps
, depth
))
2285 if(!prs_uint32("group_attr", ps
, depth
, &gr1
->group_attr
))
2287 if(!prs_uint32("num_members", ps
, depth
, &gr1
->num_members
))
2290 if(!smb_io_unihdr("hdr_acct_desc", &gr1
->hdr_acct_desc
, ps
, depth
))
2293 if(!smb_io_unistr2("uni_acct_name", &gr1
->uni_acct_name
,
2294 gr1
->hdr_acct_name
.buffer
, ps
, depth
))
2297 if(!smb_io_unistr2("uni_acct_desc", &gr1
->uni_acct_desc
,
2298 gr1
->hdr_acct_desc
.buffer
, ps
, depth
))
2304 /*******************************************************************
2305 inits a GROUP_INFO2 structure.
2306 ********************************************************************/
2308 void init_samr_group_info2(GROUP_INFO2
* gr2
, const char *acct_name
)
2310 DEBUG(5, ("init_samr_group_info2\n"));
2313 init_unistr2(&gr2
->uni_acct_name
, acct_name
, UNI_FLAGS_NONE
);
2314 init_uni_hdr(&gr2
->hdr_acct_name
, &gr2
->uni_acct_name
);
2317 /*******************************************************************
2318 reads or writes a structure.
2319 ********************************************************************/
2321 BOOL
samr_io_group_info2(const char *desc
, GROUP_INFO2
*gr2
, prs_struct
*ps
, int depth
)
2326 prs_debug(ps
, depth
, desc
, "samr_io_group_info2");
2329 if(!prs_uint16("hdr_level", ps
, depth
, &gr2
->level
))
2332 if(!smb_io_unihdr("hdr_acct_name", &gr2
->hdr_acct_name
, ps
, depth
))
2334 if(!smb_io_unistr2("uni_acct_name", &gr2
->uni_acct_name
,
2335 gr2
->hdr_acct_name
.buffer
, ps
, depth
))
2341 /*******************************************************************
2342 inits a GROUP_INFO3 structure.
2343 ********************************************************************/
2345 void init_samr_group_info3(GROUP_INFO3
*gr3
)
2347 DEBUG(5, ("init_samr_group_info3\n"));
2349 gr3
->group_attr
= (SE_GROUP_MANDATORY
|SE_GROUP_ENABLED_BY_DEFAULT
); /* why not | SE_GROUP_ENABLED ? */
2352 /*******************************************************************
2353 reads or writes a structure.
2354 ********************************************************************/
2356 BOOL
samr_io_group_info3(const char *desc
, GROUP_INFO3
*gr3
, prs_struct
*ps
, int depth
)
2361 prs_debug(ps
, depth
, desc
, "samr_io_group_info3");
2367 if(!prs_uint32("group_attr", ps
, depth
, &gr3
->group_attr
))
2373 /*******************************************************************
2374 inits a GROUP_INFO4 structure.
2375 ********************************************************************/
2377 void init_samr_group_info4(GROUP_INFO4
* gr4
, const char *acct_desc
)
2379 DEBUG(5, ("init_samr_group_info4\n"));
2382 init_unistr2(&gr4
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
2383 init_uni_hdr(&gr4
->hdr_acct_desc
, &gr4
->uni_acct_desc
);
2386 /*******************************************************************
2387 reads or writes a structure.
2388 ********************************************************************/
2390 BOOL
samr_io_group_info4(const char *desc
, GROUP_INFO4
* gr4
,
2391 prs_struct
*ps
, int depth
)
2396 prs_debug(ps
, depth
, desc
, "samr_io_group_info4");
2399 if(!prs_uint16("hdr_level", ps
, depth
, &gr4
->level
))
2401 if(!smb_io_unihdr("hdr_acct_desc", &gr4
->hdr_acct_desc
, ps
, depth
))
2403 if(!smb_io_unistr2("uni_acct_desc", &gr4
->uni_acct_desc
,
2404 gr4
->hdr_acct_desc
.buffer
, ps
, depth
))
2410 /*******************************************************************
2411 inits a GROUP_INFO5 structure.
2412 ********************************************************************/
2414 void init_samr_group_info5(GROUP_INFO5
* gr5
,
2415 char *acct_name
, char *acct_desc
,
2418 DEBUG(5, ("init_samr_group_info5\n"));
2420 gr5
->group_attr
= (SE_GROUP_MANDATORY
|SE_GROUP_ENABLED_BY_DEFAULT
); /* why not | SE_GROUP_ENABLED ? */
2421 gr5
->num_members
= num_members
;
2423 init_unistr2(&gr5
->uni_acct_name
, acct_name
, UNI_FLAGS_NONE
);
2424 init_uni_hdr(&gr5
->hdr_acct_name
, &gr5
->uni_acct_name
);
2425 init_unistr2(&gr5
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
2426 init_uni_hdr(&gr5
->hdr_acct_desc
, &gr5
->uni_acct_desc
);
2429 /*******************************************************************
2430 reads or writes a structure.
2431 ********************************************************************/
2433 BOOL
samr_io_group_info5(const char *desc
, GROUP_INFO5
* gr5
,
2434 prs_struct
*ps
, int depth
)
2441 prs_debug(ps
, depth
, desc
, "samr_io_group_info5");
2444 if(!prs_uint16("level", ps
, depth
, &dummy
))
2450 if(!smb_io_unihdr("hdr_acct_name", &gr5
->hdr_acct_name
, ps
, depth
))
2453 if(!prs_uint32("group_attr", ps
, depth
, &gr5
->group_attr
))
2455 if(!prs_uint32("num_members", ps
, depth
, &gr5
->num_members
))
2458 if(!smb_io_unihdr("hdr_acct_desc", &gr5
->hdr_acct_desc
, ps
, depth
))
2461 if(!smb_io_unistr2("uni_acct_name", &gr5
->uni_acct_name
,
2462 gr5
->hdr_acct_name
.buffer
, ps
, depth
))
2465 if(!smb_io_unistr2("uni_acct_desc", &gr5
->uni_acct_desc
,
2466 gr5
->hdr_acct_desc
.buffer
, ps
, depth
))
2473 /*******************************************************************
2474 reads or writes a structure.
2475 ********************************************************************/
2477 static BOOL
samr_group_info_ctr(const char *desc
, GROUP_INFO_CTR
**ctr
,
2478 prs_struct
*ps
, int depth
)
2480 if (UNMARSHALLING(ps
))
2481 *ctr
= PRS_ALLOC_MEM(ps
,GROUP_INFO_CTR
,1);
2486 prs_debug(ps
, depth
, desc
, "samr_group_info_ctr");
2489 if(!prs_uint16("switch_value1", ps
, depth
, &(*ctr
)->switch_value1
))
2492 switch ((*ctr
)->switch_value1
) {
2494 if(!samr_io_group_info1("group_info1", &(*ctr
)->group
.info1
, ps
, depth
))
2498 if(!samr_io_group_info2("group_info2", &(*ctr
)->group
.info2
, ps
, depth
))
2502 if(!samr_io_group_info3("group_info3", &(*ctr
)->group
.info3
, ps
, depth
))
2506 if(!samr_io_group_info4("group_info4", &(*ctr
)->group
.info4
, ps
, depth
))
2510 if(!samr_io_group_info5("group_info5", &(*ctr
)->group
.info5
, ps
, depth
))
2514 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2521 /*******************************************************************
2522 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2523 ********************************************************************/
2525 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2526 POLICY_HND
*pol
, const char *acct_desc
,
2529 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2533 init_unistr2(&q_e
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
2534 init_uni_hdr(&q_e
->hdr_acct_desc
, &q_e
->uni_acct_desc
);
2536 q_e
->access_mask
= access_mask
;
2539 /*******************************************************************
2540 reads or writes a structure.
2541 ********************************************************************/
2543 BOOL
samr_io_q_create_dom_group(const char *desc
, SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2544 prs_struct
*ps
, int depth
)
2549 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_group");
2555 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2558 if(!smb_io_unihdr("hdr_acct_desc", &q_e
->hdr_acct_desc
, ps
, depth
))
2560 if(!smb_io_unistr2("uni_acct_desc", &q_e
->uni_acct_desc
,
2561 q_e
->hdr_acct_desc
.buffer
, ps
, depth
))
2566 if(!prs_uint32("access", ps
, depth
, &q_e
->access_mask
))
2572 /*******************************************************************
2573 reads or writes a structure.
2574 ********************************************************************/
2576 BOOL
samr_io_r_create_dom_group(const char *desc
, SAMR_R_CREATE_DOM_GROUP
* r_u
,
2577 prs_struct
*ps
, int depth
)
2582 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_group");
2588 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2591 if(!prs_uint32("rid ", ps
, depth
, &r_u
->rid
))
2593 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2599 /*******************************************************************
2600 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2601 ********************************************************************/
2603 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP
* q_c
,
2606 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2608 q_c
->group_pol
= *hnd
;
2611 /*******************************************************************
2612 reads or writes a structure.
2613 ********************************************************************/
2615 BOOL
samr_io_q_delete_dom_group(const char *desc
, SAMR_Q_DELETE_DOM_GROUP
* q_u
,
2616 prs_struct
*ps
, int depth
)
2621 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_group");
2627 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2633 /*******************************************************************
2634 reads or writes a structure.
2635 ********************************************************************/
2637 BOOL
samr_io_r_delete_dom_group(const char *desc
, SAMR_R_DELETE_DOM_GROUP
* r_u
,
2638 prs_struct
*ps
, int depth
)
2643 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_group");
2649 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2652 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2658 /*******************************************************************
2659 inits a SAMR_Q_DEL_GROUPMEM structure.
2660 ********************************************************************/
2662 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM
* q_e
,
2663 POLICY_HND
*pol
, uint32 rid
)
2665 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2671 /*******************************************************************
2672 reads or writes a structure.
2673 ********************************************************************/
2675 BOOL
samr_io_q_del_groupmem(const char *desc
, SAMR_Q_DEL_GROUPMEM
* q_e
,
2676 prs_struct
*ps
, int depth
)
2681 prs_debug(ps
, depth
, desc
, "samr_io_q_del_groupmem");
2687 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2690 if(!prs_uint32("rid", ps
, depth
, &q_e
->rid
))
2696 /*******************************************************************
2697 inits a SAMR_R_DEL_GROUPMEM structure.
2698 ********************************************************************/
2700 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2703 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2705 r_u
->status
= status
;
2708 /*******************************************************************
2709 reads or writes a structure.
2710 ********************************************************************/
2712 BOOL
samr_io_r_del_groupmem(const char *desc
, SAMR_R_DEL_GROUPMEM
* r_u
,
2713 prs_struct
*ps
, int depth
)
2718 prs_debug(ps
, depth
, desc
, "samr_io_r_del_groupmem");
2724 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2730 /*******************************************************************
2731 inits a SAMR_Q_ADD_GROUPMEM structure.
2732 ********************************************************************/
2734 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM
* q_e
,
2735 POLICY_HND
*pol
, uint32 rid
)
2737 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2741 q_e
->unknown
= 0x0005;
2744 /*******************************************************************
2745 reads or writes a structure.
2746 ********************************************************************/
2748 BOOL
samr_io_q_add_groupmem(const char *desc
, SAMR_Q_ADD_GROUPMEM
* q_e
,
2749 prs_struct
*ps
, int depth
)
2754 prs_debug(ps
, depth
, desc
, "samr_io_q_add_groupmem");
2760 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2763 if(!prs_uint32("rid ", ps
, depth
, &q_e
->rid
))
2765 if(!prs_uint32("unknown", ps
, depth
, &q_e
->unknown
))
2771 /*******************************************************************
2772 inits a SAMR_R_ADD_GROUPMEM structure.
2773 ********************************************************************/
2775 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2778 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2780 r_u
->status
= status
;
2783 /*******************************************************************
2784 reads or writes a structure.
2785 ********************************************************************/
2787 BOOL
samr_io_r_add_groupmem(const char *desc
, SAMR_R_ADD_GROUPMEM
* r_u
,
2788 prs_struct
*ps
, int depth
)
2793 prs_debug(ps
, depth
, desc
, "samr_io_r_add_groupmem");
2799 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2805 /*******************************************************************
2806 inits a SAMR_Q_SET_GROUPINFO structure.
2807 ********************************************************************/
2809 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO
* q_e
,
2810 POLICY_HND
*pol
, GROUP_INFO_CTR
* ctr
)
2812 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2818 /*******************************************************************
2819 reads or writes a structure.
2820 ********************************************************************/
2822 BOOL
samr_io_q_set_groupinfo(const char *desc
, SAMR_Q_SET_GROUPINFO
* q_e
,
2823 prs_struct
*ps
, int depth
)
2828 prs_debug(ps
, depth
, desc
, "samr_io_q_set_groupinfo");
2834 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2837 if(!samr_group_info_ctr("ctr", &q_e
->ctr
, ps
, depth
))
2843 /*******************************************************************
2844 inits a SAMR_R_SET_GROUPINFO structure.
2845 ********************************************************************/
2847 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO
* r_u
, NTSTATUS status
)
2849 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2851 r_u
->status
= status
;
2854 /*******************************************************************
2855 reads or writes a structure.
2856 ********************************************************************/
2858 BOOL
samr_io_r_set_groupinfo(const char *desc
, SAMR_R_SET_GROUPINFO
* r_u
,
2859 prs_struct
*ps
, int depth
)
2864 prs_debug(ps
, depth
, desc
, "samr_io_r_set_groupinfo");
2870 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2876 /*******************************************************************
2877 inits a SAMR_Q_QUERY_GROUPINFO structure.
2878 ********************************************************************/
2880 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO
* q_e
,
2881 POLICY_HND
*pol
, uint16 switch_level
)
2883 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2887 q_e
->switch_level
= switch_level
;
2890 /*******************************************************************
2891 reads or writes a structure.
2892 ********************************************************************/
2894 BOOL
samr_io_q_query_groupinfo(const char *desc
, SAMR_Q_QUERY_GROUPINFO
* q_e
,
2895 prs_struct
*ps
, int depth
)
2900 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupinfo");
2906 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2909 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
2915 /*******************************************************************
2916 inits a SAMR_R_QUERY_GROUPINFO structure.
2917 ********************************************************************/
2919 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO
* r_u
,
2920 GROUP_INFO_CTR
* ctr
, NTSTATUS status
)
2922 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2924 r_u
->ptr
= (NT_STATUS_IS_OK(status
) && ctr
!= NULL
) ? 1 : 0;
2926 r_u
->status
= status
;
2929 /*******************************************************************
2930 reads or writes a structure.
2931 ********************************************************************/
2933 BOOL
samr_io_r_query_groupinfo(const char *desc
, SAMR_R_QUERY_GROUPINFO
* r_u
,
2934 prs_struct
*ps
, int depth
)
2939 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupinfo");
2945 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2948 if (r_u
->ptr
!= 0) {
2949 if(!samr_group_info_ctr("ctr", &r_u
->ctr
, ps
, depth
))
2955 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2961 /*******************************************************************
2962 inits a SAMR_Q_QUERY_GROUPMEM structure.
2963 ********************************************************************/
2965 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM
* q_c
, POLICY_HND
*hnd
)
2967 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2969 q_c
->group_pol
= *hnd
;
2972 /*******************************************************************
2973 reads or writes a structure.
2974 ********************************************************************/
2976 BOOL
samr_io_q_query_groupmem(const char *desc
, SAMR_Q_QUERY_GROUPMEM
* q_u
,
2977 prs_struct
*ps
, int depth
)
2982 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupmem");
2988 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2994 /*******************************************************************
2995 inits a SAMR_R_QUERY_GROUPMEM structure.
2996 ********************************************************************/
2998 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM
* r_u
,
2999 uint32 num_entries
, uint32
*rid
,
3000 uint32
*attr
, NTSTATUS status
)
3002 DEBUG(5, ("init_samr_r_query_groupmem\n"));
3004 if (NT_STATUS_IS_OK(status
)) {
3006 r_u
->num_entries
= num_entries
;
3008 r_u
->ptr_attrs
= attr
!= NULL
? 1 : 0;
3009 r_u
->ptr_rids
= rid
!= NULL
? 1 : 0;
3011 r_u
->num_rids
= num_entries
;
3014 r_u
->num_attrs
= num_entries
;
3018 r_u
->num_entries
= 0;
3021 r_u
->status
= status
;
3024 /*******************************************************************
3025 reads or writes a structure.
3026 ********************************************************************/
3028 BOOL
samr_io_r_query_groupmem(const char *desc
, SAMR_R_QUERY_GROUPMEM
* r_u
,
3029 prs_struct
*ps
, int depth
)
3036 if (UNMARSHALLING(ps
))
3039 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupmem");
3045 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
3047 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
3050 if (r_u
->ptr
!= 0) {
3051 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
3053 if(!prs_uint32("ptr_attrs", ps
, depth
, &r_u
->ptr_attrs
))
3056 if (r_u
->ptr_rids
!= 0) {
3057 if(!prs_uint32("num_rids", ps
, depth
, &r_u
->num_rids
))
3059 if (UNMARSHALLING(ps
) && r_u
->num_rids
!= 0) {
3060 r_u
->rid
= PRS_ALLOC_MEM(ps
,uint32
,r_u
->num_rids
);
3061 if (r_u
->rid
== NULL
)
3065 for (i
= 0; i
< r_u
->num_rids
; i
++) {
3066 if(!prs_uint32("", ps
, depth
, &r_u
->rid
[i
]))
3071 if (r_u
->ptr_attrs
!= 0) {
3072 if(!prs_uint32("num_attrs", ps
, depth
, &r_u
->num_attrs
))
3075 if (UNMARSHALLING(ps
) && r_u
->num_attrs
!= 0) {
3076 r_u
->attr
= PRS_ALLOC_MEM(ps
,uint32
,r_u
->num_attrs
);
3077 if (r_u
->attr
== NULL
)
3081 for (i
= 0; i
< r_u
->num_attrs
; i
++) {
3082 if(!prs_uint32("", ps
, depth
, &r_u
->attr
[i
]))
3088 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3094 /*******************************************************************
3095 inits a SAMR_Q_QUERY_USERGROUPS structure.
3096 ********************************************************************/
3098 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS
* q_u
,
3101 DEBUG(5, ("init_samr_q_query_usergroups\n"));
3106 /*******************************************************************
3107 reads or writes a structure.
3108 ********************************************************************/
3110 BOOL
samr_io_q_query_usergroups(const char *desc
, SAMR_Q_QUERY_USERGROUPS
* q_u
,
3111 prs_struct
*ps
, int depth
)
3116 prs_debug(ps
, depth
, desc
, "samr_io_q_query_usergroups");
3122 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3128 /*******************************************************************
3129 inits a SAMR_R_QUERY_USERGROUPS structure.
3130 ********************************************************************/
3132 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS
* r_u
,
3133 uint32 num_gids
, DOM_GID
* gid
,
3136 DEBUG(5, ("init_samr_r_query_usergroups\n"));
3138 if (NT_STATUS_IS_OK(status
)) {
3140 r_u
->num_entries
= num_gids
;
3141 r_u
->ptr_1
= (num_gids
!= 0) ? 1 : 0;
3142 r_u
->num_entries2
= num_gids
;
3147 r_u
->num_entries
= 0;
3152 r_u
->status
= status
;
3155 /*******************************************************************
3156 reads or writes a structure.
3157 ********************************************************************/
3159 BOOL
samr_io_gids(const char *desc
, uint32
*num_gids
, DOM_GID
** gid
,
3160 prs_struct
*ps
, int depth
)
3166 prs_debug(ps
, depth
, desc
, "samr_io_gids");
3172 if(!prs_uint32("num_gids", ps
, depth
, num_gids
))
3175 if ((*num_gids
) != 0) {
3176 if (UNMARSHALLING(ps
)) {
3177 (*gid
) = PRS_ALLOC_MEM(ps
,DOM_GID
,*num_gids
);
3180 if ((*gid
) == NULL
) {
3184 for (i
= 0; i
< (*num_gids
); i
++) {
3185 if(!smb_io_gid("gids", &(*gid
)[i
], ps
, depth
))
3193 /*******************************************************************
3194 reads or writes a structure.
3195 ********************************************************************/
3197 BOOL
samr_io_r_query_usergroups(const char *desc
, SAMR_R_QUERY_USERGROUPS
* r_u
,
3198 prs_struct
*ps
, int depth
)
3203 prs_debug(ps
, depth
, desc
, "samr_io_r_query_usergroups");
3209 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
3212 if (r_u
->ptr_0
!= 0) {
3213 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
3215 if(!prs_uint32("ptr_1 ", ps
, depth
, &r_u
->ptr_1
))
3218 if (r_u
->num_entries
!= 0 && r_u
->ptr_1
!= 0) {
3219 if(!samr_io_gids("gids", &r_u
->num_entries2
, &r_u
->gid
, ps
, depth
))
3226 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3232 /*******************************************************************
3233 inits a SAMR_Q_ENUM_DOMAINS structure.
3234 ********************************************************************/
3236 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS
* q_e
,
3238 uint32 start_idx
, uint32 size
)
3240 DEBUG(5, ("init_samr_q_enum_domains\n"));
3244 q_e
->start_idx
= start_idx
;
3245 q_e
->max_size
= size
;
3248 /*******************************************************************
3249 reads or writes a structure.
3250 ********************************************************************/
3252 BOOL
samr_io_q_enum_domains(const char *desc
, SAMR_Q_ENUM_DOMAINS
* q_e
,
3253 prs_struct
*ps
, int depth
)
3258 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_domains");
3264 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3267 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3269 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3275 /*******************************************************************
3276 inits a SAMR_R_ENUM_DOMAINS structure.
3277 ********************************************************************/
3279 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS
* r_u
,
3280 uint32 next_idx
, uint32 num_sam_entries
)
3282 DEBUG(5, ("init_samr_r_enum_domains\n"));
3284 r_u
->next_idx
= next_idx
;
3286 if (num_sam_entries
!= 0) {
3287 r_u
->ptr_entries1
= 1;
3288 r_u
->ptr_entries2
= 1;
3289 r_u
->num_entries2
= num_sam_entries
;
3290 r_u
->num_entries3
= num_sam_entries
;
3292 r_u
->num_entries4
= num_sam_entries
;
3294 r_u
->ptr_entries1
= 0;
3295 r_u
->num_entries2
= num_sam_entries
;
3296 r_u
->ptr_entries2
= 1;
3300 /*******************************************************************
3301 reads or writes a structure.
3302 ********************************************************************/
3304 BOOL
samr_io_r_enum_domains(const char *desc
, SAMR_R_ENUM_DOMAINS
* r_u
,
3305 prs_struct
*ps
, int depth
)
3312 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_domains");
3318 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3320 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3323 if (r_u
->ptr_entries1
!= 0) {
3324 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3326 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3328 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3331 if (UNMARSHALLING(ps
) && r_u
->num_entries2
) {
3332 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
,r_u
->num_entries2
);
3333 r_u
->uni_dom_name
= PRS_ALLOC_MEM(ps
,UNISTR2
,r_u
->num_entries2
);
3336 if ((r_u
->sam
== NULL
|| r_u
->uni_dom_name
== NULL
) && r_u
->num_entries2
!= 0) {
3337 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
3338 r_u
->num_entries4
= 0;
3339 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3343 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3345 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
3346 if(!sam_io_sam_entry(tmp
, &r_u
->sam
[i
], ps
, depth
))
3350 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3352 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
3353 if(!smb_io_unistr2(tmp
, &r_u
->uni_dom_name
[i
],
3354 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3363 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3365 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3371 /*******************************************************************
3372 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
3373 ********************************************************************/
3375 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
3377 uint32 start_idx
, uint32 size
)
3379 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
3383 q_e
->start_idx
= start_idx
;
3384 q_e
->max_size
= size
;
3387 /*******************************************************************
3388 reads or writes a structure.
3389 ********************************************************************/
3391 BOOL
samr_io_q_enum_dom_groups(const char *desc
, SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
3392 prs_struct
*ps
, int depth
)
3397 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_groups");
3403 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
3406 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3408 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3414 /*******************************************************************
3415 inits a SAMR_R_ENUM_DOM_GROUPS structure.
3416 ********************************************************************/
3418 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3419 uint32 next_idx
, uint32 num_sam_entries
)
3421 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
3423 r_u
->next_idx
= next_idx
;
3425 if (num_sam_entries
!= 0) {
3426 r_u
->ptr_entries1
= 1;
3427 r_u
->ptr_entries2
= 1;
3428 r_u
->num_entries2
= num_sam_entries
;
3429 r_u
->num_entries3
= num_sam_entries
;
3431 r_u
->num_entries4
= num_sam_entries
;
3433 r_u
->ptr_entries1
= 0;
3434 r_u
->num_entries2
= num_sam_entries
;
3435 r_u
->ptr_entries2
= 1;
3439 /*******************************************************************
3440 reads or writes a structure.
3441 ********************************************************************/
3443 BOOL
samr_io_r_enum_dom_groups(const char *desc
, SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3444 prs_struct
*ps
, int depth
)
3451 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_groups");
3457 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3459 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3462 if (r_u
->ptr_entries1
!= 0) {
3463 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3465 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3467 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3470 if (UNMARSHALLING(ps
) && r_u
->num_entries2
) {
3471 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
,r_u
->num_entries2
);
3472 r_u
->uni_grp_name
= PRS_ALLOC_MEM(ps
,UNISTR2
,r_u
->num_entries2
);
3475 if ((r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
) && r_u
->num_entries2
!= 0) {
3477 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3478 r_u
->num_entries4
= 0;
3479 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3483 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3484 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3488 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3489 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3490 r_u
->sam
[i
].hdr_name
.buffer
, ps
, depth
))
3497 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3499 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3505 /*******************************************************************
3506 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3507 ********************************************************************/
3509 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3510 POLICY_HND
*pol
, uint32 start_idx
,
3513 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3517 q_e
->start_idx
= start_idx
;
3518 q_e
->max_size
= size
;
3522 /*******************************************************************
3523 reads or writes a structure.
3524 ********************************************************************/
3526 BOOL
samr_io_q_enum_dom_aliases(const char *desc
, SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3527 prs_struct
*ps
, int depth
)
3532 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_aliases");
3538 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3541 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3543 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3549 /*******************************************************************
3550 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3551 ********************************************************************/
3553 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES
*r_u
, uint32 next_idx
, uint32 num_sam_entries
)
3555 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3557 r_u
->next_idx
= next_idx
;
3559 if (num_sam_entries
!= 0) {
3560 r_u
->ptr_entries1
= 1;
3561 r_u
->ptr_entries2
= 1;
3562 r_u
->num_entries2
= num_sam_entries
;
3563 r_u
->num_entries3
= num_sam_entries
;
3565 r_u
->num_entries4
= num_sam_entries
;
3567 r_u
->ptr_entries1
= 0;
3568 r_u
->num_entries2
= num_sam_entries
;
3569 r_u
->ptr_entries2
= 1;
3573 /*******************************************************************
3574 reads or writes a structure.
3575 ********************************************************************/
3577 BOOL
samr_io_r_enum_dom_aliases(const char *desc
, SAMR_R_ENUM_DOM_ALIASES
* r_u
,
3578 prs_struct
*ps
, int depth
)
3585 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_aliases");
3591 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3593 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3596 if (r_u
->ptr_entries1
!= 0) {
3597 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3599 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3601 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3604 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
> 0)) {
3605 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
,r_u
->num_entries2
);
3606 r_u
->uni_grp_name
= PRS_ALLOC_MEM(ps
,UNISTR2
,r_u
->num_entries2
);
3609 if (r_u
->num_entries2
!= 0 &&
3610 (r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
)) {
3611 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3612 r_u
->num_entries4
= 0;
3613 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3617 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3618 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3622 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3623 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3624 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3632 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3634 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3640 /*******************************************************************
3641 inits a ALIAS_INFO1 structure.
3642 ********************************************************************/
3644 void init_samr_alias_info1(ALIAS_INFO1
* al1
, char *acct_name
, uint32 num_member
, char *acct_desc
)
3646 DEBUG(5, ("init_samr_alias_info1\n"));
3648 init_unistr4(&al1
->name
, acct_name
, UNI_FLAGS_NONE
);
3649 al1
->num_member
= num_member
;
3650 init_unistr4(&al1
->description
, acct_desc
, UNI_FLAGS_NONE
);
3653 /*******************************************************************
3654 reads or writes a structure.
3655 ********************************************************************/
3657 BOOL
samr_io_alias_info1(const char *desc
, ALIAS_INFO1
* al1
,
3658 prs_struct
*ps
, int depth
)
3663 prs_debug(ps
, depth
, desc
, "samr_io_alias_info1");
3669 if ( !prs_unistr4_hdr("name", ps
, depth
, &al1
->name
) )
3671 if ( !prs_uint32("num_member", ps
, depth
, &al1
->num_member
) )
3673 if ( !prs_unistr4_hdr("description", ps
, depth
, &al1
->description
) )
3676 if ( !prs_unistr4_str("name", ps
, depth
, &al1
->name
) )
3678 if ( !prs_align(ps
) )
3680 if ( !prs_unistr4_str("description", ps
, depth
, &al1
->description
) )
3682 if ( !prs_align(ps
) )
3688 /*******************************************************************
3689 inits a ALIAS_INFO3 structure.
3690 ********************************************************************/
3692 void init_samr_alias_info3(ALIAS_INFO3
* al3
, const char *acct_desc
)
3694 DEBUG(5, ("init_samr_alias_info3\n"));
3696 init_unistr4(&al3
->description
, acct_desc
, UNI_FLAGS_NONE
);
3699 /*******************************************************************
3700 reads or writes a structure.
3701 ********************************************************************/
3703 BOOL
samr_io_alias_info3(const char *desc
, ALIAS_INFO3
*al3
,
3704 prs_struct
*ps
, int depth
)
3709 prs_debug(ps
, depth
, desc
, "samr_io_alias_info3");
3715 if (!prs_unistr4("description", ps
, depth
, &al3
->description
))
3721 /*******************************************************************
3722 reads or writes a structure.
3723 ********************************************************************/
3725 BOOL
samr_io_alias_info2(const char *desc
, ALIAS_INFO2
*al2
,
3726 prs_struct
*ps
, int depth
)
3731 prs_debug(ps
, depth
, desc
, "samr_io_alias_info2");
3737 if (!prs_unistr4("name", ps
, depth
, &al2
->name
))
3743 /*******************************************************************
3744 reads or writes a structure.
3745 ********************************************************************/
3747 BOOL
samr_alias_info_ctr(const char *desc
, prs_struct
*ps
, int depth
, ALIAS_INFO_CTR
* ctr
)
3752 prs_debug(ps
, depth
, desc
, "samr_alias_info_ctr");
3755 if ( !prs_uint16("level", ps
, depth
, &ctr
->level
) )
3760 switch (ctr
->level
) {
3762 if(!samr_io_alias_info1("alias_info1", &ctr
->alias
.info1
, ps
, depth
))
3766 if(!samr_io_alias_info2("alias_info2", &ctr
->alias
.info2
, ps
, depth
))
3770 if(!samr_io_alias_info3("alias_info3", &ctr
->alias
.info3
, ps
, depth
))
3774 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3781 /*******************************************************************
3782 inits a SAMR_Q_QUERY_ALIASINFO structure.
3783 ********************************************************************/
3785 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO
* q_e
,
3786 POLICY_HND
*pol
, uint32 switch_level
)
3788 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3791 q_e
->level
= switch_level
;
3794 /*******************************************************************
3795 reads or writes a structure.
3796 ********************************************************************/
3798 BOOL
samr_io_q_query_aliasinfo(const char *desc
, SAMR_Q_QUERY_ALIASINFO
*in
,
3799 prs_struct
*ps
, int depth
)
3804 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasinfo");
3810 if ( !smb_io_pol_hnd("pol", &(in
->pol
), ps
, depth
) )
3813 if ( !prs_uint16("level", ps
, depth
, &in
->level
) )
3819 /*******************************************************************
3820 inits a SAMR_R_QUERY_ALIASINFO structure.
3821 ********************************************************************/
3823 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO
*out
,
3824 ALIAS_INFO_CTR
* ctr
, NTSTATUS status
)
3826 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3829 out
->status
= status
;
3832 /*******************************************************************
3833 reads or writes a structure.
3834 ********************************************************************/
3836 BOOL
samr_io_r_query_aliasinfo(const char *desc
, SAMR_R_QUERY_ALIASINFO
*out
,
3837 prs_struct
*ps
, int depth
)
3842 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasinfo");
3848 if ( !prs_pointer("alias", ps
, depth
, (void*)&out
->ctr
, sizeof(ALIAS_INFO_CTR
), (PRS_POINTER_CAST
)samr_alias_info_ctr
))
3853 if(!prs_ntstatus("status", ps
, depth
, &out
->status
))
3859 /*******************************************************************
3860 inits a SAMR_Q_SET_ALIASINFO structure.
3861 ********************************************************************/
3863 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO
* q_u
,
3864 POLICY_HND
*hnd
, ALIAS_INFO_CTR
* ctr
)
3866 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3868 q_u
->alias_pol
= *hnd
;
3872 /*******************************************************************
3873 reads or writes a structure.
3874 ********************************************************************/
3876 BOOL
samr_io_q_set_aliasinfo(const char *desc
, SAMR_Q_SET_ALIASINFO
* q_u
,
3877 prs_struct
*ps
, int depth
)
3882 prs_debug(ps
, depth
, desc
, "samr_io_q_set_aliasinfo");
3888 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
3890 if(!samr_alias_info_ctr("ctr", ps
, depth
, &q_u
->ctr
))
3896 /*******************************************************************
3897 reads or writes a structure.
3898 ********************************************************************/
3900 BOOL
samr_io_r_set_aliasinfo(const char *desc
, SAMR_R_SET_ALIASINFO
* r_u
,
3901 prs_struct
*ps
, int depth
)
3906 prs_debug(ps
, depth
, desc
, "samr_io_r_set_aliasinfo");
3911 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3917 /*******************************************************************
3918 inits a SAMR_Q_QUERY_USERALIASES structure.
3919 ********************************************************************/
3921 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES
* q_u
,
3924 uint32
*ptr_sid
, DOM_SID2
* sid
)
3926 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3930 q_u
->num_sids1
= num_sids
;
3932 q_u
->num_sids2
= num_sids
;
3934 q_u
->ptr_sid
= ptr_sid
;
3938 /*******************************************************************
3939 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3940 ********************************************************************/
3942 BOOL
samr_io_q_query_useraliases(const char *desc
, SAMR_Q_QUERY_USERALIASES
* q_u
,
3943 prs_struct
*ps
, int depth
)
3951 prs_debug(ps
, depth
, desc
, "samr_io_q_query_useraliases");
3957 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3960 if(!prs_uint32("num_sids1", ps
, depth
, &q_u
->num_sids1
))
3962 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3968 if(!prs_uint32("num_sids2", ps
, depth
, &q_u
->num_sids2
))
3971 if (UNMARSHALLING(ps
) && (q_u
->num_sids2
!= 0)) {
3972 q_u
->ptr_sid
= PRS_ALLOC_MEM(ps
,uint32
,q_u
->num_sids2
);
3973 if (q_u
->ptr_sid
== NULL
)
3976 q_u
->sid
= PRS_ALLOC_MEM(ps
, DOM_SID2
, q_u
->num_sids2
);
3977 if (q_u
->sid
== NULL
)
3981 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3982 slprintf(tmp
, sizeof(tmp
) - 1, "ptr[%02d]", i
);
3983 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->ptr_sid
[i
]))
3987 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3988 if (q_u
->ptr_sid
[i
] != 0) {
3989 slprintf(tmp
, sizeof(tmp
) - 1, "sid[%02d]", i
);
3990 if(!smb_io_dom_sid2(tmp
, &q_u
->sid
[i
], ps
, depth
))
3998 /*******************************************************************
3999 inits a SAMR_R_QUERY_USERALIASES structure.
4000 ********************************************************************/
4002 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES
* r_u
,
4003 uint32 num_rids
, uint32
*rid
,
4006 DEBUG(5, ("init_samr_r_query_useraliases\n"));
4008 if (NT_STATUS_IS_OK(status
)) {
4009 r_u
->num_entries
= num_rids
;
4011 r_u
->num_entries2
= num_rids
;
4015 r_u
->num_entries
= 0;
4017 r_u
->num_entries2
= 0;
4020 r_u
->status
= status
;
4023 /*******************************************************************
4024 reads or writes a structure.
4025 ********************************************************************/
4027 BOOL
samr_io_rids(const char *desc
, uint32
*num_rids
, uint32
**rid
,
4028 prs_struct
*ps
, int depth
)
4035 prs_debug(ps
, depth
, desc
, "samr_io_rids");
4041 if(!prs_uint32("num_rids", ps
, depth
, num_rids
))
4044 if ((*num_rids
) != 0) {
4045 if (UNMARSHALLING(ps
)) {
4047 (*rid
) = PRS_ALLOC_MEM(ps
,uint32
, *num_rids
);
4052 for (i
= 0; i
< (*num_rids
); i
++) {
4053 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d]", i
);
4054 if(!prs_uint32(tmp
, ps
, depth
, &((*rid
)[i
])))
4062 /*******************************************************************
4063 reads or writes a structure.
4064 ********************************************************************/
4066 BOOL
samr_io_r_query_useraliases(const char *desc
, SAMR_R_QUERY_USERALIASES
* r_u
,
4067 prs_struct
*ps
, int depth
)
4072 prs_debug(ps
, depth
, desc
, "samr_io_r_query_useraliases");
4078 if(!prs_uint32("num_entries", ps
, depth
, &r_u
->num_entries
))
4080 if(!prs_uint32("ptr ", ps
, depth
, &r_u
->ptr
))
4083 if (r_u
->ptr
!= 0) {
4084 if(!samr_io_rids("rids", &r_u
->num_entries2
, &r_u
->rid
, ps
, depth
))
4090 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4096 /*******************************************************************
4097 inits a SAMR_Q_OPEN_ALIAS structure.
4098 ********************************************************************/
4100 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS
* q_u
, POLICY_HND
*pol
,
4101 uint32 access_mask
, uint32 rid
)
4103 DEBUG(5, ("init_samr_q_open_alias\n"));
4105 q_u
->dom_pol
= *pol
;
4106 q_u
->access_mask
= access_mask
;
4107 q_u
->rid_alias
= rid
;
4110 /*******************************************************************
4111 reads or writes a structure.
4112 ********************************************************************/
4114 BOOL
samr_io_q_open_alias(const char *desc
, SAMR_Q_OPEN_ALIAS
* q_u
,
4115 prs_struct
*ps
, int depth
)
4120 prs_debug(ps
, depth
, desc
, "samr_io_q_open_alias");
4126 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
4129 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4131 if(!prs_uint32("rid_alias", ps
, depth
, &q_u
->rid_alias
))
4137 /*******************************************************************
4138 reads or writes a structure.
4139 ********************************************************************/
4141 BOOL
samr_io_r_open_alias(const char *desc
, SAMR_R_OPEN_ALIAS
* r_u
,
4142 prs_struct
*ps
, int depth
)
4147 prs_debug(ps
, depth
, desc
, "samr_io_r_open_alias");
4153 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
4156 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4162 /*******************************************************************
4163 inits a SAMR_Q_LOOKUP_RIDS structure.
4164 ********************************************************************/
4166 void init_samr_q_lookup_rids(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_RIDS
* q_u
,
4167 POLICY_HND
*pol
, uint32 flags
,
4168 uint32 num_rids
, uint32
*rid
)
4170 DEBUG(5, ("init_samr_q_lookup_rids\n"));
4174 q_u
->num_rids1
= num_rids
;
4177 q_u
->num_rids2
= num_rids
;
4179 q_u
->rid
= TALLOC_ZERO_ARRAY(ctx
, uint32
, num_rids
);
4183 if (q_u
->rid
== NULL
) {
4187 memcpy(q_u
->rid
, rid
, num_rids
* sizeof(q_u
->rid
[0]));
4191 /*******************************************************************
4192 reads or writes a structure.
4193 ********************************************************************/
4195 BOOL
samr_io_q_lookup_rids(const char *desc
, SAMR_Q_LOOKUP_RIDS
* q_u
,
4196 prs_struct
*ps
, int depth
)
4204 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_rids");
4207 if (UNMARSHALLING(ps
))
4213 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4216 if(!prs_uint32("num_rids1", ps
, depth
, &q_u
->num_rids1
))
4218 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
4220 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
4222 if(!prs_uint32("num_rids2", ps
, depth
, &q_u
->num_rids2
))
4225 if (UNMARSHALLING(ps
) && (q_u
->num_rids2
!= 0)) {
4226 q_u
->rid
= PRS_ALLOC_MEM(ps
, uint32
, q_u
->num_rids2
);
4227 if (q_u
->rid
== NULL
)
4231 for (i
= 0; i
< q_u
->num_rids2
; i
++) {
4232 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
4233 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->rid
[i
]))
4240 /*******************************************************************
4241 inits a SAMR_R_LOOKUP_RIDS structure.
4242 ********************************************************************/
4244 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS
* r_u
,
4245 uint32 num_names
, UNIHDR
* hdr_name
,
4246 UNISTR2
*uni_name
, uint32
*type
)
4248 DEBUG(5, ("init_samr_r_lookup_rids\n"));
4250 r_u
->hdr_name
= NULL
;
4251 r_u
->uni_name
= NULL
;
4254 if (num_names
!= 0) {
4255 r_u
->num_names1
= num_names
;
4257 r_u
->num_names2
= num_names
;
4259 r_u
->num_types1
= num_names
;
4261 r_u
->num_types2
= num_names
;
4263 r_u
->hdr_name
= hdr_name
;
4264 r_u
->uni_name
= uni_name
;
4267 r_u
->num_names1
= num_names
;
4269 r_u
->num_names2
= num_names
;
4271 r_u
->num_types1
= num_names
;
4273 r_u
->num_types2
= num_names
;
4277 /*******************************************************************
4278 reads or writes a structure.
4279 ********************************************************************/
4281 BOOL
samr_io_r_lookup_rids(const char *desc
, SAMR_R_LOOKUP_RIDS
* r_u
,
4282 prs_struct
*ps
, int depth
)
4289 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_rids");
4295 if(!prs_uint32("num_names1", ps
, depth
, &r_u
->num_names1
))
4297 if(!prs_uint32("ptr_names ", ps
, depth
, &r_u
->ptr_names
))
4300 if (r_u
->ptr_names
!= 0) {
4302 if(!prs_uint32("num_names2", ps
, depth
, &r_u
->num_names2
))
4306 if (UNMARSHALLING(ps
) && (r_u
->num_names2
!= 0)) {
4307 r_u
->hdr_name
= PRS_ALLOC_MEM(ps
, UNIHDR
, r_u
->num_names2
);
4308 if (r_u
->hdr_name
== NULL
)
4311 r_u
->uni_name
= PRS_ALLOC_MEM(ps
, UNISTR2
, r_u
->num_names2
);
4312 if (r_u
->uni_name
== NULL
)
4316 for (i
= 0; i
< r_u
->num_names2
; i
++) {
4317 slprintf(tmp
, sizeof(tmp
) - 1, "hdr[%02d] ", i
);
4318 if(!smb_io_unihdr("", &r_u
->hdr_name
[i
], ps
, depth
))
4321 for (i
= 0; i
< r_u
->num_names2
; i
++) {
4322 slprintf(tmp
, sizeof(tmp
) - 1, "str[%02d] ", i
);
4323 if(!smb_io_unistr2("", &r_u
->uni_name
[i
], r_u
->hdr_name
[i
].buffer
, ps
, depth
))
4331 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
4333 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
4336 if (r_u
->ptr_types
!= 0) {
4338 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
4341 if (UNMARSHALLING(ps
) && (r_u
->num_types2
!= 0)) {
4342 r_u
->type
= PRS_ALLOC_MEM(ps
, uint32
, r_u
->num_types2
);
4343 if (r_u
->type
== NULL
)
4347 for (i
= 0; i
< r_u
->num_types2
; i
++) {
4348 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
4349 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->type
[i
]))
4354 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4360 /*******************************************************************
4361 inits a SAMR_Q_OPEN_ALIAS structure.
4362 ********************************************************************/
4364 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_u
, POLICY_HND
*hnd
)
4366 DEBUG(5, ("init_samr_q_delete_alias\n"));
4368 q_u
->alias_pol
= *hnd
;
4371 /*******************************************************************
4372 reads or writes a structure.
4373 ********************************************************************/
4375 BOOL
samr_io_q_delete_alias(const char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4376 prs_struct
*ps
, int depth
)
4381 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_alias");
4387 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4393 /*******************************************************************
4394 reads or writes a structure.
4395 ********************************************************************/
4397 BOOL
samr_io_r_delete_alias(const char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4398 prs_struct
*ps
, int depth
)
4403 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_alias");
4409 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
4411 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4417 /*******************************************************************
4418 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
4419 ********************************************************************/
4421 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
4422 POLICY_HND
*hnd
, const char *acct_desc
)
4424 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
4426 q_u
->dom_pol
= *hnd
;
4428 init_unistr2(&q_u
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
4429 init_uni_hdr(&q_u
->hdr_acct_desc
, &q_u
->uni_acct_desc
);
4431 q_u
->access_mask
= MAXIMUM_ALLOWED_ACCESS
;
4434 /*******************************************************************
4435 reads or writes a structure.
4436 ********************************************************************/
4438 BOOL
samr_io_q_create_dom_alias(const char *desc
, SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
4439 prs_struct
*ps
, int depth
)
4444 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_alias");
4450 if(!smb_io_pol_hnd("dom_pol", &q_u
->dom_pol
, ps
, depth
))
4453 if(!smb_io_unihdr("hdr_acct_desc", &q_u
->hdr_acct_desc
, ps
, depth
))
4455 if(!smb_io_unistr2("uni_acct_desc", &q_u
->uni_acct_desc
,
4456 q_u
->hdr_acct_desc
.buffer
, ps
, depth
))
4461 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4467 /*******************************************************************
4468 reads or writes a structure.
4469 ********************************************************************/
4471 BOOL
samr_io_r_create_dom_alias(const char *desc
, SAMR_R_CREATE_DOM_ALIAS
* r_u
,
4472 prs_struct
*ps
, int depth
)
4477 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_alias");
4483 if(!smb_io_pol_hnd("alias_pol", &r_u
->alias_pol
, ps
, depth
))
4486 if(!prs_uint32("rid", ps
, depth
, &r_u
->rid
))
4489 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4495 /*******************************************************************
4496 inits a SAMR_Q_ADD_ALIASMEM structure.
4497 ********************************************************************/
4499 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4502 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
4504 q_u
->alias_pol
= *hnd
;
4505 init_dom_sid2(&q_u
->sid
, sid
);
4508 /*******************************************************************
4509 reads or writes a structure.
4510 ********************************************************************/
4512 BOOL
samr_io_q_add_aliasmem(const char *desc
, SAMR_Q_ADD_ALIASMEM
* q_u
,
4513 prs_struct
*ps
, int depth
)
4518 prs_debug(ps
, depth
, desc
, "samr_io_q_add_aliasmem");
4524 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4526 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4532 /*******************************************************************
4533 reads or writes a structure.
4534 ********************************************************************/
4536 BOOL
samr_io_r_add_aliasmem(const char *desc
, SAMR_R_ADD_ALIASMEM
* r_u
,
4537 prs_struct
*ps
, int depth
)
4542 prs_debug(ps
, depth
, desc
, "samr_io_r_add_aliasmem");
4548 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4554 /*******************************************************************
4555 inits a SAMR_Q_DEL_ALIASMEM structure.
4556 ********************************************************************/
4558 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4561 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4563 q_u
->alias_pol
= *hnd
;
4564 init_dom_sid2(&q_u
->sid
, sid
);
4567 /*******************************************************************
4568 reads or writes a structure.
4569 ********************************************************************/
4571 BOOL
samr_io_q_del_aliasmem(const char *desc
, SAMR_Q_DEL_ALIASMEM
* q_u
,
4572 prs_struct
*ps
, int depth
)
4577 prs_debug(ps
, depth
, desc
, "samr_io_q_del_aliasmem");
4583 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4585 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4591 /*******************************************************************
4592 reads or writes a structure.
4593 ********************************************************************/
4595 BOOL
samr_io_r_del_aliasmem(const char *desc
, SAMR_R_DEL_ALIASMEM
* r_u
,
4596 prs_struct
*ps
, int depth
)
4601 prs_debug(ps
, depth
, desc
, "samr_io_r_del_aliasmem");
4607 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4613 /*******************************************************************
4614 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4615 ********************************************************************/
4617 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_c
,
4620 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4622 q_c
->alias_pol
= *hnd
;
4625 /*******************************************************************
4626 reads or writes a structure.
4627 ********************************************************************/
4629 BOOL
samr_io_q_delete_dom_alias(const char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4630 prs_struct
*ps
, int depth
)
4635 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_alias");
4641 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4647 /*******************************************************************
4648 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4649 ********************************************************************/
4651 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4654 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4656 r_u
->status
= status
;
4659 /*******************************************************************
4660 reads or writes a structure.
4661 ********************************************************************/
4663 BOOL
samr_io_r_delete_dom_alias(const char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4664 prs_struct
*ps
, int depth
)
4669 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_alias");
4675 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
4678 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4684 /*******************************************************************
4685 inits a SAMR_Q_QUERY_ALIASMEM structure.
4686 ********************************************************************/
4688 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM
* q_c
,
4691 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4693 q_c
->alias_pol
= *hnd
;
4696 /*******************************************************************
4697 reads or writes a structure.
4698 ********************************************************************/
4700 BOOL
samr_io_q_query_aliasmem(const char *desc
, SAMR_Q_QUERY_ALIASMEM
* q_u
,
4701 prs_struct
*ps
, int depth
)
4706 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasmem");
4712 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4718 /*******************************************************************
4719 inits a SAMR_R_QUERY_ALIASMEM structure.
4720 ********************************************************************/
4722 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM
* r_u
,
4723 uint32 num_sids
, DOM_SID2
* sid
,
4726 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4728 if (NT_STATUS_IS_OK(status
)) {
4729 r_u
->num_sids
= num_sids
;
4730 r_u
->ptr
= (num_sids
!= 0) ? 1 : 0;
4731 r_u
->num_sids1
= num_sids
;
4739 r_u
->status
= status
;
4742 /*******************************************************************
4743 reads or writes a structure.
4744 ********************************************************************/
4746 BOOL
samr_io_r_query_aliasmem(const char *desc
, SAMR_R_QUERY_ALIASMEM
* r_u
,
4747 prs_struct
*ps
, int depth
)
4754 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasmem");
4760 if(!prs_uint32("num_sids ", ps
, depth
, &r_u
->num_sids
))
4762 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
4765 if (r_u
->ptr
!= 0 && r_u
->num_sids
!= 0) {
4766 uint32
*ptr_sid
= NULL
;
4768 if(!prs_uint32("num_sids1", ps
, depth
, &r_u
->num_sids1
))
4771 /* We must always use talloc here even when marshalling. */
4772 if (r_u
->num_sids1
) {
4773 ptr_sid
= TALLOC_ARRAY(ps
->mem_ctx
, uint32
, r_u
->num_sids1
);
4781 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4783 if(!prs_uint32("ptr_sid", ps
, depth
, &ptr_sid
[i
]))
4787 if (UNMARSHALLING(ps
)) {
4788 if (r_u
->num_sids1
) {
4789 r_u
->sid
= TALLOC_ARRAY(ps
->mem_ctx
, DOM_SID2
, r_u
->num_sids1
);
4798 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4799 if (ptr_sid
[i
] != 0) {
4800 if(!smb_io_dom_sid2("sid", &r_u
->sid
[i
], ps
, depth
))
4808 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4814 /*******************************************************************
4815 inits a SAMR_Q_LOOKUP_NAMES structure.
4816 ********************************************************************/
4818 NTSTATUS
init_samr_q_lookup_names(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4819 POLICY_HND
*pol
, uint32 flags
,
4820 uint32 num_names
, const char **name
)
4824 DEBUG(5, ("init_samr_q_lookup_names\n"));
4828 q_u
->num_names1
= num_names
;
4831 q_u
->num_names2
= num_names
;
4834 if (!(q_u
->hdr_name
= TALLOC_ZERO_ARRAY(ctx
, UNIHDR
, num_names
)))
4835 return NT_STATUS_NO_MEMORY
;
4837 if (!(q_u
->uni_name
= TALLOC_ZERO_ARRAY(ctx
, UNISTR2
, num_names
)))
4838 return NT_STATUS_NO_MEMORY
;
4840 q_u
->hdr_name
= NULL
;
4841 q_u
->uni_name
= NULL
;
4844 for (i
= 0; i
< num_names
; i
++) {
4845 init_unistr2(&q_u
->uni_name
[i
], name
[i
], UNI_FLAGS_NONE
); /* unicode string for machine account */
4846 init_uni_hdr(&q_u
->hdr_name
[i
], &q_u
->uni_name
[i
]); /* unicode header for user_name */
4849 return NT_STATUS_OK
;
4852 /*******************************************************************
4853 reads or writes a structure.
4854 ********************************************************************/
4856 BOOL
samr_io_q_lookup_names(const char *desc
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4857 prs_struct
*ps
, int depth
)
4864 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_names");
4867 if (UNMARSHALLING(ps
))
4873 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4876 if(!prs_uint32("num_names1", ps
, depth
, &q_u
->num_names1
))
4878 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
4880 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
4882 if(!prs_uint32("num_names2", ps
, depth
, &q_u
->num_names2
))
4885 if (UNMARSHALLING(ps
) && (q_u
->num_names2
!= 0)) {
4886 q_u
->hdr_name
= PRS_ALLOC_MEM(ps
, UNIHDR
, q_u
->num_names2
);
4887 q_u
->uni_name
= PRS_ALLOC_MEM(ps
, UNISTR2
, q_u
->num_names2
);
4888 if (!q_u
->hdr_name
|| !q_u
->uni_name
)
4892 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4893 if(!smb_io_unihdr("", &q_u
->hdr_name
[i
], ps
, depth
))
4897 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4898 if(!smb_io_unistr2("", &q_u
->uni_name
[i
], q_u
->hdr_name
[i
].buffer
, ps
, depth
))
4905 /*******************************************************************
4906 inits a SAMR_R_LOOKUP_NAMES structure.
4907 ********************************************************************/
4909 NTSTATUS
init_samr_r_lookup_names(TALLOC_CTX
*ctx
, SAMR_R_LOOKUP_NAMES
* r_u
,
4911 uint32
*rid
, enum lsa_SidType
*type
,
4914 DEBUG(5, ("init_samr_r_lookup_names\n"));
4916 if (NT_STATUS_IS_OK(status
) && (num_rids
!= 0)) {
4919 r_u
->num_types1
= num_rids
;
4921 r_u
->num_types2
= num_rids
;
4923 r_u
->num_rids1
= num_rids
;
4925 r_u
->num_rids2
= num_rids
;
4928 if (!(r_u
->rids
= TALLOC_ZERO_ARRAY(ctx
, uint32
, num_rids
)))
4929 return NT_STATUS_NO_MEMORY
;
4930 if (!(r_u
->types
= TALLOC_ZERO_ARRAY(ctx
, uint32
, num_rids
)))
4931 return NT_STATUS_NO_MEMORY
;
4937 if (!r_u
->rids
|| !r_u
->types
)
4940 for (i
= 0; i
< num_rids
; i
++) {
4941 r_u
->rids
[i
] = rid
[i
];
4942 r_u
->types
[i
] = type
[i
];
4947 r_u
->num_types1
= 0;
4949 r_u
->num_types2
= 0;
4959 r_u
->status
= status
;
4961 return NT_STATUS_OK
;
4964 /*******************************************************************
4965 reads or writes a structure.
4966 ********************************************************************/
4968 BOOL
samr_io_r_lookup_names(const char *desc
, SAMR_R_LOOKUP_NAMES
* r_u
,
4969 prs_struct
*ps
, int depth
)
4977 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_names");
4980 if (UNMARSHALLING(ps
))
4986 if(!prs_uint32("num_rids1", ps
, depth
, &r_u
->num_rids1
))
4988 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
4991 if (r_u
->ptr_rids
!= 0) {
4992 if(!prs_uint32("num_rids2", ps
, depth
, &r_u
->num_rids2
))
4995 if (r_u
->num_rids2
!= r_u
->num_rids1
) {
5000 if (UNMARSHALLING(ps
) && r_u
->num_rids2
) {
5001 r_u
->rids
= PRS_ALLOC_MEM(ps
, uint32
, r_u
->num_rids2
);
5004 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
5009 for (i
= 0; i
< r_u
->num_rids2
; i
++) {
5010 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
5011 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->rids
[i
]))
5016 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
5018 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
5021 if (r_u
->ptr_types
!= 0) {
5022 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
5025 if (r_u
->num_types2
!= r_u
->num_types1
) {
5030 if (UNMARSHALLING(ps
) && r_u
->num_types2
) {
5031 r_u
->types
= PRS_ALLOC_MEM(ps
, uint32
, r_u
->num_types2
);
5034 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
5039 for (i
= 0; i
< r_u
->num_types2
; i
++) {
5040 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
5041 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->types
[i
]))
5046 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
5052 /*******************************************************************
5053 inits a SAMR_Q_DELETE_DOM_USER structure.
5054 ********************************************************************/
5056 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER
* q_c
,
5059 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
5061 q_c
->user_pol
= *hnd
;
5064 /*******************************************************************
5065 reads or writes a structure.
5066 ********************************************************************/
5068 BOOL
samr_io_q_delete_dom_user(const char *desc
, SAMR_Q_DELETE_DOM_USER
* q_u
,
5069 prs_struct
*ps
, int depth
)
5074 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_user");
5080 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
5086 /*******************************************************************
5087 reads or writes a structure.
5088 ********************************************************************/
5090 BOOL
samr_io_r_delete_dom_user(const char *desc
, SAMR_R_DELETE_DOM_USER
* r_u
,
5091 prs_struct
*ps
, int depth
)
5096 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_user");
5102 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
5104 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
5110 /*******************************************************************
5111 reads or writes a structure.
5112 ********************************************************************/
5114 void init_samr_q_open_user(SAMR_Q_OPEN_USER
* q_u
,
5116 uint32 access_mask
, uint32 rid
)
5118 DEBUG(5, ("samr_init_samr_q_open_user\n"));
5120 q_u
->domain_pol
= *pol
;
5121 q_u
->access_mask
= access_mask
;
5122 q_u
->user_rid
= rid
;
5125 /*******************************************************************
5126 reads or writes a structure.
5127 ********************************************************************/
5129 BOOL
samr_io_q_open_user(const char *desc
, SAMR_Q_OPEN_USER
* q_u
,
5130 prs_struct
*ps
, int depth
)
5135 prs_debug(ps
, depth
, desc
, "samr_io_q_open_user");
5141 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
5144 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
5146 if(!prs_uint32("user_rid ", ps
, depth
, &q_u
->user_rid
))
5152 /*******************************************************************
5153 reads or writes a structure.
5154 ********************************************************************/
5156 BOOL
samr_io_r_open_user(const char *desc
, SAMR_R_OPEN_USER
* r_u
,
5157 prs_struct
*ps
, int depth
)
5162 prs_debug(ps
, depth
, desc
, "samr_io_r_open_user");
5168 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
5171 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
5178 /*******************************************************************
5179 reads or writes a structure.
5180 ********************************************************************/
5182 void init_samr_q_create_user(SAMR_Q_CREATE_USER
* q_u
,
5185 uint32 acb_info
, uint32 acct_flags
)
5187 DEBUG(5, ("samr_init_samr_q_create_user\n"));
5189 q_u
->domain_pol
= *pol
;
5191 init_unistr2(&q_u
->uni_name
, name
, UNI_FLAGS_NONE
);
5192 init_uni_hdr(&q_u
->hdr_name
, &q_u
->uni_name
);
5194 q_u
->acb_info
= acb_info
;
5195 q_u
->acct_flags
= acct_flags
;
5198 /*******************************************************************
5199 reads or writes a structure.
5200 ********************************************************************/
5202 BOOL
samr_io_q_create_user(const char *desc
, SAMR_Q_CREATE_USER
* q_u
,
5203 prs_struct
*ps
, int depth
)
5208 prs_debug(ps
, depth
, desc
, "samr_io_q_create_user");
5214 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
5217 if(!smb_io_unihdr("hdr_name", &q_u
->hdr_name
, ps
, depth
))
5219 if(!smb_io_unistr2("uni_name", &q_u
->uni_name
, q_u
->hdr_name
.buffer
, ps
, depth
))
5224 if(!prs_uint32("acb_info ", ps
, depth
, &q_u
->acb_info
))
5226 if(!prs_uint32("acct_flags", ps
, depth
, &q_u
->acct_flags
))
5232 /*******************************************************************
5233 reads or writes a structure.
5234 ********************************************************************/
5236 BOOL
samr_io_r_create_user(const char *desc
, SAMR_R_CREATE_USER
* r_u
,
5237 prs_struct
*ps
, int depth
)
5242 prs_debug(ps
, depth
, desc
, "samr_io_r_create_user");
5248 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
5251 if(!prs_uint32("access_granted", ps
, depth
, &r_u
->access_granted
))
5253 if(!prs_uint32("user_rid ", ps
, depth
, &r_u
->user_rid
))
5255 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
5261 /*******************************************************************
5262 inits a SAMR_Q_QUERY_USERINFO structure.
5263 ********************************************************************/
5265 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO
* q_u
,
5266 const POLICY_HND
*hnd
, uint16 switch_value
)
5268 DEBUG(5, ("init_samr_q_query_userinfo\n"));
5271 q_u
->switch_value
= switch_value
;
5274 /*******************************************************************
5275 reads or writes a structure.
5276 ********************************************************************/
5278 BOOL
samr_io_q_query_userinfo(const char *desc
, SAMR_Q_QUERY_USERINFO
* q_u
,
5279 prs_struct
*ps
, int depth
)
5284 prs_debug(ps
, depth
, desc
, "samr_io_q_query_userinfo");
5290 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
5293 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
)) /* 0x0015 or 0x0011 */
5299 /*******************************************************************
5300 reads or writes a LOGON_HRS structure.
5301 ********************************************************************/
5303 static BOOL
sam_io_logon_hrs(const char *desc
, LOGON_HRS
* hrs
,
5304 prs_struct
*ps
, int depth
)
5309 prs_debug(ps
, depth
, desc
, "sam_io_logon_hrs");
5315 if(!prs_uint32("maxlen", ps
, depth
, &hrs
->max_len
))
5318 if(!prs_uint32("offset", ps
, depth
, &hrs
->offset
))
5321 if(!prs_uint32("len ", ps
, depth
, &hrs
->len
))
5324 if (hrs
->len
> sizeof(hrs
->hours
)) {
5325 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs
->len
));
5326 hrs
->len
= sizeof(hrs
->hours
);
5329 if(!prs_uint8s(False
, "hours", ps
, depth
, hrs
->hours
, hrs
->len
))
5335 /*******************************************************************
5336 inits a SAM_USER_INFO_18 structure.
5337 ********************************************************************/
5339 void init_sam_user_info18(SAM_USER_INFO_18
* usr
,
5340 const uint8 lm_pwd
[16], const uint8 nt_pwd
[16])
5342 DEBUG(5, ("init_sam_user_info18\n"));
5344 usr
->lm_pwd_active
=
5345 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
)) ? 1 : 0;
5346 usr
->nt_pwd_active
=
5347 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
)) ? 1 : 0;
5350 /*******************************************************************
5351 reads or writes a structure.
5352 ********************************************************************/
5354 static BOOL
sam_io_user_info18(const char *desc
, SAM_USER_INFO_18
* u
,
5355 prs_struct
*ps
, int depth
)
5360 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info18");
5366 if(!prs_uint8s(False
, "lm_pwd", ps
, depth
, u
->lm_pwd
, sizeof(u
->lm_pwd
)))
5368 if(!prs_uint8s(False
, "nt_pwd", ps
, depth
, u
->nt_pwd
, sizeof(u
->nt_pwd
)))
5371 if(!prs_uint8("lm_pwd_active", ps
, depth
, &u
->lm_pwd_active
))
5373 if(!prs_uint8("nt_pwd_active", ps
, depth
, &u
->nt_pwd_active
))
5379 /*******************************************************************
5380 inits a SAM_USER_INFO_7 structure.
5381 ********************************************************************/
5383 void init_sam_user_info7(SAM_USER_INFO_7
* usr
, const char *name
)
5385 DEBUG(5, ("init_sam_user_info7\n"));
5387 init_unistr2(&usr
->uni_name
, name
, UNI_FLAGS_NONE
); /* unicode string for name */
5388 init_uni_hdr(&usr
->hdr_name
, &usr
->uni_name
); /* unicode header for name */
5392 /*******************************************************************
5393 reads or writes a structure.
5394 ********************************************************************/
5396 static BOOL
sam_io_user_info7(const char *desc
, SAM_USER_INFO_7
* usr
,
5397 prs_struct
*ps
, int depth
)
5402 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info7");
5408 if(!smb_io_unihdr("unihdr", &usr
->hdr_name
, ps
, depth
))
5411 if(!smb_io_unistr2("unistr2", &usr
->uni_name
, True
, ps
, depth
))
5417 /*******************************************************************
5418 inits a SAM_USER_INFO_9 structure.
5419 ********************************************************************/
5421 void init_sam_user_info9(SAM_USER_INFO_9
* usr
, uint32 rid_group
)
5423 DEBUG(5, ("init_sam_user_info9\n"));
5425 usr
->rid_group
= rid_group
;
5428 /*******************************************************************
5429 reads or writes a structure.
5430 ********************************************************************/
5432 static BOOL
sam_io_user_info9(const char *desc
, SAM_USER_INFO_9
* usr
,
5433 prs_struct
*ps
, int depth
)
5438 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info9");
5444 if(!prs_uint32("rid_group", ps
, depth
, &usr
->rid_group
))
5450 /*******************************************************************
5451 inits a SAM_USER_INFO_16 structure.
5452 ********************************************************************/
5454 void init_sam_user_info16(SAM_USER_INFO_16
* usr
, uint32 acb_info
)
5456 DEBUG(5, ("init_sam_user_info16\n"));
5458 usr
->acb_info
= acb_info
;
5461 /*******************************************************************
5462 reads or writes a structure.
5463 ********************************************************************/
5465 static BOOL
sam_io_user_info16(const char *desc
, SAM_USER_INFO_16
* usr
,
5466 prs_struct
*ps
, int depth
)
5471 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info16");
5477 if(!prs_uint32("acb_info", ps
, depth
, &usr
->acb_info
))
5483 /*******************************************************************
5484 inits a SAM_USER_INFO_17 structure.
5485 ********************************************************************/
5487 void init_sam_user_info17(SAM_USER_INFO_17
* usr
,
5490 uint32 rid_user
, uint32 rid_group
, uint16 acct_ctrl
)
5492 DEBUG(5, ("init_sam_user_info17\n"));
5494 memcpy(&usr
->expiry
, expiry
, sizeof(usr
->expiry
)); /* expiry time or something? */
5495 ZERO_STRUCT(usr
->padding_1
); /* 0 - padding 24 bytes */
5497 usr
->padding_2
= 0; /* 0 - padding 4 bytes */
5499 usr
->ptr_1
= 1; /* pointer */
5500 ZERO_STRUCT(usr
->padding_3
); /* 0 - padding 32 bytes */
5501 usr
->padding_4
= 0; /* 0 - padding 4 bytes */
5503 usr
->ptr_2
= 1; /* pointer */
5504 usr
->padding_5
= 0; /* 0 - padding 4 bytes */
5506 usr
->ptr_3
= 1; /* pointer */
5507 ZERO_STRUCT(usr
->padding_6
); /* 0 - padding 32 bytes */
5509 usr
->rid_user
= rid_user
;
5510 usr
->rid_group
= rid_group
;
5512 usr
->acct_ctrl
= acct_ctrl
;
5513 usr
->unknown_3
= 0x0000;
5515 usr
->unknown_4
= 0x003f; /* 0x003f - 16 bit unknown */
5516 usr
->unknown_5
= 0x003c; /* 0x003c - 16 bit unknown */
5518 ZERO_STRUCT(usr
->padding_7
); /* 0 - padding 16 bytes */
5519 usr
->padding_8
= 0; /* 0 - padding 4 bytes */
5521 init_unistr2(&usr
->uni_mach_acct
, mach_acct
, UNI_FLAGS_NONE
); /* unicode string for machine account */
5522 init_uni_hdr(&usr
->hdr_mach_acct
, &usr
->uni_mach_acct
); /* unicode header for machine account */
5525 /*******************************************************************
5526 reads or writes a structure.
5527 ********************************************************************/
5529 static BOOL
sam_io_user_info17(const char *desc
, SAM_USER_INFO_17
* usr
,
5530 prs_struct
*ps
, int depth
)
5535 prs_debug(ps
, depth
, desc
, "samr_io_r_unknown_17");
5541 if(!prs_uint8s(False
, "padding_0", ps
, depth
, usr
->padding_0
, sizeof(usr
->padding_0
)))
5544 if(!smb_io_time("time", &usr
->expiry
, ps
, depth
))
5547 if(!prs_uint8s(False
, "padding_1", ps
, depth
, usr
->padding_1
, sizeof(usr
->padding_1
)))
5550 if(!smb_io_unihdr("unihdr", &usr
->hdr_mach_acct
, ps
, depth
))
5553 if(!prs_uint32("padding_2", ps
, depth
, &usr
->padding_2
))
5556 if(!prs_uint32("ptr_1 ", ps
, depth
, &usr
->ptr_1
))
5558 if(!prs_uint8s(False
, "padding_3", ps
, depth
, usr
->padding_3
, sizeof(usr
->padding_3
)))
5561 if(!prs_uint32("padding_4", ps
, depth
, &usr
->padding_4
))
5564 if(!prs_uint32("ptr_2 ", ps
, depth
, &usr
->ptr_2
))
5566 if(!prs_uint32("padding_5", ps
, depth
, &usr
->padding_5
))
5569 if(!prs_uint32("ptr_3 ", ps
, depth
, &usr
->ptr_3
))
5571 if(!prs_uint8s(False
, "padding_6", ps
, depth
, usr
->padding_6
,sizeof(usr
->padding_6
)))
5574 if(!prs_uint32("rid_user ", ps
, depth
, &usr
->rid_user
))
5576 if(!prs_uint32("rid_group", ps
, depth
, &usr
->rid_group
))
5578 if(!prs_uint16("acct_ctrl", ps
, depth
, &usr
->acct_ctrl
))
5580 if(!prs_uint16("unknown_3", ps
, depth
, &usr
->unknown_3
))
5582 if(!prs_uint16("unknown_4", ps
, depth
, &usr
->unknown_4
))
5584 if(!prs_uint16("unknown_5", ps
, depth
, &usr
->unknown_5
))
5587 if(!prs_uint8s(False
, "padding_7", ps
, depth
, usr
->padding_7
, sizeof(usr
->padding_7
)))
5590 if(!prs_uint32("padding_8", ps
, depth
, &(usr
->padding_8
)))
5593 if(!smb_io_unistr2("unistr2", &usr
->uni_mach_acct
, True
, ps
, depth
))
5599 if(!prs_uint8s(False
, "padding_9", ps
, depth
, usr
->padding_9
, sizeof(usr
->padding_9
)))
5605 /*************************************************************************
5606 init_sam_user_info24
5607 *************************************************************************/
5609 void init_sam_user_info24(SAM_USER_INFO_24
* usr
, char newpass
[516],
5612 DEBUG(10, ("init_sam_user_info24:\n"));
5613 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5614 usr
->pw_len
= pw_len
;
5617 /*******************************************************************
5618 reads or writes a structure.
5619 ********************************************************************/
5621 static BOOL
sam_io_user_info24(const char *desc
, SAM_USER_INFO_24
* usr
,
5622 prs_struct
*ps
, int depth
)
5627 prs_debug(ps
, depth
, desc
, "sam_io_user_info24");
5633 if(!prs_uint8s(False
, "password", ps
, depth
, usr
->pass
,
5637 if (MARSHALLING(ps
) && (usr
->pw_len
!= 0)) {
5638 if (!prs_uint8("pw_len", ps
, depth
, &usr
->pw_len
))
5640 } else if (UNMARSHALLING(ps
)) {
5641 if (!prs_uint8("pw_len", ps
, depth
, &usr
->pw_len
))
5648 /*******************************************************************
5649 reads or writes a structure.
5650 ********************************************************************/
5652 static BOOL
sam_io_user_info26(const char *desc
, SAM_USER_INFO_26
* usr
,
5653 prs_struct
*ps
, int depth
)
5658 prs_debug(ps
, depth
, desc
, "sam_io_user_info26");
5664 if(!prs_uint8s(False
, "password", ps
, depth
, usr
->pass
,
5668 if (!prs_uint8("pw_len", ps
, depth
, &usr
->pw_len
))
5675 /*************************************************************************
5676 init_sam_user_info23
5678 unknown_6 = 0x0000 04ec
5680 *************************************************************************/
5682 void init_sam_user_info23W(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5683 NTTIME
* logoff_time
, /* all zeros */
5684 NTTIME
* kickoff_time
, /* all zeros */
5685 NTTIME
* pass_last_set_time
, /* all zeros */
5686 NTTIME
* pass_can_change_time
, /* all zeros */
5687 NTTIME
* pass_must_change_time
, /* all zeros */
5698 uint32 user_rid
, /* 0x0000 0000 */
5701 uint32 fields_present
,
5704 uint16 bad_password_count
,
5708 usr
->logon_time
= *logon_time
; /* all zeros */
5709 usr
->logoff_time
= *logoff_time
; /* all zeros */
5710 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5711 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5712 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5713 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5715 ZERO_STRUCT(usr
->nt_pwd
);
5716 ZERO_STRUCT(usr
->lm_pwd
);
5718 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5719 usr
->group_rid
= group_rid
;
5720 usr
->acb_info
= acb_info
;
5721 usr
->fields_present
= fields_present
; /* 09f8 27fa */
5723 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5724 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5726 if (nt_time_is_zero(pass_must_change_time
)) {
5727 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
5729 usr
->passmustchange
=0;
5732 ZERO_STRUCT(usr
->padding1
);
5733 ZERO_STRUCT(usr
->padding2
);
5735 usr
->bad_password_count
= bad_password_count
;
5736 usr
->logon_count
= logon_count
;
5738 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5740 copy_unistr2(&usr
->uni_user_name
, user_name
);
5741 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
5743 copy_unistr2(&usr
->uni_full_name
, full_name
);
5744 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
5746 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5747 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
5749 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5750 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
5752 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5753 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
5755 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5756 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
5758 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5759 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
5761 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5762 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
5764 copy_unistr2(&usr
->uni_comment
, unk_str
);
5765 init_uni_hdr(&usr
->hdr_comment
, &usr
->uni_comment
);
5767 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5768 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
5771 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5773 ZERO_STRUCT(usr
->logon_hrs
);
5777 /*************************************************************************
5778 init_sam_user_info23
5780 unknown_6 = 0x0000 04ec
5782 *************************************************************************/
5784 void init_sam_user_info23A(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5785 NTTIME
* logoff_time
, /* all zeros */
5786 NTTIME
* kickoff_time
, /* all zeros */
5787 NTTIME
* pass_last_set_time
, /* all zeros */
5788 NTTIME
* pass_can_change_time
, /* all zeros */
5789 NTTIME
* pass_must_change_time
, /* all zeros */
5790 char *user_name
, /* NULL */
5792 char *home_dir
, char *dir_drive
, char *log_scr
,
5793 char *prof_path
, const char *desc
, char *wkstas
,
5794 char *unk_str
, char *mung_dial
, uint32 user_rid
, /* 0x0000 0000 */
5795 uint32 group_rid
, uint32 acb_info
,
5796 uint32 fields_present
, uint16 logon_divs
,
5797 LOGON_HRS
* hrs
, uint16 bad_password_count
, uint16 logon_count
,
5800 DATA_BLOB blob
= base64_decode_data_blob(mung_dial
);
5802 usr
->logon_time
= *logon_time
; /* all zeros */
5803 usr
->logoff_time
= *logoff_time
; /* all zeros */
5804 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5805 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5806 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5807 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5809 ZERO_STRUCT(usr
->nt_pwd
);
5810 ZERO_STRUCT(usr
->lm_pwd
);
5812 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5813 usr
->group_rid
= group_rid
;
5814 usr
->acb_info
= acb_info
;
5815 usr
->fields_present
= fields_present
; /* 09f8 27fa */
5817 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5818 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5820 if (nt_time_is_zero(pass_must_change_time
)) {
5821 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
5823 usr
->passmustchange
=0;
5826 ZERO_STRUCT(usr
->padding1
);
5827 ZERO_STRUCT(usr
->padding2
);
5829 usr
->bad_password_count
= bad_password_count
;
5830 usr
->logon_count
= logon_count
;
5832 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5834 init_unistr2(&usr
->uni_user_name
, user_name
, UNI_FLAGS_NONE
);
5835 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
5837 init_unistr2(&usr
->uni_full_name
, full_name
, UNI_FLAGS_NONE
);
5838 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
5840 init_unistr2(&usr
->uni_home_dir
, home_dir
, UNI_FLAGS_NONE
);
5841 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
5843 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, UNI_FLAGS_NONE
);
5844 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
5846 init_unistr2(&usr
->uni_logon_script
, log_scr
, UNI_FLAGS_NONE
);
5847 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
5849 init_unistr2(&usr
->uni_profile_path
, prof_path
, UNI_FLAGS_NONE
);
5850 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
5852 init_unistr2(&usr
->uni_acct_desc
, desc
, UNI_FLAGS_NONE
);
5853 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
5855 init_unistr2(&usr
->uni_workstations
, wkstas
, UNI_FLAGS_NONE
);
5856 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
5858 init_unistr2(&usr
->uni_comment
, unk_str
, UNI_FLAGS_NONE
);
5859 init_uni_hdr(&usr
->hdr_comment
, &usr
->uni_comment
);
5861 init_unistr2_from_datablob(&usr
->uni_munged_dial
, &blob
);
5862 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
5864 data_blob_free(&blob
);
5867 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5869 ZERO_STRUCT(usr
->logon_hrs
);
5874 /*************************************************************************
5875 init_samr_user_info25P
5876 fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS
5877 *************************************************************************/
5879 void init_sam_user_info25P(SAM_USER_INFO_25
* usr
,
5880 uint32 fields_present
, uint32 acb_info
,
5883 usr
->fields_present
= fields_present
;
5884 ZERO_STRUCT(usr
->padding1
);
5885 ZERO_STRUCT(usr
->padding2
);
5887 usr
->acb_info
= acb_info
;
5888 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5892 /*******************************************************************
5893 reads or writes a structure.
5894 ********************************************************************/
5896 static BOOL
sam_io_user_info23(const char *desc
, SAM_USER_INFO_23
* usr
,
5897 prs_struct
*ps
, int depth
)
5902 prs_debug(ps
, depth
, desc
, "sam_io_user_info23");
5908 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5910 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5912 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5914 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
5916 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
5918 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5921 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5923 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5925 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5927 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5929 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5931 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5933 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5935 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5937 if(!smb_io_unihdr("hdr_comment ", &usr
->hdr_comment
, ps
, depth
)) /* unknown string */
5939 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5942 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5944 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5947 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5949 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5951 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5954 if(!prs_uint32("fields_present ", ps
, depth
, &usr
->fields_present
))
5956 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5960 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5963 if(!prs_uint16("bad_password_count ", ps
, depth
, &usr
->bad_password_count
))
5965 if(!prs_uint16("logon_count ", ps
, depth
, &usr
->logon_count
))
5968 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
5970 if(!prs_uint8("passmustchange ", ps
, depth
, &usr
->passmustchange
))
5972 if(!prs_uint8("padding2 ", ps
, depth
, &usr
->padding2
))
5976 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5979 /* here begins pointed-to data */
5981 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5984 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5987 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5990 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5993 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5996 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5999 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
6002 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
6005 if(!smb_io_unistr2("uni_comment ", &usr
->uni_comment
, usr
->hdr_comment
.buffer
, ps
, depth
)) /* unknown string */
6008 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
6011 /* ok, this is only guess-work (as usual) */
6012 if (usr
->ptr_logon_hrs
) {
6013 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
6020 /*******************************************************************
6021 reads or writes a structure.
6022 NB. This structure is *definately* incorrect. It's my best guess
6023 currently for W2K SP2. The password field is encrypted in a different
6024 way than normal... And there are definately other problems. JRA.
6025 ********************************************************************/
6027 static BOOL
sam_io_user_info25(const char *desc
, SAM_USER_INFO_25
* usr
, prs_struct
*ps
, int depth
)
6032 prs_debug(ps
, depth
, desc
, "sam_io_user_info25");
6038 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
6040 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
6042 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
6044 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
6046 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
6048 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
6051 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
6053 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
6055 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
6057 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
6059 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
6061 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
6063 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
6065 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
6067 if(!smb_io_unihdr("hdr_comment ", &usr
->hdr_comment
, ps
, depth
)) /* unknown string */
6069 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
6072 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
6074 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
6077 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
6079 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
6081 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
6083 if(!prs_uint32("fields_present ", ps
, depth
, &usr
->fields_present
))
6086 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
6090 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
6093 if(!prs_uint16("bad_password_count ", ps
, depth
, &usr
->bad_password_count
))
6095 if(!prs_uint16("logon_count ", ps
, depth
, &usr
->logon_count
))
6098 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
6100 if(!prs_uint8("passmustchange ", ps
, depth
, &usr
->passmustchange
))
6102 if(!prs_uint8("padding2 ", ps
, depth
, &usr
->padding2
))
6106 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
6109 /* here begins pointed-to data */
6111 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
6114 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
6117 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
6120 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
6123 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
6126 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
6129 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
6132 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
6135 if(!smb_io_unistr2("uni_comment ", &usr
->uni_comment
, usr
->hdr_comment
.buffer
, ps
, depth
)) /* unknown string */
6138 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
6141 /* ok, this is only guess-work (as usual) */
6142 if (usr
->ptr_logon_hrs
) {
6143 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
6151 /*************************************************************************
6152 init_sam_user_info21W
6154 unknown_6 = 0x0000 04ec
6156 *************************************************************************/
6158 void init_sam_user_info21W(SAM_USER_INFO_21
* usr
,
6159 NTTIME
* logon_time
,
6160 NTTIME
* logoff_time
,
6161 NTTIME
* kickoff_time
,
6162 NTTIME
* pass_last_set_time
,
6163 NTTIME
* pass_can_change_time
,
6164 NTTIME
* pass_must_change_time
,
6180 uint32 fields_present
,
6183 uint16 bad_password_count
,
6186 usr
->logon_time
= *logon_time
;
6187 usr
->logoff_time
= *logoff_time
;
6188 usr
->kickoff_time
= *kickoff_time
;
6189 usr
->pass_last_set_time
= *pass_last_set_time
;
6190 usr
->pass_can_change_time
= *pass_can_change_time
;
6191 usr
->pass_must_change_time
= *pass_must_change_time
;
6193 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
));
6194 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
));
6196 usr
->user_rid
= user_rid
;
6197 usr
->group_rid
= group_rid
;
6198 usr
->acb_info
= acb_info
;
6199 usr
->fields_present
= fields_present
; /* 0x00ff ffff */
6201 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
6202 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
6203 usr
->bad_password_count
= bad_password_count
;
6204 usr
->logon_count
= logon_count
;
6206 if (nt_time_is_zero(pass_must_change_time
)) {
6207 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
6209 usr
->passmustchange
=0;
6212 ZERO_STRUCT(usr
->padding1
);
6213 ZERO_STRUCT(usr
->padding2
);
6215 copy_unistr2(&usr
->uni_user_name
, user_name
);
6216 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
6218 copy_unistr2(&usr
->uni_full_name
, full_name
);
6219 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
6221 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
6222 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
6224 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
6225 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
6227 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
6228 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
6230 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
6231 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
6233 copy_unistr2(&usr
->uni_acct_desc
, desc
);
6234 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
6236 copy_unistr2(&usr
->uni_workstations
, wkstas
);
6237 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
6239 copy_unistr2(&usr
->uni_comment
, unk_str
);
6240 init_uni_hdr(&usr
->hdr_comment
, &usr
->uni_comment
);
6242 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
6243 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
6246 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
6248 ZERO_STRUCT(usr
->logon_hrs
);
6252 /*************************************************************************
6253 init_sam_user_info21
6255 unknown_6 = 0x0000 04ec
6257 *************************************************************************/
6259 NTSTATUS
init_sam_user_info21A(SAM_USER_INFO_21
*usr
, struct samu
*pw
, DOM_SID
*domain_sid
)
6261 NTTIME logon_time
, logoff_time
, kickoff_time
,
6262 pass_last_set_time
, pass_can_change_time
,
6263 pass_must_change_time
;
6265 time_t must_change_time
;
6266 const char* user_name
= pdb_get_username(pw
);
6267 const char* full_name
= pdb_get_fullname(pw
);
6268 const char* home_dir
= pdb_get_homedir(pw
);
6269 const char* dir_drive
= pdb_get_dir_drive(pw
);
6270 const char* logon_script
= pdb_get_logon_script(pw
);
6271 const char* profile_path
= pdb_get_profile_path(pw
);
6272 const char* description
= pdb_get_acct_desc(pw
);
6273 const char* workstations
= pdb_get_workstations(pw
);
6274 const char* munged_dial
= pdb_get_munged_dial(pw
);
6275 DATA_BLOB munged_dial_blob
;
6278 const DOM_SID
*user_sid
;
6281 const DOM_SID
*group_sid
;
6284 munged_dial_blob
= base64_decode_data_blob(munged_dial
);
6286 munged_dial_blob
= data_blob(NULL
, 0);
6289 /* Create NTTIME structs */
6290 unix_to_nt_time (&logon_time
, pdb_get_logon_time(pw
));
6291 unix_to_nt_time (&logoff_time
, pdb_get_logoff_time(pw
));
6292 unix_to_nt_time (&kickoff_time
, pdb_get_kickoff_time(pw
));
6293 unix_to_nt_time (&pass_last_set_time
, pdb_get_pass_last_set_time(pw
));
6294 unix_to_nt_time (&pass_can_change_time
,pdb_get_pass_can_change_time(pw
));
6295 must_change_time
= pdb_get_pass_must_change_time(pw
);
6296 if (must_change_time
== get_time_t_max())
6297 unix_to_nt_time_abs(&pass_must_change_time
, must_change_time
);
6299 unix_to_nt_time(&pass_must_change_time
, must_change_time
);
6301 /* structure assignment */
6302 usr
->logon_time
= logon_time
;
6303 usr
->logoff_time
= logoff_time
;
6304 usr
->kickoff_time
= kickoff_time
;
6305 usr
->pass_last_set_time
= pass_last_set_time
;
6306 usr
->pass_can_change_time
= pass_can_change_time
;
6307 usr
->pass_must_change_time
= pass_must_change_time
;
6309 ZERO_STRUCT(usr
->nt_pwd
);
6310 ZERO_STRUCT(usr
->lm_pwd
);
6312 user_sid
= pdb_get_user_sid(pw
);
6314 if (!sid_peek_check_rid(domain_sid
, user_sid
, &user_rid
)) {
6315 fstring user_sid_string
;
6316 fstring domain_sid_string
;
6317 DEBUG(0, ("init_sam_user_info_21A: User %s has SID %s, \nwhich conflicts with "
6318 "the domain sid %s. Failing operation.\n",
6320 sid_to_string(user_sid_string
, user_sid
),
6321 sid_to_string(domain_sid_string
, domain_sid
)));
6322 data_blob_free(&munged_dial_blob
);
6323 return NT_STATUS_UNSUCCESSFUL
;
6327 group_sid
= pdb_get_group_sid(pw
);
6330 if (!sid_peek_check_rid(domain_sid
, group_sid
, &group_rid
)) {
6331 fstring group_sid_string
;
6332 fstring domain_sid_string
;
6333 DEBUG(0, ("init_sam_user_info_21A: User %s has Primary Group SID %s, \n"
6334 "which conflicts with the domain sid %s. Failing operation.\n",
6336 sid_to_string(group_sid_string
, group_sid
),
6337 sid_to_string(domain_sid_string
, domain_sid
)));
6338 data_blob_free(&munged_dial_blob
);
6339 return NT_STATUS_UNSUCCESSFUL
;
6342 usr
->user_rid
= user_rid
;
6343 usr
->group_rid
= group_rid
;
6344 usr
->acb_info
= pdb_get_acct_ctrl(pw
);
6347 Look at a user on a real NT4 PDC with usrmgr, press
6348 'ok'. Then you will see that fields_present is set to
6349 0x08f827fa. Look at the user immediately after that again,
6350 and you will see that 0x00fffff is returned. This solves
6351 the problem that you get access denied after having looked
6355 usr
->fields_present
= pdb_build_fields_present(pw
);
6357 usr
->logon_divs
= pdb_get_logon_divs(pw
);
6358 usr
->ptr_logon_hrs
= pdb_get_hours(pw
) ? 1 : 0;
6359 usr
->bad_password_count
= pdb_get_bad_password_count(pw
);
6360 usr
->logon_count
= pdb_get_logon_count(pw
);
6362 if (pdb_get_pass_must_change_time(pw
) == 0) {
6363 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
6365 usr
->passmustchange
=0;
6368 ZERO_STRUCT(usr
->padding1
);
6369 ZERO_STRUCT(usr
->padding2
);
6371 init_unistr2(&usr
->uni_user_name
, user_name
, UNI_STR_TERMINATE
);
6372 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
6374 init_unistr2(&usr
->uni_full_name
, full_name
, UNI_STR_TERMINATE
);
6375 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
6377 init_unistr2(&usr
->uni_home_dir
, home_dir
, UNI_STR_TERMINATE
);
6378 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
6380 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, UNI_STR_TERMINATE
);
6381 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
6383 init_unistr2(&usr
->uni_logon_script
, logon_script
, UNI_STR_TERMINATE
);
6384 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
6386 init_unistr2(&usr
->uni_profile_path
, profile_path
, UNI_STR_TERMINATE
);
6387 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
6389 init_unistr2(&usr
->uni_acct_desc
, description
, UNI_STR_TERMINATE
);
6390 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
6392 init_unistr2(&usr
->uni_workstations
, workstations
, UNI_STR_TERMINATE
);
6393 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
6395 init_unistr2(&usr
->uni_comment
, NULL
, UNI_STR_TERMINATE
);
6396 init_uni_hdr(&usr
->hdr_comment
, &usr
->uni_comment
);
6398 init_unistr2_from_datablob(&usr
->uni_munged_dial
, &munged_dial_blob
);
6399 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
6400 data_blob_free(&munged_dial_blob
);
6402 if (pdb_get_hours(pw
)) {
6403 usr
->logon_hrs
.max_len
= 1260;
6404 usr
->logon_hrs
.offset
= 0;
6405 usr
->logon_hrs
.len
= pdb_get_hours_len(pw
);
6406 memcpy(&usr
->logon_hrs
.hours
, pdb_get_hours(pw
), MAX_HOURS_LEN
);
6408 usr
->logon_hrs
.max_len
= 1260;
6409 usr
->logon_hrs
.offset
= 0;
6410 usr
->logon_hrs
.len
= 0;
6411 memset(&usr
->logon_hrs
, 0xff, sizeof(usr
->logon_hrs
));
6414 return NT_STATUS_OK
;
6417 /*******************************************************************
6418 reads or writes a structure.
6419 ********************************************************************/
6421 static BOOL
sam_io_user_info21(const char *desc
, SAM_USER_INFO_21
* usr
,
6422 prs_struct
*ps
, int depth
)
6427 prs_debug(ps
, depth
, desc
, "sam_io_user_info21");
6433 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
6435 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
6437 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
,depth
))
6439 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
6441 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
,depth
))
6443 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
6446 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
6448 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
6450 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
6452 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
6454 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
6456 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
6458 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
6460 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
6462 if(!smb_io_unihdr("hdr_comment ", &usr
->hdr_comment
, ps
, depth
)) /* unknown string */
6464 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
6467 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
6469 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
6472 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
6474 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
6476 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
6479 if(!prs_uint32("fields_present ", ps
, depth
, &usr
->fields_present
))
6481 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
6485 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
6488 if(!prs_uint16("bad_password_count ", ps
, depth
, &usr
->bad_password_count
))
6490 if(!prs_uint16("logon_count ", ps
, depth
, &usr
->logon_count
))
6493 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
6495 if(!prs_uint8("passmustchange ", ps
, depth
, &usr
->passmustchange
))
6497 if(!prs_uint8("padding2 ", ps
, depth
, &usr
->padding2
))
6500 /* here begins pointed-to data */
6502 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
,usr
->hdr_user_name
.buffer
, ps
, depth
))
6504 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
))
6506 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
))
6508 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
))
6510 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
))
6512 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
))
6514 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
))
6516 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
))
6518 if(!smb_io_unistr2("uni_comment", &usr
->uni_comment
, usr
->hdr_comment
.buffer
, ps
, depth
))
6520 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
))
6523 /* ok, this is only guess-work (as usual) */
6524 if (usr
->ptr_logon_hrs
) {
6525 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
6532 void init_sam_user_info20A(SAM_USER_INFO_20
*usr
, struct samu
*pw
)
6534 const char *munged_dial
= pdb_get_munged_dial(pw
);
6538 blob
= base64_decode_data_blob(munged_dial
);
6540 blob
= data_blob(NULL
, 0);
6543 init_unistr2_from_datablob(&usr
->uni_munged_dial
, &blob
);
6544 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
6545 data_blob_free(&blob
);
6548 /*******************************************************************
6549 reads or writes a structure.
6550 ********************************************************************/
6552 static BOOL
sam_io_user_info20(const char *desc
, SAM_USER_INFO_20
*usr
,
6553 prs_struct
*ps
, int depth
)
6558 prs_debug(ps
, depth
, desc
, "sam_io_user_info20");
6564 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
6567 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
)) /* worksations user can log on from */
6573 /*******************************************************************
6574 inits a SAM_USERINFO_CTR structure.
6575 ********************************************************************/
6577 NTSTATUS
make_samr_userinfo_ctr_usr21(TALLOC_CTX
*ctx
, SAM_USERINFO_CTR
* ctr
,
6578 uint16 switch_value
,
6579 SAM_USER_INFO_21
* usr
)
6581 DEBUG(5, ("make_samr_userinfo_ctr_usr21\n"));
6583 ctr
->switch_value
= switch_value
;
6584 ctr
->info
.id
= NULL
;
6586 switch (switch_value
) {
6588 ctr
->info
.id16
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_16
);
6589 if (ctr
->info
.id16
== NULL
)
6590 return NT_STATUS_NO_MEMORY
;
6592 init_sam_user_info16(ctr
->info
.id16
, usr
->acb_info
);
6595 /* whoops - got this wrong. i think. or don't understand what's happening. */
6599 info
= (void *)&id11
;
6601 expire
.low
= 0xffffffff;
6602 expire
.high
= 0x7fffffff;
6604 ctr
->info
.id
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_17
);
6605 init_sam_user_info11(ctr
->info
.id17
, &expire
,
6606 "BROOKFIELDS$", /* name */
6607 0x03ef, /* user rid */
6608 0x201, /* group rid */
6609 0x0080); /* acb info */
6615 ctr
->info
.id18
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_18
);
6616 if (ctr
->info
.id18
== NULL
)
6617 return NT_STATUS_NO_MEMORY
;
6619 init_sam_user_info18(ctr
->info
.id18
, usr
->lm_pwd
, usr
->nt_pwd
);
6623 SAM_USER_INFO_21
*cusr
;
6624 cusr
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_21
);
6625 ctr
->info
.id21
= cusr
;
6626 if (ctr
->info
.id21
== NULL
)
6627 return NT_STATUS_NO_MEMORY
;
6628 memcpy(cusr
, usr
, sizeof(*usr
));
6629 memset(cusr
->lm_pwd
, 0, sizeof(cusr
->lm_pwd
));
6630 memset(cusr
->nt_pwd
, 0, sizeof(cusr
->nt_pwd
));
6634 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
6635 return NT_STATUS_INVALID_INFO_CLASS
;
6638 return NT_STATUS_OK
;
6641 /*******************************************************************
6642 inits a SAM_USERINFO_CTR structure.
6643 ********************************************************************/
6645 static void init_samr_userinfo_ctr(SAM_USERINFO_CTR
* ctr
, DATA_BLOB
*sess_key
,
6646 uint16 switch_value
, void *info
)
6648 DEBUG(5, ("init_samr_userinfo_ctr\n"));
6650 ctr
->switch_value
= switch_value
;
6651 ctr
->info
.id
= info
;
6653 switch (switch_value
) {
6655 SamOEMhashBlob(ctr
->info
.id24
->pass
, 516, sess_key
);
6656 dump_data(100, (char *)sess_key
->data
, sess_key
->length
);
6657 dump_data(100, (char *)ctr
->info
.id24
->pass
, 516);
6660 SamOEMhashBlob(ctr
->info
.id23
->pass
, 516, sess_key
);
6661 dump_data(100, (char *)sess_key
->data
, sess_key
->length
);
6662 dump_data(100, (char *)ctr
->info
.id23
->pass
, 516);
6667 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value
));
6671 /*******************************************************************
6672 reads or writes a structure.
6673 ********************************************************************/
6675 static BOOL
samr_io_userinfo_ctr(const char *desc
, SAM_USERINFO_CTR
**ppctr
,
6676 prs_struct
*ps
, int depth
)
6679 SAM_USERINFO_CTR
*ctr
;
6681 prs_debug(ps
, depth
, desc
, "samr_io_userinfo_ctr");
6684 if (UNMARSHALLING(ps
)) {
6685 ctr
= PRS_ALLOC_MEM(ps
,SAM_USERINFO_CTR
,1);
6693 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
6695 if(!prs_uint16("switch_value", ps
, depth
, &ctr
->switch_value
))
6702 switch (ctr
->switch_value
) {
6704 if (UNMARSHALLING(ps
))
6705 ctr
->info
.id7
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_7
,1);
6706 if (ctr
->info
.id7
== NULL
) {
6707 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6710 ret
= sam_io_user_info7("", ctr
->info
.id7
, ps
, depth
);
6713 if (UNMARSHALLING(ps
))
6714 ctr
->info
.id9
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_9
,1);
6715 if (ctr
->info
.id9
== NULL
) {
6716 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6719 ret
= sam_io_user_info9("", ctr
->info
.id9
, ps
, depth
);
6722 if (UNMARSHALLING(ps
))
6723 ctr
->info
.id16
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_16
,1);
6724 if (ctr
->info
.id16
== NULL
) {
6725 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6728 ret
= sam_io_user_info16("", ctr
->info
.id16
, ps
, depth
);
6731 if (UNMARSHALLING(ps
))
6732 ctr
->info
.id17
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_17
,1);
6734 if (ctr
->info
.id17
== NULL
) {
6735 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6738 ret
= sam_io_user_info17("", ctr
->info
.id17
, ps
, depth
);
6741 if (UNMARSHALLING(ps
))
6742 ctr
->info
.id18
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_18
,1);
6744 if (ctr
->info
.id18
== NULL
) {
6745 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6748 ret
= sam_io_user_info18("", ctr
->info
.id18
, ps
, depth
);
6751 if (UNMARSHALLING(ps
))
6752 ctr
->info
.id20
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_20
,1);
6754 if (ctr
->info
.id20
== NULL
) {
6755 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6758 ret
= sam_io_user_info20("", ctr
->info
.id20
, ps
, depth
);
6761 if (UNMARSHALLING(ps
))
6762 ctr
->info
.id21
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_21
,1);
6764 if (ctr
->info
.id21
== NULL
) {
6765 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6768 ret
= sam_io_user_info21("", ctr
->info
.id21
, ps
, depth
);
6771 if (UNMARSHALLING(ps
))
6772 ctr
->info
.id23
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_23
,1);
6774 if (ctr
->info
.id23
== NULL
) {
6775 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6778 ret
= sam_io_user_info23("", ctr
->info
.id23
, ps
, depth
);
6781 if (UNMARSHALLING(ps
))
6782 ctr
->info
.id24
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_24
,1);
6784 if (ctr
->info
.id24
== NULL
) {
6785 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6788 ret
= sam_io_user_info24("", ctr
->info
.id24
, ps
, depth
);
6791 if (UNMARSHALLING(ps
))
6792 ctr
->info
.id25
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_25
,1);
6794 if (ctr
->info
.id25
== NULL
) {
6795 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6798 ret
= sam_io_user_info25("", ctr
->info
.id25
, ps
, depth
);
6801 if (UNMARSHALLING(ps
))
6802 ctr
->info
.id26
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_26
,1);
6804 if (ctr
->info
.id26
== NULL
) {
6805 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6808 ret
= sam_io_user_info26("", ctr
->info
.id26
, ps
, depth
);
6811 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr
->switch_value
));
6819 /*******************************************************************
6820 inits a SAMR_R_QUERY_USERINFO structure.
6821 ********************************************************************/
6823 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO
* r_u
,
6824 SAM_USERINFO_CTR
* ctr
, NTSTATUS status
)
6826 DEBUG(5, ("init_samr_r_query_userinfo\n"));
6831 if (NT_STATUS_IS_OK(status
)) {
6836 r_u
->status
= status
; /* return status */
6839 /*******************************************************************
6840 reads or writes a structure.
6841 ********************************************************************/
6843 BOOL
samr_io_r_query_userinfo(const char *desc
, SAMR_R_QUERY_USERINFO
* r_u
,
6844 prs_struct
*ps
, int depth
)
6849 prs_debug(ps
, depth
, desc
, "samr_io_r_query_userinfo");
6855 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
6858 if (r_u
->ptr
!= 0) {
6859 if(!samr_io_userinfo_ctr("ctr", &r_u
->ctr
, ps
, depth
))
6865 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6871 /*******************************************************************
6872 inits a SAMR_Q_SET_USERINFO structure.
6873 ********************************************************************/
6875 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO
* q_u
,
6876 const POLICY_HND
*hnd
, DATA_BLOB
*sess_key
,
6877 uint16 switch_value
, void *info
)
6879 DEBUG(5, ("init_samr_q_set_userinfo\n"));
6882 q_u
->switch_value
= switch_value
;
6883 init_samr_userinfo_ctr(q_u
->ctr
, sess_key
, switch_value
, info
);
6886 /*******************************************************************
6887 reads or writes a structure.
6888 ********************************************************************/
6890 BOOL
samr_io_q_set_userinfo(const char *desc
, SAMR_Q_SET_USERINFO
* q_u
,
6891 prs_struct
*ps
, int depth
)
6896 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo");
6902 smb_io_pol_hnd("pol", &(q_u
->pol
), ps
, depth
);
6904 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6906 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6912 /*******************************************************************
6913 inits a SAMR_R_SET_USERINFO structure.
6914 ********************************************************************/
6916 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO
* r_u
, NTSTATUS status
)
6918 DEBUG(5, ("init_samr_r_set_userinfo\n"));
6920 r_u
->status
= status
; /* return status */
6923 /*******************************************************************
6924 reads or writes a structure.
6925 ********************************************************************/
6927 BOOL
samr_io_r_set_userinfo(const char *desc
, SAMR_R_SET_USERINFO
* r_u
,
6928 prs_struct
*ps
, int depth
)
6933 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo");
6939 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6945 /*******************************************************************
6946 inits a SAMR_Q_SET_USERINFO2 structure.
6947 ********************************************************************/
6949 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2
* q_u
,
6950 const POLICY_HND
*hnd
, DATA_BLOB
*sess_key
,
6951 uint16 switch_value
, SAM_USERINFO_CTR
* ctr
)
6953 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
6956 q_u
->switch_value
= switch_value
;
6959 q_u
->ctr
->switch_value
= switch_value
;
6961 switch (switch_value
) {
6963 SamOEMhashBlob(ctr
->info
.id18
->lm_pwd
, 16, sess_key
);
6964 SamOEMhashBlob(ctr
->info
.id18
->nt_pwd
, 16, sess_key
);
6965 dump_data(100, (char *)sess_key
->data
, sess_key
->length
);
6966 dump_data(100, (char *)ctr
->info
.id18
->lm_pwd
, 16);
6967 dump_data(100, (char *)ctr
->info
.id18
->nt_pwd
, 16);
6972 /*******************************************************************
6973 reads or writes a structure.
6974 ********************************************************************/
6976 BOOL
samr_io_q_set_userinfo2(const char *desc
, SAMR_Q_SET_USERINFO2
* q_u
,
6977 prs_struct
*ps
, int depth
)
6982 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo2");
6988 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
6991 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6993 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6999 /*******************************************************************
7000 inits a SAMR_R_SET_USERINFO2 structure.
7001 ********************************************************************/
7003 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2
* r_u
, NTSTATUS status
)
7005 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
7007 r_u
->status
= status
; /* return status */
7010 /*******************************************************************
7011 reads or writes a structure.
7012 ********************************************************************/
7014 BOOL
samr_io_r_set_userinfo2(const char *desc
, SAMR_R_SET_USERINFO2
* r_u
,
7015 prs_struct
*ps
, int depth
)
7020 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo2");
7026 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7032 /*******************************************************************
7033 inits a SAMR_Q_CONNECT structure.
7034 ********************************************************************/
7036 void init_samr_q_connect(SAMR_Q_CONNECT
* q_u
,
7037 char *srv_name
, uint32 access_mask
)
7039 DEBUG(5, ("init_samr_q_connect\n"));
7041 /* make PDC server name \\server */
7042 q_u
->ptr_srv_name
= (srv_name
!= NULL
&& *srv_name
) ? 1 : 0;
7043 init_unistr2(&q_u
->uni_srv_name
, srv_name
, UNI_STR_TERMINATE
);
7045 /* example values: 0x0000 0002 */
7046 q_u
->access_mask
= access_mask
;
7049 /*******************************************************************
7050 reads or writes a structure.
7051 ********************************************************************/
7053 BOOL
samr_io_q_connect(const char *desc
, SAMR_Q_CONNECT
* q_u
,
7054 prs_struct
*ps
, int depth
)
7059 prs_debug(ps
, depth
, desc
, "samr_io_q_connect");
7065 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
7067 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
7072 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
7078 /*******************************************************************
7079 reads or writes a structure.
7080 ********************************************************************/
7082 BOOL
samr_io_r_connect(const char *desc
, SAMR_R_CONNECT
* r_u
,
7083 prs_struct
*ps
, int depth
)
7088 prs_debug(ps
, depth
, desc
, "samr_io_r_connect");
7094 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
7097 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7103 /*******************************************************************
7104 inits a SAMR_Q_CONNECT4 structure.
7105 ********************************************************************/
7107 void init_samr_q_connect4(SAMR_Q_CONNECT4
* q_u
,
7108 char *srv_name
, uint32 access_mask
)
7110 DEBUG(5, ("init_samr_q_connect4\n"));
7112 /* make PDC server name \\server */
7113 q_u
->ptr_srv_name
= (srv_name
!= NULL
&& *srv_name
) ? 1 : 0;
7114 init_unistr2(&q_u
->uni_srv_name
, srv_name
, UNI_STR_TERMINATE
);
7116 /* Only value we've seen, possibly an address type ? */
7119 /* example values: 0x0000 0002 */
7120 q_u
->access_mask
= access_mask
;
7123 /*******************************************************************
7124 reads or writes a structure.
7125 ********************************************************************/
7127 BOOL
samr_io_q_connect4(const char *desc
, SAMR_Q_CONNECT4
* q_u
,
7128 prs_struct
*ps
, int depth
)
7133 prs_debug(ps
, depth
, desc
, "samr_io_q_connect4");
7139 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
7141 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
7146 if(!prs_uint32("unk_0", ps
, depth
, &q_u
->unk_0
))
7148 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
7154 /*******************************************************************
7155 reads or writes a structure.
7156 ********************************************************************/
7158 BOOL
samr_io_r_connect4(const char *desc
, SAMR_R_CONNECT4
* r_u
,
7159 prs_struct
*ps
, int depth
)
7164 prs_debug(ps
, depth
, desc
, "samr_io_r_connect4");
7170 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
7173 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7179 /*******************************************************************
7180 inits a SAMR_Q_CONNECT5 structure.
7181 ********************************************************************/
7183 void init_samr_q_connect5(SAMR_Q_CONNECT5
* q_u
,
7184 char *srv_name
, uint32 access_mask
)
7186 DEBUG(5, ("init_samr_q_connect5\n"));
7188 /* make PDC server name \\server */
7189 q_u
->ptr_srv_name
= (srv_name
!= NULL
&& *srv_name
) ? 1 : 0;
7190 init_unistr2(&q_u
->uni_srv_name
, srv_name
, UNI_STR_TERMINATE
);
7192 /* example values: 0x0000 0002 */
7193 q_u
->access_mask
= access_mask
;
7196 q_u
->info1_unk1
= 3;
7197 q_u
->info1_unk2
= 0;
7200 /*******************************************************************
7201 inits a SAMR_R_CONNECT5 structure.
7202 ********************************************************************/
7204 void init_samr_r_connect5(SAMR_R_CONNECT5
* r_u
, POLICY_HND
*pol
, NTSTATUS status
)
7206 DEBUG(5, ("init_samr_q_connect5\n"));
7209 r_u
->info1_unk1
= 3;
7210 r_u
->info1_unk2
= 0;
7212 r_u
->connect_pol
= *pol
;
7213 r_u
->status
= status
;
7216 /*******************************************************************
7217 reads or writes a structure.
7218 ********************************************************************/
7220 BOOL
samr_io_q_connect5(const char *desc
, SAMR_Q_CONNECT5
* q_u
,
7221 prs_struct
*ps
, int depth
)
7226 prs_debug(ps
, depth
, desc
, "samr_io_q_connect5");
7232 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
7234 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
7239 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
7242 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
7244 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
7247 if(!prs_uint32("info1_unk1", ps
, depth
, &q_u
->info1_unk1
))
7249 if(!prs_uint32("info1_unk2", ps
, depth
, &q_u
->info1_unk2
))
7255 /*******************************************************************
7256 reads or writes a structure.
7257 ********************************************************************/
7259 BOOL
samr_io_r_connect5(const char *desc
, SAMR_R_CONNECT5
* r_u
,
7260 prs_struct
*ps
, int depth
)
7265 prs_debug(ps
, depth
, desc
, "samr_io_r_connect5");
7271 if(!prs_uint32("level", ps
, depth
, &r_u
->level
))
7273 if(!prs_uint32("level", ps
, depth
, &r_u
->level
))
7275 if(!prs_uint32("info1_unk1", ps
, depth
, &r_u
->info1_unk1
))
7277 if(!prs_uint32("info1_unk2", ps
, depth
, &r_u
->info1_unk2
))
7280 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
7283 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7289 /*******************************************************************
7290 inits a SAMR_Q_CONNECT_ANON structure.
7291 ********************************************************************/
7293 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON
* q_u
)
7295 DEBUG(5, ("init_samr_q_connect_anon\n"));
7298 q_u
->unknown_0
= 0x5c; /* server name (?!!) */
7299 q_u
->access_mask
= MAXIMUM_ALLOWED_ACCESS
;
7302 /*******************************************************************
7303 reads or writes a structure.
7304 ********************************************************************/
7306 BOOL
samr_io_q_connect_anon(const char *desc
, SAMR_Q_CONNECT_ANON
* q_u
,
7307 prs_struct
*ps
, int depth
)
7312 prs_debug(ps
, depth
, desc
, "samr_io_q_connect_anon");
7318 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
7321 if(!prs_uint16("unknown_0", ps
, depth
, &q_u
->unknown_0
))
7326 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
7332 /*******************************************************************
7333 reads or writes a structure.
7334 ********************************************************************/
7336 BOOL
samr_io_r_connect_anon(const char *desc
, SAMR_R_CONNECT_ANON
* r_u
,
7337 prs_struct
*ps
, int depth
)
7342 prs_debug(ps
, depth
, desc
, "samr_io_r_connect_anon");
7348 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
7351 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7357 /*******************************************************************
7358 inits a SAMR_Q_GET_DOM_PWINFO structure.
7359 ********************************************************************/
7361 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO
* q_u
,
7364 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
7367 init_unistr2(&q_u
->uni_srv_name
, srv_name
, UNI_FLAGS_NONE
);
7368 init_uni_hdr(&q_u
->hdr_srv_name
, &q_u
->uni_srv_name
);
7371 /*******************************************************************
7372 reads or writes a structure.
7373 ********************************************************************/
7375 BOOL
samr_io_q_get_dom_pwinfo(const char *desc
, SAMR_Q_GET_DOM_PWINFO
* q_u
,
7376 prs_struct
*ps
, int depth
)
7381 prs_debug(ps
, depth
, desc
, "samr_io_q_get_dom_pwinfo");
7387 if(!prs_uint32("ptr", ps
, depth
, &q_u
->ptr
))
7389 if (q_u
->ptr
!= 0) {
7390 if(!smb_io_unihdr("", &q_u
->hdr_srv_name
, ps
, depth
))
7392 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->hdr_srv_name
.buffer
, ps
, depth
))
7399 /*******************************************************************
7400 reads or writes a structure.
7401 ********************************************************************/
7403 BOOL
samr_io_r_get_dom_pwinfo(const char *desc
, SAMR_R_GET_DOM_PWINFO
* r_u
,
7404 prs_struct
*ps
, int depth
)
7409 prs_debug(ps
, depth
, desc
, "samr_io_r_get_dom_pwinfo");
7415 if(!prs_uint16("min_pwd_length", ps
, depth
, &r_u
->min_pwd_length
))
7419 if(!prs_uint32("password_properties", ps
, depth
, &r_u
->password_properties
))
7422 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7428 /*******************************************************************
7429 make a SAMR_ENC_PASSWD structure.
7430 ********************************************************************/
7432 void init_enc_passwd(SAMR_ENC_PASSWD
* pwd
, const char pass
[512])
7440 memcpy(pwd
->pass
, pass
, sizeof(pwd
->pass
));
7444 /*******************************************************************
7445 reads or writes a SAMR_ENC_PASSWD structure.
7446 ********************************************************************/
7448 BOOL
samr_io_enc_passwd(const char *desc
, SAMR_ENC_PASSWD
* pwd
,
7449 prs_struct
*ps
, int depth
)
7454 prs_debug(ps
, depth
, desc
, "samr_io_enc_passwd");
7460 if(!prs_uint32("ptr", ps
, depth
, &pwd
->ptr
))
7463 if (pwd
->ptr
!= 0) {
7464 if(!prs_uint8s(False
, "pwd", ps
, depth
, pwd
->pass
, sizeof(pwd
->pass
)))
7471 /*******************************************************************
7472 inits a SAMR_ENC_HASH structure.
7473 ********************************************************************/
7475 void init_enc_hash(SAMR_ENC_HASH
* hsh
, const uchar hash
[16])
7483 memcpy(hsh
->hash
, hash
, sizeof(hsh
->hash
));
7487 /*******************************************************************
7488 reads or writes a SAMR_ENC_HASH structure.
7489 ********************************************************************/
7491 BOOL
samr_io_enc_hash(const char *desc
, SAMR_ENC_HASH
* hsh
,
7492 prs_struct
*ps
, int depth
)
7497 prs_debug(ps
, depth
, desc
, "samr_io_enc_hash");
7503 if(!prs_uint32("ptr ", ps
, depth
, &hsh
->ptr
))
7505 if (hsh
->ptr
!= 0) {
7506 if(!prs_uint8s(False
, "hash", ps
, depth
, hsh
->hash
,sizeof(hsh
->hash
)))
7513 /*******************************************************************
7514 inits a SAMR_Q_CHGPASSWD_USER structure.
7515 ********************************************************************/
7517 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER
* q_u
,
7518 const char *dest_host
, const char *user_name
,
7519 const uchar nt_newpass
[516],
7520 const uchar nt_oldhash
[16],
7521 const uchar lm_newpass
[516],
7522 const uchar lm_oldhash
[16])
7524 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
7527 init_unistr2(&q_u
->uni_dest_host
, dest_host
, UNI_FLAGS_NONE
);
7528 init_uni_hdr(&q_u
->hdr_dest_host
, &q_u
->uni_dest_host
);
7530 init_unistr2(&q_u
->uni_user_name
, user_name
, UNI_FLAGS_NONE
);
7531 init_uni_hdr(&q_u
->hdr_user_name
, &q_u
->uni_user_name
);
7533 init_enc_passwd(&q_u
->nt_newpass
, (const char *)nt_newpass
);
7534 init_enc_hash(&q_u
->nt_oldhash
, nt_oldhash
);
7536 q_u
->unknown
= 0x01;
7538 init_enc_passwd(&q_u
->lm_newpass
, (const char *)lm_newpass
);
7539 init_enc_hash(&q_u
->lm_oldhash
, lm_oldhash
);
7542 /*******************************************************************
7543 reads or writes a structure.
7544 ********************************************************************/
7546 BOOL
samr_io_q_chgpasswd_user(const char *desc
, SAMR_Q_CHGPASSWD_USER
* q_u
,
7547 prs_struct
*ps
, int depth
)
7552 prs_debug(ps
, depth
, desc
, "samr_io_q_chgpasswd_user");
7558 if(!prs_uint32("ptr_0", ps
, depth
, &q_u
->ptr_0
))
7561 if(!smb_io_unihdr("", &q_u
->hdr_dest_host
, ps
, depth
))
7563 if(!smb_io_unistr2("", &q_u
->uni_dest_host
, q_u
->hdr_dest_host
.buffer
, ps
, depth
))
7568 if(!smb_io_unihdr("", &q_u
->hdr_user_name
, ps
, depth
))
7570 if(!smb_io_unistr2("", &q_u
->uni_user_name
, q_u
->hdr_user_name
.buffer
,ps
, depth
))
7573 if(!samr_io_enc_passwd("nt_newpass", &q_u
->nt_newpass
, ps
, depth
))
7575 if(!samr_io_enc_hash("nt_oldhash", &q_u
->nt_oldhash
, ps
, depth
))
7578 if(!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
7581 if(!samr_io_enc_passwd("lm_newpass", &q_u
->lm_newpass
, ps
, depth
))
7583 if(!samr_io_enc_hash("lm_oldhash", &q_u
->lm_oldhash
, ps
, depth
))
7589 /*******************************************************************
7590 inits a SAMR_R_CHGPASSWD_USER structure.
7591 ********************************************************************/
7593 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER
* r_u
, NTSTATUS status
)
7595 DEBUG(5, ("init_samr_r_chgpasswd_user\n"));
7597 r_u
->status
= status
;
7600 /*******************************************************************
7601 reads or writes a structure.
7602 ********************************************************************/
7604 BOOL
samr_io_r_chgpasswd_user(const char *desc
, SAMR_R_CHGPASSWD_USER
* r_u
,
7605 prs_struct
*ps
, int depth
)
7610 prs_debug(ps
, depth
, desc
, "samr_io_r_chgpasswd_user");
7616 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7622 /*******************************************************************
7623 inits a SAMR_Q_CHGPASSWD3 structure.
7624 ********************************************************************/
7626 void init_samr_q_chgpasswd_user3(SAMR_Q_CHGPASSWD_USER3
* q_u
,
7627 const char *dest_host
, const char *user_name
,
7628 const uchar nt_newpass
[516],
7629 const uchar nt_oldhash
[16],
7630 const uchar lm_newpass
[516],
7631 const uchar lm_oldhash
[16])
7633 DEBUG(5, ("init_samr_q_chgpasswd_user3\n"));
7636 init_unistr2(&q_u
->uni_dest_host
, dest_host
, UNI_FLAGS_NONE
);
7637 init_uni_hdr(&q_u
->hdr_dest_host
, &q_u
->uni_dest_host
);
7639 init_unistr2(&q_u
->uni_user_name
, user_name
, UNI_FLAGS_NONE
);
7640 init_uni_hdr(&q_u
->hdr_user_name
, &q_u
->uni_user_name
);
7642 init_enc_passwd(&q_u
->nt_newpass
, (const char *)nt_newpass
);
7643 init_enc_hash(&q_u
->nt_oldhash
, nt_oldhash
);
7645 q_u
->lm_change
= 0x01;
7647 init_enc_passwd(&q_u
->lm_newpass
, (const char *)lm_newpass
);
7648 init_enc_hash(&q_u
->lm_oldhash
, lm_oldhash
);
7650 init_enc_passwd(&q_u
->password3
, NULL
);
7653 /*******************************************************************
7654 reads or writes a structure.
7655 ********************************************************************/
7657 BOOL
samr_io_q_chgpasswd_user3(const char *desc
, SAMR_Q_CHGPASSWD_USER3
* q_u
,
7658 prs_struct
*ps
, int depth
)
7663 prs_debug(ps
, depth
, desc
, "samr_io_q_chgpasswd_user3");
7669 if(!prs_uint32("ptr_0", ps
, depth
, &q_u
->ptr_0
))
7672 if(!smb_io_unihdr("", &q_u
->hdr_dest_host
, ps
, depth
))
7674 if(!smb_io_unistr2("", &q_u
->uni_dest_host
, q_u
->hdr_dest_host
.buffer
, ps
, depth
))
7679 if(!smb_io_unihdr("", &q_u
->hdr_user_name
, ps
, depth
))
7681 if(!smb_io_unistr2("", &q_u
->uni_user_name
, q_u
->hdr_user_name
.buffer
,ps
, depth
))
7684 if(!samr_io_enc_passwd("nt_newpass", &q_u
->nt_newpass
, ps
, depth
))
7686 if(!samr_io_enc_hash("nt_oldhash", &q_u
->nt_oldhash
, ps
, depth
))
7689 if(!prs_uint32("lm_change", ps
, depth
, &q_u
->lm_change
))
7692 if(!samr_io_enc_passwd("lm_newpass", &q_u
->lm_newpass
, ps
, depth
))
7694 if(!samr_io_enc_hash("lm_oldhash", &q_u
->lm_oldhash
, ps
, depth
))
7697 if(!samr_io_enc_passwd("password3", &q_u
->password3
, ps
, depth
))
7703 /*******************************************************************
7704 inits a SAMR_R_CHGPASSWD_USER3 structure.
7705 ********************************************************************/
7707 void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3
*r_u
, NTSTATUS status
,
7708 SAMR_CHANGE_REJECT
*reject
, SAM_UNK_INFO_1
*info
)
7710 DEBUG(5, ("init_samr_r_chgpasswd_user3\n"));
7712 r_u
->status
= status
;
7716 r_u
->ptr_reject
= 0;
7722 if (reject
&& (reject
->reject_reason
!= Undefined
)) {
7723 r_u
->reject
= reject
;
7724 r_u
->ptr_reject
= 1;
7728 /*******************************************************************
7729 Reads or writes an SAMR_CHANGE_REJECT structure.
7730 ********************************************************************/
7732 BOOL
samr_io_change_reject(const char *desc
, SAMR_CHANGE_REJECT
*reject
, prs_struct
*ps
, int depth
)
7737 prs_debug(ps
, depth
, desc
, "samr_io_change_reject");
7743 if(UNMARSHALLING(ps
))
7744 ZERO_STRUCTP(reject
);
7746 if (!prs_uint32("reject_reason", ps
, depth
, &reject
->reject_reason
))
7749 if (!prs_uint32("unknown1", ps
, depth
, &reject
->unknown1
))
7752 if (!prs_uint32("unknown2", ps
, depth
, &reject
->unknown2
))
7758 /*******************************************************************
7759 reads or writes a structure.
7760 ********************************************************************/
7762 BOOL
samr_io_r_chgpasswd_user3(const char *desc
, SAMR_R_CHGPASSWD_USER3
*r_u
,
7763 prs_struct
*ps
, int depth
)
7768 prs_debug(ps
, depth
, desc
, "samr_io_r_chgpasswd_user3");
7774 if (!prs_uint32("ptr_info", ps
, depth
, &r_u
->ptr_info
))
7777 /* special case: Windows 2000 can return stub data here saying
7778 NT_STATUS_NOT_SUPPORTED */
7780 if ( NT_STATUS_EQUAL( NT_STATUS_NOT_SUPPORTED
, NT_STATUS(r_u
->ptr_info
)) ) {
7781 r_u
->status
= NT_STATUS_NOT_SUPPORTED
;
7785 if (r_u
->ptr_info
&& r_u
->info
!= NULL
) {
7786 /* SAM_UNK_INFO_1 */
7787 if (!sam_io_unk_info1("info", r_u
->info
, ps
, depth
))
7791 if (!prs_uint32("ptr_reject", ps
, depth
, &r_u
->ptr_reject
))
7794 if (r_u
->ptr_reject
&& r_u
->reject
!= NULL
) {
7795 /* SAMR_CHANGE_REJECT */
7796 if (!samr_io_change_reject("reject", r_u
->reject
, ps
, depth
))
7800 if (!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7806 /*******************************************************************
7807 reads or writes a structure.
7808 ********************************************************************/
7810 void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2
*q_u
,
7811 POLICY_HND
*domain_pol
, uint16 switch_value
)
7813 DEBUG(5, ("init_samr_q_query_domain_info2\n"));
7815 q_u
->domain_pol
= *domain_pol
;
7816 q_u
->switch_value
= switch_value
;
7819 /*******************************************************************
7820 reads or writes a structure.
7821 ********************************************************************/
7823 BOOL
samr_io_q_query_domain_info2(const char *desc
, SAMR_Q_QUERY_DOMAIN_INFO2
*q_u
,
7824 prs_struct
*ps
, int depth
)
7829 prs_debug(ps
, depth
, desc
, "samr_io_q_query_domain_info2");
7835 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
7838 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
7844 /*******************************************************************
7845 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7846 ********************************************************************/
7848 void init_samr_r_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2
* r_u
,
7849 uint16 switch_value
, SAM_UNK_CTR
* ctr
,
7852 DEBUG(5, ("init_samr_r_query_domain_info2\n"));
7855 r_u
->switch_value
= 0;
7856 r_u
->status
= status
; /* return status */
7858 if (NT_STATUS_IS_OK(status
)) {
7859 r_u
->switch_value
= switch_value
;
7865 /*******************************************************************
7866 reads or writes a structure.
7867 ********************************************************************/
7869 BOOL
samr_io_r_query_domain_info2(const char *desc
, SAMR_R_QUERY_DOMAIN_INFO2
* r_u
,
7870 prs_struct
*ps
, int depth
)
7875 prs_debug(ps
, depth
, desc
, "samr_io_r_query_domain_info2");
7881 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
7884 if (r_u
->ptr_0
!= 0 && r_u
->ctr
!= NULL
) {
7885 if(!prs_uint16("switch_value", ps
, depth
, &r_u
->switch_value
))
7890 switch (r_u
->switch_value
) {
7892 if(!sam_io_unk_info13("unk_inf13", &r_u
->ctr
->info
.inf13
, ps
, depth
))
7896 if(!sam_io_unk_info12("unk_inf12", &r_u
->ctr
->info
.inf12
, ps
, depth
))
7900 if(!sam_io_unk_info9("unk_inf9",&r_u
->ctr
->info
.inf9
, ps
,depth
))
7904 if(!sam_io_unk_info8("unk_inf8",&r_u
->ctr
->info
.inf8
, ps
,depth
))
7908 if(!sam_io_unk_info7("unk_inf7",&r_u
->ctr
->info
.inf7
, ps
,depth
))
7912 if(!sam_io_unk_info6("unk_inf6",&r_u
->ctr
->info
.inf6
, ps
,depth
))
7916 if(!sam_io_unk_info5("unk_inf5",&r_u
->ctr
->info
.inf5
, ps
,depth
))
7920 if(!sam_io_unk_info4("unk_inf4",&r_u
->ctr
->info
.inf4
, ps
,depth
))
7924 if(!sam_io_unk_info3("unk_inf3",&r_u
->ctr
->info
.inf3
, ps
,depth
))
7928 if(!sam_io_unk_info2("unk_inf2",&r_u
->ctr
->info
.inf2
, ps
,depth
))
7932 if(!sam_io_unk_info1("unk_inf1",&r_u
->ctr
->info
.inf1
, ps
,depth
))
7936 DEBUG(0, ("samr_io_r_query_domain_info2: unknown switch level 0x%x\n",
7937 r_u
->switch_value
));
7938 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
7946 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7953 /*******************************************************************
7954 reads or writes a structure.
7955 ********************************************************************/
7957 void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO
*q_u
,
7958 POLICY_HND
*domain_pol
, uint16 switch_value
, SAM_UNK_CTR
*ctr
)
7960 DEBUG(5, ("init_samr_q_set_domain_info\n"));
7962 q_u
->domain_pol
= *domain_pol
;
7963 q_u
->switch_value0
= switch_value
;
7965 q_u
->switch_value
= switch_value
;
7970 /*******************************************************************
7971 reads or writes a structure.
7972 ********************************************************************/
7974 BOOL
samr_io_q_set_domain_info(const char *desc
, SAMR_Q_SET_DOMAIN_INFO
*q_u
,
7975 prs_struct
*ps
, int depth
)
7980 prs_debug(ps
, depth
, desc
, "samr_io_q_set_domain_info");
7986 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
7989 if(!prs_uint16("switch_value0", ps
, depth
, &q_u
->switch_value0
))
7992 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
7998 if (UNMARSHALLING(ps
)) {
7999 if ((q_u
->ctr
= PRS_ALLOC_MEM(ps
, SAM_UNK_CTR
, 1)) == NULL
)
8003 switch (q_u
->switch_value
) {
8006 if(!sam_io_unk_info12("unk_inf12", &q_u
->ctr
->info
.inf12
, ps
, depth
))
8010 if(!sam_io_unk_info7("unk_inf7",&q_u
->ctr
->info
.inf7
, ps
,depth
))
8014 if(!sam_io_unk_info6("unk_inf6",&q_u
->ctr
->info
.inf6
, ps
,depth
))
8018 if(!sam_io_unk_info5("unk_inf5",&q_u
->ctr
->info
.inf5
, ps
,depth
))
8022 if(!sam_io_unk_info3("unk_inf3",&q_u
->ctr
->info
.inf3
, ps
,depth
))
8026 if(!sam_io_unk_info2("unk_inf2",&q_u
->ctr
->info
.inf2
, ps
,depth
))
8030 if(!sam_io_unk_info1("unk_inf1",&q_u
->ctr
->info
.inf1
, ps
,depth
))
8034 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
8035 q_u
->switch_value
));
8042 /*******************************************************************
8043 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
8044 ********************************************************************/
8046 void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO
* r_u
, NTSTATUS status
)
8048 DEBUG(5, ("init_samr_r_set_domain_info\n"));
8050 r_u
->status
= status
; /* return status */
8053 /*******************************************************************
8054 reads or writes a structure.
8055 ********************************************************************/
8057 BOOL
samr_io_r_set_domain_info(const char *desc
, SAMR_R_SET_DOMAIN_INFO
* r_u
,
8058 prs_struct
*ps
, int depth
)
8063 prs_debug(ps
, depth
, desc
, "samr_io_r_samr_unknown_2e");
8069 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))