2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-2000,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
7 * Copyright (C) Paul Ashton 1997-2000,
8 * Copyright (C) Elrond 2000,
9 * Copyright (C) Jeremy Allison 2001
10 * Copyright (C) Jean François Micouleau 1998-2001.
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.
28 #include "rpc_parse.h"
31 /*******************************************************************
32 inits a SAMR_Q_CLOSE_HND structure.
33 ********************************************************************/
35 void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND
* q_c
, POLICY_HND
*hnd
)
37 DEBUG(5, ("init_samr_q_close_hnd\n"));
42 /*******************************************************************
43 reads or writes a structure.
44 ********************************************************************/
46 BOOL
samr_io_q_close_hnd(char *desc
, SAMR_Q_CLOSE_HND
* q_u
,
47 prs_struct
*ps
, int depth
)
52 prs_debug(ps
, depth
, desc
, "samr_io_q_close_hnd");
58 return smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
);
61 /*******************************************************************
62 reads or writes a structure.
63 ********************************************************************/
65 BOOL
samr_io_r_close_hnd(char *desc
, SAMR_R_CLOSE_HND
* r_u
,
66 prs_struct
*ps
, int depth
)
71 prs_debug(ps
, depth
, desc
, "samr_io_r_close_hnd");
77 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
80 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
86 /*******************************************************************
87 inits a SAMR_Q_LOOKUP_DOMAIN structure.
88 ********************************************************************/
90 void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN
* q_u
,
91 POLICY_HND
*pol
, char *dom_name
)
93 int len_name
= strlen(dom_name
);
95 DEBUG(5, ("init_samr_q_lookup_domain\n"));
97 q_u
->connect_pol
= *pol
;
99 init_uni_hdr(&q_u
->hdr_domain
, len_name
);
100 init_unistr2(&q_u
->uni_domain
, dom_name
, len_name
);
103 /*******************************************************************
104 reads or writes a structure.
105 ********************************************************************/
106 BOOL
samr_io_q_lookup_domain(char *desc
, SAMR_Q_LOOKUP_DOMAIN
* q_u
,
107 prs_struct
*ps
, int depth
)
112 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_domain");
118 if(!smb_io_pol_hnd("connect_pol", &q_u
->connect_pol
, ps
, depth
))
121 if(!smb_io_unihdr("hdr_domain", &q_u
->hdr_domain
, ps
, depth
))
124 if(!smb_io_unistr2("uni_domain", &q_u
->uni_domain
, q_u
->hdr_domain
.buffer
, ps
, depth
))
130 /*******************************************************************
131 inits a SAMR_R_LOOKUP_DOMAIN structure.
132 ********************************************************************/
134 void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN
* r_u
,
135 DOM_SID
*dom_sid
, NTSTATUS status
)
137 DEBUG(5, ("init_samr_r_lookup_domain\n"));
139 r_u
->status
= status
;
141 if (NT_STATUS_IS_OK(status
)) {
143 init_dom_sid2(&r_u
->dom_sid
, dom_sid
);
147 /*******************************************************************
148 reads or writes a structure.
149 ********************************************************************/
151 BOOL
samr_io_r_lookup_domain(char *desc
, SAMR_R_LOOKUP_DOMAIN
* r_u
,
152 prs_struct
*ps
, int depth
)
157 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_domain");
163 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr_sid
))
166 if (r_u
->ptr_sid
!= 0) {
167 if(!smb_io_dom_sid2("sid", &r_u
->dom_sid
, ps
, depth
))
173 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
179 /*******************************************************************
180 reads or writes a structure.
181 ********************************************************************/
183 void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D
* q_u
, POLICY_HND
*dom_pol
, DOM_SID
*sid
)
185 DEBUG(5, ("samr_init_samr_q_unknown_2d\n"));
187 q_u
->dom_pol
= *dom_pol
;
188 init_dom_sid2(&q_u
->sid
, sid
);
191 /*******************************************************************
192 reads or writes a structure.
193 ********************************************************************/
195 BOOL
samr_io_q_unknown_2d(char *desc
, SAMR_Q_UNKNOWN_2D
* q_u
,
196 prs_struct
*ps
, int depth
)
201 prs_debug(ps
, depth
, desc
, "samr_io_q_unknown_2d");
207 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
210 if(!smb_io_dom_sid2("sid", &q_u
->sid
, ps
, depth
))
219 /*******************************************************************
220 reads or writes a structure.
221 ********************************************************************/
223 BOOL
samr_io_r_unknown_2d(char *desc
, SAMR_R_UNKNOWN_2D
* r_u
,
224 prs_struct
*ps
, int depth
)
229 prs_debug(ps
, depth
, desc
, "samr_io_r_unknown_2d");
235 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
241 /*******************************************************************
242 reads or writes a structure.
243 ********************************************************************/
245 void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN
* q_u
,
246 POLICY_HND
*pol
, uint32 flags
,
249 DEBUG(5, ("samr_init_samr_q_open_domain\n"));
253 init_dom_sid2(&q_u
->dom_sid
, sid
);
256 /*******************************************************************
257 reads or writes a structure.
258 ********************************************************************/
260 BOOL
samr_io_q_open_domain(char *desc
, SAMR_Q_OPEN_DOMAIN
* q_u
,
261 prs_struct
*ps
, int depth
)
266 prs_debug(ps
, depth
, desc
, "samr_io_q_open_domain");
272 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
275 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
278 if(!smb_io_dom_sid2("sid", &q_u
->dom_sid
, ps
, depth
))
284 /*******************************************************************
285 reads or writes a structure.
286 ********************************************************************/
288 BOOL
samr_io_r_open_domain(char *desc
, SAMR_R_OPEN_DOMAIN
* r_u
,
289 prs_struct
*ps
, int depth
)
294 prs_debug(ps
, depth
, desc
, "samr_io_r_open_domain");
300 if(!smb_io_pol_hnd("domain_pol", &r_u
->domain_pol
, ps
, depth
))
303 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
309 /*******************************************************************
310 reads or writes a structure.
311 ********************************************************************/
313 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
314 POLICY_HND
*user_pol
)
316 DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
318 q_u
->user_pol
= *user_pol
;
321 /*******************************************************************
322 reads or writes a structure.
323 ********************************************************************/
325 BOOL
samr_io_q_get_usrdom_pwinfo(char *desc
, SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
326 prs_struct
*ps
, int depth
)
331 prs_debug(ps
, depth
, desc
, "samr_io_q_get_usrdom_pwinfo");
337 return smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
);
340 /*******************************************************************
342 ********************************************************************/
344 void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO
*r_u
, NTSTATUS status
)
346 DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
348 r_u
->unknown_0
= 0x0000;
352 * r_u->unknown_1 = 0x0015;
355 r_u
->unknown_1
= 0x01D1;
356 r_u
->unknown_1
= 0x0015;
358 r_u
->unknown_2
= 0x00000000;
360 r_u
->status
= status
;
363 /*******************************************************************
364 reads or writes a structure.
365 ********************************************************************/
367 BOOL
samr_io_r_get_usrdom_pwinfo(char *desc
, SAMR_R_GET_USRDOM_PWINFO
* r_u
,
368 prs_struct
*ps
, int depth
)
373 prs_debug(ps
, depth
, desc
, "samr_io_r_get_usrdom_pwinfo");
379 if(!prs_uint16("unknown_0", ps
, depth
, &r_u
->unknown_0
))
381 if(!prs_uint16("unknown_1", ps
, depth
, &r_u
->unknown_1
))
383 if(!prs_uint32("unknown_2", ps
, depth
, &r_u
->unknown_2
))
385 if(!prs_ntstatus("status ", ps
, depth
, &r_u
->status
))
391 /*******************************************************************
392 reads or writes a structure.
393 ********************************************************************/
395 void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ
* q_u
,
396 POLICY_HND
*user_pol
, uint32 sec_info
)
398 DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
400 q_u
->user_pol
= *user_pol
;
401 q_u
->sec_info
= sec_info
;
405 /*******************************************************************
406 reads or writes a structure.
407 ********************************************************************/
409 BOOL
samr_io_q_query_sec_obj(char *desc
, SAMR_Q_QUERY_SEC_OBJ
* q_u
,
410 prs_struct
*ps
, int depth
)
415 prs_debug(ps
, depth
, desc
, "samr_io_q_query_sec_obj");
421 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
424 if(!prs_uint32("sec_info", ps
, depth
, &q_u
->sec_info
))
430 /*******************************************************************
431 reads or writes a structure.
432 ********************************************************************/
434 void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
435 POLICY_HND
*domain_pol
, uint16 switch_value
)
437 DEBUG(5, ("samr_init_samr_q_query_dom_info\n"));
439 q_u
->domain_pol
= *domain_pol
;
440 q_u
->switch_value
= switch_value
;
443 /*******************************************************************
444 reads or writes a structure.
445 ********************************************************************/
447 BOOL
samr_io_q_query_dom_info(char *desc
, SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
448 prs_struct
*ps
, int depth
)
453 prs_debug(ps
, depth
, desc
, "samr_io_q_query_dom_info");
459 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
462 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
469 /*******************************************************************
471 ********************************************************************/
473 void init_unk_info3(SAM_UNK_INFO_3
*u_3
, NTTIME nt_logout
)
475 u_3
->logout
.low
= nt_logout
.low
;
476 u_3
->logout
.high
= nt_logout
.high
;
479 /*******************************************************************
480 reads or writes a structure.
481 ********************************************************************/
483 static BOOL
sam_io_unk_info3(char *desc
, SAM_UNK_INFO_3
* u_3
,
484 prs_struct
*ps
, int depth
)
489 prs_debug(ps
, depth
, desc
, "sam_io_unk_info3");
492 if(!smb_io_time("logout", &u_3
->logout
, ps
, depth
))
498 /*******************************************************************
500 ********************************************************************/
502 void init_unk_info6(SAM_UNK_INFO_6
* u_6
)
504 u_6
->unknown_0
= 0x00000000;
506 memset(u_6
->padding
, 0, sizeof(u_6
->padding
)); /* 12 bytes zeros */
509 /*******************************************************************
510 reads or writes a structure.
511 ********************************************************************/
513 static BOOL
sam_io_unk_info6(char *desc
, SAM_UNK_INFO_6
* u_6
,
514 prs_struct
*ps
, int depth
)
519 prs_debug(ps
, depth
, desc
, "sam_io_unk_info6");
522 if(!prs_uint32("unknown_0", ps
, depth
, &u_6
->unknown_0
)) /* 0x0000 0000 */
524 if(!prs_uint32("ptr_0", ps
, depth
, &u_6
->ptr_0
)) /* pointer to unknown structure */
526 if(!prs_uint8s(False
, "padding", ps
, depth
, u_6
->padding
, sizeof(u_6
->padding
))) /* 12 bytes zeros */
532 /*******************************************************************
534 ********************************************************************/
536 void init_unk_info7(SAM_UNK_INFO_7
* u_7
)
538 u_7
->unknown_0
= 0x0003;
541 /*******************************************************************
542 reads or writes a structure.
543 ********************************************************************/
545 static BOOL
sam_io_unk_info7(char *desc
, SAM_UNK_INFO_7
* u_7
,
546 prs_struct
*ps
, int depth
)
551 prs_debug(ps
, depth
, desc
, "sam_io_unk_info7");
554 if(!prs_uint16("unknown_0", ps
, depth
, &u_7
->unknown_0
)) /* 0x0003 */
560 /*******************************************************************
562 ********************************************************************/
564 void init_unk_info12(SAM_UNK_INFO_12
* u_12
, NTTIME nt_lock_duration
, NTTIME nt_reset_time
, uint16 lockout
)
566 u_12
->duration
.low
= nt_lock_duration
.low
;
567 u_12
->duration
.high
= nt_lock_duration
.high
;
568 u_12
->reset_count
.low
= nt_reset_time
.low
;
569 u_12
->reset_count
.high
= nt_reset_time
.high
;
571 u_12
->bad_attempt_lockout
= lockout
;
574 /*******************************************************************
575 reads or writes a structure.
576 ********************************************************************/
578 static BOOL
sam_io_unk_info12(char *desc
, SAM_UNK_INFO_12
* u_12
,
579 prs_struct
*ps
, int depth
)
584 prs_debug(ps
, depth
, desc
, "sam_io_unk_info12");
587 if(!smb_io_time("duration", &u_12
->duration
, ps
, depth
))
589 if(!smb_io_time("reset_count", &u_12
->reset_count
, ps
, depth
))
591 if(!prs_uint16("bad_attempt_lockout", ps
, depth
, &u_12
->bad_attempt_lockout
))
597 /*******************************************************************
599 ********************************************************************/
600 void init_unk_info5(SAM_UNK_INFO_5
* u_5
,char *server
)
602 int len_server
= strlen(server
);
604 init_uni_hdr(&u_5
->hdr_server
, len_server
);
606 init_unistr2(&u_5
->uni_server
, server
, len_server
);
609 /*******************************************************************
610 reads or writes a structure.
611 ********************************************************************/
613 static BOOL
sam_io_unk_info5(char *desc
, SAM_UNK_INFO_5
* u_5
,
614 prs_struct
*ps
, int depth
)
619 prs_debug(ps
, depth
, desc
, "sam_io_unk_info5");
622 if(!smb_io_unihdr("hdr_server", &u_5
->hdr_server
, ps
, depth
))
625 if(!smb_io_unistr2("uni_server", &u_5
->uni_server
, u_5
->hdr_server
.buffer
, ps
, depth
))
631 /*******************************************************************
633 ********************************************************************/
634 void init_unk_info2(SAM_UNK_INFO_2
* u_2
,
635 char *domain
, char *server
,
636 uint32 seq_num
, uint32 num_users
, uint32 num_groups
, uint32 num_alias
)
638 int len_domain
= strlen(domain
);
639 int len_server
= strlen(server
);
641 u_2
->unknown_0
= 0x00000000;
642 u_2
->unknown_1
= 0x80000000;
643 u_2
->unknown_2
= 0x00000000;
646 init_uni_hdr(&u_2
->hdr_domain
, len_domain
);
647 init_uni_hdr(&u_2
->hdr_server
, len_server
);
649 u_2
->seq_num
= seq_num
;
650 u_2
->unknown_3
= 0x00000000;
652 u_2
->unknown_4
= 0x00000001;
653 u_2
->unknown_5
= 0x00000003;
654 u_2
->unknown_6
= 0x00000001;
655 u_2
->num_domain_usrs
= num_users
;
656 u_2
->num_domain_grps
= num_groups
;
657 u_2
->num_local_grps
= num_alias
;
659 memset(u_2
->padding
, 0, sizeof(u_2
->padding
)); /* 12 bytes zeros */
661 init_unistr2(&u_2
->uni_domain
, domain
, len_domain
);
662 init_unistr2(&u_2
->uni_server
, server
, len_server
);
665 /*******************************************************************
666 reads or writes a structure.
667 ********************************************************************/
669 static BOOL
sam_io_unk_info2(char *desc
, SAM_UNK_INFO_2
* u_2
,
670 prs_struct
*ps
, int depth
)
675 prs_debug(ps
, depth
, desc
, "sam_io_unk_info2");
678 if(!prs_uint32("unknown_0", ps
, depth
, &u_2
->unknown_0
)) /* 0x0000 0000 */
680 if(!prs_uint32("unknown_1", ps
, depth
, &u_2
->unknown_1
)) /* 0x8000 0000 */
682 if(!prs_uint32("unknown_2", ps
, depth
, &u_2
->unknown_2
)) /* 0x0000 0000 */
685 if(!prs_uint32("ptr_0", ps
, depth
, &u_2
->ptr_0
))
687 if(!smb_io_unihdr("hdr_domain", &u_2
->hdr_domain
, ps
, depth
))
689 if(!smb_io_unihdr("hdr_server", &u_2
->hdr_server
, ps
, depth
))
692 /* put all the data in here, at the moment, including what the above
693 pointer is referring to
696 if(!prs_uint32("seq_num ", ps
, depth
, &u_2
->seq_num
)) /* 0x0000 0099 or 0x1000 0000 */
698 if(!prs_uint32("unknown_3 ", ps
, depth
, &u_2
->unknown_3
)) /* 0x0000 0000 */
701 if(!prs_uint32("unknown_4 ", ps
, depth
, &u_2
->unknown_4
)) /* 0x0000 0001 */
703 if(!prs_uint32("unknown_5 ", ps
, depth
, &u_2
->unknown_5
)) /* 0x0000 0003 */
705 if(!prs_uint32("unknown_6 ", ps
, depth
, &u_2
->unknown_6
)) /* 0x0000 0001 */
707 if(!prs_uint32("num_domain_usrs ", ps
, depth
, &u_2
->num_domain_usrs
))
709 if(!prs_uint32("num_domain_grps", ps
, depth
, &u_2
->num_domain_grps
))
711 if(!prs_uint32("num_local_grps", ps
, depth
, &u_2
->num_local_grps
))
714 if(!prs_uint8s(False
, "padding", ps
, depth
, u_2
->padding
,sizeof(u_2
->padding
)))
717 if(!smb_io_unistr2("uni_domain", &u_2
->uni_domain
, u_2
->hdr_domain
.buffer
, ps
, depth
))
719 if(!smb_io_unistr2("uni_server", &u_2
->uni_server
, u_2
->hdr_server
.buffer
, ps
, depth
))
725 /*******************************************************************
727 ********************************************************************/
729 void init_unk_info1(SAM_UNK_INFO_1
*u_1
, uint16 min_pass_len
, uint16 pass_hist
,
730 uint32 flag
, NTTIME nt_expire
, NTTIME nt_min_age
)
732 u_1
->min_length_password
= min_pass_len
;
733 u_1
->password_history
= pass_hist
;
736 /* password never expire */
737 u_1
->expire
.high
= nt_expire
.high
;
738 u_1
->expire
.low
= nt_expire
.low
;
740 /* can change the password now */
741 u_1
->min_passwordage
.high
= nt_min_age
.high
;
742 u_1
->min_passwordage
.low
= nt_min_age
.low
;
746 /*******************************************************************
747 reads or writes a structure.
748 ********************************************************************/
750 static BOOL
sam_io_unk_info1(char *desc
, SAM_UNK_INFO_1
* u_1
,
751 prs_struct
*ps
, int depth
)
756 prs_debug(ps
, depth
, desc
, "sam_io_unk_info1");
759 if(!prs_uint16("min_length_password", ps
, depth
, &u_1
->min_length_password
))
761 if(!prs_uint16("password_history", ps
, depth
, &u_1
->password_history
))
763 if(!prs_uint32("flag", ps
, depth
, &u_1
->flag
))
765 if(!smb_io_time("expire", &u_1
->expire
, ps
, depth
))
767 if(!smb_io_time("min_passwordage", &u_1
->min_passwordage
, ps
, depth
))
773 /*******************************************************************
774 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
775 ********************************************************************/
777 void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
778 uint16 switch_value
, SAM_UNK_CTR
* ctr
,
781 DEBUG(5, ("init_samr_r_query_dom_info\n"));
784 r_u
->switch_value
= 0;
785 r_u
->status
= status
; /* return status */
787 if (NT_STATUS_IS_OK(status
)) {
788 r_u
->switch_value
= switch_value
;
794 /*******************************************************************
795 reads or writes a structure.
796 ********************************************************************/
798 BOOL
samr_io_r_query_dom_info(char *desc
, SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
799 prs_struct
*ps
, int depth
)
804 prs_debug(ps
, depth
, desc
, "samr_io_r_query_dom_info");
810 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
813 if (r_u
->ptr_0
!= 0 && r_u
->ctr
!= NULL
) {
814 if(!prs_uint16("switch_value", ps
, depth
, &r_u
->switch_value
))
819 switch (r_u
->switch_value
) {
821 if(!sam_io_unk_info12("unk_inf12", &r_u
->ctr
->info
.inf12
, ps
, depth
))
825 if(!sam_io_unk_info7("unk_inf7",&r_u
->ctr
->info
.inf7
, ps
,depth
))
829 if(!sam_io_unk_info6("unk_inf6",&r_u
->ctr
->info
.inf6
, ps
,depth
))
833 if(!sam_io_unk_info5("unk_inf5",&r_u
->ctr
->info
.inf5
, ps
,depth
))
837 if(!sam_io_unk_info3("unk_inf3",&r_u
->ctr
->info
.inf3
, ps
,depth
))
841 if(!sam_io_unk_info2("unk_inf2",&r_u
->ctr
->info
.inf2
, ps
,depth
))
845 if(!sam_io_unk_info1("unk_inf1",&r_u
->ctr
->info
.inf1
, ps
,depth
))
849 DEBUG(0, ("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
851 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
859 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
865 /*******************************************************************
866 reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
867 ********************************************************************/
869 BOOL
samr_io_r_query_sec_obj(char *desc
, SAMR_R_QUERY_SEC_OBJ
* r_u
,
870 prs_struct
*ps
, int depth
)
875 prs_debug(ps
, depth
, desc
, "samr_io_r_query_sec_obj");
881 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
884 if(!sec_io_desc_buf("sec", &r_u
->buf
, ps
, depth
))
888 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
894 /*******************************************************************
895 reads or writes a SAM_STR1 structure.
896 ********************************************************************/
898 static BOOL
sam_io_sam_str1(char *desc
, SAM_STR1
* sam
, uint32 acct_buf
,
899 uint32 name_buf
, uint32 desc_buf
,
900 prs_struct
*ps
, int depth
)
905 prs_debug(ps
, depth
, desc
, "sam_io_sam_str1");
910 if (!smb_io_unistr2("name", &sam
->uni_acct_name
, acct_buf
, ps
, depth
))
913 if (!smb_io_unistr2("desc", &sam
->uni_acct_desc
, desc_buf
, ps
, depth
))
916 if (!smb_io_unistr2("full", &sam
->uni_full_name
, name_buf
, ps
, depth
))
922 /*******************************************************************
923 inits a SAM_ENTRY1 structure.
924 ********************************************************************/
926 static void init_sam_entry1(SAM_ENTRY1
* sam
, uint32 user_idx
,
927 uint32 len_sam_name
, uint32 len_sam_full
,
928 uint32 len_sam_desc
, uint32 rid_user
,
931 DEBUG(5, ("init_sam_entry1\n"));
935 sam
->user_idx
= user_idx
;
936 sam
->rid_user
= rid_user
;
937 sam
->acb_info
= acb_info
;
939 init_uni_hdr(&sam
->hdr_acct_name
, len_sam_name
);
940 init_uni_hdr(&sam
->hdr_user_name
, len_sam_full
);
941 init_uni_hdr(&sam
->hdr_user_desc
, len_sam_desc
);
944 /*******************************************************************
945 reads or writes a SAM_ENTRY1 structure.
946 ********************************************************************/
948 static BOOL
sam_io_sam_entry1(char *desc
, SAM_ENTRY1
* sam
,
949 prs_struct
*ps
, int depth
)
954 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry1");
960 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
963 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
965 if(!prs_uint16("acb_info ", ps
, depth
, &sam
->acb_info
))
971 if (!smb_io_unihdr("hdr_acct_name", &sam
->hdr_acct_name
, ps
, depth
))
973 if (!smb_io_unihdr("hdr_user_desc", &sam
->hdr_user_desc
, ps
, depth
))
975 if (!smb_io_unihdr("hdr_user_name", &sam
->hdr_user_name
, ps
, depth
))
981 /*******************************************************************
982 reads or writes a SAM_STR2 structure.
983 ********************************************************************/
985 static BOOL
sam_io_sam_str2(char *desc
, SAM_STR2
* sam
, uint32 acct_buf
,
986 uint32 desc_buf
, prs_struct
*ps
, int depth
)
991 prs_debug(ps
, depth
, desc
, "sam_io_sam_str2");
997 if(!smb_io_unistr2("uni_srv_name", &sam
->uni_srv_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
999 if(!smb_io_unistr2("uni_srv_desc", &sam
->uni_srv_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
1005 /*******************************************************************
1006 inits a SAM_ENTRY2 structure.
1007 ********************************************************************/
1008 static void init_sam_entry2(SAM_ENTRY2
* sam
, uint32 user_idx
,
1009 uint32 len_sam_name
, uint32 len_sam_desc
,
1010 uint32 rid_user
, uint16 acb_info
)
1012 DEBUG(5, ("init_sam_entry2\n"));
1014 sam
->user_idx
= user_idx
;
1015 sam
->rid_user
= rid_user
;
1016 sam
->acb_info
= acb_info
;
1018 init_uni_hdr(&sam
->hdr_srv_name
, len_sam_name
);
1019 init_uni_hdr(&sam
->hdr_srv_desc
, len_sam_desc
);
1022 /*******************************************************************
1023 reads or writes a SAM_ENTRY2 structure.
1024 ********************************************************************/
1026 static BOOL
sam_io_sam_entry2(char *desc
, SAM_ENTRY2
* sam
,
1027 prs_struct
*ps
, int depth
)
1032 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry2");
1038 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
1041 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
1043 if(!prs_uint16("acb_info ", ps
, depth
, &sam
->acb_info
))
1049 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_name
, ps
, depth
)) /* account name unicode string header */
1051 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_desc
, ps
, depth
)) /* account name unicode string header */
1057 /*******************************************************************
1058 reads or writes a SAM_STR3 structure.
1059 ********************************************************************/
1061 static BOOL
sam_io_sam_str3(char *desc
, SAM_STR3
* sam
, uint32 acct_buf
,
1062 uint32 desc_buf
, prs_struct
*ps
, int depth
)
1067 prs_debug(ps
, depth
, desc
, "sam_io_sam_str3");
1073 if(!smb_io_unistr2("uni_grp_name", &sam
->uni_grp_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
1075 if(!smb_io_unistr2("uni_grp_desc", &sam
->uni_grp_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
1081 /*******************************************************************
1082 inits a SAM_ENTRY3 structure.
1083 ********************************************************************/
1085 static void init_sam_entry3(SAM_ENTRY3
* sam
, uint32 grp_idx
,
1086 uint32 len_grp_name
, uint32 len_grp_desc
,
1089 DEBUG(5, ("init_sam_entry3\n"));
1091 sam
->grp_idx
= grp_idx
;
1092 sam
->rid_grp
= rid_grp
;
1093 sam
->attr
= 0x07; /* group rid attributes - gets ignored by nt 4.0 */
1095 init_uni_hdr(&sam
->hdr_grp_name
, len_grp_name
);
1096 init_uni_hdr(&sam
->hdr_grp_desc
, len_grp_desc
);
1099 /*******************************************************************
1100 reads or writes a SAM_ENTRY3 structure.
1101 ********************************************************************/
1103 static BOOL
sam_io_sam_entry3(char *desc
, SAM_ENTRY3
* sam
,
1104 prs_struct
*ps
, int depth
)
1109 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry3");
1115 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1118 if(!prs_uint32("rid_grp", ps
, depth
, &sam
->rid_grp
))
1120 if(!prs_uint32("attr ", ps
, depth
, &sam
->attr
))
1123 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_name
, ps
, depth
)) /* account name unicode string header */
1125 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_desc
, ps
, depth
)) /* account name unicode string header */
1131 /*******************************************************************
1132 inits a SAM_ENTRY4 structure.
1133 ********************************************************************/
1135 static void init_sam_entry4(SAM_ENTRY4
* sam
, uint32 user_idx
,
1136 uint32 len_acct_name
)
1138 DEBUG(5, ("init_sam_entry4\n"));
1140 sam
->user_idx
= user_idx
;
1141 init_str_hdr(&sam
->hdr_acct_name
, len_acct_name
+1, len_acct_name
, len_acct_name
!= 0);
1144 /*******************************************************************
1145 reads or writes a SAM_ENTRY4 structure.
1146 ********************************************************************/
1148 static BOOL
sam_io_sam_entry4(char *desc
, SAM_ENTRY4
* sam
,
1149 prs_struct
*ps
, int depth
)
1154 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry4");
1160 if(!prs_uint32("user_idx", ps
, depth
, &sam
->user_idx
))
1162 if(!smb_io_strhdr("strhdr", &sam
->hdr_acct_name
, ps
, depth
))
1168 /*******************************************************************
1169 inits a SAM_ENTRY5 structure.
1170 ********************************************************************/
1172 static void init_sam_entry5(SAM_ENTRY5
* sam
, uint32 grp_idx
,
1173 uint32 len_grp_name
)
1175 DEBUG(5, ("init_sam_entry5\n"));
1177 sam
->grp_idx
= grp_idx
;
1178 init_str_hdr(&sam
->hdr_grp_name
, len_grp_name
, len_grp_name
,
1182 /*******************************************************************
1183 reads or writes a SAM_ENTRY5 structure.
1184 ********************************************************************/
1186 static BOOL
sam_io_sam_entry5(char *desc
, SAM_ENTRY5
* sam
,
1187 prs_struct
*ps
, int depth
)
1192 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry5");
1198 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1200 if(!smb_io_strhdr("strhdr", &sam
->hdr_grp_name
, ps
, depth
))
1206 /*******************************************************************
1207 inits a SAM_ENTRY structure.
1208 ********************************************************************/
1210 void init_sam_entry(SAM_ENTRY
* sam
, uint32 len_sam_name
, uint32 rid
)
1212 DEBUG(10, ("init_sam_entry: %d %d\n", len_sam_name
, rid
));
1215 init_uni_hdr(&sam
->hdr_name
, len_sam_name
);
1218 /*******************************************************************
1219 reads or writes a SAM_ENTRY structure.
1220 ********************************************************************/
1222 static BOOL
sam_io_sam_entry(char *desc
, SAM_ENTRY
* sam
,
1223 prs_struct
*ps
, int depth
)
1228 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry");
1233 if(!prs_uint32("rid", ps
, depth
, &sam
->rid
))
1235 if(!smb_io_unihdr("unihdr", &sam
->hdr_name
, ps
, depth
)) /* account name unicode string header */
1241 /*******************************************************************
1242 inits a SAMR_Q_ENUM_DOM_USERS structure.
1243 ********************************************************************/
1245 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS
* q_e
, POLICY_HND
*pol
,
1247 uint16 acb_mask
, uint16 unk_1
, uint32 size
)
1249 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
1253 q_e
->start_idx
= start_idx
; /* zero indicates lots */
1254 q_e
->acb_mask
= acb_mask
;
1255 q_e
->unknown_1
= unk_1
;
1256 q_e
->max_size
= size
;
1259 /*******************************************************************
1260 reads or writes a structure.
1261 ********************************************************************/
1263 BOOL
samr_io_q_enum_dom_users(char *desc
, SAMR_Q_ENUM_DOM_USERS
* q_e
,
1264 prs_struct
*ps
, int depth
)
1269 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_users");
1275 if(!smb_io_pol_hnd("domain_pol", &q_e
->pol
, ps
, depth
))
1278 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
1280 if(!prs_uint16("acb_mask ", ps
, depth
, &q_e
->acb_mask
))
1282 if(!prs_uint16("unknown_1", ps
, depth
, &q_e
->unknown_1
))
1285 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1292 /*******************************************************************
1293 inits a SAMR_R_ENUM_DOM_USERS structure.
1294 ********************************************************************/
1296 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS
* r_u
,
1297 uint32 next_idx
, uint32 num_sam_entries
)
1299 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
1301 r_u
->next_idx
= next_idx
;
1303 if (num_sam_entries
!= 0) {
1304 r_u
->ptr_entries1
= 1;
1305 r_u
->ptr_entries2
= 1;
1306 r_u
->num_entries2
= num_sam_entries
;
1307 r_u
->num_entries3
= num_sam_entries
;
1309 r_u
->num_entries4
= num_sam_entries
;
1311 r_u
->ptr_entries1
= 0;
1312 r_u
->num_entries2
= num_sam_entries
;
1313 r_u
->ptr_entries2
= 1;
1317 /*******************************************************************
1318 reads or writes a structure.
1319 ********************************************************************/
1321 BOOL
samr_io_r_enum_dom_users(char *desc
, SAMR_R_ENUM_DOM_USERS
* r_u
,
1322 prs_struct
*ps
, int depth
)
1329 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_users");
1335 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
1337 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
1340 if (r_u
->ptr_entries1
!= 0) {
1341 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
1343 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
1345 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
1348 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
!= 0)) {
1349 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
1350 r_u
->uni_acct_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
1353 if ((r_u
->sam
== NULL
|| r_u
->uni_acct_name
== NULL
) && r_u
->num_entries2
!= 0) {
1354 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
1355 r_u
->num_entries4
= 0;
1356 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
1360 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1361 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
1365 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1366 if(!smb_io_unistr2("", &r_u
->uni_acct_name
[i
],r_u
->sam
[i
].hdr_name
.buffer
, ps
,depth
))
1375 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
1377 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
1383 /*******************************************************************
1384 inits a SAMR_Q_QUERY_DISPINFO structure.
1385 ********************************************************************/
1387 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO
* q_e
, POLICY_HND
*pol
,
1388 uint16 switch_level
, uint32 start_idx
,
1391 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
1393 q_e
->domain_pol
= *pol
;
1395 q_e
->switch_level
= switch_level
;
1397 q_e
->start_idx
= start_idx
;
1398 q_e
->max_entries
= max_entries
;
1399 q_e
->max_size
= 0xffff; /* Not especially useful */
1402 /*******************************************************************
1403 reads or writes a structure.
1404 ********************************************************************/
1406 BOOL
samr_io_q_query_dispinfo(char *desc
, SAMR_Q_QUERY_DISPINFO
* q_e
,
1407 prs_struct
*ps
, int depth
)
1412 prs_debug(ps
, depth
, desc
, "samr_io_q_query_dispinfo");
1418 if(!smb_io_pol_hnd("domain_pol", &q_e
->domain_pol
, ps
, depth
))
1421 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
1426 if(!prs_uint32("start_idx ", ps
, depth
, &q_e
->start_idx
))
1428 if(!prs_uint32("max_entries ", ps
, depth
, &q_e
->max_entries
))
1430 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1436 /*******************************************************************
1437 inits a SAM_DISPINFO_1 structure.
1438 ********************************************************************/
1440 NTSTATUS
init_sam_dispinfo_1(TALLOC_CTX
*ctx
, SAM_DISPINFO_1
*sam
, uint32 num_entries
,
1441 uint32 start_idx
, DISP_USER_INFO
*disp_user_info
)
1443 uint32 len_sam_name
, len_sam_full
, len_sam_desc
;
1446 SAM_ACCOUNT
*pwd
= NULL
;
1449 DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries
));
1452 return NT_STATUS_OK
;
1454 sam
->sam
=(SAM_ENTRY1
*)talloc(ctx
, num_entries
*sizeof(SAM_ENTRY1
));
1456 return NT_STATUS_NO_MEMORY
;
1458 sam
->str
=(SAM_STR1
*)talloc(ctx
, num_entries
*sizeof(SAM_STR1
));
1460 return NT_STATUS_NO_MEMORY
;
1462 ZERO_STRUCTP(sam
->sam
);
1463 ZERO_STRUCTP(sam
->str
);
1465 for (i
= 0; i
< num_entries
; i
++) {
1466 DEBUG(11, ("init_sam_dispinfo_1: entry: %d\n",i
));
1468 pwd
=disp_user_info
[i
+start_idx
].sam
;
1470 len_sam_name
= strlen(unix_to_dos_static(pdb_get_username(pwd
)));
1471 len_sam_full
= strlen(unix_to_dos_static(pdb_get_fullname(pwd
)));
1472 len_sam_desc
= strlen(unix_to_dos_static(pdb_get_acct_desc(pwd
)));
1474 init_sam_entry1(&sam
->sam
[i
], start_idx
+ i
+ 1,
1475 len_sam_name
, len_sam_full
, len_sam_desc
,
1476 pdb_get_user_rid(pwd
), pdb_get_acct_ctrl(pwd
));
1478 ZERO_STRUCTP(&sam
->str
[i
].uni_acct_name
);
1479 ZERO_STRUCTP(&sam
->str
[i
].uni_full_name
);
1480 ZERO_STRUCTP(&sam
->str
[i
].uni_acct_desc
);
1482 init_unistr2(&sam
->str
[i
].uni_acct_name
, unix_to_dos_static(pdb_get_username(pwd
)), len_sam_name
);
1483 init_unistr2(&sam
->str
[i
].uni_full_name
, unix_to_dos_static(pdb_get_fullname(pwd
)), len_sam_full
);
1484 init_unistr2(&sam
->str
[i
].uni_acct_desc
, unix_to_dos_static(pdb_get_acct_desc(pwd
)), len_sam_desc
);
1487 return NT_STATUS_OK
;
1490 /*******************************************************************
1491 reads or writes a structure.
1492 ********************************************************************/
1494 static BOOL
sam_io_sam_dispinfo_1(char *desc
, SAM_DISPINFO_1
* sam
,
1496 prs_struct
*ps
, int depth
)
1500 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_1");
1506 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1508 if ((sam
->sam
= (SAM_ENTRY1
*)
1509 prs_alloc_mem(ps
, sizeof(SAM_ENTRY1
) *
1510 num_entries
)) == NULL
) {
1511 DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
1515 if ((sam
->str
= (SAM_STR1
*)
1516 prs_alloc_mem(ps
, sizeof(SAM_STR1
) *
1517 num_entries
)) == NULL
) {
1518 DEBUG(0, ("out of memory allocating SAM_STR1\n"));
1523 for (i
= 0; i
< num_entries
; i
++) {
1524 if(!sam_io_sam_entry1("", &sam
->sam
[i
], ps
, depth
))
1528 for (i
= 0; i
< num_entries
; i
++) {
1529 if(!sam_io_sam_str1("", &sam
->str
[i
],
1530 sam
->sam
[i
].hdr_acct_name
.buffer
,
1531 sam
->sam
[i
].hdr_user_name
.buffer
,
1532 sam
->sam
[i
].hdr_user_desc
.buffer
, ps
, depth
))
1539 /*******************************************************************
1540 inits a SAM_DISPINFO_2 structure.
1541 ********************************************************************/
1543 NTSTATUS
init_sam_dispinfo_2(TALLOC_CTX
*ctx
, SAM_DISPINFO_2
*sam
, uint32 num_entries
,
1544 uint32 start_idx
, DISP_USER_INFO
*disp_user_info
)
1546 uint32 len_sam_name
, len_sam_desc
;
1549 SAM_ACCOUNT
*pwd
= NULL
;
1552 DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries
));
1555 return NT_STATUS_OK
;
1557 if (!(sam
->sam
=(SAM_ENTRY2
*)talloc(ctx
, num_entries
*sizeof(SAM_ENTRY2
))))
1558 return NT_STATUS_NO_MEMORY
;
1560 if (!(sam
->str
=(SAM_STR2
*)talloc(ctx
, num_entries
*sizeof(SAM_STR2
))))
1561 return NT_STATUS_NO_MEMORY
;
1563 ZERO_STRUCTP(sam
->sam
);
1564 ZERO_STRUCTP(sam
->str
);
1566 for (i
= 0; i
< num_entries
; i
++) {
1567 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i
));
1568 pwd
=disp_user_info
[i
+start_idx
].sam
;
1570 len_sam_name
= strlen(unix_to_dos_static(pdb_get_username(pwd
)));
1571 len_sam_desc
= strlen(unix_to_dos_static(pdb_get_acct_desc(pwd
)));
1573 init_sam_entry2(&sam
->sam
[i
], start_idx
+ i
+ 1,
1574 len_sam_name
, len_sam_desc
,
1575 pdb_get_user_rid(pwd
), pdb_get_acct_ctrl(pwd
));
1577 ZERO_STRUCTP(&sam
->str
[i
].uni_srv_name
);
1578 ZERO_STRUCTP(&sam
->str
[i
].uni_srv_desc
);
1580 init_unistr2(&sam
->str
[i
].uni_srv_name
, unix_to_dos_static(pdb_get_username(pwd
)), len_sam_name
);
1581 init_unistr2(&sam
->str
[i
].uni_srv_desc
, unix_to_dos_static(pdb_get_acct_desc(pwd
)), len_sam_desc
);
1584 return NT_STATUS_OK
;
1587 /*******************************************************************
1588 reads or writes a structure.
1589 ********************************************************************/
1591 static BOOL
sam_io_sam_dispinfo_2(char *desc
, SAM_DISPINFO_2
* sam
,
1593 prs_struct
*ps
, int depth
)
1600 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_2");
1606 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1608 if ((sam
->sam
= (SAM_ENTRY2
*)
1609 prs_alloc_mem(ps
, sizeof(SAM_ENTRY2
) *
1610 num_entries
)) == NULL
) {
1611 DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
1615 if ((sam
->str
= (SAM_STR2
*)
1616 prs_alloc_mem(ps
, sizeof(SAM_STR2
) *
1617 num_entries
)) == NULL
) {
1618 DEBUG(0, ("out of memory allocating SAM_STR2\n"));
1623 for (i
= 0; i
< num_entries
; i
++) {
1624 if(!sam_io_sam_entry2("", &sam
->sam
[i
], ps
, depth
))
1628 for (i
= 0; i
< num_entries
; i
++) {
1629 if(!sam_io_sam_str2("", &sam
->str
[i
],
1630 sam
->sam
[i
].hdr_srv_name
.buffer
,
1631 sam
->sam
[i
].hdr_srv_desc
.buffer
, ps
, depth
))
1638 /*******************************************************************
1639 inits a SAM_DISPINFO_3 structure.
1640 ********************************************************************/
1642 NTSTATUS
init_sam_dispinfo_3(TALLOC_CTX
*ctx
, SAM_DISPINFO_3
*sam
, uint32 num_entries
,
1643 uint32 start_idx
, DISP_GROUP_INFO
*disp_group_info
)
1645 uint32 len_sam_name
, len_sam_desc
;
1650 DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries
));
1653 return NT_STATUS_OK
;
1655 if (!(sam
->sam
=(SAM_ENTRY3
*)talloc(ctx
, num_entries
*sizeof(SAM_ENTRY3
))))
1656 return NT_STATUS_NO_MEMORY
;
1658 if (!(sam
->str
=(SAM_STR3
*)talloc(ctx
, num_entries
*sizeof(SAM_STR3
))))
1659 return NT_STATUS_NO_MEMORY
;
1661 ZERO_STRUCTP(sam
->sam
);
1662 ZERO_STRUCTP(sam
->str
);
1664 for (i
= 0; i
< num_entries
; i
++) {
1665 DOMAIN_GRP
*grp
= disp_group_info
[i
+start_idx
].grp
;
1667 DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i
));
1669 len_sam_name
= strlen(grp
->name
);
1670 len_sam_desc
= strlen(grp
->comment
);
1672 init_sam_entry3(&sam
->sam
[i
], start_idx
+ i
+ 1, len_sam_name
, len_sam_desc
, grp
->rid
);
1674 init_unistr2(&sam
->str
[i
].uni_grp_name
, grp
->name
, len_sam_name
);
1675 init_unistr2(&sam
->str
[i
].uni_grp_desc
, grp
->comment
, len_sam_desc
);
1678 return NT_STATUS_OK
;
1681 /*******************************************************************
1682 reads or writes a structure.
1683 ********************************************************************/
1685 static BOOL
sam_io_sam_dispinfo_3(char *desc
, SAM_DISPINFO_3
* sam
,
1687 prs_struct
*ps
, int depth
)
1694 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_3");
1700 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1702 if ((sam
->sam
= (SAM_ENTRY3
*)
1703 prs_alloc_mem(ps
, sizeof(SAM_ENTRY3
) *
1704 num_entries
)) == NULL
) {
1705 DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
1709 if ((sam
->str
= (SAM_STR3
*)
1710 prs_alloc_mem(ps
, sizeof(SAM_STR3
) *
1711 num_entries
)) == NULL
) {
1712 DEBUG(0, ("out of memory allocating SAM_STR3\n"));
1717 for (i
= 0; i
< num_entries
; i
++) {
1718 if(!sam_io_sam_entry3("", &sam
->sam
[i
], ps
, depth
))
1722 for (i
= 0; i
< num_entries
; i
++) {
1723 if(!sam_io_sam_str3("", &sam
->str
[i
],
1724 sam
->sam
[i
].hdr_grp_name
.buffer
,
1725 sam
->sam
[i
].hdr_grp_desc
.buffer
, ps
, depth
))
1732 /*******************************************************************
1733 inits a SAM_DISPINFO_4 structure.
1734 ********************************************************************/
1736 NTSTATUS
init_sam_dispinfo_4(TALLOC_CTX
*ctx
, SAM_DISPINFO_4
*sam
, uint32 num_entries
,
1737 uint32 start_idx
, DISP_USER_INFO
*disp_user_info
)
1739 uint32 len_sam_name
;
1742 SAM_ACCOUNT
*pwd
= NULL
;
1745 DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries
));
1748 return NT_STATUS_OK
;
1750 if (!(sam
->sam
=(SAM_ENTRY4
*)talloc(ctx
, num_entries
*sizeof(SAM_ENTRY4
))))
1751 return NT_STATUS_NO_MEMORY
;
1753 if (!(sam
->str
=(SAM_STR4
*)talloc(ctx
, num_entries
*sizeof(SAM_STR4
))))
1754 return NT_STATUS_NO_MEMORY
;
1756 ZERO_STRUCTP(sam
->sam
);
1757 ZERO_STRUCTP(sam
->str
);
1759 for (i
= 0; i
< num_entries
; i
++) {
1760 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i
));
1761 pwd
=disp_user_info
[i
+start_idx
].sam
;
1763 len_sam_name
= strlen(unix_to_dos_static(pdb_get_username(pwd
)));
1765 init_sam_entry4(&sam
->sam
[i
], start_idx
+ i
+ 1, len_sam_name
);
1767 init_string2(&sam
->str
[i
].acct_name
, unix_to_dos_static(pdb_get_username(pwd
)),
1768 len_sam_name
+1, len_sam_name
);
1771 return NT_STATUS_OK
;
1774 /*******************************************************************
1775 reads or writes a structure.
1776 ********************************************************************/
1778 static BOOL
sam_io_sam_dispinfo_4(char *desc
, SAM_DISPINFO_4
* sam
,
1780 prs_struct
*ps
, int depth
)
1787 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_4");
1793 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1795 if ((sam
->sam
= (SAM_ENTRY4
*)
1796 prs_alloc_mem(ps
, sizeof(SAM_ENTRY4
) *
1797 num_entries
)) == NULL
) {
1798 DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
1802 if ((sam
->str
= (SAM_STR4
*)
1803 prs_alloc_mem(ps
, sizeof(SAM_STR4
) *
1804 num_entries
)) == NULL
) {
1805 DEBUG(0, ("out of memory allocating SAM_STR4\n"));
1810 for (i
= 0; i
< num_entries
; i
++) {
1811 if(!sam_io_sam_entry4("", &sam
->sam
[i
], ps
, depth
))
1815 for (i
= 0; i
< num_entries
; i
++) {
1816 if(!smb_io_string2("acct_name", &sam
->str
[i
].acct_name
,
1817 sam
->sam
[i
].hdr_acct_name
.buffer
, ps
, depth
))
1824 /*******************************************************************
1825 inits a SAM_DISPINFO_5 structure.
1826 ********************************************************************/
1828 NTSTATUS
init_sam_dispinfo_5(TALLOC_CTX
*ctx
, SAM_DISPINFO_5
*sam
, uint32 num_entries
,
1829 uint32 start_idx
, DISP_GROUP_INFO
*disp_group_info
)
1831 uint32 len_sam_name
;
1836 DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries
));
1839 return NT_STATUS_OK
;
1841 if (!(sam
->sam
=(SAM_ENTRY5
*)talloc(ctx
, num_entries
*sizeof(SAM_ENTRY5
))))
1842 return NT_STATUS_NO_MEMORY
;
1844 if (!(sam
->str
=(SAM_STR5
*)talloc(ctx
, num_entries
*sizeof(SAM_STR5
))))
1845 return NT_STATUS_NO_MEMORY
;
1847 ZERO_STRUCTP(sam
->sam
);
1848 ZERO_STRUCTP(sam
->str
);
1850 for (i
= 0; i
< num_entries
; i
++) {
1851 DOMAIN_GRP
*grp
= disp_group_info
[i
+start_idx
].grp
;
1853 DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i
));
1855 len_sam_name
= strlen(grp
->name
);
1857 init_sam_entry5(&sam
->sam
[i
], start_idx
+ i
+ 1, len_sam_name
);
1858 init_string2(&sam
->str
[i
].grp_name
, grp
->name
, len_sam_name
+1, len_sam_name
);
1861 return NT_STATUS_OK
;
1864 /*******************************************************************
1865 reads or writes a structure.
1866 ********************************************************************/
1868 static BOOL
sam_io_sam_dispinfo_5(char *desc
, SAM_DISPINFO_5
* sam
,
1870 prs_struct
*ps
, int depth
)
1877 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_5");
1883 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1885 if ((sam
->sam
= (SAM_ENTRY5
*)
1886 prs_alloc_mem(ps
, sizeof(SAM_ENTRY5
) *
1887 num_entries
)) == NULL
) {
1888 DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
1892 if ((sam
->str
= (SAM_STR5
*)
1893 prs_alloc_mem(ps
, sizeof(SAM_STR5
) *
1894 num_entries
)) == NULL
) {
1895 DEBUG(0, ("out of memory allocating SAM_STR5\n"));
1900 for (i
= 0; i
< num_entries
; i
++) {
1901 if(!sam_io_sam_entry5("", &sam
->sam
[i
], ps
, depth
))
1905 for (i
= 0; i
< num_entries
; i
++) {
1906 if(!smb_io_string2("grp_name", &sam
->str
[i
].grp_name
,
1907 sam
->sam
[i
].hdr_grp_name
.buffer
, ps
, depth
))
1914 /*******************************************************************
1915 inits a SAMR_R_QUERY_DISPINFO structure.
1916 ********************************************************************/
1918 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO
* r_u
,
1919 uint32 num_entries
, uint32 total_size
, uint32 data_size
,
1920 uint16 switch_level
, SAM_DISPINFO_CTR
* ctr
,
1923 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level
));
1925 r_u
->total_size
= total_size
;
1927 r_u
->data_size
= data_size
;
1929 r_u
->switch_level
= switch_level
;
1930 r_u
->num_entries
= num_entries
;
1933 r_u
->ptr_entries
= 0;
1935 r_u
->ptr_entries
= 1;
1937 r_u
->num_entries2
= num_entries
;
1940 r_u
->status
= status
;
1943 /*******************************************************************
1944 reads or writes a structure.
1945 ********************************************************************/
1947 BOOL
samr_io_r_query_dispinfo(char *desc
, SAMR_R_QUERY_DISPINFO
* r_u
,
1948 prs_struct
*ps
, int depth
)
1953 prs_debug(ps
, depth
, desc
, "samr_io_r_query_dispinfo");
1959 if(!prs_uint32("total_size ", ps
, depth
, &r_u
->total_size
))
1961 if(!prs_uint32("data_size ", ps
, depth
, &r_u
->data_size
))
1963 if(!prs_uint16("switch_level", ps
, depth
, &r_u
->switch_level
))
1968 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
1970 if(!prs_uint32("ptr_entries ", ps
, depth
, &r_u
->ptr_entries
))
1973 if (r_u
->ptr_entries
==0) {
1976 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
1982 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
1985 switch (r_u
->switch_level
) {
1987 if(!sam_io_sam_dispinfo_1("users", r_u
->ctr
->sam
.info1
,
1988 r_u
->num_entries
, ps
, depth
))
1992 if(!sam_io_sam_dispinfo_2("servers", r_u
->ctr
->sam
.info2
,
1993 r_u
->num_entries
, ps
, depth
))
1997 if(!sam_io_sam_dispinfo_3("groups", r_u
->ctr
->sam
.info3
,
1998 r_u
->num_entries
, ps
, depth
))
2002 if(!sam_io_sam_dispinfo_4("user list",
2003 r_u
->ctr
->sam
.info4
,
2004 r_u
->num_entries
, ps
, depth
))
2008 if(!sam_io_sam_dispinfo_5("group list",
2009 r_u
->ctr
->sam
.info5
,
2010 r_u
->num_entries
, ps
, depth
))
2014 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
2020 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2026 /*******************************************************************
2027 inits a SAMR_Q_OPEN_GROUP structure.
2028 ********************************************************************/
2030 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP
* q_c
,
2032 uint32 access_mask
, uint32 rid
)
2034 DEBUG(5, ("init_samr_q_open_group\n"));
2036 q_c
->domain_pol
= *hnd
;
2037 q_c
->access_mask
= access_mask
;
2038 q_c
->rid_group
= rid
;
2041 /*******************************************************************
2042 reads or writes a structure.
2043 ********************************************************************/
2045 BOOL
samr_io_q_open_group(char *desc
, SAMR_Q_OPEN_GROUP
* q_u
,
2046 prs_struct
*ps
, int depth
)
2051 prs_debug(ps
, depth
, desc
, "samr_io_q_open_group");
2057 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
2060 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
2062 if(!prs_uint32("rid_group", ps
, depth
, &q_u
->rid_group
))
2068 /*******************************************************************
2069 reads or writes a structure.
2070 ********************************************************************/
2072 BOOL
samr_io_r_open_group(char *desc
, SAMR_R_OPEN_GROUP
* r_u
,
2073 prs_struct
*ps
, int depth
)
2078 prs_debug(ps
, depth
, desc
, "samr_io_r_open_group");
2084 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2087 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2093 /*******************************************************************
2094 inits a GROUP_INFO1 structure.
2095 ********************************************************************/
2097 void init_samr_group_info1(GROUP_INFO1
* gr1
,
2098 char *acct_name
, char *acct_desc
,
2101 int desc_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
2102 int acct_len
= acct_name
!= NULL
? strlen(acct_name
) : 0;
2104 DEBUG(5, ("init_samr_group_info1\n"));
2106 init_uni_hdr(&gr1
->hdr_acct_name
, acct_len
);
2108 gr1
->unknown_1
= 0x3;
2109 gr1
->num_members
= num_members
;
2111 init_uni_hdr(&gr1
->hdr_acct_desc
, desc_len
);
2113 init_unistr2(&gr1
->uni_acct_name
, acct_name
, acct_len
);
2114 init_unistr2(&gr1
->uni_acct_desc
, acct_desc
, desc_len
);
2117 /*******************************************************************
2118 reads or writes a structure.
2119 ********************************************************************/
2121 BOOL
samr_io_group_info1(char *desc
, GROUP_INFO1
* gr1
,
2122 prs_struct
*ps
, int depth
)
2127 prs_debug(ps
, depth
, desc
, "samr_io_group_info1");
2133 if(!smb_io_unihdr("hdr_acct_name", &gr1
->hdr_acct_name
, ps
, depth
))
2136 if(!prs_uint32("unknown_1", ps
, depth
, &gr1
->unknown_1
))
2138 if(!prs_uint32("num_members", ps
, depth
, &gr1
->num_members
))
2141 if(!smb_io_unihdr("hdr_acct_desc", &gr1
->hdr_acct_desc
, ps
, depth
))
2144 if(!smb_io_unistr2("uni_acct_name", &gr1
->uni_acct_name
,
2145 gr1
->hdr_acct_name
.buffer
, ps
, depth
))
2148 if(!smb_io_unistr2("uni_acct_desc", &gr1
->uni_acct_desc
,
2149 gr1
->hdr_acct_desc
.buffer
, ps
, depth
))
2155 /*******************************************************************
2156 inits a GROUP_INFO3 structure.
2157 ********************************************************************/
2159 void init_samr_group_info3(GROUP_INFO3
*gr3
)
2161 DEBUG(5, ("init_samr_group_info3\n"));
2163 gr3
->unknown_1
= 0x3;
2166 /*******************************************************************
2167 reads or writes a structure.
2168 ********************************************************************/
2170 BOOL
samr_io_group_info3(char *desc
, GROUP_INFO3
*gr3
, prs_struct
*ps
, int depth
)
2175 prs_debug(ps
, depth
, desc
, "samr_io_group_info3");
2181 if(!prs_uint32("unknown_1", ps
, depth
, &gr3
->unknown_1
))
2187 /*******************************************************************
2188 inits a GROUP_INFO4 structure.
2189 ********************************************************************/
2191 void init_samr_group_info4(GROUP_INFO4
* gr4
, char *acct_desc
)
2193 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
2195 DEBUG(5, ("init_samr_group_info4\n"));
2197 init_uni_hdr(&gr4
->hdr_acct_desc
, acct_len
);
2198 init_unistr2(&gr4
->uni_acct_desc
, acct_desc
, acct_len
);
2201 /*******************************************************************
2202 reads or writes a structure.
2203 ********************************************************************/
2205 BOOL
samr_io_group_info4(char *desc
, GROUP_INFO4
* gr4
,
2206 prs_struct
*ps
, int depth
)
2211 prs_debug(ps
, depth
, desc
, "samr_io_group_info4");
2217 if(!smb_io_unihdr("hdr_acct_desc", &gr4
->hdr_acct_desc
, ps
, depth
))
2219 if(!smb_io_unistr2("uni_acct_desc", &gr4
->uni_acct_desc
,
2220 gr4
->hdr_acct_desc
.buffer
, ps
, depth
))
2226 /*******************************************************************
2227 reads or writes a structure.
2228 ********************************************************************/
2230 static BOOL
samr_group_info_ctr(char *desc
, GROUP_INFO_CTR
**ctr
,
2231 prs_struct
*ps
, int depth
)
2233 if (UNMARSHALLING(ps
))
2234 *ctr
= (GROUP_INFO_CTR
*)prs_alloc_mem(ps
,sizeof(GROUP_INFO_CTR
));
2239 prs_debug(ps
, depth
, desc
, "samr_group_info_ctr");
2242 if(!prs_uint16("switch_value1", ps
, depth
, &(*ctr
)->switch_value1
))
2245 switch ((*ctr
)->switch_value1
) {
2247 if(!samr_io_group_info1("group_info1", &(*ctr
)->group
.info1
, ps
, depth
))
2251 if(!samr_io_group_info3("group_info3", &(*ctr
)->group
.info3
, ps
, depth
))
2255 if(!samr_io_group_info4("group_info4", &(*ctr
)->group
.info4
, ps
, depth
))
2259 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2266 /*******************************************************************
2267 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2268 ********************************************************************/
2270 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2271 POLICY_HND
*pol
, char *acct_desc
,
2274 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
2276 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2280 init_uni_hdr(&q_e
->hdr_acct_desc
, acct_len
);
2281 init_unistr2(&q_e
->uni_acct_desc
, acct_desc
, acct_len
);
2283 q_e
->access_mask
= access_mask
;
2286 /*******************************************************************
2287 reads or writes a structure.
2288 ********************************************************************/
2290 BOOL
samr_io_q_create_dom_group(char *desc
, SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2291 prs_struct
*ps
, int depth
)
2296 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_group");
2302 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2305 if(!smb_io_unihdr("hdr_acct_desc", &q_e
->hdr_acct_desc
, ps
, depth
))
2307 if(!smb_io_unistr2("uni_acct_desc", &q_e
->uni_acct_desc
,
2308 q_e
->hdr_acct_desc
.buffer
, ps
, depth
))
2313 if(!prs_uint32("access", ps
, depth
, &q_e
->access_mask
))
2319 /*******************************************************************
2320 reads or writes a structure.
2321 ********************************************************************/
2323 BOOL
samr_io_r_create_dom_group(char *desc
, SAMR_R_CREATE_DOM_GROUP
* r_u
,
2324 prs_struct
*ps
, int depth
)
2329 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_group");
2335 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2338 if(!prs_uint32("rid ", ps
, depth
, &r_u
->rid
))
2340 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2346 /*******************************************************************
2347 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2348 ********************************************************************/
2350 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP
* q_c
,
2353 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2355 q_c
->group_pol
= *hnd
;
2358 /*******************************************************************
2359 reads or writes a structure.
2360 ********************************************************************/
2362 BOOL
samr_io_q_delete_dom_group(char *desc
, SAMR_Q_DELETE_DOM_GROUP
* q_u
,
2363 prs_struct
*ps
, int depth
)
2368 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_group");
2374 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2380 /*******************************************************************
2381 reads or writes a structure.
2382 ********************************************************************/
2384 BOOL
samr_io_r_delete_dom_group(char *desc
, SAMR_R_DELETE_DOM_GROUP
* r_u
,
2385 prs_struct
*ps
, int depth
)
2390 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_group");
2396 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2399 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2405 /*******************************************************************
2406 inits a SAMR_Q_DEL_GROUPMEM structure.
2407 ********************************************************************/
2409 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM
* q_e
,
2410 POLICY_HND
*pol
, uint32 rid
)
2412 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2418 /*******************************************************************
2419 reads or writes a structure.
2420 ********************************************************************/
2422 BOOL
samr_io_q_del_groupmem(char *desc
, SAMR_Q_DEL_GROUPMEM
* q_e
,
2423 prs_struct
*ps
, int depth
)
2428 prs_debug(ps
, depth
, desc
, "samr_io_q_del_groupmem");
2434 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2437 if(!prs_uint32("rid", ps
, depth
, &q_e
->rid
))
2443 /*******************************************************************
2444 inits a SAMR_R_DEL_GROUPMEM structure.
2445 ********************************************************************/
2447 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2450 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2452 r_u
->status
= status
;
2455 /*******************************************************************
2456 reads or writes a structure.
2457 ********************************************************************/
2459 BOOL
samr_io_r_del_groupmem(char *desc
, SAMR_R_DEL_GROUPMEM
* r_u
,
2460 prs_struct
*ps
, int depth
)
2465 prs_debug(ps
, depth
, desc
, "samr_io_r_del_groupmem");
2471 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2477 /*******************************************************************
2478 inits a SAMR_Q_ADD_GROUPMEM structure.
2479 ********************************************************************/
2481 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM
* q_e
,
2482 POLICY_HND
*pol
, uint32 rid
)
2484 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2488 q_e
->unknown
= 0x0005;
2491 /*******************************************************************
2492 reads or writes a structure.
2493 ********************************************************************/
2495 BOOL
samr_io_q_add_groupmem(char *desc
, SAMR_Q_ADD_GROUPMEM
* q_e
,
2496 prs_struct
*ps
, int depth
)
2501 prs_debug(ps
, depth
, desc
, "samr_io_q_add_groupmem");
2507 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2510 if(!prs_uint32("rid ", ps
, depth
, &q_e
->rid
))
2512 if(!prs_uint32("unknown", ps
, depth
, &q_e
->unknown
))
2518 /*******************************************************************
2519 inits a SAMR_R_ADD_GROUPMEM structure.
2520 ********************************************************************/
2522 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2525 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2527 r_u
->status
= status
;
2530 /*******************************************************************
2531 reads or writes a structure.
2532 ********************************************************************/
2534 BOOL
samr_io_r_add_groupmem(char *desc
, SAMR_R_ADD_GROUPMEM
* r_u
,
2535 prs_struct
*ps
, int depth
)
2540 prs_debug(ps
, depth
, desc
, "samr_io_r_add_groupmem");
2546 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2552 /*******************************************************************
2553 inits a SAMR_Q_SET_GROUPINFO structure.
2554 ********************************************************************/
2556 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO
* q_e
,
2557 POLICY_HND
*pol
, GROUP_INFO_CTR
* ctr
)
2559 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2565 /*******************************************************************
2566 reads or writes a structure.
2567 ********************************************************************/
2569 BOOL
samr_io_q_set_groupinfo(char *desc
, SAMR_Q_SET_GROUPINFO
* q_e
,
2570 prs_struct
*ps
, int depth
)
2575 prs_debug(ps
, depth
, desc
, "samr_io_q_set_groupinfo");
2581 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2584 if(!samr_group_info_ctr("ctr", &q_e
->ctr
, ps
, depth
))
2590 /*******************************************************************
2591 inits a SAMR_R_SET_GROUPINFO structure.
2592 ********************************************************************/
2594 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO
* r_u
, NTSTATUS status
)
2596 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2598 r_u
->status
= status
;
2601 /*******************************************************************
2602 reads or writes a structure.
2603 ********************************************************************/
2605 BOOL
samr_io_r_set_groupinfo(char *desc
, SAMR_R_SET_GROUPINFO
* r_u
,
2606 prs_struct
*ps
, int depth
)
2611 prs_debug(ps
, depth
, desc
, "samr_io_r_set_groupinfo");
2617 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2623 /*******************************************************************
2624 inits a SAMR_Q_QUERY_GROUPINFO structure.
2625 ********************************************************************/
2627 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO
* q_e
,
2628 POLICY_HND
*pol
, uint16 switch_level
)
2630 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2634 q_e
->switch_level
= switch_level
;
2637 /*******************************************************************
2638 reads or writes a structure.
2639 ********************************************************************/
2641 BOOL
samr_io_q_query_groupinfo(char *desc
, SAMR_Q_QUERY_GROUPINFO
* q_e
,
2642 prs_struct
*ps
, int depth
)
2647 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupinfo");
2653 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2656 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
2662 /*******************************************************************
2663 inits a SAMR_R_QUERY_GROUPINFO structure.
2664 ********************************************************************/
2666 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO
* r_u
,
2667 GROUP_INFO_CTR
* ctr
, NTSTATUS status
)
2669 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2671 r_u
->ptr
= (NT_STATUS_IS_OK(status
) && ctr
!= NULL
) ? 1 : 0;
2673 r_u
->status
= status
;
2676 /*******************************************************************
2677 reads or writes a structure.
2678 ********************************************************************/
2680 BOOL
samr_io_r_query_groupinfo(char *desc
, SAMR_R_QUERY_GROUPINFO
* r_u
,
2681 prs_struct
*ps
, int depth
)
2686 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupinfo");
2692 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2695 if (r_u
->ptr
!= 0) {
2696 if(!samr_group_info_ctr("ctr", &r_u
->ctr
, ps
, depth
))
2702 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2708 /*******************************************************************
2709 inits a SAMR_Q_QUERY_GROUPMEM structure.
2710 ********************************************************************/
2712 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM
* q_c
, POLICY_HND
*hnd
)
2714 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2716 q_c
->group_pol
= *hnd
;
2719 /*******************************************************************
2720 reads or writes a structure.
2721 ********************************************************************/
2723 BOOL
samr_io_q_query_groupmem(char *desc
, SAMR_Q_QUERY_GROUPMEM
* q_u
,
2724 prs_struct
*ps
, int depth
)
2729 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupmem");
2735 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2741 /*******************************************************************
2742 inits a SAMR_R_QUERY_GROUPMEM structure.
2743 ********************************************************************/
2745 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM
* r_u
,
2746 uint32 num_entries
, uint32
*rid
,
2747 uint32
*attr
, NTSTATUS status
)
2749 DEBUG(5, ("init_samr_r_query_groupmem\n"));
2751 if (NT_STATUS_IS_OK(status
)) {
2753 r_u
->num_entries
= num_entries
;
2755 r_u
->ptr_attrs
= attr
!= NULL
? 1 : 0;
2756 r_u
->ptr_rids
= rid
!= NULL
? 1 : 0;
2758 r_u
->num_rids
= num_entries
;
2761 r_u
->num_attrs
= num_entries
;
2765 r_u
->num_entries
= 0;
2768 r_u
->status
= status
;
2771 /*******************************************************************
2772 reads or writes a structure.
2773 ********************************************************************/
2775 BOOL
samr_io_r_query_groupmem(char *desc
, SAMR_R_QUERY_GROUPMEM
* r_u
,
2776 prs_struct
*ps
, int depth
)
2783 if (UNMARSHALLING(ps
))
2786 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupmem");
2792 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2794 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2797 if (r_u
->ptr
!= 0) {
2798 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
2800 if(!prs_uint32("ptr_attrs", ps
, depth
, &r_u
->ptr_attrs
))
2803 if (r_u
->ptr_rids
!= 0) {
2804 if(!prs_uint32("num_rids", ps
, depth
, &r_u
->num_rids
))
2806 if (UNMARSHALLING(ps
) && r_u
->num_rids
!= 0) {
2807 r_u
->rid
= (uint32
*)prs_alloc_mem(ps
,sizeof(r_u
->rid
[0])*r_u
->num_rids
);
2808 if (r_u
->rid
== NULL
)
2812 for (i
= 0; i
< r_u
->num_rids
; i
++) {
2813 if(!prs_uint32("", ps
, depth
, &r_u
->rid
[i
]))
2818 if (r_u
->ptr_attrs
!= 0) {
2819 if(!prs_uint32("num_attrs", ps
, depth
, &r_u
->num_attrs
))
2822 if (UNMARSHALLING(ps
) && r_u
->num_attrs
!= 0) {
2823 r_u
->attr
= (uint32
*)prs_alloc_mem(ps
,sizeof(r_u
->attr
[0])*r_u
->num_attrs
);
2824 if (r_u
->attr
== NULL
)
2828 for (i
= 0; i
< r_u
->num_attrs
; i
++) {
2829 if(!prs_uint32("", ps
, depth
, &r_u
->attr
[i
]))
2835 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2841 /*******************************************************************
2842 inits a SAMR_Q_QUERY_USERGROUPS structure.
2843 ********************************************************************/
2845 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS
* q_u
,
2848 DEBUG(5, ("init_samr_q_query_usergroups\n"));
2853 /*******************************************************************
2854 reads or writes a structure.
2855 ********************************************************************/
2857 BOOL
samr_io_q_query_usergroups(char *desc
, SAMR_Q_QUERY_USERGROUPS
* q_u
,
2858 prs_struct
*ps
, int depth
)
2863 prs_debug(ps
, depth
, desc
, "samr_io_q_query_usergroups");
2869 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
2875 /*******************************************************************
2876 inits a SAMR_R_QUERY_USERGROUPS structure.
2877 ********************************************************************/
2879 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS
* r_u
,
2880 uint32 num_gids
, DOM_GID
* gid
,
2883 DEBUG(5, ("init_samr_r_query_usergroups\n"));
2885 if (NT_STATUS_IS_OK(status
)) {
2887 r_u
->num_entries
= num_gids
;
2888 r_u
->ptr_1
= (num_gids
!= 0) ? 1 : 0;
2889 r_u
->num_entries2
= num_gids
;
2894 r_u
->num_entries
= 0;
2899 r_u
->status
= status
;
2902 /*******************************************************************
2903 reads or writes a structure.
2904 ********************************************************************/
2906 BOOL
samr_io_gids(char *desc
, uint32
*num_gids
, DOM_GID
** gid
,
2907 prs_struct
*ps
, int depth
)
2913 prs_debug(ps
, depth
, desc
, "samr_io_gids");
2919 if(!prs_uint32("num_gids", ps
, depth
, num_gids
))
2922 if ((*num_gids
) != 0) {
2923 if (UNMARSHALLING(ps
)) {
2924 (*gid
) = (DOM_GID
*)prs_alloc_mem(ps
,sizeof(DOM_GID
)*(*num_gids
));
2927 if ((*gid
) == NULL
) {
2931 for (i
= 0; i
< (*num_gids
); i
++) {
2932 if(!smb_io_gid("gids", &(*gid
)[i
], ps
, depth
))
2940 /*******************************************************************
2941 reads or writes a structure.
2942 ********************************************************************/
2944 BOOL
samr_io_r_query_usergroups(char *desc
, SAMR_R_QUERY_USERGROUPS
* r_u
,
2945 prs_struct
*ps
, int depth
)
2950 prs_debug(ps
, depth
, desc
, "samr_io_r_query_usergroups");
2956 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
2959 if (r_u
->ptr_0
!= 0) {
2960 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2962 if(!prs_uint32("ptr_1 ", ps
, depth
, &r_u
->ptr_1
))
2965 if (r_u
->num_entries
!= 0 && r_u
->ptr_1
!= 0) {
2966 if(!samr_io_gids("gids", &r_u
->num_entries2
, &r_u
->gid
, ps
, depth
))
2973 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2979 /*******************************************************************
2980 inits a SAMR_Q_ENUM_DOMAINS structure.
2981 ********************************************************************/
2983 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS
* q_e
,
2985 uint32 start_idx
, uint32 size
)
2987 DEBUG(5, ("init_samr_q_enum_domains\n"));
2991 q_e
->start_idx
= start_idx
;
2992 q_e
->max_size
= size
;
2995 /*******************************************************************
2996 reads or writes a structure.
2997 ********************************************************************/
2999 BOOL
samr_io_q_enum_domains(char *desc
, SAMR_Q_ENUM_DOMAINS
* q_e
,
3000 prs_struct
*ps
, int depth
)
3005 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_domains");
3011 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3014 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3016 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3022 /*******************************************************************
3023 inits a SAMR_R_ENUM_DOMAINS structure.
3024 ********************************************************************/
3026 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS
* r_u
,
3027 uint32 next_idx
, uint32 num_sam_entries
)
3029 DEBUG(5, ("init_samr_r_enum_domains\n"));
3031 r_u
->next_idx
= next_idx
;
3033 if (num_sam_entries
!= 0) {
3034 r_u
->ptr_entries1
= 1;
3035 r_u
->ptr_entries2
= 1;
3036 r_u
->num_entries2
= num_sam_entries
;
3037 r_u
->num_entries3
= num_sam_entries
;
3039 r_u
->num_entries4
= num_sam_entries
;
3041 r_u
->ptr_entries1
= 0;
3042 r_u
->num_entries2
= num_sam_entries
;
3043 r_u
->ptr_entries2
= 1;
3047 /*******************************************************************
3048 reads or writes a structure.
3049 ********************************************************************/
3051 BOOL
samr_io_r_enum_domains(char *desc
, SAMR_R_ENUM_DOMAINS
* r_u
,
3052 prs_struct
*ps
, int depth
)
3059 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_domains");
3065 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3067 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3070 if (r_u
->ptr_entries1
!= 0) {
3071 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3073 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3075 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3078 if (UNMARSHALLING(ps
)) {
3079 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
3080 r_u
->uni_dom_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
3083 if ((r_u
->sam
== NULL
|| r_u
->uni_dom_name
== NULL
) && r_u
->num_entries2
!= 0) {
3084 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
3085 r_u
->num_entries4
= 0;
3086 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3090 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3092 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
3093 if(!sam_io_sam_entry(tmp
, &r_u
->sam
[i
], ps
, depth
))
3097 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3099 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
3100 if(!smb_io_unistr2(tmp
, &r_u
->uni_dom_name
[i
],
3101 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3110 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3112 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3118 /*******************************************************************
3119 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
3120 ********************************************************************/
3122 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
3124 uint32 start_idx
, uint32 size
)
3126 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
3130 q_e
->start_idx
= start_idx
;
3131 q_e
->max_size
= size
;
3134 /*******************************************************************
3135 reads or writes a structure.
3136 ********************************************************************/
3138 BOOL
samr_io_q_enum_dom_groups(char *desc
, SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
3139 prs_struct
*ps
, int depth
)
3144 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_groups");
3150 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
3153 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3155 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3161 /*******************************************************************
3162 inits a SAMR_R_ENUM_DOM_GROUPS structure.
3163 ********************************************************************/
3165 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3166 uint32 next_idx
, uint32 num_sam_entries
)
3168 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
3170 r_u
->next_idx
= next_idx
;
3172 if (num_sam_entries
!= 0) {
3173 r_u
->ptr_entries1
= 1;
3174 r_u
->ptr_entries2
= 1;
3175 r_u
->num_entries2
= num_sam_entries
;
3176 r_u
->num_entries3
= num_sam_entries
;
3178 r_u
->num_entries4
= num_sam_entries
;
3180 r_u
->ptr_entries1
= 0;
3181 r_u
->num_entries2
= num_sam_entries
;
3182 r_u
->ptr_entries2
= 1;
3186 /*******************************************************************
3187 reads or writes a structure.
3188 ********************************************************************/
3190 BOOL
samr_io_r_enum_dom_groups(char *desc
, SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3191 prs_struct
*ps
, int depth
)
3198 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_groups");
3204 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3206 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3209 if (r_u
->ptr_entries1
!= 0) {
3210 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3212 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3214 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3217 if (UNMARSHALLING(ps
)) {
3218 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
3219 r_u
->uni_grp_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
3222 if ((r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
) && r_u
->num_entries2
!= 0) {
3224 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3225 r_u
->num_entries4
= 0;
3226 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3230 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3231 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3235 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3236 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3237 r_u
->sam
[i
].hdr_name
.buffer
, ps
, depth
))
3244 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3246 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3252 /*******************************************************************
3253 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3254 ********************************************************************/
3256 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3257 POLICY_HND
*pol
, uint32 start_idx
,
3260 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3264 q_e
->start_idx
= start_idx
;
3265 q_e
->max_size
= size
;
3269 /*******************************************************************
3270 reads or writes a structure.
3271 ********************************************************************/
3273 BOOL
samr_io_q_enum_dom_aliases(char *desc
, SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3274 prs_struct
*ps
, int depth
)
3279 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_aliases");
3285 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3288 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3290 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3296 /*******************************************************************
3297 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3298 ********************************************************************/
3300 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES
*r_u
, uint32 next_idx
, uint32 num_sam_entries
)
3302 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3304 r_u
->next_idx
= next_idx
;
3306 if (num_sam_entries
!= 0) {
3307 r_u
->ptr_entries1
= 1;
3308 r_u
->ptr_entries2
= 1;
3309 r_u
->num_entries2
= num_sam_entries
;
3310 r_u
->num_entries3
= num_sam_entries
;
3312 r_u
->num_entries4
= num_sam_entries
;
3314 r_u
->ptr_entries1
= 0;
3315 r_u
->num_entries2
= num_sam_entries
;
3316 r_u
->ptr_entries2
= 1;
3320 /*******************************************************************
3321 reads or writes a structure.
3322 ********************************************************************/
3324 BOOL
samr_io_r_enum_dom_aliases(char *desc
, SAMR_R_ENUM_DOM_ALIASES
* r_u
,
3325 prs_struct
*ps
, int depth
)
3332 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_aliases");
3338 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3340 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3343 if (r_u
->ptr_entries1
!= 0) {
3344 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3346 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3348 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3351 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
> 0)) {
3352 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
3353 r_u
->uni_grp_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
3356 if (r_u
->num_entries2
!= 0 &&
3357 (r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
)) {
3358 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3359 r_u
->num_entries4
= 0;
3360 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3364 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3365 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3369 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3370 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3371 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3379 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3381 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3387 /*******************************************************************
3388 inits a ALIAS_INFO1 structure.
3389 ********************************************************************/
3391 void init_samr_alias_info1(ALIAS_INFO1
* al1
, char *acct_name
, uint32 num_member
, char *acct_desc
)
3393 int acct_len_name
= acct_name
!= NULL
? strlen(acct_name
) : 0;
3394 int acct_len_desc
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
3396 DEBUG(5, ("init_samr_alias_info1\n"));
3398 init_uni_hdr(&al1
->hdr_acct_name
, acct_len_name
);
3399 init_unistr2(&al1
->uni_acct_name
, acct_name
, acct_len_name
);
3401 al1
->num_member
=num_member
;
3403 init_uni_hdr(&al1
->hdr_acct_desc
, acct_len_desc
);
3404 init_unistr2(&al1
->uni_acct_desc
, acct_desc
, acct_len_desc
);
3407 /*******************************************************************
3408 reads or writes a structure.
3409 ********************************************************************/
3411 BOOL
samr_io_alias_info1(char *desc
, ALIAS_INFO1
* al1
,
3412 prs_struct
*ps
, int depth
)
3417 prs_debug(ps
, depth
, desc
, "samr_io_alias_info1");
3423 if(!smb_io_unihdr("hdr_acct_name", &al1
->hdr_acct_name
, ps
, depth
))
3425 if(!prs_uint32("num_member", ps
, depth
, &al1
->num_member
))
3427 if(!smb_io_unihdr("hdr_acct_desc", &al1
->hdr_acct_desc
, ps
, depth
))
3430 if(!smb_io_unistr2("uni_acct_name", &al1
->uni_acct_name
,
3431 al1
->hdr_acct_name
.buffer
, ps
, depth
))
3437 if(!smb_io_unistr2("uni_acct_desc", &al1
->uni_acct_desc
,
3438 al1
->hdr_acct_desc
.buffer
, ps
, depth
))
3444 /*******************************************************************
3445 inits a ALIAS_INFO3 structure.
3446 ********************************************************************/
3448 void init_samr_alias_info3(ALIAS_INFO3
* al3
, char *acct_desc
)
3450 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
3452 DEBUG(5, ("init_samr_alias_info3\n"));
3454 init_uni_hdr(&al3
->hdr_acct_desc
, acct_len
);
3455 init_unistr2(&al3
->uni_acct_desc
, acct_desc
, acct_len
);
3458 /*******************************************************************
3459 reads or writes a structure.
3460 ********************************************************************/
3462 BOOL
samr_io_alias_info3(char *desc
, ALIAS_INFO3
* al3
,
3463 prs_struct
*ps
, int depth
)
3468 prs_debug(ps
, depth
, desc
, "samr_io_alias_info3");
3474 if(!smb_io_unihdr("hdr_acct_desc", &al3
->hdr_acct_desc
, ps
, depth
))
3476 if(!smb_io_unistr2("uni_acct_desc", &al3
->uni_acct_desc
,
3477 al3
->hdr_acct_desc
.buffer
, ps
, depth
))
3483 /*******************************************************************
3484 reads or writes a structure.
3485 ********************************************************************/
3487 BOOL
samr_alias_info_ctr(char *desc
, ALIAS_INFO_CTR
* ctr
,
3488 prs_struct
*ps
, int depth
)
3493 prs_debug(ps
, depth
, desc
, "samr_alias_info_ctr");
3496 if(!prs_uint16("switch_value1", ps
, depth
, &ctr
->switch_value1
))
3498 if(!prs_uint16("switch_value2", ps
, depth
, &ctr
->switch_value2
))
3501 switch (ctr
->switch_value1
) {
3503 if(!samr_io_alias_info1("alias_info1", &ctr
->alias
.info1
, ps
, depth
))
3507 if(!samr_io_alias_info3("alias_info3", &ctr
->alias
.info3
, ps
, depth
))
3511 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3518 /*******************************************************************
3519 inits a SAMR_Q_QUERY_ALIASINFO structure.
3520 ********************************************************************/
3522 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO
* q_e
,
3523 POLICY_HND
*pol
, uint16 switch_level
)
3525 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3528 q_e
->switch_level
= switch_level
;
3531 /*******************************************************************
3532 reads or writes a structure.
3533 ********************************************************************/
3535 BOOL
samr_io_q_query_aliasinfo(char *desc
, SAMR_Q_QUERY_ALIASINFO
* q_e
,
3536 prs_struct
*ps
, int depth
)
3541 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasinfo");
3547 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
3550 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
3556 /*******************************************************************
3557 inits a SAMR_R_QUERY_ALIASINFO structure.
3558 ********************************************************************/
3560 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO
* r_u
,
3561 ALIAS_INFO_CTR
* ctr
, NTSTATUS status
)
3563 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3565 r_u
->ptr
= (NT_STATUS_IS_OK(status
) && ctr
!= NULL
) ? 1 : 0;
3567 r_u
->status
= status
;
3570 /*******************************************************************
3571 reads or writes a structure.
3572 ********************************************************************/
3574 BOOL
samr_io_r_query_aliasinfo(char *desc
, SAMR_R_QUERY_ALIASINFO
* r_u
,
3575 prs_struct
*ps
, int depth
)
3580 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasinfo");
3586 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
3589 if (r_u
->ptr
!= 0) {
3590 if(!samr_alias_info_ctr("ctr", &r_u
->ctr
, ps
, depth
))
3596 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3602 /*******************************************************************
3603 inits a SAMR_Q_SET_ALIASINFO structure.
3604 ********************************************************************/
3606 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO
* q_u
,
3607 POLICY_HND
*hnd
, ALIAS_INFO_CTR
* ctr
)
3609 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3611 q_u
->alias_pol
= *hnd
;
3615 /*******************************************************************
3616 reads or writes a structure.
3617 ********************************************************************/
3619 BOOL
samr_io_q_set_aliasinfo(char *desc
, SAMR_Q_SET_ALIASINFO
* q_u
,
3620 prs_struct
*ps
, int depth
)
3625 prs_debug(ps
, depth
, desc
, "samr_io_q_set_aliasinfo");
3631 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
3633 if(!samr_alias_info_ctr("ctr", &q_u
->ctr
, ps
, depth
))
3639 /*******************************************************************
3640 reads or writes a structure.
3641 ********************************************************************/
3643 BOOL
samr_io_r_set_aliasinfo(char *desc
, SAMR_R_SET_ALIASINFO
* r_u
,
3644 prs_struct
*ps
, int depth
)
3649 prs_debug(ps
, depth
, desc
, "samr_io_r_set_aliasinfo");
3654 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3660 /*******************************************************************
3661 inits a SAMR_Q_QUERY_USERALIASES structure.
3662 ********************************************************************/
3664 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES
* q_u
,
3667 uint32
*ptr_sid
, DOM_SID2
* sid
)
3669 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3673 q_u
->num_sids1
= num_sids
;
3675 q_u
->num_sids2
= num_sids
;
3677 q_u
->ptr_sid
= ptr_sid
;
3681 /*******************************************************************
3682 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3683 ********************************************************************/
3685 BOOL
samr_io_q_query_useraliases(char *desc
, SAMR_Q_QUERY_USERALIASES
* q_u
,
3686 prs_struct
*ps
, int depth
)
3694 prs_debug(ps
, depth
, desc
, "samr_io_q_query_useraliases");
3700 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3703 if(!prs_uint32("num_sids1", ps
, depth
, &q_u
->num_sids1
))
3705 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3711 if(!prs_uint32("num_sids2", ps
, depth
, &q_u
->num_sids2
))
3714 if (UNMARSHALLING(ps
) && (q_u
->num_sids2
!= 0)) {
3715 q_u
->ptr_sid
= (uint32
*)prs_alloc_mem(ps
,sizeof(q_u
->ptr_sid
[0])*q_u
->num_sids2
);
3716 if (q_u
->ptr_sid
== NULL
)
3719 q_u
->sid
= (DOM_SID2
*)prs_alloc_mem(ps
, sizeof(q_u
->sid
[0]) * q_u
->num_sids2
);
3720 if (q_u
->sid
== NULL
)
3724 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3725 slprintf(tmp
, sizeof(tmp
) - 1, "ptr[%02d]", i
);
3726 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->ptr_sid
[i
]))
3730 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3731 if (q_u
->ptr_sid
[i
] != 0) {
3732 slprintf(tmp
, sizeof(tmp
) - 1, "sid[%02d]", i
);
3733 if(!smb_io_dom_sid2(tmp
, &q_u
->sid
[i
], ps
, depth
))
3741 /*******************************************************************
3742 inits a SAMR_R_QUERY_USERALIASES structure.
3743 ********************************************************************/
3745 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES
* r_u
,
3746 uint32 num_rids
, uint32
*rid
,
3749 DEBUG(5, ("init_samr_r_query_useraliases\n"));
3751 if (NT_STATUS_IS_OK(status
)) {
3752 r_u
->num_entries
= num_rids
;
3754 r_u
->num_entries2
= num_rids
;
3758 r_u
->num_entries
= 0;
3760 r_u
->num_entries2
= 0;
3763 r_u
->status
= status
;
3766 /*******************************************************************
3767 reads or writes a structure.
3768 ********************************************************************/
3770 BOOL
samr_io_rids(char *desc
, uint32
*num_rids
, uint32
**rid
,
3771 prs_struct
*ps
, int depth
)
3778 prs_debug(ps
, depth
, desc
, "samr_io_rids");
3784 if(!prs_uint32("num_rids", ps
, depth
, num_rids
))
3787 if ((*num_rids
) != 0) {
3788 if (UNMARSHALLING(ps
)) {
3790 (*rid
) = (uint32
*)prs_alloc_mem(ps
,sizeof(uint32
)*(*num_rids
));
3795 for (i
= 0; i
< (*num_rids
); i
++) {
3796 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d]", i
);
3797 if(!prs_uint32(tmp
, ps
, depth
, &((*rid
)[i
])))
3805 /*******************************************************************
3806 reads or writes a structure.
3807 ********************************************************************/
3809 BOOL
samr_io_r_query_useraliases(char *desc
, SAMR_R_QUERY_USERALIASES
* r_u
,
3810 prs_struct
*ps
, int depth
)
3815 prs_debug(ps
, depth
, desc
, "samr_io_r_query_useraliases");
3821 if(!prs_uint32("num_entries", ps
, depth
, &r_u
->num_entries
))
3823 if(!prs_uint32("ptr ", ps
, depth
, &r_u
->ptr
))
3826 if (r_u
->ptr
!= 0) {
3827 if(!samr_io_rids("rids", &r_u
->num_entries2
, &r_u
->rid
, ps
, depth
))
3833 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3839 /*******************************************************************
3840 inits a SAMR_Q_OPEN_ALIAS structure.
3841 ********************************************************************/
3843 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS
* q_u
, POLICY_HND
*pol
,
3844 uint32 access_mask
, uint32 rid
)
3846 DEBUG(5, ("init_samr_q_open_alias\n"));
3848 q_u
->dom_pol
= *pol
;
3849 q_u
->access_mask
= access_mask
;
3850 q_u
->rid_alias
= rid
;
3853 /*******************************************************************
3854 reads or writes a structure.
3855 ********************************************************************/
3857 BOOL
samr_io_q_open_alias(char *desc
, SAMR_Q_OPEN_ALIAS
* q_u
,
3858 prs_struct
*ps
, int depth
)
3863 prs_debug(ps
, depth
, desc
, "samr_io_q_open_alias");
3869 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
3872 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
3874 if(!prs_uint32("rid_alias", ps
, depth
, &q_u
->rid_alias
))
3880 /*******************************************************************
3881 reads or writes a structure.
3882 ********************************************************************/
3884 BOOL
samr_io_r_open_alias(char *desc
, SAMR_R_OPEN_ALIAS
* r_u
,
3885 prs_struct
*ps
, int depth
)
3890 prs_debug(ps
, depth
, desc
, "samr_io_r_open_alias");
3896 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
3899 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3905 /*******************************************************************
3906 inits a SAMR_Q_LOOKUP_RIDS structure.
3907 ********************************************************************/
3909 void init_samr_q_lookup_rids(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_RIDS
* q_u
,
3910 POLICY_HND
*pol
, uint32 flags
,
3911 uint32 num_rids
, uint32
*rid
)
3913 DEBUG(5, ("init_samr_q_lookup_rids\n"));
3917 q_u
->num_rids1
= num_rids
;
3920 q_u
->num_rids2
= num_rids
;
3921 q_u
->rid
= (uint32
*)talloc_zero(ctx
, num_rids
* sizeof(q_u
->rid
[0]));
3922 if (q_u
->rid
== NULL
) {
3926 memcpy(q_u
->rid
, rid
, num_rids
* sizeof(q_u
->rid
[0]));
3930 /*******************************************************************
3931 reads or writes a structure.
3932 ********************************************************************/
3934 BOOL
samr_io_q_lookup_rids(char *desc
, SAMR_Q_LOOKUP_RIDS
* q_u
,
3935 prs_struct
*ps
, int depth
)
3943 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_rids");
3946 if (UNMARSHALLING(ps
))
3952 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3955 if(!prs_uint32("num_rids1", ps
, depth
, &q_u
->num_rids1
))
3957 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
3959 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3961 if(!prs_uint32("num_rids2", ps
, depth
, &q_u
->num_rids2
))
3964 if (UNMARSHALLING(ps
) && (q_u
->num_rids2
!= 0)) {
3965 q_u
->rid
= (uint32
*)prs_alloc_mem(ps
, sizeof(q_u
->rid
[0])*q_u
->num_rids2
);
3966 if (q_u
->rid
== NULL
)
3970 for (i
= 0; i
< q_u
->num_rids2
; i
++) {
3971 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
3972 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->rid
[i
]))
3979 /*******************************************************************
3980 inits a SAMR_R_LOOKUP_RIDS structure.
3981 ********************************************************************/
3983 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS
* r_u
,
3984 uint32 num_names
, UNIHDR
* hdr_name
,
3985 UNISTR2
*uni_name
, uint32
*type
)
3987 DEBUG(5, ("init_samr_r_lookup_rids\n"));
3989 r_u
->hdr_name
= NULL
;
3990 r_u
->uni_name
= NULL
;
3993 if (num_names
!= 0) {
3994 r_u
->num_names1
= num_names
;
3996 r_u
->num_names2
= num_names
;
3998 r_u
->num_types1
= num_names
;
4000 r_u
->num_types2
= num_names
;
4002 r_u
->hdr_name
= hdr_name
;
4003 r_u
->uni_name
= uni_name
;
4006 r_u
->num_names1
= num_names
;
4008 r_u
->num_names2
= num_names
;
4010 r_u
->num_types1
= num_names
;
4012 r_u
->num_types2
= num_names
;
4016 /*******************************************************************
4017 reads or writes a structure.
4018 ********************************************************************/
4020 BOOL
samr_io_r_lookup_rids(char *desc
, SAMR_R_LOOKUP_RIDS
* r_u
,
4021 prs_struct
*ps
, int depth
)
4028 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_rids");
4034 if(!prs_uint32("num_names1", ps
, depth
, &r_u
->num_names1
))
4036 if(!prs_uint32("ptr_names ", ps
, depth
, &r_u
->ptr_names
))
4039 if (r_u
->ptr_names
!= 0) {
4041 if(!prs_uint32("num_names2", ps
, depth
, &r_u
->num_names2
))
4045 if (UNMARSHALLING(ps
) && (r_u
->num_names2
!= 0)) {
4046 r_u
->hdr_name
= (UNIHDR
*) prs_alloc_mem(ps
, r_u
->num_names2
* sizeof(r_u
->hdr_name
[0]));
4047 if (r_u
->hdr_name
== NULL
)
4050 r_u
->uni_name
= (UNISTR2
*)prs_alloc_mem(ps
, r_u
->num_names2
* sizeof(r_u
->uni_name
[0]));
4051 if (r_u
->uni_name
== NULL
)
4055 for (i
= 0; i
< r_u
->num_names2
; i
++) {
4056 slprintf(tmp
, sizeof(tmp
) - 1, "hdr[%02d] ", i
);
4057 if(!smb_io_unihdr("", &r_u
->hdr_name
[i
], ps
, depth
))
4060 for (i
= 0; i
< r_u
->num_names2
; i
++) {
4061 slprintf(tmp
, sizeof(tmp
) - 1, "str[%02d] ", i
);
4062 if(!smb_io_unistr2("", &r_u
->uni_name
[i
], r_u
->hdr_name
[i
].buffer
, ps
, depth
))
4070 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
4072 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
4075 if (r_u
->ptr_types
!= 0) {
4077 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
4080 if (UNMARSHALLING(ps
) && (r_u
->num_types2
!= 0)) {
4081 r_u
->type
= (uint32
*)prs_alloc_mem(ps
, r_u
->num_types2
* sizeof(r_u
->type
[0]));
4082 if (r_u
->type
== NULL
)
4086 for (i
= 0; i
< r_u
->num_types2
; i
++) {
4087 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
4088 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->type
[i
]))
4093 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4099 /*******************************************************************
4100 inits a SAMR_Q_OPEN_ALIAS structure.
4101 ********************************************************************/
4103 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_u
, POLICY_HND
*hnd
)
4105 DEBUG(5, ("init_samr_q_delete_alias\n"));
4107 q_u
->alias_pol
= *hnd
;
4110 /*******************************************************************
4111 reads or writes a structure.
4112 ********************************************************************/
4114 BOOL
samr_io_q_delete_alias(char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4115 prs_struct
*ps
, int depth
)
4120 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_alias");
4126 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4132 /*******************************************************************
4133 reads or writes a structure.
4134 ********************************************************************/
4136 BOOL
samr_io_r_delete_alias(char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4137 prs_struct
*ps
, int depth
)
4142 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_alias");
4148 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
4150 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4156 /*******************************************************************
4157 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
4158 ********************************************************************/
4160 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
4161 POLICY_HND
*hnd
, char *acct_desc
)
4163 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
4165 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
4167 q_u
->dom_pol
= *hnd
;
4169 init_uni_hdr(&q_u
->hdr_acct_desc
, acct_len
);
4170 init_unistr2(&q_u
->uni_acct_desc
, acct_desc
, acct_len
);
4172 q_u
->access_mask
= 0x001f000f;
4175 /*******************************************************************
4176 reads or writes a structure.
4177 ********************************************************************/
4179 BOOL
samr_io_q_create_dom_alias(char *desc
, SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
4180 prs_struct
*ps
, int depth
)
4185 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_alias");
4191 if(!smb_io_pol_hnd("dom_pol", &q_u
->dom_pol
, ps
, depth
))
4194 if(!smb_io_unihdr("hdr_acct_desc", &q_u
->hdr_acct_desc
, ps
, depth
))
4196 if(!smb_io_unistr2("uni_acct_desc", &q_u
->uni_acct_desc
,
4197 q_u
->hdr_acct_desc
.buffer
, ps
, depth
))
4202 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4208 /*******************************************************************
4209 reads or writes a structure.
4210 ********************************************************************/
4212 BOOL
samr_io_r_create_dom_alias(char *desc
, SAMR_R_CREATE_DOM_ALIAS
* r_u
,
4213 prs_struct
*ps
, int depth
)
4218 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_alias");
4224 if(!smb_io_pol_hnd("alias_pol", &r_u
->alias_pol
, ps
, depth
))
4227 if(!prs_uint32("rid", ps
, depth
, &r_u
->rid
))
4230 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4236 /*******************************************************************
4237 inits a SAMR_Q_ADD_ALIASMEM structure.
4238 ********************************************************************/
4240 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4243 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
4245 q_u
->alias_pol
= *hnd
;
4246 init_dom_sid2(&q_u
->sid
, sid
);
4249 /*******************************************************************
4250 reads or writes a structure.
4251 ********************************************************************/
4253 BOOL
samr_io_q_add_aliasmem(char *desc
, SAMR_Q_ADD_ALIASMEM
* q_u
,
4254 prs_struct
*ps
, int depth
)
4259 prs_debug(ps
, depth
, desc
, "samr_io_q_add_aliasmem");
4265 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4267 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4273 /*******************************************************************
4274 reads or writes a structure.
4275 ********************************************************************/
4277 BOOL
samr_io_r_add_aliasmem(char *desc
, SAMR_R_ADD_ALIASMEM
* r_u
,
4278 prs_struct
*ps
, int depth
)
4283 prs_debug(ps
, depth
, desc
, "samr_io_r_add_aliasmem");
4289 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4295 /*******************************************************************
4296 inits a SAMR_Q_DEL_ALIASMEM structure.
4297 ********************************************************************/
4299 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4302 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4304 q_u
->alias_pol
= *hnd
;
4305 init_dom_sid2(&q_u
->sid
, sid
);
4308 /*******************************************************************
4309 reads or writes a structure.
4310 ********************************************************************/
4312 BOOL
samr_io_q_del_aliasmem(char *desc
, SAMR_Q_DEL_ALIASMEM
* q_u
,
4313 prs_struct
*ps
, int depth
)
4318 prs_debug(ps
, depth
, desc
, "samr_io_q_del_aliasmem");
4324 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4326 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4332 /*******************************************************************
4333 reads or writes a structure.
4334 ********************************************************************/
4336 BOOL
samr_io_r_del_aliasmem(char *desc
, SAMR_R_DEL_ALIASMEM
* r_u
,
4337 prs_struct
*ps
, int depth
)
4342 prs_debug(ps
, depth
, desc
, "samr_io_r_del_aliasmem");
4348 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4354 /*******************************************************************
4355 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4356 ********************************************************************/
4358 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_c
,
4361 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4363 q_c
->alias_pol
= *hnd
;
4366 /*******************************************************************
4367 reads or writes a structure.
4368 ********************************************************************/
4370 BOOL
samr_io_q_delete_dom_alias(char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4371 prs_struct
*ps
, int depth
)
4376 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_alias");
4382 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4388 /*******************************************************************
4389 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4390 ********************************************************************/
4392 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4395 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4397 r_u
->status
= status
;
4400 /*******************************************************************
4401 reads or writes a structure.
4402 ********************************************************************/
4404 BOOL
samr_io_r_delete_dom_alias(char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4405 prs_struct
*ps
, int depth
)
4410 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_alias");
4416 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4422 /*******************************************************************
4423 inits a SAMR_Q_QUERY_ALIASMEM structure.
4424 ********************************************************************/
4426 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM
* q_c
,
4429 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4431 q_c
->alias_pol
= *hnd
;
4434 /*******************************************************************
4435 reads or writes a structure.
4436 ********************************************************************/
4438 BOOL
samr_io_q_query_aliasmem(char *desc
, SAMR_Q_QUERY_ALIASMEM
* q_u
,
4439 prs_struct
*ps
, int depth
)
4444 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasmem");
4450 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4456 /*******************************************************************
4457 inits a SAMR_R_QUERY_ALIASMEM structure.
4458 ********************************************************************/
4460 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM
* r_u
,
4461 uint32 num_sids
, DOM_SID2
* sid
,
4464 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4466 if (NT_STATUS_IS_OK(status
)) {
4467 r_u
->num_sids
= num_sids
;
4468 r_u
->ptr
= (num_sids
!= 0) ? 1 : 0;
4469 r_u
->num_sids1
= num_sids
;
4477 r_u
->status
= status
;
4480 /*******************************************************************
4481 reads or writes a structure.
4482 ********************************************************************/
4484 BOOL
samr_io_r_query_aliasmem(char *desc
, SAMR_R_QUERY_ALIASMEM
* r_u
,
4485 prs_struct
*ps
, int depth
)
4488 uint32 ptr_sid
[MAX_LOOKUP_SIDS
];
4493 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasmem");
4499 if(!prs_uint32("num_sids ", ps
, depth
, &r_u
->num_sids
))
4501 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
4504 if (r_u
->ptr
!= 0) {
4505 SMB_ASSERT_ARRAY(ptr_sid
, r_u
->num_sids
);
4507 if (r_u
->num_sids
!= 0) {
4508 if(!prs_uint32("num_sids1", ps
, depth
, &r_u
->num_sids1
))
4511 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4513 if(!prs_uint32("", ps
, depth
, &ptr_sid
[i
]))
4517 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4518 if (ptr_sid
[i
] != 0) {
4519 if(!smb_io_dom_sid2("", &r_u
->sid
[i
], ps
, depth
))
4528 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4534 /*******************************************************************
4535 inits a SAMR_Q_LOOKUP_NAMES structure.
4536 ********************************************************************/
4538 NTSTATUS
init_samr_q_lookup_names(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4539 POLICY_HND
*pol
, uint32 flags
,
4540 uint32 num_names
, char **name
)
4544 DEBUG(5, ("init_samr_q_lookup_names\n"));
4548 q_u
->num_names1
= num_names
;
4551 q_u
->num_names2
= num_names
;
4553 if (!(q_u
->hdr_name
= (UNIHDR
*)talloc_zero(ctx
, num_names
* sizeof(UNIHDR
))))
4554 return NT_STATUS_NO_MEMORY
;
4556 if (!(q_u
->uni_name
= (UNISTR2
*)talloc_zero(ctx
, num_names
* sizeof(UNISTR2
))))
4557 return NT_STATUS_NO_MEMORY
;
4559 for (i
= 0; i
< num_names
; i
++) {
4560 int len_name
= name
[i
] != NULL
? strlen(name
[i
]) : 0;
4561 init_uni_hdr(&q_u
->hdr_name
[i
], len_name
); /* unicode header for user_name */
4562 init_unistr2(&q_u
->uni_name
[i
], name
[i
], len_name
); /* unicode string for machine account */
4565 return NT_STATUS_OK
;
4568 /*******************************************************************
4569 reads or writes a structure.
4570 ********************************************************************/
4572 BOOL
samr_io_q_lookup_names(char *desc
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4573 prs_struct
*ps
, int depth
)
4580 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_names");
4583 if (UNMARSHALLING(ps
))
4589 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4592 if(!prs_uint32("num_names1", ps
, depth
, &q_u
->num_names1
))
4594 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
4596 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
4598 if(!prs_uint32("num_names2", ps
, depth
, &q_u
->num_names2
))
4601 if (UNMARSHALLING(ps
) && (q_u
->num_names2
!= 0)) {
4602 q_u
->hdr_name
= (UNIHDR
*)prs_alloc_mem(ps
, sizeof(UNIHDR
) *
4604 q_u
->uni_name
= (UNISTR2
*)prs_alloc_mem(ps
, sizeof(UNISTR2
) *
4606 if (!q_u
->hdr_name
|| !q_u
->uni_name
)
4610 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4611 if(!smb_io_unihdr("", &q_u
->hdr_name
[i
], ps
, depth
))
4615 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4616 if(!smb_io_unistr2("", &q_u
->uni_name
[i
], q_u
->hdr_name
[i
].buffer
, ps
, depth
))
4623 /*******************************************************************
4624 inits a SAMR_R_LOOKUP_NAMES structure.
4625 ********************************************************************/
4627 NTSTATUS
init_samr_r_lookup_names(TALLOC_CTX
*ctx
, SAMR_R_LOOKUP_NAMES
* r_u
,
4629 uint32
*rid
, uint32
*type
,
4632 DEBUG(5, ("init_samr_r_lookup_names\n"));
4634 if (NT_STATUS_IS_OK(status
) && (num_rids
!= 0)) {
4637 r_u
->num_types1
= num_rids
;
4639 r_u
->num_types2
= num_rids
;
4641 r_u
->num_rids1
= num_rids
;
4643 r_u
->num_rids2
= num_rids
;
4645 if (!(r_u
->rids
= (uint32
*)talloc_zero(ctx
, sizeof(uint32
)*num_rids
)))
4646 return NT_STATUS_NO_MEMORY
;
4647 if (!(r_u
->types
= (uint32
*)talloc_zero(ctx
, sizeof(uint32
)*num_rids
)))
4648 return NT_STATUS_NO_MEMORY
;
4650 if (!r_u
->rids
|| !r_u
->types
)
4653 for (i
= 0; i
< num_rids
; i
++) {
4654 r_u
->rids
[i
] = rid
[i
];
4655 r_u
->types
[i
] = type
[i
];
4660 r_u
->num_types1
= 0;
4662 r_u
->num_types2
= 0;
4672 r_u
->status
= status
;
4674 return NT_STATUS_OK
;
4677 /*******************************************************************
4678 reads or writes a structure.
4679 ********************************************************************/
4681 BOOL
samr_io_r_lookup_names(char *desc
, SAMR_R_LOOKUP_NAMES
* r_u
,
4682 prs_struct
*ps
, int depth
)
4690 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_names");
4693 if (UNMARSHALLING(ps
))
4699 if(!prs_uint32("num_rids1", ps
, depth
, &r_u
->num_rids1
))
4701 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
4704 if (r_u
->ptr_rids
!= 0) {
4705 if(!prs_uint32("num_rids2", ps
, depth
, &r_u
->num_rids2
))
4708 if (r_u
->num_rids2
!= r_u
->num_rids1
) {
4713 if (UNMARSHALLING(ps
))
4714 r_u
->rids
= (uint32
*)prs_alloc_mem(ps
, sizeof(uint32
)*r_u
->num_rids2
);
4717 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
4721 for (i
= 0; i
< r_u
->num_rids2
; i
++) {
4722 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
4723 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->rids
[i
]))
4728 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
4730 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
4733 if (r_u
->ptr_types
!= 0) {
4734 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
4737 if (r_u
->num_types2
!= r_u
->num_types1
) {
4742 if (UNMARSHALLING(ps
))
4743 r_u
->types
= (uint32
*)prs_alloc_mem(ps
, sizeof(uint32
)*r_u
->num_types2
);
4746 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
4750 for (i
= 0; i
< r_u
->num_types2
; i
++) {
4751 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
4752 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->types
[i
]))
4757 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4763 /*******************************************************************
4764 inits a SAMR_Q_DELETE_DOM_USER structure.
4765 ********************************************************************/
4767 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER
* q_c
,
4770 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
4772 q_c
->user_pol
= *hnd
;
4775 /*******************************************************************
4776 reads or writes a structure.
4777 ********************************************************************/
4779 BOOL
samr_io_q_delete_dom_user(char *desc
, SAMR_Q_DELETE_DOM_USER
* q_u
,
4780 prs_struct
*ps
, int depth
)
4785 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_user");
4791 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
4797 /*******************************************************************
4798 reads or writes a structure.
4799 ********************************************************************/
4801 BOOL
samr_io_r_delete_dom_user(char *desc
, SAMR_R_DELETE_DOM_USER
* r_u
,
4802 prs_struct
*ps
, int depth
)
4807 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_user");
4813 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
4815 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4821 /*******************************************************************
4822 reads or writes a structure.
4823 ********************************************************************/
4825 void init_samr_q_open_user(SAMR_Q_OPEN_USER
* q_u
,
4827 uint32 access_mask
, uint32 rid
)
4829 DEBUG(5, ("samr_init_samr_q_open_user\n"));
4831 q_u
->domain_pol
= *pol
;
4832 q_u
->access_mask
= access_mask
;
4833 q_u
->user_rid
= rid
;
4836 /*******************************************************************
4837 reads or writes a structure.
4838 ********************************************************************/
4840 BOOL
samr_io_q_open_user(char *desc
, SAMR_Q_OPEN_USER
* q_u
,
4841 prs_struct
*ps
, int depth
)
4846 prs_debug(ps
, depth
, desc
, "samr_io_q_open_user");
4852 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4855 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4857 if(!prs_uint32("user_rid ", ps
, depth
, &q_u
->user_rid
))
4863 /*******************************************************************
4864 reads or writes a structure.
4865 ********************************************************************/
4867 BOOL
samr_io_r_open_user(char *desc
, SAMR_R_OPEN_USER
* r_u
,
4868 prs_struct
*ps
, int depth
)
4873 prs_debug(ps
, depth
, desc
, "samr_io_r_open_user");
4879 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
4882 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4889 /*******************************************************************
4890 reads or writes a structure.
4891 ********************************************************************/
4893 void init_samr_q_create_user(SAMR_Q_CREATE_USER
* q_u
,
4896 uint32 acb_info
, uint32 access_mask
)
4899 len_name
= strlen(name
);
4901 DEBUG(5, ("samr_init_samr_q_create_user\n"));
4903 q_u
->domain_pol
= *pol
;
4905 init_uni_hdr(&q_u
->hdr_name
, len_name
);
4906 init_unistr2(&q_u
->uni_name
, name
, len_name
);
4908 q_u
->acb_info
= acb_info
;
4909 q_u
->access_mask
= access_mask
;
4912 /*******************************************************************
4913 reads or writes a structure.
4914 ********************************************************************/
4916 BOOL
samr_io_q_create_user(char *desc
, SAMR_Q_CREATE_USER
* q_u
,
4917 prs_struct
*ps
, int depth
)
4922 prs_debug(ps
, depth
, desc
, "samr_io_q_create_user");
4928 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4931 if(!smb_io_unihdr("hdr_name", &q_u
->hdr_name
, ps
, depth
))
4933 if(!smb_io_unistr2("uni_name", &q_u
->uni_name
, q_u
->hdr_name
.buffer
, ps
, depth
))
4938 if(!prs_uint32("acb_info ", ps
, depth
, &q_u
->acb_info
))
4940 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4946 /*******************************************************************
4947 reads or writes a structure.
4948 ********************************************************************/
4950 BOOL
samr_io_r_create_user(char *desc
, SAMR_R_CREATE_USER
* r_u
,
4951 prs_struct
*ps
, int depth
)
4956 prs_debug(ps
, depth
, desc
, "samr_io_r_create_user");
4962 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
4965 if(!prs_uint32("unknown_0", ps
, depth
, &r_u
->unknown_0
))
4967 if(!prs_uint32("user_rid ", ps
, depth
, &r_u
->user_rid
))
4969 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4975 /*******************************************************************
4976 inits a SAMR_Q_QUERY_USERINFO structure.
4977 ********************************************************************/
4979 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO
* q_u
,
4980 POLICY_HND
*hnd
, uint16 switch_value
)
4982 DEBUG(5, ("init_samr_q_query_userinfo\n"));
4985 q_u
->switch_value
= switch_value
;
4988 /*******************************************************************
4989 reads or writes a structure.
4990 ********************************************************************/
4992 BOOL
samr_io_q_query_userinfo(char *desc
, SAMR_Q_QUERY_USERINFO
* q_u
,
4993 prs_struct
*ps
, int depth
)
4998 prs_debug(ps
, depth
, desc
, "samr_io_q_query_userinfo");
5004 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
5007 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
)) /* 0x0015 or 0x0011 */
5013 /*******************************************************************
5014 reads or writes a LOGON_HRS structure.
5015 ********************************************************************/
5017 static BOOL
sam_io_logon_hrs(char *desc
, LOGON_HRS
* hrs
,
5018 prs_struct
*ps
, int depth
)
5023 prs_debug(ps
, depth
, desc
, "sam_io_logon_hrs");
5029 if(!prs_uint32("len ", ps
, depth
, &hrs
->len
))
5032 if (hrs
->len
> sizeof(hrs
->hours
)) {
5033 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs
->len
));
5034 hrs
->len
= sizeof(hrs
->hours
);
5037 if(!prs_uint8s(False
, "hours", ps
, depth
, hrs
->hours
, hrs
->len
))
5043 /*******************************************************************
5044 inits a SAM_USER_INFO_12 structure.
5045 ********************************************************************/
5047 void init_sam_user_info12(SAM_USER_INFO_12
* usr
,
5048 const uint8 lm_pwd
[16], const uint8 nt_pwd
[16])
5050 DEBUG(5, ("init_sam_user_info12\n"));
5052 usr
->lm_pwd_active
=
5053 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
)) ? 1 : 0;
5054 usr
->nt_pwd_active
=
5055 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
)) ? 1 : 0;
5058 /*******************************************************************
5059 reads or writes a structure.
5060 ********************************************************************/
5062 static BOOL
sam_io_user_info12(char *desc
, SAM_USER_INFO_12
* u
,
5063 prs_struct
*ps
, int depth
)
5068 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info12");
5074 if(!prs_uint8s(False
, "lm_pwd", ps
, depth
, u
->lm_pwd
, sizeof(u
->lm_pwd
)))
5076 if(!prs_uint8s(False
, "nt_pwd", ps
, depth
, u
->nt_pwd
, sizeof(u
->nt_pwd
)))
5079 if(!prs_uint8("lm_pwd_active", ps
, depth
, &u
->lm_pwd_active
))
5081 if(!prs_uint8("nt_pwd_active", ps
, depth
, &u
->nt_pwd_active
))
5087 /*******************************************************************
5088 inits a SAM_USER_INFO_10 structure.
5089 ********************************************************************/
5091 void init_sam_user_info10(SAM_USER_INFO_10
* usr
, uint32 acb_info
)
5093 DEBUG(5, ("init_sam_user_info10\n"));
5095 usr
->acb_info
= acb_info
;
5098 /*******************************************************************
5099 reads or writes a structure.
5100 ********************************************************************/
5102 static BOOL
sam_io_user_info10(char *desc
, SAM_USER_INFO_10
* usr
,
5103 prs_struct
*ps
, int depth
)
5108 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info10");
5114 if(!prs_uint32("acb_info", ps
, depth
, &usr
->acb_info
))
5120 /*******************************************************************
5121 inits a SAM_USER_INFO_11 structure.
5122 ********************************************************************/
5124 void init_sam_user_info11(SAM_USER_INFO_11
* usr
,
5127 uint32 rid_user
, uint32 rid_group
, uint16 acct_ctrl
)
5131 DEBUG(5, ("init_sam_user_info11\n"));
5133 len_mach_acct
= strlen(mach_acct
);
5135 memcpy(&(usr
->expiry
), expiry
, sizeof(usr
->expiry
)); /* expiry time or something? */
5136 ZERO_STRUCT(usr
->padding_1
); /* 0 - padding 24 bytes */
5138 init_uni_hdr(&usr
->hdr_mach_acct
, len_mach_acct
); /* unicode header for machine account */
5139 usr
->padding_2
= 0; /* 0 - padding 4 bytes */
5141 usr
->ptr_1
= 1; /* pointer */
5142 ZERO_STRUCT(usr
->padding_3
); /* 0 - padding 32 bytes */
5143 usr
->padding_4
= 0; /* 0 - padding 4 bytes */
5145 usr
->ptr_2
= 1; /* pointer */
5146 usr
->padding_5
= 0; /* 0 - padding 4 bytes */
5148 usr
->ptr_3
= 1; /* pointer */
5149 ZERO_STRUCT(usr
->padding_6
); /* 0 - padding 32 bytes */
5151 usr
->rid_user
= rid_user
;
5152 usr
->rid_group
= rid_group
;
5154 usr
->acct_ctrl
= acct_ctrl
;
5155 usr
->unknown_3
= 0x0000;
5157 usr
->unknown_4
= 0x003f; /* 0x003f - 16 bit unknown */
5158 usr
->unknown_5
= 0x003c; /* 0x003c - 16 bit unknown */
5160 ZERO_STRUCT(usr
->padding_7
); /* 0 - padding 16 bytes */
5161 usr
->padding_8
= 0; /* 0 - padding 4 bytes */
5163 init_unistr2(&usr
->uni_mach_acct
, mach_acct
, len_mach_acct
); /* unicode string for machine account */
5166 /*******************************************************************
5167 reads or writes a structure.
5168 ********************************************************************/
5170 static BOOL
sam_io_user_info11(char *desc
, SAM_USER_INFO_11
* usr
,
5171 prs_struct
*ps
, int depth
)
5176 prs_debug(ps
, depth
, desc
, "samr_io_r_unknown_11");
5182 if(!prs_uint8s(False
, "padding_0", ps
, depth
, usr
->padding_0
, sizeof(usr
->padding_0
)))
5185 if(!smb_io_time("time", &usr
->expiry
, ps
, depth
))
5188 if(!prs_uint8s(False
, "padding_1", ps
, depth
, usr
->padding_1
, sizeof(usr
->padding_1
)))
5191 if(!smb_io_unihdr("unihdr", &usr
->hdr_mach_acct
, ps
, depth
))
5194 if(!prs_uint32("padding_2", ps
, depth
, &usr
->padding_2
))
5197 if(!prs_uint32("ptr_1 ", ps
, depth
, &usr
->ptr_1
))
5199 if(!prs_uint8s(False
, "padding_3", ps
, depth
, usr
->padding_3
, sizeof(usr
->padding_3
)))
5202 if(!prs_uint32("padding_4", ps
, depth
, &usr
->padding_4
))
5205 if(!prs_uint32("ptr_2 ", ps
, depth
, &usr
->ptr_2
))
5207 if(!prs_uint32("padding_5", ps
, depth
, &usr
->padding_5
))
5210 if(!prs_uint32("ptr_3 ", ps
, depth
, &usr
->ptr_3
))
5212 if(!prs_uint8s(False
, "padding_6", ps
, depth
, usr
->padding_6
,sizeof(usr
->padding_6
)))
5215 if(!prs_uint32("rid_user ", ps
, depth
, &usr
->rid_user
))
5217 if(!prs_uint32("rid_group", ps
, depth
, &usr
->rid_group
))
5219 if(!prs_uint16("acct_ctrl", ps
, depth
, &usr
->acct_ctrl
))
5221 if(!prs_uint16("unknown_3", ps
, depth
, &usr
->unknown_3
))
5223 if(!prs_uint16("unknown_4", ps
, depth
, &usr
->unknown_4
))
5225 if(!prs_uint16("unknown_5", ps
, depth
, &usr
->unknown_5
))
5228 if(!prs_uint8s(False
, "padding_7", ps
, depth
, usr
->padding_7
, sizeof(usr
->padding_7
)))
5231 if(!prs_uint32("padding_8", ps
, depth
, &(usr
->padding_8
)))
5234 if(!smb_io_unistr2("unistr2", &usr
->uni_mach_acct
, True
, ps
, depth
))
5240 if(!prs_uint8s(False
, "padding_9", ps
, depth
, usr
->padding_9
, sizeof(usr
->padding_9
)))
5246 /*************************************************************************
5249 unknown_3 = 0x09f8 27fa
5250 unknown_5 = 0x0001 0000
5251 unknown_6 = 0x0000 04ec
5253 *************************************************************************/
5255 void init_sam_user_info24(SAM_USER_INFO_24
* usr
, char newpass
[516], uint16 pw_len
)
5257 DEBUG(10, ("init_sam_user_info24:\n"));
5258 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5259 usr
->pw_len
= pw_len
;
5262 /*******************************************************************
5263 reads or writes a structure.
5264 ********************************************************************/
5266 static BOOL
sam_io_user_info24(char *desc
, SAM_USER_INFO_24
* usr
,
5267 prs_struct
*ps
, int depth
)
5272 prs_debug(ps
, depth
, desc
, "sam_io_user_info24");
5278 if(!prs_uint8s(False
, "password", ps
, depth
, usr
->pass
,
5282 if (MARSHALLING(ps
) && (usr
->pw_len
!= 0)) {
5283 if (!prs_uint16("pw_len", ps
, depth
, &usr
->pw_len
))
5292 /*************************************************************************
5293 init_sam_user_info23
5295 unknown_3 = 0x09f8 27fa
5296 unknown_5 = 0x0001 0000
5297 unknown_6 = 0x0000 04ec
5299 *************************************************************************/
5301 void init_sam_user_info23W(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5302 NTTIME
* logoff_time
, /* all zeros */
5303 NTTIME
* kickoff_time
, /* all zeros */
5304 NTTIME
* pass_last_set_time
, /* all zeros */
5305 NTTIME
* pass_can_change_time
, /* all zeros */
5306 NTTIME
* pass_must_change_time
, /* all zeros */
5317 uint32 user_rid
, /* 0x0000 0000 */
5324 char newpass
[516], uint32 unknown_6
)
5326 int len_user_name
= user_name
!= NULL
? user_name
->uni_str_len
: 0;
5327 int len_full_name
= full_name
!= NULL
? full_name
->uni_str_len
: 0;
5328 int len_home_dir
= home_dir
!= NULL
? home_dir
->uni_str_len
: 0;
5329 int len_dir_drive
= dir_drive
!= NULL
? dir_drive
->uni_str_len
: 0;
5330 int len_logon_script
= log_scr
!= NULL
? log_scr
->uni_str_len
: 0;
5331 int len_profile_path
= prof_path
!= NULL
? prof_path
->uni_str_len
: 0;
5332 int len_description
= desc
!= NULL
? desc
->uni_str_len
: 0;
5333 int len_workstations
= wkstas
!= NULL
? wkstas
->uni_str_len
: 0;
5334 int len_unknown_str
= unk_str
!= NULL
? unk_str
->uni_str_len
: 0;
5335 int len_munged_dial
= mung_dial
!= NULL
? mung_dial
->uni_str_len
: 0;
5337 usr
->logon_time
= *logon_time
; /* all zeros */
5338 usr
->logoff_time
= *logoff_time
; /* all zeros */
5339 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5340 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5341 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5342 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5344 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
); /* NULL */
5345 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5346 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5347 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5348 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5349 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5350 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5351 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5352 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5353 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5355 ZERO_STRUCT(usr
->nt_pwd
);
5356 ZERO_STRUCT(usr
->lm_pwd
);
5358 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5359 usr
->group_rid
= group_rid
;
5360 usr
->acb_info
= acb_info
;
5361 usr
->unknown_3
= unknown_3
; /* 09f8 27fa */
5363 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5364 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5366 ZERO_STRUCT(usr
->padding1
);
5368 usr
->unknown_5
= unknown_5
; /* 0x0001 0000 */
5370 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5372 copy_unistr2(&usr
->uni_user_name
, user_name
);
5373 copy_unistr2(&usr
->uni_full_name
, full_name
);
5374 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5375 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5376 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5377 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5378 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5379 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5380 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5381 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5383 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5386 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5389 /*************************************************************************
5390 init_sam_user_info23
5392 unknown_3 = 0x09f8 27fa
5393 unknown_5 = 0x0001 0000
5394 unknown_6 = 0x0000 04ec
5396 *************************************************************************/
5398 void init_sam_user_info23A(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5399 NTTIME
* logoff_time
, /* all zeros */
5400 NTTIME
* kickoff_time
, /* all zeros */
5401 NTTIME
* pass_last_set_time
, /* all zeros */
5402 NTTIME
* pass_can_change_time
, /* all zeros */
5403 NTTIME
* pass_must_change_time
, /* all zeros */
5404 char *user_name
, /* NULL */
5406 char *home_dir
, char *dir_drive
, char *log_scr
,
5407 char *prof_path
, char *desc
, char *wkstas
,
5408 char *unk_str
, char *mung_dial
, uint32 user_rid
, /* 0x0000 0000 */
5409 uint32 group_rid
, uint32 acb_info
,
5410 uint32 unknown_3
, uint16 logon_divs
,
5411 LOGON_HRS
* hrs
, uint32 unknown_5
,
5412 char newpass
[516], uint32 unknown_6
)
5414 int len_user_name
= user_name
!= NULL
? strlen(user_name
) : 0;
5415 int len_full_name
= full_name
!= NULL
? strlen(full_name
) : 0;
5416 int len_home_dir
= home_dir
!= NULL
? strlen(home_dir
) : 0;
5417 int len_dir_drive
= dir_drive
!= NULL
? strlen(dir_drive
) : 0;
5418 int len_logon_script
= log_scr
!= NULL
? strlen(log_scr
) : 0;
5419 int len_profile_path
= prof_path
!= NULL
? strlen(prof_path
) : 0;
5420 int len_description
= desc
!= NULL
? strlen(desc
) : 0;
5421 int len_workstations
= wkstas
!= NULL
? strlen(wkstas
) : 0;
5422 int len_unknown_str
= unk_str
!= NULL
? strlen(unk_str
) : 0;
5423 int len_munged_dial
= mung_dial
!= NULL
? strlen(mung_dial
) : 0;
5425 usr
->logon_time
= *logon_time
; /* all zeros */
5426 usr
->logoff_time
= *logoff_time
; /* all zeros */
5427 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5428 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5429 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5430 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5432 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
); /* NULL */
5433 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5434 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5435 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5436 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5437 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5438 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5439 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5440 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5441 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5443 ZERO_STRUCT(usr
->nt_pwd
);
5444 ZERO_STRUCT(usr
->lm_pwd
);
5446 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5447 usr
->group_rid
= group_rid
;
5448 usr
->acb_info
= acb_info
;
5449 usr
->unknown_3
= unknown_3
; /* 09f8 27fa */
5451 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5452 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5454 ZERO_STRUCT(usr
->padding1
);
5456 usr
->unknown_5
= unknown_5
; /* 0x0001 0000 */
5458 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5460 init_unistr2(&usr
->uni_user_name
, user_name
, len_user_name
); /* NULL */
5461 init_unistr2(&usr
->uni_full_name
, full_name
, len_full_name
);
5462 init_unistr2(&usr
->uni_home_dir
, home_dir
, len_home_dir
);
5463 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, len_dir_drive
);
5464 init_unistr2(&usr
->uni_logon_script
, log_scr
, len_logon_script
);
5465 init_unistr2(&usr
->uni_profile_path
, prof_path
, len_profile_path
);
5466 init_unistr2(&usr
->uni_acct_desc
, desc
, len_description
);
5467 init_unistr2(&usr
->uni_workstations
, wkstas
, len_workstations
);
5468 init_unistr2(&usr
->uni_unknown_str
, unk_str
, len_unknown_str
);
5469 init_unistr2(&usr
->uni_munged_dial
, mung_dial
, len_munged_dial
);
5471 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5474 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5477 /*******************************************************************
5478 reads or writes a structure.
5479 ********************************************************************/
5481 static BOOL
sam_io_user_info23(char *desc
, SAM_USER_INFO_23
* usr
,
5482 prs_struct
*ps
, int depth
)
5487 prs_debug(ps
, depth
, desc
, "sam_io_user_info23");
5493 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5495 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5497 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5499 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
5501 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
5503 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5506 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5508 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5510 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5512 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5514 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5516 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5518 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5520 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5522 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5524 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5527 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5529 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5532 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5534 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5536 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5539 if(!prs_uint32("unknown_3 ", ps
, depth
, &usr
->unknown_3
))
5541 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5545 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5547 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
5549 if(!prs_uint32("unknown_5 ", ps
, depth
, &usr
->unknown_5
))
5552 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5555 /* here begins pointed-to data */
5557 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5560 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5563 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5566 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5569 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5572 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5575 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5578 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5581 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5584 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
5587 /* ok, this is only guess-work (as usual) */
5588 if (usr
->ptr_logon_hrs
) {
5589 if(!prs_uint32("unknown_6 ", ps
, depth
, &usr
->unknown_6
))
5591 if(!prs_uint32("padding4 ", ps
, depth
, &usr
->padding4
))
5593 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5595 } else if (UNMARSHALLING(ps
)) {
5603 /*******************************************************************
5604 reads or writes a structure.
5605 NB. This structure is *definately* incorrect. It's my best guess
5606 currently for W2K SP2. The password field is encrypted in a different
5607 way than normal... And there are definately other problems. JRA.
5608 ********************************************************************/
5610 static BOOL
sam_io_user_info25(char *desc
, SAM_USER_INFO_25
* usr
, prs_struct
*ps
, int depth
)
5615 prs_debug(ps
, depth
, desc
, "sam_io_user_info25");
5621 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5623 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5625 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5627 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
5629 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
5631 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5634 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5636 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5638 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5640 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5642 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5644 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5646 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5648 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5650 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5652 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5655 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5657 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5660 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5662 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5664 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5667 if(!prs_uint32s(False
, "unknown_6 ", ps
, depth
, usr
->unknown_6
, 6))
5670 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5673 /* here begins pointed-to data */
5675 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5678 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5681 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5684 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5687 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5690 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5693 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5696 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5699 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5702 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
5705 #if 0 /* JRA - unknown... */
5706 /* ok, this is only guess-work (as usual) */
5707 if (usr
->ptr_logon_hrs
) {
5708 if(!prs_uint32("unknown_6 ", ps
, depth
, &usr
->unknown_6
))
5710 if(!prs_uint32("padding4 ", ps
, depth
, &usr
->padding4
))
5712 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5714 } else if (UNMARSHALLING(ps
)) {
5724 /*************************************************************************
5725 init_sam_user_info21W
5727 unknown_3 = 0x00ff ffff
5728 unknown_5 = 0x0002 0000
5729 unknown_6 = 0x0000 04ec
5731 *************************************************************************/
5733 void init_sam_user_info21W(SAM_USER_INFO_21
* usr
,
5734 NTTIME
* logon_time
,
5735 NTTIME
* logoff_time
,
5736 NTTIME
* kickoff_time
,
5737 NTTIME
* pass_last_set_time
,
5738 NTTIME
* pass_can_change_time
,
5739 NTTIME
* pass_must_change_time
,
5758 uint32 unknown_5
, uint32 unknown_6
)
5760 int len_user_name
= user_name
!= NULL
? user_name
->uni_str_len
: 0;
5761 int len_full_name
= full_name
!= NULL
? full_name
->uni_str_len
: 0;
5762 int len_home_dir
= home_dir
!= NULL
? home_dir
->uni_str_len
: 0;
5763 int len_dir_drive
= dir_drive
!= NULL
? dir_drive
->uni_str_len
: 0;
5764 int len_logon_script
= log_scr
!= NULL
? log_scr
->uni_str_len
: 0;
5765 int len_profile_path
= prof_path
!= NULL
? prof_path
->uni_str_len
: 0;
5766 int len_description
= desc
!= NULL
? desc
->uni_str_len
: 0;
5767 int len_workstations
= wkstas
!= NULL
? wkstas
->uni_str_len
: 0;
5768 int len_unknown_str
= unk_str
!= NULL
? unk_str
->uni_str_len
: 0;
5769 int len_munged_dial
= mung_dial
!= NULL
? mung_dial
->uni_str_len
: 0;
5771 usr
->logon_time
= *logon_time
;
5772 usr
->logoff_time
= *logoff_time
;
5773 usr
->kickoff_time
= *kickoff_time
;
5774 usr
->pass_last_set_time
= *pass_last_set_time
;
5775 usr
->pass_can_change_time
= *pass_can_change_time
;
5776 usr
->pass_must_change_time
= *pass_must_change_time
;
5778 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
);
5779 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5780 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5781 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5782 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5783 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5784 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5785 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5786 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5787 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5789 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
));
5790 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
));
5792 usr
->user_rid
= user_rid
;
5793 usr
->group_rid
= group_rid
;
5794 usr
->acb_info
= acb_info
;
5795 usr
->unknown_3
= unknown_3
; /* 0x00ff ffff */
5797 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5798 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5799 usr
->unknown_5
= unknown_5
; /* 0x0002 0000 */
5801 ZERO_STRUCT(usr
->padding1
);
5803 copy_unistr2(&usr
->uni_user_name
, user_name
);
5804 copy_unistr2(&usr
->uni_full_name
, full_name
);
5805 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5806 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5807 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5808 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5809 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5810 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5811 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5812 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5814 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5817 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5820 /*************************************************************************
5821 init_sam_user_info21
5823 unknown_3 = 0x00ff ffff
5824 unknown_5 = 0x0002 0000
5825 unknown_6 = 0x0000 04ec
5827 *************************************************************************/
5829 void init_sam_user_info21A(SAM_USER_INFO_21
*usr
, SAM_ACCOUNT
*pw
)
5831 NTTIME logon_time
, logoff_time
, kickoff_time
,
5832 pass_last_set_time
, pass_can_change_time
,
5833 pass_must_change_time
;
5835 int len_user_name
, len_full_name
, len_home_dir
,
5836 len_dir_drive
, len_logon_script
, len_profile_path
,
5837 len_description
, len_workstations
, len_unknown_str
,
5840 const char* user_name
= pdb_get_username(pw
);
5841 const char* full_name
= pdb_get_fullname(pw
);
5842 const char* home_dir
= pdb_get_homedir(pw
);
5843 const char* dir_drive
= pdb_get_dirdrive(pw
);
5844 const char* logon_script
= pdb_get_logon_script(pw
);
5845 const char* profile_path
= pdb_get_profile_path(pw
);
5846 const char* description
= pdb_get_acct_desc(pw
);
5847 const char* workstations
= pdb_get_workstations(pw
);
5848 const char* munged_dial
= pdb_get_munged_dial(pw
);
5850 len_user_name
= user_name
!= NULL
? strlen(unix_to_dos_static(user_name
))+1 : 0;
5851 len_full_name
= full_name
!= NULL
? strlen(unix_to_dos_static(full_name
))+1 : 0;
5852 len_home_dir
= home_dir
!= NULL
? strlen(unix_to_dos_static(home_dir
))+1 : 0;
5853 len_dir_drive
= dir_drive
!= NULL
? strlen(unix_to_dos_static(dir_drive
))+1 : 0;
5854 len_logon_script
= logon_script
!= NULL
? strlen(unix_to_dos_static(logon_script
))+1 : 0;
5855 len_profile_path
= profile_path
!= NULL
? strlen(unix_to_dos_static(profile_path
))+1 : 0;
5856 len_description
= description
!= NULL
? strlen(unix_to_dos_static(description
))+1 : 0;
5857 len_workstations
= workstations
!= NULL
? strlen(unix_to_dos_static(workstations
))+1 : 0;
5858 len_unknown_str
= 0;
5859 len_munged_dial
= munged_dial
!= NULL
? strlen(unix_to_dos_static(munged_dial
))+1 : 0;
5862 /* Create NTTIME structs */
5863 unix_to_nt_time (&logon_time
, pdb_get_logon_time(pw
));
5864 unix_to_nt_time (&logoff_time
, pdb_get_logoff_time(pw
));
5865 unix_to_nt_time (&kickoff_time
, pdb_get_kickoff_time(pw
));
5866 unix_to_nt_time (&pass_last_set_time
, pdb_get_pass_last_set_time(pw
));
5867 unix_to_nt_time (&pass_can_change_time
, pdb_get_pass_can_change_time(pw
));
5868 unix_to_nt_time (&pass_must_change_time
,pdb_get_pass_must_change_time(pw
));
5870 /* structure assignment */
5871 usr
->logon_time
= logon_time
;
5872 usr
->logoff_time
= logoff_time
;
5873 usr
->kickoff_time
= kickoff_time
;
5874 usr
->pass_last_set_time
= pass_last_set_time
;
5875 usr
->pass_can_change_time
= pass_can_change_time
;
5876 usr
->pass_must_change_time
= pass_must_change_time
;
5878 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
);
5879 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5880 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5881 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5882 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5883 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5884 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5885 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5886 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5887 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5889 ZERO_STRUCT(usr
->nt_pwd
);
5890 ZERO_STRUCT(usr
->lm_pwd
);
5892 usr
->user_rid
= pdb_get_user_rid(pw
);
5893 usr
->group_rid
= pdb_get_group_rid(pw
);
5894 usr
->acb_info
= pdb_get_acct_ctrl(pw
);
5895 usr
->unknown_3
= pdb_get_unknown3(pw
);
5897 usr
->logon_divs
= pdb_get_logon_divs(pw
);
5898 usr
->ptr_logon_hrs
= pdb_get_hours(pw
) ? 1 : 0;
5899 usr
->unknown_5
= pdb_get_unknown5(pw
); /* 0x0002 0000 */
5901 ZERO_STRUCT(usr
->padding1
);
5903 init_unistr2(&usr
->uni_user_name
, unix_to_dos_static(user_name
), len_user_name
);
5904 init_unistr2(&usr
->uni_full_name
, unix_to_dos_static(full_name
), len_full_name
);
5905 init_unistr2(&usr
->uni_home_dir
, unix_to_dos_static(home_dir
), len_home_dir
);
5906 init_unistr2(&usr
->uni_dir_drive
, unix_to_dos_static(dir_drive
), len_dir_drive
);
5907 init_unistr2(&usr
->uni_logon_script
, unix_to_dos_static(logon_script
), len_logon_script
);
5908 init_unistr2(&usr
->uni_profile_path
, unix_to_dos_static(profile_path
), len_profile_path
);
5909 init_unistr2(&usr
->uni_acct_desc
, unix_to_dos_static(description
), len_description
);
5910 init_unistr2(&usr
->uni_workstations
, unix_to_dos_static(workstations
), len_workstations
);
5911 init_unistr2(&usr
->uni_unknown_str
, NULL
, len_unknown_str
);
5912 init_unistr2(&usr
->uni_munged_dial
, unix_to_dos_static(munged_dial
), len_munged_dial
);
5914 usr
->unknown_6
= pdb_get_unknown6(pw
);
5917 if (pdb_get_hours(pw
)) {
5918 usr
->logon_hrs
.len
= pdb_get_hours_len(pw
);
5919 memcpy(&usr
->logon_hrs
.hours
, pdb_get_hours(pw
), MAX_HOURS_LEN
);
5921 memset(&usr
->logon_hrs
, 0xff, sizeof(usr
->logon_hrs
));
5924 /*******************************************************************
5925 reads or writes a structure.
5926 ********************************************************************/
5928 static BOOL
sam_io_user_info21(char *desc
, SAM_USER_INFO_21
* usr
,
5929 prs_struct
*ps
, int depth
)
5934 prs_debug(ps
, depth
, desc
, "sam_io_user_info21");
5940 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5942 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5944 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
,depth
))
5946 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5948 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
,depth
))
5950 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5953 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5955 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5957 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5959 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5961 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5963 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5965 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5967 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5969 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5971 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5974 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5976 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5979 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5981 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5983 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5986 if(!prs_uint32("unknown_3 ", ps
, depth
, &usr
->unknown_3
))
5988 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5992 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5994 if(!prs_uint32("unknown_5 ", ps
, depth
, &usr
->unknown_5
))
5997 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
6000 /* here begins pointed-to data */
6002 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
,usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
6004 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
6006 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
6008 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
6010 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
6012 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
6014 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
6016 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
6018 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
6020 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
)) /* worksations user can log on from */
6023 /* ok, this is only guess-work (as usual) */
6024 if (usr
->ptr_logon_hrs
) {
6027 if(!prs_uint32("unknown_6 ", ps
, depth
, &usr
->unknown_6
))
6029 if(!prs_uint32("padding4 ", ps
, depth
, &usr
->padding4
))
6031 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
6033 } else if (UNMARSHALLING(ps
)) {
6041 void init_sam_user_info20A(SAM_USER_INFO_20
*usr
, SAM_ACCOUNT
*pw
)
6043 int len_munged_dial
;
6044 const char* munged_dial
= pdb_get_munged_dial(pw
);
6046 len_munged_dial
= munged_dial
!= NULL
? strlen(unix_to_dos_static(munged_dial
))+1 : 0;
6047 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
6048 init_unistr2(&usr
->uni_munged_dial
, unix_to_dos_static(munged_dial
), len_munged_dial
);
6052 /*******************************************************************
6053 reads or writes a structure.
6054 ********************************************************************/
6056 static BOOL
sam_io_user_info20(char *desc
, SAM_USER_INFO_20
*usr
,
6057 prs_struct
*ps
, int depth
)
6062 prs_debug(ps
, depth
, desc
, "sam_io_user_info20");
6068 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
6071 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
)) /* worksations user can log on from */
6077 /*******************************************************************
6078 inits a SAM_USERINFO_CTR structure.
6079 ********************************************************************/
6081 NTSTATUS
make_samr_userinfo_ctr_usr21(TALLOC_CTX
*ctx
, SAM_USERINFO_CTR
* ctr
,
6082 uint16 switch_value
,
6083 SAM_USER_INFO_21
* usr
)
6085 DEBUG(5, ("init_samr_userinfo_ctr\n"));
6087 ctr
->switch_value
= switch_value
;
6088 ctr
->info
.id
= NULL
;
6090 switch (switch_value
) {
6092 ctr
->info
.id10
= (SAM_USER_INFO_10
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_10
));
6093 if (ctr
->info
.id10
== NULL
)
6094 return NT_STATUS_NO_MEMORY
;
6096 init_sam_user_info10(ctr
->info
.id10
, usr
->acb_info
);
6099 /* whoops - got this wrong. i think. or don't understand what's happening. */
6103 info
= (void *)&id11
;
6105 expire
.low
= 0xffffffff;
6106 expire
.high
= 0x7fffffff;
6108 ctr
->info
.id
= (SAM_USER_INFO_11
*) talloc_zero(ctx
,sizeof(*ctr
->info
.id11
));
6109 init_sam_user_info11(ctr
->info
.id11
, &expire
,
6110 "BROOKFIELDS$", /* name */
6111 0x03ef, /* user rid */
6112 0x201, /* group rid */
6113 0x0080); /* acb info */
6119 ctr
->info
.id12
= (SAM_USER_INFO_12
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_12
));
6120 if (ctr
->info
.id12
== NULL
)
6121 return NT_STATUS_NO_MEMORY
;
6123 init_sam_user_info12(ctr
->info
.id12
, usr
->lm_pwd
, usr
->nt_pwd
);
6127 SAM_USER_INFO_21
*cusr
;
6128 cusr
= (SAM_USER_INFO_21
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_21
));
6129 ctr
->info
.id21
= cusr
;
6130 if (ctr
->info
.id21
== NULL
)
6131 return NT_STATUS_NO_MEMORY
;
6132 memcpy(cusr
, usr
, sizeof(*usr
));
6133 memset(cusr
->lm_pwd
, 0, sizeof(cusr
->lm_pwd
));
6134 memset(cusr
->nt_pwd
, 0, sizeof(cusr
->nt_pwd
));
6138 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
6139 return NT_STATUS_INVALID_INFO_CLASS
;
6142 return NT_STATUS_OK
;
6145 /*******************************************************************
6146 inits a SAM_USERINFO_CTR structure.
6147 ********************************************************************/
6149 void init_samr_userinfo_ctr(SAM_USERINFO_CTR
* ctr
, uchar
* sess_key
,
6150 uint16 switch_value
, void *info
)
6152 DEBUG(5, ("init_samr_userinfo_ctr\n"));
6154 ctr
->switch_value
= switch_value
;
6155 ctr
->info
.id
= info
;
6157 switch (switch_value
) {
6159 SamOEMhash(ctr
->info
.id24
->pass
, sess_key
, 516);
6160 dump_data(100, (char *)sess_key
, 16);
6161 dump_data(100, (char *)ctr
->info
.id24
->pass
, 516);
6164 SamOEMhash(ctr
->info
.id23
->pass
, sess_key
, 516);
6165 dump_data(100, (char *)sess_key
, 16);
6166 dump_data(100, (char *)ctr
->info
.id23
->pass
, 516);
6169 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level\n"));
6173 /*******************************************************************
6174 reads or writes a structure.
6175 ********************************************************************/
6177 static BOOL
samr_io_userinfo_ctr(char *desc
, SAM_USERINFO_CTR
**ppctr
,
6178 prs_struct
*ps
, int depth
)
6181 SAM_USERINFO_CTR
*ctr
;
6183 prs_debug(ps
, depth
, desc
, "samr_io_userinfo_ctr");
6186 if (UNMARSHALLING(ps
)) {
6187 ctr
= (SAM_USERINFO_CTR
*)prs_alloc_mem(ps
,sizeof(SAM_USERINFO_CTR
));
6195 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
6197 if(!prs_uint16("switch_value", ps
, depth
, &ctr
->switch_value
))
6204 switch (ctr
->switch_value
) {
6206 if (UNMARSHALLING(ps
))
6207 ctr
->info
.id10
= (SAM_USER_INFO_10
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_10
));
6208 if (ctr
->info
.id10
== NULL
) {
6209 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6212 ret
= sam_io_user_info10("", ctr
->info
.id10
, ps
, depth
);
6215 if (UNMARSHALLING(ps
))
6216 ctr
->info
.id11
= (SAM_USER_INFO_11
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_11
));
6218 if (ctr
->info
.id11
== NULL
) {
6219 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6222 ret
= sam_io_user_info11("", ctr
->info
.id11
, ps
, depth
);
6225 if (UNMARSHALLING(ps
))
6226 ctr
->info
.id12
= (SAM_USER_INFO_12
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_12
));
6228 if (ctr
->info
.id12
== NULL
) {
6229 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6232 ret
= sam_io_user_info12("", ctr
->info
.id12
, ps
, depth
);
6235 if (UNMARSHALLING(ps
))
6236 ctr
->info
.id20
= (SAM_USER_INFO_20
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_20
));
6238 if (ctr
->info
.id20
== NULL
) {
6239 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6242 ret
= sam_io_user_info20("", ctr
->info
.id20
, ps
, depth
);
6245 if (UNMARSHALLING(ps
))
6246 ctr
->info
.id21
= (SAM_USER_INFO_21
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_21
));
6248 if (ctr
->info
.id21
== NULL
) {
6249 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6252 ret
= sam_io_user_info21("", ctr
->info
.id21
, ps
, depth
);
6255 if (UNMARSHALLING(ps
))
6256 ctr
->info
.id23
= (SAM_USER_INFO_23
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_23
));
6258 if (ctr
->info
.id23
== NULL
) {
6259 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6262 ret
= sam_io_user_info23("", ctr
->info
.id23
, ps
, depth
);
6265 if (UNMARSHALLING(ps
))
6266 ctr
->info
.id24
= (SAM_USER_INFO_24
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_24
));
6268 if (ctr
->info
.id24
== NULL
) {
6269 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6272 ret
= sam_io_user_info24("", ctr
->info
.id24
, ps
, depth
);
6275 if (UNMARSHALLING(ps
))
6276 ctr
->info
.id25
= (SAM_USER_INFO_25
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_25
));
6278 if (ctr
->info
.id25
== NULL
) {
6279 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6282 ret
= sam_io_user_info25("", ctr
->info
.id25
, ps
, depth
);
6285 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr
->switch_value
));
6293 /*******************************************************************
6294 inits a SAMR_R_QUERY_USERINFO structure.
6295 ********************************************************************/
6297 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO
* r_u
,
6298 SAM_USERINFO_CTR
* ctr
, NTSTATUS status
)
6300 DEBUG(5, ("init_samr_r_query_userinfo\n"));
6305 if (NT_STATUS_IS_OK(status
)) {
6310 r_u
->status
= status
; /* return status */
6313 /*******************************************************************
6314 reads or writes a structure.
6315 ********************************************************************/
6317 BOOL
samr_io_r_query_userinfo(char *desc
, SAMR_R_QUERY_USERINFO
* r_u
,
6318 prs_struct
*ps
, int depth
)
6323 prs_debug(ps
, depth
, desc
, "samr_io_r_query_userinfo");
6329 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
6332 if (r_u
->ptr
!= 0) {
6333 if(!samr_io_userinfo_ctr("ctr", &r_u
->ctr
, ps
, depth
))
6339 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6345 /*******************************************************************
6346 inits a SAMR_Q_SET_USERINFO structure.
6347 ********************************************************************/
6349 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO
* q_u
,
6350 POLICY_HND
*hnd
, unsigned char sess_key
[16],
6351 uint16 switch_value
, void *info
)
6353 DEBUG(5, ("init_samr_q_set_userinfo\n"));
6356 q_u
->switch_value
= switch_value
;
6357 init_samr_userinfo_ctr(q_u
->ctr
, sess_key
, switch_value
, info
);
6360 /*******************************************************************
6361 reads or writes a structure.
6362 ********************************************************************/
6364 BOOL
samr_io_q_set_userinfo(char *desc
, SAMR_Q_SET_USERINFO
* q_u
,
6365 prs_struct
*ps
, int depth
)
6370 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo");
6376 smb_io_pol_hnd("pol", &(q_u
->pol
), ps
, depth
);
6378 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6380 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6386 /*******************************************************************
6387 inits a SAMR_R_SET_USERINFO structure.
6388 ********************************************************************/
6390 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO
* r_u
, NTSTATUS status
)
6392 DEBUG(5, ("init_samr_r_set_userinfo\n"));
6394 r_u
->status
= status
; /* return status */
6397 /*******************************************************************
6398 reads or writes a structure.
6399 ********************************************************************/
6401 BOOL
samr_io_r_set_userinfo(char *desc
, SAMR_R_SET_USERINFO
* r_u
,
6402 prs_struct
*ps
, int depth
)
6407 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo");
6413 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6419 /*******************************************************************
6420 inits a SAMR_Q_SET_USERINFO2 structure.
6421 ********************************************************************/
6423 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2
* q_u
,
6424 POLICY_HND
*hnd
, unsigned char sess_key
[16],
6425 uint16 switch_value
, SAM_USERINFO_CTR
* ctr
)
6427 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
6430 q_u
->switch_value
= switch_value
;
6433 if (q_u
->ctr
!= NULL
)
6434 q_u
->ctr
->switch_value
= switch_value
;
6436 switch (switch_value
) {
6438 SamOEMhash(ctr
->info
.id12
->lm_pwd
, sess_key
, 16);
6439 SamOEMhash(ctr
->info
.id12
->nt_pwd
, sess_key
, 16);
6440 dump_data(100, (char *)sess_key
, 16);
6441 dump_data(100, (char *)ctr
->info
.id12
->lm_pwd
, 16);
6442 dump_data(100, (char *)ctr
->info
.id12
->nt_pwd
, 16);
6447 /*******************************************************************
6448 reads or writes a structure.
6449 ********************************************************************/
6451 BOOL
samr_io_q_set_userinfo2(char *desc
, SAMR_Q_SET_USERINFO2
* q_u
,
6452 prs_struct
*ps
, int depth
)
6457 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo2");
6463 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
6466 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6468 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6474 /*******************************************************************
6475 inits a SAMR_R_SET_USERINFO2 structure.
6476 ********************************************************************/
6478 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2
* r_u
, NTSTATUS status
)
6480 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
6482 r_u
->status
= status
; /* return status */
6485 /*******************************************************************
6486 reads or writes a structure.
6487 ********************************************************************/
6489 BOOL
samr_io_r_set_userinfo2(char *desc
, SAMR_R_SET_USERINFO2
* r_u
,
6490 prs_struct
*ps
, int depth
)
6495 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo2");
6501 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6507 /*******************************************************************
6508 inits a SAMR_Q_CONNECT structure.
6509 ********************************************************************/
6511 void init_samr_q_connect(SAMR_Q_CONNECT
* q_u
,
6512 char *srv_name
, uint32 access_mask
)
6514 int len_srv_name
= strlen(srv_name
);
6516 DEBUG(5, ("init_samr_q_connect\n"));
6518 /* make PDC server name \\server */
6519 q_u
->ptr_srv_name
= len_srv_name
> 0 ? 1 : 0;
6520 init_unistr2(&q_u
->uni_srv_name
, srv_name
, len_srv_name
+ 1);
6522 /* example values: 0x0000 0002 */
6523 q_u
->access_mask
= access_mask
;
6526 /*******************************************************************
6527 reads or writes a structure.
6528 ********************************************************************/
6530 BOOL
samr_io_q_connect(char *desc
, SAMR_Q_CONNECT
* q_u
,
6531 prs_struct
*ps
, int depth
)
6536 prs_debug(ps
, depth
, desc
, "samr_io_q_connect");
6542 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
6544 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
6549 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6555 /*******************************************************************
6556 reads or writes a structure.
6557 ********************************************************************/
6559 BOOL
samr_io_r_connect(char *desc
, SAMR_R_CONNECT
* r_u
,
6560 prs_struct
*ps
, int depth
)
6565 prs_debug(ps
, depth
, desc
, "samr_io_r_connect");
6571 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6574 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6580 /*******************************************************************
6581 inits a SAMR_Q_CONNECT_ANON structure.
6582 ********************************************************************/
6584 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON
* q_u
)
6586 DEBUG(5, ("init_samr_q_connect_anon\n"));
6589 q_u
->unknown_0
= 0x5c; /* server name (?!!) */
6590 q_u
->unknown_1
= 0x01;
6591 q_u
->access_mask
= 0x20;
6594 /*******************************************************************
6595 reads or writes a structure.
6596 ********************************************************************/
6598 BOOL
samr_io_q_connect_anon(char *desc
, SAMR_Q_CONNECT_ANON
* q_u
,
6599 prs_struct
*ps
, int depth
)
6604 prs_debug(ps
, depth
, desc
, "samr_io_q_connect_anon");
6610 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
6612 if(!prs_uint16("unknown_0", ps
, depth
, &q_u
->unknown_0
))
6614 if(!prs_uint16("unknown_1", ps
, depth
, &q_u
->unknown_1
))
6616 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6622 /*******************************************************************
6623 reads or writes a structure.
6624 ********************************************************************/
6626 BOOL
samr_io_r_connect_anon(char *desc
, SAMR_R_CONNECT_ANON
* r_u
,
6627 prs_struct
*ps
, int depth
)
6632 prs_debug(ps
, depth
, desc
, "samr_io_r_connect_anon");
6638 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6641 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6647 /*******************************************************************
6648 inits a SAMR_Q_GET_DOM_PWINFO structure.
6649 ********************************************************************/
6651 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO
* q_u
,
6654 int len_srv_name
= strlen(srv_name
);
6656 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
6659 init_uni_hdr(&q_u
->hdr_srv_name
, len_srv_name
);
6660 init_unistr2(&q_u
->uni_srv_name
, srv_name
, len_srv_name
);
6663 /*******************************************************************
6664 reads or writes a structure.
6665 ********************************************************************/
6667 BOOL
samr_io_q_get_dom_pwinfo(char *desc
, SAMR_Q_GET_DOM_PWINFO
* q_u
,
6668 prs_struct
*ps
, int depth
)
6673 prs_debug(ps
, depth
, desc
, "samr_io_q_get_dom_pwinfo");
6679 if(!prs_uint32("ptr", ps
, depth
, &q_u
->ptr
))
6681 if (q_u
->ptr
!= 0) {
6682 if(!smb_io_unihdr("", &q_u
->hdr_srv_name
, ps
, depth
))
6684 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->hdr_srv_name
.buffer
, ps
, depth
))
6691 /*******************************************************************
6692 reads or writes a structure.
6693 ********************************************************************/
6695 BOOL
samr_io_r_get_dom_pwinfo(char *desc
, SAMR_R_GET_DOM_PWINFO
* r_u
,
6696 prs_struct
*ps
, int depth
)
6701 prs_debug(ps
, depth
, desc
, "samr_io_r_get_dom_pwinfo");
6708 * we need 16 bytes herre according to tests. Don't know
6709 * what they are, but the length is important for the singing
6712 if(!prs_uint32("unk_0", ps
, depth
, &r_u
->unk_0
))
6714 if(!prs_uint32("unk_1", ps
, depth
, &r_u
->unk_1
))
6716 if(!prs_uint32("unk_2", ps
, depth
, &r_u
->unk_2
))
6719 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6725 /*******************************************************************
6726 make a SAMR_ENC_PASSWD structure.
6727 ********************************************************************/
6729 void init_enc_passwd(SAMR_ENC_PASSWD
* pwd
, char pass
[512])
6737 memcpy(pwd
->pass
, pass
, sizeof(pwd
->pass
));
6741 /*******************************************************************
6742 reads or writes a SAMR_ENC_PASSWD structure.
6743 ********************************************************************/
6745 BOOL
samr_io_enc_passwd(char *desc
, SAMR_ENC_PASSWD
* pwd
,
6746 prs_struct
*ps
, int depth
)
6751 prs_debug(ps
, depth
, desc
, "samr_io_enc_passwd");
6757 if(!prs_uint32("ptr", ps
, depth
, &pwd
->ptr
))
6760 if (pwd
->ptr
!= 0) {
6761 if(!prs_uint8s(False
, "pwd", ps
, depth
, pwd
->pass
, sizeof(pwd
->pass
)))
6768 /*******************************************************************
6769 inits a SAMR_ENC_HASH structure.
6770 ********************************************************************/
6772 void init_enc_hash(SAMR_ENC_HASH
* hsh
, uchar hash
[16])
6780 memcpy(hsh
->hash
, hash
, sizeof(hsh
->hash
));
6784 /*******************************************************************
6785 reads or writes a SAMR_ENC_HASH structure.
6786 ********************************************************************/
6788 BOOL
samr_io_enc_hash(char *desc
, SAMR_ENC_HASH
* hsh
,
6789 prs_struct
*ps
, int depth
)
6794 prs_debug(ps
, depth
, desc
, "samr_io_enc_hash");
6800 if(!prs_uint32("ptr ", ps
, depth
, &hsh
->ptr
))
6802 if (hsh
->ptr
!= 0) {
6803 if(!prs_uint8s(False
, "hash", ps
, depth
, hsh
->hash
,sizeof(hsh
->hash
)))
6810 /*******************************************************************
6811 inits a SAMR_R_GET_DOM_PWINFO structure.
6812 ********************************************************************/
6814 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER
* q_u
,
6815 char *dest_host
, char *user_name
,
6816 char nt_newpass
[516],
6817 uchar nt_oldhash
[16],
6818 char lm_newpass
[516],
6819 uchar lm_oldhash
[16])
6821 int len_dest_host
= strlen(dest_host
);
6822 int len_user_name
= strlen(user_name
);
6824 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
6827 init_uni_hdr(&q_u
->hdr_dest_host
, len_dest_host
);
6828 init_unistr2(&q_u
->uni_dest_host
, dest_host
, len_dest_host
);
6829 init_uni_hdr(&q_u
->hdr_user_name
, len_user_name
);
6830 init_unistr2(&q_u
->uni_user_name
, user_name
, len_user_name
);
6832 init_enc_passwd(&q_u
->nt_newpass
, nt_newpass
);
6833 init_enc_hash(&q_u
->nt_oldhash
, nt_oldhash
);
6835 q_u
->unknown
= 0x01;
6837 init_enc_passwd(&q_u
->lm_newpass
, lm_newpass
);
6838 init_enc_hash(&q_u
->lm_oldhash
, lm_oldhash
);
6841 /*******************************************************************
6842 reads or writes a structure.
6843 ********************************************************************/
6845 BOOL
samr_io_q_chgpasswd_user(char *desc
, SAMR_Q_CHGPASSWD_USER
* q_u
,
6846 prs_struct
*ps
, int depth
)
6851 prs_debug(ps
, depth
, desc
, "samr_io_q_chgpasswd_user");
6857 if(!prs_uint32("ptr_0", ps
, depth
, &q_u
->ptr_0
))
6860 if(!smb_io_unihdr("", &q_u
->hdr_dest_host
, ps
, depth
))
6862 if(!smb_io_unistr2("", &q_u
->uni_dest_host
, q_u
->hdr_dest_host
.buffer
, ps
, depth
))
6867 if(!smb_io_unihdr("", &q_u
->hdr_user_name
, ps
, depth
))
6869 if(!smb_io_unistr2("", &q_u
->uni_user_name
, q_u
->hdr_user_name
.buffer
,ps
, depth
))
6872 if(!samr_io_enc_passwd("nt_newpass", &q_u
->nt_newpass
, ps
, depth
))
6874 if(!samr_io_enc_hash("nt_oldhash", &q_u
->nt_oldhash
, ps
, depth
))
6877 if(!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
6880 if(!samr_io_enc_passwd("lm_newpass", &q_u
->lm_newpass
, ps
, depth
))
6882 if(!samr_io_enc_hash("lm_oldhash", &q_u
->lm_oldhash
, ps
, depth
))
6888 /*******************************************************************
6889 inits a SAMR_R_CHGPASSWD_USER structure.
6890 ********************************************************************/
6892 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER
* r_u
, NTSTATUS status
)
6894 DEBUG(5, ("init_r_chgpasswd_user\n"));
6896 r_u
->status
= status
;
6899 /*******************************************************************
6900 reads or writes a structure.
6901 ********************************************************************/
6903 BOOL
samr_io_r_chgpasswd_user(char *desc
, SAMR_R_CHGPASSWD_USER
* r_u
,
6904 prs_struct
*ps
, int depth
)
6909 prs_debug(ps
, depth
, desc
, "samr_io_r_chgpasswd_user");
6915 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6921 /*******************************************************************
6922 reads or writes a structure.
6923 ********************************************************************/
6925 void init_samr_q_unknown_2e(SAMR_Q_UNKNOWN_2E
*q_u
,
6926 POLICY_HND
*domain_pol
, uint16 switch_value
)
6928 DEBUG(5, ("init_samr_q_unknown_2e\n"));
6930 q_u
->domain_pol
= *domain_pol
;
6931 q_u
->switch_value
= switch_value
;
6934 /*******************************************************************
6935 reads or writes a structure.
6936 ********************************************************************/
6938 BOOL
samr_io_q_unknown_2e(char *desc
, SAMR_Q_UNKNOWN_2E
*q_u
,
6939 prs_struct
*ps
, int depth
)
6944 prs_debug(ps
, depth
, desc
, "samr_io_q_unknown_2e");
6950 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
6953 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6959 /*******************************************************************
6960 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
6961 ********************************************************************/
6963 void init_samr_r_samr_unknown_2e(SAMR_R_UNKNOWN_2E
* r_u
,
6964 uint16 switch_value
, SAM_UNK_CTR
* ctr
,
6967 DEBUG(5, ("init_samr_r_samr_unknown_2e\n"));
6970 r_u
->switch_value
= 0;
6971 r_u
->status
= status
; /* return status */
6973 if (NT_STATUS_IS_OK(status
)) {
6974 r_u
->switch_value
= switch_value
;
6980 /*******************************************************************
6981 reads or writes a structure.
6982 ********************************************************************/
6984 BOOL
samr_io_r_samr_unknown_2e(char *desc
, SAMR_R_UNKNOWN_2E
* r_u
,
6985 prs_struct
*ps
, int depth
)
6990 prs_debug(ps
, depth
, desc
, "samr_io_r_samr_unknown_2e");
6996 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
6999 if (r_u
->ptr_0
!= 0 && r_u
->ctr
!= NULL
) {
7000 if(!prs_uint16("switch_value", ps
, depth
, &r_u
->switch_value
))
7005 switch (r_u
->switch_value
) {
7007 if(!sam_io_unk_info12("unk_inf12", &r_u
->ctr
->info
.inf12
, ps
, depth
))
7011 if(!sam_io_unk_info7("unk_inf7",&r_u
->ctr
->info
.inf7
, ps
,depth
))
7015 if(!sam_io_unk_info6("unk_inf6",&r_u
->ctr
->info
.inf6
, ps
,depth
))
7019 if(!sam_io_unk_info5("unk_inf5",&r_u
->ctr
->info
.inf5
, ps
,depth
))
7023 if(!sam_io_unk_info3("unk_inf3",&r_u
->ctr
->info
.inf3
, ps
,depth
))
7027 if(!sam_io_unk_info2("unk_inf2",&r_u
->ctr
->info
.inf2
, ps
,depth
))
7031 if(!sam_io_unk_info1("unk_inf1",&r_u
->ctr
->info
.inf1
, ps
,depth
))
7035 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
7036 r_u
->switch_value
));
7037 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
7045 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7052 /*******************************************************************
7053 reads or writes a structure.
7054 ********************************************************************/
7056 void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO
*q_u
,
7057 POLICY_HND
*domain_pol
, uint16 switch_value
, SAM_UNK_CTR
*ctr
)
7059 DEBUG(5, ("init_samr_q_set_domain_info\n"));
7061 q_u
->domain_pol
= *domain_pol
;
7062 q_u
->switch_value0
= switch_value
;
7064 q_u
->switch_value
= switch_value
;
7069 /*******************************************************************
7070 reads or writes a structure.
7071 ********************************************************************/
7073 BOOL
samr_io_q_set_domain_info(char *desc
, SAMR_Q_SET_DOMAIN_INFO
*q_u
,
7074 prs_struct
*ps
, int depth
)
7079 prs_debug(ps
, depth
, desc
, "samr_io_q_set_domain_info");
7085 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
7088 if(!prs_uint16("switch_value0", ps
, depth
, &q_u
->switch_value0
))
7091 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
7097 if ((q_u
->ctr
= (SAM_UNK_CTR
*)prs_alloc_mem(ps
, sizeof(SAM_UNK_CTR
))) == NULL
)
7100 switch (q_u
->switch_value
) {
7103 if(!sam_io_unk_info12("unk_inf12", &q_u
->ctr
->info
.inf12
, ps
, depth
))
7107 if(!sam_io_unk_info7("unk_inf7",&q_u
->ctr
->info
.inf7
, ps
,depth
))
7111 if(!sam_io_unk_info6("unk_inf6",&q_u
->ctr
->info
.inf6
, ps
,depth
))
7115 if(!sam_io_unk_info5("unk_inf5",&q_u
->ctr
->info
.inf5
, ps
,depth
))
7119 if(!sam_io_unk_info3("unk_inf3",&q_u
->ctr
->info
.inf3
, ps
,depth
))
7123 if(!sam_io_unk_info2("unk_inf2",&q_u
->ctr
->info
.inf2
, ps
,depth
))
7127 if(!sam_io_unk_info1("unk_inf1",&q_u
->ctr
->info
.inf1
, ps
,depth
))
7131 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
7132 q_u
->switch_value
));
7139 /*******************************************************************
7140 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7141 ********************************************************************/
7143 void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO
* r_u
, NTSTATUS status
)
7145 DEBUG(5, ("init_samr_r_set_domain_info\n"));
7147 r_u
->status
= status
; /* return status */
7150 /*******************************************************************
7151 reads or writes a structure.
7152 ********************************************************************/
7154 BOOL
samr_io_r_set_domain_info(char *desc
, SAMR_R_SET_DOMAIN_INFO
* r_u
,
7155 prs_struct
*ps
, int depth
)
7160 prs_debug(ps
, depth
, desc
, "samr_io_r_samr_unknown_2e");
7166 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))