2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2000,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6 * Copyright (C) Paul Ashton 1997-2000,
7 * Copyright (C) Elrond 2000,
8 * Copyright (C) Jeremy Allison 2001,
9 * Copyright (C) Jean François Micouleau 1998-2001,
10 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include "rpc_parse.h"
32 #define DBGC_CLASS DBGC_RPC_PARSE
34 /*******************************************************************
35 inits a SAMR_Q_CLOSE_HND structure.
36 ********************************************************************/
38 void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND
* q_c
, POLICY_HND
*hnd
)
40 DEBUG(5, ("init_samr_q_close_hnd\n"));
45 /*******************************************************************
46 reads or writes a structure.
47 ********************************************************************/
49 BOOL
samr_io_q_close_hnd(const char *desc
, SAMR_Q_CLOSE_HND
* q_u
,
50 prs_struct
*ps
, int depth
)
55 prs_debug(ps
, depth
, desc
, "samr_io_q_close_hnd");
61 return smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
);
64 /*******************************************************************
65 reads or writes a structure.
66 ********************************************************************/
68 BOOL
samr_io_r_close_hnd(const char *desc
, SAMR_R_CLOSE_HND
* r_u
,
69 prs_struct
*ps
, int depth
)
74 prs_debug(ps
, depth
, desc
, "samr_io_r_close_hnd");
80 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
83 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
89 /*******************************************************************
90 inits a SAMR_Q_LOOKUP_DOMAIN structure.
91 ********************************************************************/
93 void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN
* q_u
,
94 POLICY_HND
*pol
, char *dom_name
)
96 DEBUG(5, ("init_samr_q_lookup_domain\n"));
98 q_u
->connect_pol
= *pol
;
100 init_unistr2(&q_u
->uni_domain
, dom_name
, UNI_FLAGS_NONE
);
101 init_uni_hdr(&q_u
->hdr_domain
, &q_u
->uni_domain
);
104 /*******************************************************************
105 reads or writes a structure.
106 ********************************************************************/
107 BOOL
samr_io_q_lookup_domain(const char *desc
, SAMR_Q_LOOKUP_DOMAIN
* q_u
,
108 prs_struct
*ps
, int depth
)
113 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_domain");
119 if(!smb_io_pol_hnd("connect_pol", &q_u
->connect_pol
, ps
, depth
))
122 if(!smb_io_unihdr("hdr_domain", &q_u
->hdr_domain
, ps
, depth
))
125 if(!smb_io_unistr2("uni_domain", &q_u
->uni_domain
, q_u
->hdr_domain
.buffer
, ps
, depth
))
131 /*******************************************************************
132 inits a SAMR_R_LOOKUP_DOMAIN structure.
133 ********************************************************************/
135 void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN
* r_u
,
136 DOM_SID
*dom_sid
, NTSTATUS status
)
138 DEBUG(5, ("init_samr_r_lookup_domain\n"));
140 r_u
->status
= status
;
142 if (NT_STATUS_IS_OK(status
)) {
144 init_dom_sid2(&r_u
->dom_sid
, dom_sid
);
148 /*******************************************************************
149 reads or writes a structure.
150 ********************************************************************/
152 BOOL
samr_io_r_lookup_domain(const char *desc
, SAMR_R_LOOKUP_DOMAIN
* r_u
,
153 prs_struct
*ps
, int depth
)
158 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_domain");
164 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr_sid
))
167 if (r_u
->ptr_sid
!= 0) {
168 if(!smb_io_dom_sid2("sid", &r_u
->dom_sid
, ps
, depth
))
174 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
180 /*******************************************************************
181 reads or writes a structure.
182 ********************************************************************/
184 void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN
* q_u
, POLICY_HND
*dom_pol
, DOM_SID
*sid
)
186 DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n"));
188 q_u
->dom_pol
= *dom_pol
;
189 init_dom_sid2(&q_u
->sid
, sid
);
192 /*******************************************************************
193 reads or writes a structure.
194 ********************************************************************/
196 BOOL
samr_io_q_remove_sid_foreign_domain(const char *desc
, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN
* q_u
,
197 prs_struct
*ps
, int depth
)
202 prs_debug(ps
, depth
, desc
, "samr_io_q_remove_sid_foreign_domain");
208 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
211 if(!smb_io_dom_sid2("sid", &q_u
->sid
, ps
, depth
))
220 /*******************************************************************
221 reads or writes a structure.
222 ********************************************************************/
224 BOOL
samr_io_r_remove_sid_foreign_domain(const char *desc
, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN
* r_u
,
225 prs_struct
*ps
, int depth
)
230 prs_debug(ps
, depth
, desc
, "samr_io_r_remove_sid_foreign_domain");
236 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
242 /*******************************************************************
243 reads or writes a structure.
244 ********************************************************************/
246 void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN
* q_u
,
247 POLICY_HND
*pol
, uint32 flags
,
250 DEBUG(5, ("samr_init_samr_q_open_domain\n"));
254 init_dom_sid2(&q_u
->dom_sid
, sid
);
257 /*******************************************************************
258 reads or writes a structure.
259 ********************************************************************/
261 BOOL
samr_io_q_open_domain(const char *desc
, SAMR_Q_OPEN_DOMAIN
* q_u
,
262 prs_struct
*ps
, int depth
)
267 prs_debug(ps
, depth
, desc
, "samr_io_q_open_domain");
273 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
276 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
279 if(!smb_io_dom_sid2("sid", &q_u
->dom_sid
, ps
, depth
))
285 /*******************************************************************
286 reads or writes a structure.
287 ********************************************************************/
289 BOOL
samr_io_r_open_domain(const char *desc
, SAMR_R_OPEN_DOMAIN
* r_u
,
290 prs_struct
*ps
, int depth
)
295 prs_debug(ps
, depth
, desc
, "samr_io_r_open_domain");
301 if(!smb_io_pol_hnd("domain_pol", &r_u
->domain_pol
, ps
, depth
))
304 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
310 /*******************************************************************
311 reads or writes a structure.
312 ********************************************************************/
314 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
315 POLICY_HND
*user_pol
)
317 DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
319 q_u
->user_pol
= *user_pol
;
322 /*******************************************************************
323 reads or writes a structure.
324 ********************************************************************/
326 BOOL
samr_io_q_get_usrdom_pwinfo(const char *desc
, SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
327 prs_struct
*ps
, int depth
)
332 prs_debug(ps
, depth
, desc
, "samr_io_q_get_usrdom_pwinfo");
338 return smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
);
341 /*******************************************************************
343 ********************************************************************/
345 void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO
*r_u
, NTSTATUS status
)
347 DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
349 r_u
->unknown_0
= 0x0000;
353 * r_u->unknown_1 = 0x0015;
356 r_u
->unknown_1
= 0x01D1;
357 r_u
->unknown_1
= 0x0015;
359 r_u
->unknown_2
= 0x00000000;
361 r_u
->status
= status
;
364 /*******************************************************************
365 reads or writes a structure.
366 ********************************************************************/
368 BOOL
samr_io_r_get_usrdom_pwinfo(const char *desc
, SAMR_R_GET_USRDOM_PWINFO
* r_u
,
369 prs_struct
*ps
, int depth
)
374 prs_debug(ps
, depth
, desc
, "samr_io_r_get_usrdom_pwinfo");
380 if(!prs_uint16("unknown_0", ps
, depth
, &r_u
->unknown_0
))
382 if(!prs_uint16("unknown_1", ps
, depth
, &r_u
->unknown_1
))
384 if(!prs_uint32("unknown_2", ps
, depth
, &r_u
->unknown_2
))
386 if(!prs_ntstatus("status ", ps
, depth
, &r_u
->status
))
393 /*******************************************************************
394 reads or writes a structure.
395 ********************************************************************/
397 BOOL
samr_io_q_set_sec_obj(const char *desc
, SAMR_Q_SET_SEC_OBJ
* q_u
,
398 prs_struct
*ps
, int depth
)
403 prs_debug(ps
, depth
, desc
, "samr_io_q_set_sec_obj");
409 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
412 if(!prs_uint32("sec_info", ps
, depth
, &q_u
->sec_info
))
415 if(!sec_io_desc_buf("sec_desc", &q_u
->buf
, ps
, depth
))
422 /*******************************************************************
423 reads or writes a structure.
424 ********************************************************************/
426 void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ
* q_u
,
427 POLICY_HND
*user_pol
, uint32 sec_info
)
429 DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
431 q_u
->user_pol
= *user_pol
;
432 q_u
->sec_info
= sec_info
;
436 /*******************************************************************
437 reads or writes a structure.
438 ********************************************************************/
440 BOOL
samr_io_q_query_sec_obj(const char *desc
, SAMR_Q_QUERY_SEC_OBJ
* q_u
,
441 prs_struct
*ps
, int depth
)
446 prs_debug(ps
, depth
, desc
, "samr_io_q_query_sec_obj");
452 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
455 if(!prs_uint32("sec_info", ps
, depth
, &q_u
->sec_info
))
461 /*******************************************************************
462 reads or writes a structure.
463 ********************************************************************/
465 void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
466 POLICY_HND
*domain_pol
, uint16 switch_value
)
468 DEBUG(5, ("samr_init_samr_q_query_dom_info\n"));
470 q_u
->domain_pol
= *domain_pol
;
471 q_u
->switch_value
= switch_value
;
474 /*******************************************************************
475 reads or writes a structure.
476 ********************************************************************/
478 BOOL
samr_io_q_query_dom_info(const char *desc
, SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
479 prs_struct
*ps
, int depth
)
484 prs_debug(ps
, depth
, desc
, "samr_io_q_query_dom_info");
490 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
493 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
500 /*******************************************************************
502 ********************************************************************/
504 void init_unk_info3(SAM_UNK_INFO_3
*u_3
, NTTIME nt_logout
)
506 u_3
->logout
.low
= nt_logout
.low
;
507 u_3
->logout
.high
= nt_logout
.high
;
510 /*******************************************************************
511 reads or writes a structure.
512 ********************************************************************/
514 static BOOL
sam_io_unk_info3(const char *desc
, SAM_UNK_INFO_3
* u_3
,
515 prs_struct
*ps
, int depth
)
520 prs_debug(ps
, depth
, desc
, "sam_io_unk_info3");
523 if(!smb_io_time("logout", &u_3
->logout
, ps
, depth
))
529 /*******************************************************************
531 ********************************************************************/
533 void init_unk_info6(SAM_UNK_INFO_6
* u_6
)
535 u_6
->unknown_0
= 0x00000000;
537 memset(u_6
->padding
, 0, sizeof(u_6
->padding
)); /* 12 bytes zeros */
540 /*******************************************************************
541 reads or writes a structure.
542 ********************************************************************/
544 static BOOL
sam_io_unk_info6(const char *desc
, SAM_UNK_INFO_6
* u_6
,
545 prs_struct
*ps
, int depth
)
550 prs_debug(ps
, depth
, desc
, "sam_io_unk_info6");
553 if(!prs_uint32("unknown_0", ps
, depth
, &u_6
->unknown_0
)) /* 0x0000 0000 */
555 if(!prs_uint32("ptr_0", ps
, depth
, &u_6
->ptr_0
)) /* pointer to unknown structure */
557 if(!prs_uint8s(False
, "padding", ps
, depth
, u_6
->padding
, sizeof(u_6
->padding
))) /* 12 bytes zeros */
563 /*******************************************************************
565 ********************************************************************/
567 void init_unk_info7(SAM_UNK_INFO_7
* u_7
, uint32 server_role
)
569 u_7
->server_role
= server_role
;
572 /*******************************************************************
573 reads or writes a structure.
574 ********************************************************************/
576 static BOOL
sam_io_unk_info7(const char *desc
, SAM_UNK_INFO_7
* u_7
,
577 prs_struct
*ps
, int depth
)
582 prs_debug(ps
, depth
, desc
, "sam_io_unk_info7");
585 if(!prs_uint16("server_role", ps
, depth
, &u_7
->server_role
))
591 /*******************************************************************
593 ********************************************************************/
595 void init_unk_info8(SAM_UNK_INFO_8
* u_8
, uint32 seq_num
)
597 unix_to_nt_time(&u_8
->domain_create_time
, 0);
598 u_8
->seq_num
.low
= seq_num
;
599 u_8
->seq_num
.high
= 0x0000;
602 /*******************************************************************
603 reads or writes a structure.
604 ********************************************************************/
606 static BOOL
sam_io_unk_info8(const char *desc
, SAM_UNK_INFO_8
* u_8
,
607 prs_struct
*ps
, int depth
)
612 prs_debug(ps
, depth
, desc
, "sam_io_unk_info8");
615 if (!prs_uint64("seq_num", ps
, depth
, &u_8
->seq_num
))
618 if(!smb_io_time("domain_create_time", &u_8
->domain_create_time
, ps
, depth
))
625 /*******************************************************************
627 ********************************************************************/
629 void init_unk_info12(SAM_UNK_INFO_12
* u_12
, NTTIME nt_lock_duration
, NTTIME nt_reset_time
, uint16 lockout
)
631 u_12
->duration
.low
= nt_lock_duration
.low
;
632 u_12
->duration
.high
= nt_lock_duration
.high
;
633 u_12
->reset_count
.low
= nt_reset_time
.low
;
634 u_12
->reset_count
.high
= nt_reset_time
.high
;
636 u_12
->bad_attempt_lockout
= lockout
;
639 /*******************************************************************
640 reads or writes a structure.
641 ********************************************************************/
643 static BOOL
sam_io_unk_info12(const char *desc
, SAM_UNK_INFO_12
* u_12
,
644 prs_struct
*ps
, int depth
)
649 prs_debug(ps
, depth
, desc
, "sam_io_unk_info12");
652 if(!smb_io_time("duration", &u_12
->duration
, ps
, depth
))
654 if(!smb_io_time("reset_count", &u_12
->reset_count
, ps
, depth
))
656 if(!prs_uint16("bad_attempt_lockout", ps
, depth
, &u_12
->bad_attempt_lockout
))
662 /*******************************************************************
664 ********************************************************************/
666 void init_unk_info5(SAM_UNK_INFO_5
* u_5
,const char *server
)
668 init_unistr2(&u_5
->uni_server
, server
, UNI_FLAGS_NONE
);
669 init_uni_hdr(&u_5
->hdr_server
, &u_5
->uni_server
);
672 /*******************************************************************
673 reads or writes a structure.
674 ********************************************************************/
676 static BOOL
sam_io_unk_info5(const char *desc
, SAM_UNK_INFO_5
* u_5
,
677 prs_struct
*ps
, int depth
)
682 prs_debug(ps
, depth
, desc
, "sam_io_unk_info5");
685 if(!smb_io_unihdr("hdr_server", &u_5
->hdr_server
, ps
, depth
))
688 if(!smb_io_unistr2("uni_server", &u_5
->uni_server
, u_5
->hdr_server
.buffer
, ps
, depth
))
694 /*******************************************************************
696 ********************************************************************/
698 void init_unk_info2(SAM_UNK_INFO_2
* u_2
,
699 const char *comment
, const char *domain
, const char *server
,
700 uint32 seq_num
, uint32 num_users
, uint32 num_groups
, uint32 num_alias
, NTTIME nt_logout
, uint32 server_role
)
702 u_2
->logout
.low
= nt_logout
.low
;
703 u_2
->logout
.high
= nt_logout
.high
;
705 u_2
->seq_num
.low
= seq_num
;
706 u_2
->seq_num
.high
= 0x00000000;
709 u_2
->unknown_4
= 0x00000001;
710 u_2
->server_role
= server_role
;
711 u_2
->unknown_6
= 0x00000001;
712 u_2
->num_domain_usrs
= num_users
;
713 u_2
->num_domain_grps
= num_groups
;
714 u_2
->num_local_grps
= num_alias
;
716 memset(u_2
->padding
, 0, sizeof(u_2
->padding
)); /* 12 bytes zeros */
718 init_unistr2(&u_2
->uni_comment
, comment
, UNI_FLAGS_NONE
);
719 init_uni_hdr(&u_2
->hdr_comment
, &u_2
->uni_comment
);
720 init_unistr2(&u_2
->uni_domain
, domain
, UNI_FLAGS_NONE
);
721 init_uni_hdr(&u_2
->hdr_domain
, &u_2
->uni_domain
);
722 init_unistr2(&u_2
->uni_server
, server
, UNI_FLAGS_NONE
);
723 init_uni_hdr(&u_2
->hdr_server
, &u_2
->uni_server
);
726 /*******************************************************************
727 reads or writes a structure.
728 ********************************************************************/
730 static BOOL
sam_io_unk_info2(const char *desc
, SAM_UNK_INFO_2
* u_2
,
731 prs_struct
*ps
, int depth
)
736 prs_debug(ps
, depth
, desc
, "sam_io_unk_info2");
739 if(!smb_io_time("logout", &u_2
->logout
, ps
, depth
))
741 if(!smb_io_unihdr("hdr_comment", &u_2
->hdr_comment
, ps
, depth
))
743 if(!smb_io_unihdr("hdr_domain", &u_2
->hdr_domain
, ps
, depth
))
745 if(!smb_io_unihdr("hdr_server", &u_2
->hdr_server
, ps
, depth
))
748 /* put all the data in here, at the moment, including what the above
749 pointer is referring to
752 if(!prs_uint64("seq_num ", ps
, depth
, &u_2
->seq_num
))
755 if(!prs_uint32("unknown_4 ", ps
, depth
, &u_2
->unknown_4
)) /* 0x0000 0001 */
757 if(!prs_uint32("server_role ", ps
, depth
, &u_2
->server_role
))
759 if(!prs_uint32("unknown_6 ", ps
, depth
, &u_2
->unknown_6
)) /* 0x0000 0001 */
761 if(!prs_uint32("num_domain_usrs ", ps
, depth
, &u_2
->num_domain_usrs
))
763 if(!prs_uint32("num_domain_grps", ps
, depth
, &u_2
->num_domain_grps
))
765 if(!prs_uint32("num_local_grps", ps
, depth
, &u_2
->num_local_grps
))
768 if(!smb_io_unistr2("uni_comment", &u_2
->uni_comment
, u_2
->hdr_comment
.buffer
, ps
, depth
))
770 if(!smb_io_unistr2("uni_domain", &u_2
->uni_domain
, u_2
->hdr_domain
.buffer
, ps
, depth
))
772 if(!smb_io_unistr2("uni_server", &u_2
->uni_server
, u_2
->hdr_server
.buffer
, ps
, depth
))
778 /*******************************************************************
780 ********************************************************************/
782 void init_unk_info1(SAM_UNK_INFO_1
*u_1
, uint16 min_pass_len
, uint16 pass_hist
,
783 uint32 flag
, NTTIME nt_expire
, NTTIME nt_min_age
)
785 u_1
->min_length_password
= min_pass_len
;
786 u_1
->password_history
= pass_hist
;
789 /* password never expire */
790 u_1
->expire
.high
= nt_expire
.high
;
791 u_1
->expire
.low
= nt_expire
.low
;
793 /* can change the password now */
794 u_1
->min_passwordage
.high
= nt_min_age
.high
;
795 u_1
->min_passwordage
.low
= nt_min_age
.low
;
799 /*******************************************************************
800 reads or writes a structure.
801 ********************************************************************/
803 static BOOL
sam_io_unk_info1(const char *desc
, SAM_UNK_INFO_1
* u_1
,
804 prs_struct
*ps
, int depth
)
809 prs_debug(ps
, depth
, desc
, "sam_io_unk_info1");
812 if(!prs_uint16("min_length_password", ps
, depth
, &u_1
->min_length_password
))
814 if(!prs_uint16("password_history", ps
, depth
, &u_1
->password_history
))
816 if(!prs_uint32("flag", ps
, depth
, &u_1
->flag
))
818 if(!smb_io_time("expire", &u_1
->expire
, ps
, depth
))
820 if(!smb_io_time("min_passwordage", &u_1
->min_passwordage
, ps
, depth
))
826 /*******************************************************************
827 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
828 ********************************************************************/
830 void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
831 uint16 switch_value
, SAM_UNK_CTR
* ctr
,
834 DEBUG(5, ("init_samr_r_query_dom_info\n"));
837 r_u
->switch_value
= 0;
838 r_u
->status
= status
; /* return status */
840 if (NT_STATUS_IS_OK(status
)) {
841 r_u
->switch_value
= switch_value
;
847 /*******************************************************************
848 reads or writes a structure.
849 ********************************************************************/
851 BOOL
samr_io_r_query_dom_info(const char *desc
, SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
852 prs_struct
*ps
, int depth
)
857 prs_debug(ps
, depth
, desc
, "samr_io_r_query_dom_info");
863 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
866 if (r_u
->ptr_0
!= 0 && r_u
->ctr
!= NULL
) {
867 if(!prs_uint16("switch_value", ps
, depth
, &r_u
->switch_value
))
872 switch (r_u
->switch_value
) {
874 if(!sam_io_unk_info12("unk_inf12", &r_u
->ctr
->info
.inf12
, ps
, depth
))
878 if(!sam_io_unk_info8("unk_inf8",&r_u
->ctr
->info
.inf8
, ps
,depth
))
882 if(!sam_io_unk_info7("unk_inf7",&r_u
->ctr
->info
.inf7
, ps
,depth
))
886 if(!sam_io_unk_info6("unk_inf6",&r_u
->ctr
->info
.inf6
, ps
,depth
))
890 if(!sam_io_unk_info5("unk_inf5",&r_u
->ctr
->info
.inf5
, ps
,depth
))
894 if(!sam_io_unk_info3("unk_inf3",&r_u
->ctr
->info
.inf3
, ps
,depth
))
898 if(!sam_io_unk_info2("unk_inf2",&r_u
->ctr
->info
.inf2
, ps
,depth
))
902 if(!sam_io_unk_info1("unk_inf1",&r_u
->ctr
->info
.inf1
, ps
,depth
))
906 DEBUG(0, ("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
908 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
916 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
922 /*******************************************************************
923 reads or writes a SAMR_R_SET_SEC_OBJ structure.
924 ********************************************************************/
926 BOOL
samr_io_r_set_sec_obj(const char *desc
, SAMR_R_SET_SEC_OBJ
* r_u
,
927 prs_struct
*ps
, int depth
)
932 prs_debug(ps
, depth
, desc
, "samr_io_r_set_sec_obj");
938 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
944 /*******************************************************************
945 reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
946 ********************************************************************/
948 BOOL
samr_io_r_query_sec_obj(const char *desc
, SAMR_R_QUERY_SEC_OBJ
* r_u
,
949 prs_struct
*ps
, int depth
)
954 prs_debug(ps
, depth
, desc
, "samr_io_r_query_sec_obj");
960 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
963 if(!sec_io_desc_buf("sec", &r_u
->buf
, ps
, depth
))
967 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
973 /*******************************************************************
974 reads or writes a SAM_STR1 structure.
975 ********************************************************************/
977 static BOOL
sam_io_sam_str1(const char *desc
, SAM_STR1
* sam
, uint32 acct_buf
,
978 uint32 name_buf
, uint32 desc_buf
,
979 prs_struct
*ps
, int depth
)
984 prs_debug(ps
, depth
, desc
, "sam_io_sam_str1");
989 if (!smb_io_unistr2("name", &sam
->uni_acct_name
, acct_buf
, ps
, depth
))
992 if (!smb_io_unistr2("desc", &sam
->uni_acct_desc
, desc_buf
, ps
, depth
))
995 if (!smb_io_unistr2("full", &sam
->uni_full_name
, name_buf
, ps
, depth
))
1001 /*******************************************************************
1002 inits a SAM_ENTRY1 structure.
1003 ********************************************************************/
1005 static void init_sam_entry1(SAM_ENTRY1
*sam
, uint32 user_idx
,
1006 UNISTR2
*sam_name
, UNISTR2
*sam_full
,
1007 UNISTR2
*sam_desc
, uint32 rid_user
,
1010 DEBUG(5, ("init_sam_entry1\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_acct_name
, sam_name
);
1019 init_uni_hdr(&sam
->hdr_user_name
, sam_full
);
1020 init_uni_hdr(&sam
->hdr_user_desc
, sam_desc
);
1023 /*******************************************************************
1024 reads or writes a SAM_ENTRY1 structure.
1025 ********************************************************************/
1027 static BOOL
sam_io_sam_entry1(const char *desc
, SAM_ENTRY1
* sam
,
1028 prs_struct
*ps
, int depth
)
1033 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry1");
1039 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
1042 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
1044 if(!prs_uint16("acb_info ", ps
, depth
, &sam
->acb_info
))
1050 if (!smb_io_unihdr("hdr_acct_name", &sam
->hdr_acct_name
, ps
, depth
))
1052 if (!smb_io_unihdr("hdr_user_desc", &sam
->hdr_user_desc
, ps
, depth
))
1054 if (!smb_io_unihdr("hdr_user_name", &sam
->hdr_user_name
, ps
, depth
))
1060 /*******************************************************************
1061 reads or writes a SAM_STR2 structure.
1062 ********************************************************************/
1064 static BOOL
sam_io_sam_str2(const char *desc
, SAM_STR2
* sam
, uint32 acct_buf
,
1065 uint32 desc_buf
, prs_struct
*ps
, int depth
)
1070 prs_debug(ps
, depth
, desc
, "sam_io_sam_str2");
1076 if(!smb_io_unistr2("uni_srv_name", &sam
->uni_srv_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
1078 if(!smb_io_unistr2("uni_srv_desc", &sam
->uni_srv_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
1084 /*******************************************************************
1085 inits a SAM_ENTRY2 structure.
1086 ********************************************************************/
1087 static void init_sam_entry2(SAM_ENTRY2
* sam
, uint32 user_idx
,
1088 UNISTR2
*sam_name
, UNISTR2
*sam_desc
,
1089 uint32 rid_user
, uint16 acb_info
)
1091 DEBUG(5, ("init_sam_entry2\n"));
1093 sam
->user_idx
= user_idx
;
1094 sam
->rid_user
= rid_user
;
1095 sam
->acb_info
= acb_info
;
1097 init_uni_hdr(&sam
->hdr_srv_name
, sam_name
);
1098 init_uni_hdr(&sam
->hdr_srv_desc
, sam_desc
);
1101 /*******************************************************************
1102 reads or writes a SAM_ENTRY2 structure.
1103 ********************************************************************/
1105 static BOOL
sam_io_sam_entry2(const char *desc
, SAM_ENTRY2
* sam
,
1106 prs_struct
*ps
, int depth
)
1111 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry2");
1117 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
1120 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
1122 if(!prs_uint16("acb_info ", ps
, depth
, &sam
->acb_info
))
1128 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_name
, ps
, depth
)) /* account name unicode string header */
1130 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_desc
, ps
, depth
)) /* account name unicode string header */
1136 /*******************************************************************
1137 reads or writes a SAM_STR3 structure.
1138 ********************************************************************/
1140 static BOOL
sam_io_sam_str3(const char *desc
, SAM_STR3
* sam
, uint32 acct_buf
,
1141 uint32 desc_buf
, prs_struct
*ps
, int depth
)
1146 prs_debug(ps
, depth
, desc
, "sam_io_sam_str3");
1152 if(!smb_io_unistr2("uni_grp_name", &sam
->uni_grp_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
1154 if(!smb_io_unistr2("uni_grp_desc", &sam
->uni_grp_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
1160 /*******************************************************************
1161 inits a SAM_ENTRY3 structure.
1162 ********************************************************************/
1164 static void init_sam_entry3(SAM_ENTRY3
* sam
, uint32 grp_idx
,
1165 UNISTR2
*grp_name
, UNISTR2
*grp_desc
,
1168 DEBUG(5, ("init_sam_entry3\n"));
1170 sam
->grp_idx
= grp_idx
;
1171 sam
->rid_grp
= rid_grp
;
1172 sam
->attr
= 0x07; /* group rid attributes - gets ignored by nt 4.0 */
1174 init_uni_hdr(&sam
->hdr_grp_name
, grp_name
);
1175 init_uni_hdr(&sam
->hdr_grp_desc
, grp_desc
);
1178 /*******************************************************************
1179 reads or writes a SAM_ENTRY3 structure.
1180 ********************************************************************/
1182 static BOOL
sam_io_sam_entry3(const char *desc
, SAM_ENTRY3
* sam
,
1183 prs_struct
*ps
, int depth
)
1188 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry3");
1194 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1197 if(!prs_uint32("rid_grp", ps
, depth
, &sam
->rid_grp
))
1199 if(!prs_uint32("attr ", ps
, depth
, &sam
->attr
))
1202 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_name
, ps
, depth
)) /* account name unicode string header */
1204 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_desc
, ps
, depth
)) /* account name unicode string header */
1210 /*******************************************************************
1211 inits a SAM_ENTRY4 structure.
1212 ********************************************************************/
1214 static void init_sam_entry4(SAM_ENTRY4
* sam
, uint32 user_idx
,
1215 uint32 len_acct_name
)
1217 DEBUG(5, ("init_sam_entry4\n"));
1219 sam
->user_idx
= user_idx
;
1220 init_str_hdr(&sam
->hdr_acct_name
, len_acct_name
+1, len_acct_name
, len_acct_name
!= 0);
1223 /*******************************************************************
1224 reads or writes a SAM_ENTRY4 structure.
1225 ********************************************************************/
1227 static BOOL
sam_io_sam_entry4(const char *desc
, SAM_ENTRY4
* sam
,
1228 prs_struct
*ps
, int depth
)
1233 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry4");
1239 if(!prs_uint32("user_idx", ps
, depth
, &sam
->user_idx
))
1241 if(!smb_io_strhdr("strhdr", &sam
->hdr_acct_name
, ps
, depth
))
1247 /*******************************************************************
1248 inits a SAM_ENTRY5 structure.
1249 ********************************************************************/
1251 static void init_sam_entry5(SAM_ENTRY5
* sam
, uint32 grp_idx
,
1252 uint32 len_grp_name
)
1254 DEBUG(5, ("init_sam_entry5\n"));
1256 sam
->grp_idx
= grp_idx
;
1257 init_str_hdr(&sam
->hdr_grp_name
, len_grp_name
, len_grp_name
,
1261 /*******************************************************************
1262 reads or writes a SAM_ENTRY5 structure.
1263 ********************************************************************/
1265 static BOOL
sam_io_sam_entry5(const char *desc
, SAM_ENTRY5
* sam
,
1266 prs_struct
*ps
, int depth
)
1271 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry5");
1277 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1279 if(!smb_io_strhdr("strhdr", &sam
->hdr_grp_name
, ps
, depth
))
1285 /*******************************************************************
1286 inits a SAM_ENTRY structure.
1287 ********************************************************************/
1289 void init_sam_entry(SAM_ENTRY
*sam
, UNISTR2
*uni2
, uint32 rid
)
1291 DEBUG(10, ("init_sam_entry: %d\n", rid
));
1294 init_uni_hdr(&sam
->hdr_name
, uni2
);
1297 /*******************************************************************
1298 reads or writes a SAM_ENTRY structure.
1299 ********************************************************************/
1301 static BOOL
sam_io_sam_entry(const char *desc
, SAM_ENTRY
* sam
,
1302 prs_struct
*ps
, int depth
)
1307 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry");
1312 if(!prs_uint32("rid", ps
, depth
, &sam
->rid
))
1314 if(!smb_io_unihdr("unihdr", &sam
->hdr_name
, ps
, depth
)) /* account name unicode string header */
1320 /*******************************************************************
1321 inits a SAMR_Q_ENUM_DOM_USERS structure.
1322 ********************************************************************/
1324 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS
* q_e
, POLICY_HND
*pol
,
1326 uint16 acb_mask
, uint16 unk_1
, uint32 size
)
1328 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
1332 q_e
->start_idx
= start_idx
; /* zero indicates lots */
1333 q_e
->acb_mask
= acb_mask
;
1334 q_e
->unknown_1
= unk_1
;
1335 q_e
->max_size
= size
;
1338 /*******************************************************************
1339 reads or writes a structure.
1340 ********************************************************************/
1342 BOOL
samr_io_q_enum_dom_users(const char *desc
, SAMR_Q_ENUM_DOM_USERS
* q_e
,
1343 prs_struct
*ps
, int depth
)
1348 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_users");
1354 if(!smb_io_pol_hnd("domain_pol", &q_e
->pol
, ps
, depth
))
1357 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
1359 if(!prs_uint16("acb_mask ", ps
, depth
, &q_e
->acb_mask
))
1361 if(!prs_uint16("unknown_1", ps
, depth
, &q_e
->unknown_1
))
1364 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1371 /*******************************************************************
1372 inits a SAMR_R_ENUM_DOM_USERS structure.
1373 ********************************************************************/
1375 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS
* r_u
,
1376 uint32 next_idx
, uint32 num_sam_entries
)
1378 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
1380 r_u
->next_idx
= next_idx
;
1382 if (num_sam_entries
!= 0) {
1383 r_u
->ptr_entries1
= 1;
1384 r_u
->ptr_entries2
= 1;
1385 r_u
->num_entries2
= num_sam_entries
;
1386 r_u
->num_entries3
= num_sam_entries
;
1388 r_u
->num_entries4
= num_sam_entries
;
1390 r_u
->ptr_entries1
= 0;
1391 r_u
->num_entries2
= num_sam_entries
;
1392 r_u
->ptr_entries2
= 1;
1396 /*******************************************************************
1397 reads or writes a structure.
1398 ********************************************************************/
1400 BOOL
samr_io_r_enum_dom_users(const char *desc
, SAMR_R_ENUM_DOM_USERS
* r_u
,
1401 prs_struct
*ps
, int depth
)
1408 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_users");
1414 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
1416 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
1419 if (r_u
->ptr_entries1
!= 0) {
1420 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
1422 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
1424 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
1427 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
!= 0)) {
1428 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
, r_u
->num_entries2
);
1429 r_u
->uni_acct_name
= PRS_ALLOC_MEM(ps
,UNISTR2
, r_u
->num_entries2
);
1432 if ((r_u
->sam
== NULL
|| r_u
->uni_acct_name
== NULL
) && r_u
->num_entries2
!= 0) {
1433 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
1434 r_u
->num_entries4
= 0;
1435 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
1439 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1440 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
1444 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1445 if(!smb_io_unistr2("", &r_u
->uni_acct_name
[i
],r_u
->sam
[i
].hdr_name
.buffer
, ps
,depth
))
1454 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
1456 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
1462 /*******************************************************************
1463 inits a SAMR_Q_QUERY_DISPINFO structure.
1464 ********************************************************************/
1466 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO
* q_e
, POLICY_HND
*pol
,
1467 uint16 switch_level
, uint32 start_idx
,
1468 uint32 max_entries
, uint32 max_size
)
1470 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
1472 q_e
->domain_pol
= *pol
;
1474 q_e
->switch_level
= switch_level
;
1476 q_e
->start_idx
= start_idx
;
1477 q_e
->max_entries
= max_entries
;
1478 q_e
->max_size
= max_size
;
1481 /*******************************************************************
1482 reads or writes a structure.
1483 ********************************************************************/
1485 BOOL
samr_io_q_query_dispinfo(const char *desc
, SAMR_Q_QUERY_DISPINFO
* q_e
,
1486 prs_struct
*ps
, int depth
)
1491 prs_debug(ps
, depth
, desc
, "samr_io_q_query_dispinfo");
1497 if(!smb_io_pol_hnd("domain_pol", &q_e
->domain_pol
, ps
, depth
))
1500 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
1505 if(!prs_uint32("start_idx ", ps
, depth
, &q_e
->start_idx
))
1507 if(!prs_uint32("max_entries ", ps
, depth
, &q_e
->max_entries
))
1509 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1515 /*******************************************************************
1516 inits a SAM_DISPINFO_1 structure.
1517 ********************************************************************/
1519 NTSTATUS
init_sam_dispinfo_1(TALLOC_CTX
*ctx
, SAM_DISPINFO_1
**sam
,
1520 uint32 num_entries
, uint32 start_idx
,
1521 struct samr_displayentry
*entries
)
1525 DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries
));
1528 return NT_STATUS_OK
;
1530 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_1
, num_entries
);
1532 return NT_STATUS_NO_MEMORY
;
1534 (*sam
)->sam
=TALLOC_ARRAY(ctx
, SAM_ENTRY1
, num_entries
);
1535 if ((*sam
)->sam
== NULL
)
1536 return NT_STATUS_NO_MEMORY
;
1538 (*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR1
, num_entries
);
1539 if ((*sam
)->str
== NULL
)
1540 return NT_STATUS_NO_MEMORY
;
1542 for (i
= 0; i
< num_entries
; i
++) {
1543 init_unistr2(&(*sam
)->str
[i
].uni_acct_name
,
1544 entries
[i
].account_name
, UNI_FLAGS_NONE
);
1545 init_unistr2(&(*sam
)->str
[i
].uni_full_name
,
1546 entries
[i
].fullname
, UNI_FLAGS_NONE
);
1547 init_unistr2(&(*sam
)->str
[i
].uni_acct_desc
,
1548 entries
[i
].description
, UNI_FLAGS_NONE
);
1550 init_sam_entry1(&(*sam
)->sam
[i
], start_idx
+i
+1,
1551 &(*sam
)->str
[i
].uni_acct_name
,
1552 &(*sam
)->str
[i
].uni_full_name
,
1553 &(*sam
)->str
[i
].uni_acct_desc
,
1554 entries
[i
].rid
, entries
[i
].acct_flags
);
1557 return NT_STATUS_OK
;
1560 /*******************************************************************
1561 reads or writes a structure.
1562 ********************************************************************/
1564 static BOOL
sam_io_sam_dispinfo_1(const char *desc
, SAM_DISPINFO_1
* sam
,
1566 prs_struct
*ps
, int depth
)
1570 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_1");
1576 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1578 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY1
, num_entries
)) == NULL
) {
1579 DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
1583 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR1
, num_entries
)) == NULL
) {
1584 DEBUG(0, ("out of memory allocating SAM_STR1\n"));
1589 for (i
= 0; i
< num_entries
; i
++) {
1590 if(!sam_io_sam_entry1("", &sam
->sam
[i
], ps
, depth
))
1594 for (i
= 0; i
< num_entries
; i
++) {
1595 if(!sam_io_sam_str1("", &sam
->str
[i
],
1596 sam
->sam
[i
].hdr_acct_name
.buffer
,
1597 sam
->sam
[i
].hdr_user_name
.buffer
,
1598 sam
->sam
[i
].hdr_user_desc
.buffer
, ps
, depth
))
1605 /*******************************************************************
1606 inits a SAM_DISPINFO_2 structure.
1607 ********************************************************************/
1609 NTSTATUS
init_sam_dispinfo_2(TALLOC_CTX
*ctx
, SAM_DISPINFO_2
**sam
,
1610 uint32 num_entries
, uint32 start_idx
,
1611 struct samr_displayentry
*entries
)
1615 DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries
));
1618 return NT_STATUS_OK
;
1620 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_2
, num_entries
);
1622 return NT_STATUS_NO_MEMORY
;
1624 (*sam
)->sam
= TALLOC_ARRAY(ctx
, SAM_ENTRY2
, num_entries
);
1625 if ((*sam
)->sam
== NULL
)
1626 return NT_STATUS_NO_MEMORY
;
1628 (*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR2
, num_entries
);
1629 if ((*sam
)->str
== NULL
)
1630 return NT_STATUS_NO_MEMORY
;
1632 for (i
= 0; i
< num_entries
; i
++) {
1633 init_unistr2(&(*sam
)->str
[i
].uni_srv_name
,
1634 entries
[i
].account_name
, UNI_FLAGS_NONE
);
1635 init_unistr2(&(*sam
)->str
[i
].uni_srv_desc
,
1636 entries
[i
].description
, UNI_FLAGS_NONE
);
1638 init_sam_entry2(&(*sam
)->sam
[i
], start_idx
+ i
+ 1,
1639 &(*sam
)->str
[i
].uni_srv_name
,
1640 &(*sam
)->str
[i
].uni_srv_desc
,
1641 entries
[i
].rid
, entries
[i
].acct_flags
);
1644 return NT_STATUS_OK
;
1647 /*******************************************************************
1648 reads or writes a structure.
1649 ********************************************************************/
1651 static BOOL
sam_io_sam_dispinfo_2(const char *desc
, SAM_DISPINFO_2
* sam
,
1653 prs_struct
*ps
, int depth
)
1660 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_2");
1666 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1668 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY2
, num_entries
)) == NULL
) {
1669 DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
1673 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR2
, num_entries
)) == NULL
) {
1674 DEBUG(0, ("out of memory allocating SAM_STR2\n"));
1679 for (i
= 0; i
< num_entries
; i
++) {
1680 if(!sam_io_sam_entry2("", &sam
->sam
[i
], ps
, depth
))
1684 for (i
= 0; i
< num_entries
; i
++) {
1685 if(!sam_io_sam_str2("", &sam
->str
[i
],
1686 sam
->sam
[i
].hdr_srv_name
.buffer
,
1687 sam
->sam
[i
].hdr_srv_desc
.buffer
, ps
, depth
))
1694 /*******************************************************************
1695 inits a SAM_DISPINFO_3 structure.
1696 ********************************************************************/
1698 NTSTATUS
init_sam_dispinfo_3(TALLOC_CTX
*ctx
, SAM_DISPINFO_3
**sam
,
1699 uint32 num_entries
, uint32 start_idx
,
1700 struct samr_displayentry
*entries
)
1704 DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries
));
1707 return NT_STATUS_OK
;
1709 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_3
, num_entries
);
1711 return NT_STATUS_NO_MEMORY
;
1713 if (!((*sam
)->sam
=TALLOC_ARRAY(ctx
, SAM_ENTRY3
, num_entries
)))
1714 return NT_STATUS_NO_MEMORY
;
1716 if (!((*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR3
, num_entries
)))
1717 return NT_STATUS_NO_MEMORY
;
1719 for (i
= 0; i
< num_entries
; i
++) {
1720 DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i
));
1722 init_unistr2(&(*sam
)->str
[i
].uni_grp_name
,
1723 entries
[i
].account_name
, UNI_FLAGS_NONE
);
1724 init_unistr2(&(*sam
)->str
[i
].uni_grp_desc
,
1725 entries
[i
].description
, UNI_FLAGS_NONE
);
1727 init_sam_entry3(&(*sam
)->sam
[i
], start_idx
+i
+1,
1728 &(*sam
)->str
[i
].uni_grp_name
,
1729 &(*sam
)->str
[i
].uni_grp_desc
,
1733 return NT_STATUS_OK
;
1736 /*******************************************************************
1737 reads or writes a structure.
1738 ********************************************************************/
1740 static BOOL
sam_io_sam_dispinfo_3(const char *desc
, SAM_DISPINFO_3
* sam
,
1742 prs_struct
*ps
, int depth
)
1749 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_3");
1755 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1757 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY3
, num_entries
)) == NULL
) {
1758 DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
1762 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR3
, num_entries
)) == NULL
) {
1763 DEBUG(0, ("out of memory allocating SAM_STR3\n"));
1768 for (i
= 0; i
< num_entries
; i
++) {
1769 if(!sam_io_sam_entry3("", &sam
->sam
[i
], ps
, depth
))
1773 for (i
= 0; i
< num_entries
; i
++) {
1774 if(!sam_io_sam_str3("", &sam
->str
[i
],
1775 sam
->sam
[i
].hdr_grp_name
.buffer
,
1776 sam
->sam
[i
].hdr_grp_desc
.buffer
, ps
, depth
))
1783 /*******************************************************************
1784 inits a SAM_DISPINFO_4 structure.
1785 ********************************************************************/
1787 NTSTATUS
init_sam_dispinfo_4(TALLOC_CTX
*ctx
, SAM_DISPINFO_4
**sam
,
1788 uint32 num_entries
, uint32 start_idx
,
1789 struct samr_displayentry
*entries
)
1793 DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries
));
1796 return NT_STATUS_OK
;
1798 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_4
, num_entries
);
1800 return NT_STATUS_NO_MEMORY
;
1802 (*sam
)->sam
= TALLOC_ARRAY(ctx
, SAM_ENTRY4
, num_entries
);
1803 if ((*sam
)->sam
== NULL
)
1804 return NT_STATUS_NO_MEMORY
;
1806 (*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR4
, num_entries
);
1807 if ((*sam
)->str
== NULL
)
1808 return NT_STATUS_NO_MEMORY
;
1810 for (i
= 0; i
< num_entries
; i
++) {
1811 size_t len_sam_name
= strlen(entries
[i
].account_name
);
1813 DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i
));
1815 init_sam_entry4(&(*sam
)->sam
[i
], start_idx
+ i
+ 1,
1818 init_string2(&(*sam
)->str
[i
].acct_name
,
1819 entries
[i
].account_name
, len_sam_name
+1,
1823 return NT_STATUS_OK
;
1826 /*******************************************************************
1827 reads or writes a structure.
1828 ********************************************************************/
1830 static BOOL
sam_io_sam_dispinfo_4(const char *desc
, SAM_DISPINFO_4
* sam
,
1832 prs_struct
*ps
, int depth
)
1839 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_4");
1845 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1847 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY4
, num_entries
)) == NULL
) {
1848 DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
1852 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR4
, num_entries
)) == NULL
) {
1853 DEBUG(0, ("out of memory allocating SAM_STR4\n"));
1858 for (i
= 0; i
< num_entries
; i
++) {
1859 if(!sam_io_sam_entry4("", &sam
->sam
[i
], ps
, depth
))
1863 for (i
= 0; i
< num_entries
; i
++) {
1864 if(!smb_io_string2("acct_name", &sam
->str
[i
].acct_name
,
1865 sam
->sam
[i
].hdr_acct_name
.buffer
, ps
, depth
))
1872 /*******************************************************************
1873 inits a SAM_DISPINFO_5 structure.
1874 ********************************************************************/
1876 NTSTATUS
init_sam_dispinfo_5(TALLOC_CTX
*ctx
, SAM_DISPINFO_5
**sam
,
1877 uint32 num_entries
, uint32 start_idx
,
1878 struct samr_displayentry
*entries
)
1880 uint32 len_sam_name
;
1883 DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries
));
1886 return NT_STATUS_OK
;
1888 *sam
= TALLOC_ZERO_ARRAY(ctx
, SAM_DISPINFO_5
, num_entries
);
1890 return NT_STATUS_NO_MEMORY
;
1892 if (!((*sam
)->sam
=TALLOC_ARRAY(ctx
, SAM_ENTRY5
, num_entries
)))
1893 return NT_STATUS_NO_MEMORY
;
1895 if (!((*sam
)->str
=TALLOC_ARRAY(ctx
, SAM_STR5
, num_entries
)))
1896 return NT_STATUS_NO_MEMORY
;
1898 for (i
= 0; i
< num_entries
; i
++) {
1899 DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i
));
1901 len_sam_name
= strlen(entries
[i
].account_name
);
1903 init_sam_entry5(&(*sam
)->sam
[i
], start_idx
+i
+1, len_sam_name
);
1904 init_string2(&(*sam
)->str
[i
].grp_name
, entries
[i
].account_name
,
1905 len_sam_name
+1, len_sam_name
);
1908 return NT_STATUS_OK
;
1911 /*******************************************************************
1912 reads or writes a structure.
1913 ********************************************************************/
1915 static BOOL
sam_io_sam_dispinfo_5(const char *desc
, SAM_DISPINFO_5
* sam
,
1917 prs_struct
*ps
, int depth
)
1924 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_5");
1930 if (UNMARSHALLING(ps
) && num_entries
> 0) {
1932 if ((sam
->sam
= PRS_ALLOC_MEM(ps
, SAM_ENTRY5
, num_entries
)) == NULL
) {
1933 DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
1937 if ((sam
->str
= PRS_ALLOC_MEM(ps
, SAM_STR5
, num_entries
)) == NULL
) {
1938 DEBUG(0, ("out of memory allocating SAM_STR5\n"));
1943 for (i
= 0; i
< num_entries
; i
++) {
1944 if(!sam_io_sam_entry5("", &sam
->sam
[i
], ps
, depth
))
1948 for (i
= 0; i
< num_entries
; i
++) {
1949 if(!smb_io_string2("grp_name", &sam
->str
[i
].grp_name
,
1950 sam
->sam
[i
].hdr_grp_name
.buffer
, ps
, depth
))
1957 /*******************************************************************
1958 inits a SAMR_R_QUERY_DISPINFO structure.
1959 ********************************************************************/
1961 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO
* r_u
,
1962 uint32 num_entries
, uint32 total_size
, uint32 data_size
,
1963 uint16 switch_level
, SAM_DISPINFO_CTR
* ctr
,
1966 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level
));
1968 r_u
->total_size
= total_size
;
1970 r_u
->data_size
= data_size
;
1972 r_u
->switch_level
= switch_level
;
1973 r_u
->num_entries
= num_entries
;
1976 r_u
->ptr_entries
= 0;
1978 r_u
->ptr_entries
= 1;
1980 r_u
->num_entries2
= num_entries
;
1983 r_u
->status
= status
;
1986 /*******************************************************************
1987 reads or writes a structure.
1988 ********************************************************************/
1990 BOOL
samr_io_r_query_dispinfo(const char *desc
, SAMR_R_QUERY_DISPINFO
* r_u
,
1991 prs_struct
*ps
, int depth
)
1996 prs_debug(ps
, depth
, desc
, "samr_io_r_query_dispinfo");
2002 if(!prs_uint32("total_size ", ps
, depth
, &r_u
->total_size
))
2004 if(!prs_uint32("data_size ", ps
, depth
, &r_u
->data_size
))
2006 if(!prs_uint16("switch_level", ps
, depth
, &r_u
->switch_level
))
2011 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2013 if(!prs_uint32("ptr_entries ", ps
, depth
, &r_u
->ptr_entries
))
2016 if (r_u
->ptr_entries
==0) {
2019 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2025 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
2028 switch (r_u
->switch_level
) {
2030 if(!sam_io_sam_dispinfo_1("users", r_u
->ctr
->sam
.info1
,
2031 r_u
->num_entries
, ps
, depth
))
2035 if(!sam_io_sam_dispinfo_2("servers", r_u
->ctr
->sam
.info2
,
2036 r_u
->num_entries
, ps
, depth
))
2040 if(!sam_io_sam_dispinfo_3("groups", r_u
->ctr
->sam
.info3
,
2041 r_u
->num_entries
, ps
, depth
))
2045 if(!sam_io_sam_dispinfo_4("user list",
2046 r_u
->ctr
->sam
.info4
,
2047 r_u
->num_entries
, ps
, depth
))
2051 if(!sam_io_sam_dispinfo_5("group list",
2052 r_u
->ctr
->sam
.info5
,
2053 r_u
->num_entries
, ps
, depth
))
2057 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
2063 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2069 /*******************************************************************
2070 inits a SAMR_Q_OPEN_GROUP structure.
2071 ********************************************************************/
2073 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP
* q_c
,
2075 uint32 access_mask
, uint32 rid
)
2077 DEBUG(5, ("init_samr_q_open_group\n"));
2079 q_c
->domain_pol
= *hnd
;
2080 q_c
->access_mask
= access_mask
;
2081 q_c
->rid_group
= rid
;
2084 /*******************************************************************
2085 reads or writes a structure.
2086 ********************************************************************/
2088 BOOL
samr_io_q_open_group(const char *desc
, SAMR_Q_OPEN_GROUP
* q_u
,
2089 prs_struct
*ps
, int depth
)
2094 prs_debug(ps
, depth
, desc
, "samr_io_q_open_group");
2100 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
2103 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
2105 if(!prs_uint32("rid_group", ps
, depth
, &q_u
->rid_group
))
2111 /*******************************************************************
2112 reads or writes a structure.
2113 ********************************************************************/
2115 BOOL
samr_io_r_open_group(const char *desc
, SAMR_R_OPEN_GROUP
* r_u
,
2116 prs_struct
*ps
, int depth
)
2121 prs_debug(ps
, depth
, desc
, "samr_io_r_open_group");
2127 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2130 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2136 /*******************************************************************
2137 inits a GROUP_INFO1 structure.
2138 ********************************************************************/
2140 void init_samr_group_info1(GROUP_INFO1
* gr1
,
2141 char *acct_name
, char *acct_desc
,
2144 DEBUG(5, ("init_samr_group_info1\n"));
2146 gr1
->unknown_1
= 0x3;
2147 gr1
->num_members
= num_members
;
2149 init_unistr2(&gr1
->uni_acct_name
, acct_name
, UNI_FLAGS_NONE
);
2150 init_uni_hdr(&gr1
->hdr_acct_name
, &gr1
->uni_acct_name
);
2151 init_unistr2(&gr1
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
2152 init_uni_hdr(&gr1
->hdr_acct_desc
, &gr1
->uni_acct_desc
);
2155 /*******************************************************************
2156 reads or writes a structure.
2157 ********************************************************************/
2159 BOOL
samr_io_group_info1(const char *desc
, GROUP_INFO1
* gr1
,
2160 prs_struct
*ps
, int depth
)
2167 prs_debug(ps
, depth
, desc
, "samr_io_group_info1");
2170 if(!prs_uint16("level", ps
, depth
, &dummy
))
2176 if(!smb_io_unihdr("hdr_acct_name", &gr1
->hdr_acct_name
, ps
, depth
))
2179 if(!prs_uint32("unknown_1", ps
, depth
, &gr1
->unknown_1
))
2181 if(!prs_uint32("num_members", ps
, depth
, &gr1
->num_members
))
2184 if(!smb_io_unihdr("hdr_acct_desc", &gr1
->hdr_acct_desc
, ps
, depth
))
2187 if(!smb_io_unistr2("uni_acct_name", &gr1
->uni_acct_name
,
2188 gr1
->hdr_acct_name
.buffer
, ps
, depth
))
2191 if(!smb_io_unistr2("uni_acct_desc", &gr1
->uni_acct_desc
,
2192 gr1
->hdr_acct_desc
.buffer
, ps
, depth
))
2198 /*******************************************************************
2199 inits a GROUP_INFO2 structure.
2200 ********************************************************************/
2202 void init_samr_group_info2(GROUP_INFO2
* gr2
, const char *acct_name
)
2204 DEBUG(5, ("init_samr_group_info2\n"));
2207 init_unistr2(&gr2
->uni_acct_name
, acct_name
, UNI_FLAGS_NONE
);
2208 init_uni_hdr(&gr2
->hdr_acct_name
, &gr2
->uni_acct_name
);
2211 /*******************************************************************
2212 reads or writes a structure.
2213 ********************************************************************/
2215 BOOL
samr_io_group_info2(const char *desc
, GROUP_INFO2
*gr2
, prs_struct
*ps
, int depth
)
2220 prs_debug(ps
, depth
, desc
, "samr_io_group_info2");
2223 if(!prs_uint16("hdr_level", ps
, depth
, &gr2
->level
))
2226 if(!smb_io_unihdr("hdr_acct_name", &gr2
->hdr_acct_name
, ps
, depth
))
2228 if(!smb_io_unistr2("uni_acct_name", &gr2
->uni_acct_name
,
2229 gr2
->hdr_acct_name
.buffer
, ps
, depth
))
2235 /*******************************************************************
2236 inits a GROUP_INFO3 structure.
2237 ********************************************************************/
2239 void init_samr_group_info3(GROUP_INFO3
*gr3
)
2241 DEBUG(5, ("init_samr_group_info3\n"));
2243 gr3
->unknown_1
= 0x3;
2246 /*******************************************************************
2247 reads or writes a structure.
2248 ********************************************************************/
2250 BOOL
samr_io_group_info3(const char *desc
, GROUP_INFO3
*gr3
, prs_struct
*ps
, int depth
)
2255 prs_debug(ps
, depth
, desc
, "samr_io_group_info3");
2261 if(!prs_uint32("unknown_1", ps
, depth
, &gr3
->unknown_1
))
2267 /*******************************************************************
2268 inits a GROUP_INFO4 structure.
2269 ********************************************************************/
2271 void init_samr_group_info4(GROUP_INFO4
* gr4
, const char *acct_desc
)
2273 DEBUG(5, ("init_samr_group_info4\n"));
2276 init_unistr2(&gr4
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
2277 init_uni_hdr(&gr4
->hdr_acct_desc
, &gr4
->uni_acct_desc
);
2280 /*******************************************************************
2281 reads or writes a structure.
2282 ********************************************************************/
2284 BOOL
samr_io_group_info4(const char *desc
, GROUP_INFO4
* gr4
,
2285 prs_struct
*ps
, int depth
)
2290 prs_debug(ps
, depth
, desc
, "samr_io_group_info4");
2293 if(!prs_uint16("hdr_level", ps
, depth
, &gr4
->level
))
2295 if(!smb_io_unihdr("hdr_acct_desc", &gr4
->hdr_acct_desc
, ps
, depth
))
2297 if(!smb_io_unistr2("uni_acct_desc", &gr4
->uni_acct_desc
,
2298 gr4
->hdr_acct_desc
.buffer
, ps
, depth
))
2304 /*******************************************************************
2305 reads or writes a structure.
2306 ********************************************************************/
2308 static BOOL
samr_group_info_ctr(const char *desc
, GROUP_INFO_CTR
**ctr
,
2309 prs_struct
*ps
, int depth
)
2311 if (UNMARSHALLING(ps
))
2312 *ctr
= PRS_ALLOC_MEM(ps
,GROUP_INFO_CTR
,1);
2317 prs_debug(ps
, depth
, desc
, "samr_group_info_ctr");
2320 if(!prs_uint16("switch_value1", ps
, depth
, &(*ctr
)->switch_value1
))
2323 switch ((*ctr
)->switch_value1
) {
2325 if(!samr_io_group_info1("group_info1", &(*ctr
)->group
.info1
, ps
, depth
))
2329 if(!samr_io_group_info2("group_info2", &(*ctr
)->group
.info2
, ps
, depth
))
2333 if(!samr_io_group_info3("group_info3", &(*ctr
)->group
.info3
, ps
, depth
))
2337 if(!samr_io_group_info4("group_info4", &(*ctr
)->group
.info4
, ps
, depth
))
2341 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2348 /*******************************************************************
2349 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2350 ********************************************************************/
2352 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2353 POLICY_HND
*pol
, const char *acct_desc
,
2356 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2360 init_unistr2(&q_e
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
2361 init_uni_hdr(&q_e
->hdr_acct_desc
, &q_e
->uni_acct_desc
);
2363 q_e
->access_mask
= access_mask
;
2366 /*******************************************************************
2367 reads or writes a structure.
2368 ********************************************************************/
2370 BOOL
samr_io_q_create_dom_group(const char *desc
, SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2371 prs_struct
*ps
, int depth
)
2376 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_group");
2382 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2385 if(!smb_io_unihdr("hdr_acct_desc", &q_e
->hdr_acct_desc
, ps
, depth
))
2387 if(!smb_io_unistr2("uni_acct_desc", &q_e
->uni_acct_desc
,
2388 q_e
->hdr_acct_desc
.buffer
, ps
, depth
))
2393 if(!prs_uint32("access", ps
, depth
, &q_e
->access_mask
))
2399 /*******************************************************************
2400 reads or writes a structure.
2401 ********************************************************************/
2403 BOOL
samr_io_r_create_dom_group(const char *desc
, SAMR_R_CREATE_DOM_GROUP
* r_u
,
2404 prs_struct
*ps
, int depth
)
2409 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_group");
2415 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2418 if(!prs_uint32("rid ", ps
, depth
, &r_u
->rid
))
2420 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2426 /*******************************************************************
2427 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2428 ********************************************************************/
2430 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP
* q_c
,
2433 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2435 q_c
->group_pol
= *hnd
;
2438 /*******************************************************************
2439 reads or writes a structure.
2440 ********************************************************************/
2442 BOOL
samr_io_q_delete_dom_group(const char *desc
, SAMR_Q_DELETE_DOM_GROUP
* q_u
,
2443 prs_struct
*ps
, int depth
)
2448 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_group");
2454 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2460 /*******************************************************************
2461 reads or writes a structure.
2462 ********************************************************************/
2464 BOOL
samr_io_r_delete_dom_group(const char *desc
, SAMR_R_DELETE_DOM_GROUP
* r_u
,
2465 prs_struct
*ps
, int depth
)
2470 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_group");
2476 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2479 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2485 /*******************************************************************
2486 inits a SAMR_Q_DEL_GROUPMEM structure.
2487 ********************************************************************/
2489 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM
* q_e
,
2490 POLICY_HND
*pol
, uint32 rid
)
2492 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2498 /*******************************************************************
2499 reads or writes a structure.
2500 ********************************************************************/
2502 BOOL
samr_io_q_del_groupmem(const char *desc
, SAMR_Q_DEL_GROUPMEM
* q_e
,
2503 prs_struct
*ps
, int depth
)
2508 prs_debug(ps
, depth
, desc
, "samr_io_q_del_groupmem");
2514 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2517 if(!prs_uint32("rid", ps
, depth
, &q_e
->rid
))
2523 /*******************************************************************
2524 inits a SAMR_R_DEL_GROUPMEM structure.
2525 ********************************************************************/
2527 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2530 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2532 r_u
->status
= status
;
2535 /*******************************************************************
2536 reads or writes a structure.
2537 ********************************************************************/
2539 BOOL
samr_io_r_del_groupmem(const char *desc
, SAMR_R_DEL_GROUPMEM
* r_u
,
2540 prs_struct
*ps
, int depth
)
2545 prs_debug(ps
, depth
, desc
, "samr_io_r_del_groupmem");
2551 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2557 /*******************************************************************
2558 inits a SAMR_Q_ADD_GROUPMEM structure.
2559 ********************************************************************/
2561 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM
* q_e
,
2562 POLICY_HND
*pol
, uint32 rid
)
2564 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2568 q_e
->unknown
= 0x0005;
2571 /*******************************************************************
2572 reads or writes a structure.
2573 ********************************************************************/
2575 BOOL
samr_io_q_add_groupmem(const char *desc
, SAMR_Q_ADD_GROUPMEM
* q_e
,
2576 prs_struct
*ps
, int depth
)
2581 prs_debug(ps
, depth
, desc
, "samr_io_q_add_groupmem");
2587 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2590 if(!prs_uint32("rid ", ps
, depth
, &q_e
->rid
))
2592 if(!prs_uint32("unknown", ps
, depth
, &q_e
->unknown
))
2598 /*******************************************************************
2599 inits a SAMR_R_ADD_GROUPMEM structure.
2600 ********************************************************************/
2602 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2605 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2607 r_u
->status
= status
;
2610 /*******************************************************************
2611 reads or writes a structure.
2612 ********************************************************************/
2614 BOOL
samr_io_r_add_groupmem(const char *desc
, SAMR_R_ADD_GROUPMEM
* r_u
,
2615 prs_struct
*ps
, int depth
)
2620 prs_debug(ps
, depth
, desc
, "samr_io_r_add_groupmem");
2626 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2632 /*******************************************************************
2633 inits a SAMR_Q_SET_GROUPINFO structure.
2634 ********************************************************************/
2636 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO
* q_e
,
2637 POLICY_HND
*pol
, GROUP_INFO_CTR
* ctr
)
2639 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2645 /*******************************************************************
2646 reads or writes a structure.
2647 ********************************************************************/
2649 BOOL
samr_io_q_set_groupinfo(const char *desc
, SAMR_Q_SET_GROUPINFO
* q_e
,
2650 prs_struct
*ps
, int depth
)
2655 prs_debug(ps
, depth
, desc
, "samr_io_q_set_groupinfo");
2661 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2664 if(!samr_group_info_ctr("ctr", &q_e
->ctr
, ps
, depth
))
2670 /*******************************************************************
2671 inits a SAMR_R_SET_GROUPINFO structure.
2672 ********************************************************************/
2674 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO
* r_u
, NTSTATUS status
)
2676 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2678 r_u
->status
= status
;
2681 /*******************************************************************
2682 reads or writes a structure.
2683 ********************************************************************/
2685 BOOL
samr_io_r_set_groupinfo(const char *desc
, SAMR_R_SET_GROUPINFO
* r_u
,
2686 prs_struct
*ps
, int depth
)
2691 prs_debug(ps
, depth
, desc
, "samr_io_r_set_groupinfo");
2697 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2703 /*******************************************************************
2704 inits a SAMR_Q_QUERY_GROUPINFO structure.
2705 ********************************************************************/
2707 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO
* q_e
,
2708 POLICY_HND
*pol
, uint16 switch_level
)
2710 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2714 q_e
->switch_level
= switch_level
;
2717 /*******************************************************************
2718 reads or writes a structure.
2719 ********************************************************************/
2721 BOOL
samr_io_q_query_groupinfo(const char *desc
, SAMR_Q_QUERY_GROUPINFO
* q_e
,
2722 prs_struct
*ps
, int depth
)
2727 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupinfo");
2733 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2736 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
2742 /*******************************************************************
2743 inits a SAMR_R_QUERY_GROUPINFO structure.
2744 ********************************************************************/
2746 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO
* r_u
,
2747 GROUP_INFO_CTR
* ctr
, NTSTATUS status
)
2749 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2751 r_u
->ptr
= (NT_STATUS_IS_OK(status
) && ctr
!= NULL
) ? 1 : 0;
2753 r_u
->status
= status
;
2756 /*******************************************************************
2757 reads or writes a structure.
2758 ********************************************************************/
2760 BOOL
samr_io_r_query_groupinfo(const char *desc
, SAMR_R_QUERY_GROUPINFO
* r_u
,
2761 prs_struct
*ps
, int depth
)
2766 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupinfo");
2772 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2775 if (r_u
->ptr
!= 0) {
2776 if(!samr_group_info_ctr("ctr", &r_u
->ctr
, ps
, depth
))
2782 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2788 /*******************************************************************
2789 inits a SAMR_Q_QUERY_GROUPMEM structure.
2790 ********************************************************************/
2792 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM
* q_c
, POLICY_HND
*hnd
)
2794 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2796 q_c
->group_pol
= *hnd
;
2799 /*******************************************************************
2800 reads or writes a structure.
2801 ********************************************************************/
2803 BOOL
samr_io_q_query_groupmem(const char *desc
, SAMR_Q_QUERY_GROUPMEM
* q_u
,
2804 prs_struct
*ps
, int depth
)
2809 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupmem");
2815 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2821 /*******************************************************************
2822 inits a SAMR_R_QUERY_GROUPMEM structure.
2823 ********************************************************************/
2825 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM
* r_u
,
2826 uint32 num_entries
, uint32
*rid
,
2827 uint32
*attr
, NTSTATUS status
)
2829 DEBUG(5, ("init_samr_r_query_groupmem\n"));
2831 if (NT_STATUS_IS_OK(status
)) {
2833 r_u
->num_entries
= num_entries
;
2835 r_u
->ptr_attrs
= attr
!= NULL
? 1 : 0;
2836 r_u
->ptr_rids
= rid
!= NULL
? 1 : 0;
2838 r_u
->num_rids
= num_entries
;
2841 r_u
->num_attrs
= num_entries
;
2845 r_u
->num_entries
= 0;
2848 r_u
->status
= status
;
2851 /*******************************************************************
2852 reads or writes a structure.
2853 ********************************************************************/
2855 BOOL
samr_io_r_query_groupmem(const char *desc
, SAMR_R_QUERY_GROUPMEM
* r_u
,
2856 prs_struct
*ps
, int depth
)
2863 if (UNMARSHALLING(ps
))
2866 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupmem");
2872 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2874 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2877 if (r_u
->ptr
!= 0) {
2878 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
2880 if(!prs_uint32("ptr_attrs", ps
, depth
, &r_u
->ptr_attrs
))
2883 if (r_u
->ptr_rids
!= 0) {
2884 if(!prs_uint32("num_rids", ps
, depth
, &r_u
->num_rids
))
2886 if (UNMARSHALLING(ps
) && r_u
->num_rids
!= 0) {
2887 r_u
->rid
= PRS_ALLOC_MEM(ps
,uint32
,r_u
->num_rids
);
2888 if (r_u
->rid
== NULL
)
2892 for (i
= 0; i
< r_u
->num_rids
; i
++) {
2893 if(!prs_uint32("", ps
, depth
, &r_u
->rid
[i
]))
2898 if (r_u
->ptr_attrs
!= 0) {
2899 if(!prs_uint32("num_attrs", ps
, depth
, &r_u
->num_attrs
))
2902 if (UNMARSHALLING(ps
) && r_u
->num_attrs
!= 0) {
2903 r_u
->attr
= PRS_ALLOC_MEM(ps
,uint32
,r_u
->num_attrs
);
2904 if (r_u
->attr
== NULL
)
2908 for (i
= 0; i
< r_u
->num_attrs
; i
++) {
2909 if(!prs_uint32("", ps
, depth
, &r_u
->attr
[i
]))
2915 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
2921 /*******************************************************************
2922 inits a SAMR_Q_QUERY_USERGROUPS structure.
2923 ********************************************************************/
2925 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS
* q_u
,
2928 DEBUG(5, ("init_samr_q_query_usergroups\n"));
2933 /*******************************************************************
2934 reads or writes a structure.
2935 ********************************************************************/
2937 BOOL
samr_io_q_query_usergroups(const char *desc
, SAMR_Q_QUERY_USERGROUPS
* q_u
,
2938 prs_struct
*ps
, int depth
)
2943 prs_debug(ps
, depth
, desc
, "samr_io_q_query_usergroups");
2949 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
2955 /*******************************************************************
2956 inits a SAMR_R_QUERY_USERGROUPS structure.
2957 ********************************************************************/
2959 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS
* r_u
,
2960 uint32 num_gids
, DOM_GID
* gid
,
2963 DEBUG(5, ("init_samr_r_query_usergroups\n"));
2965 if (NT_STATUS_IS_OK(status
)) {
2967 r_u
->num_entries
= num_gids
;
2968 r_u
->ptr_1
= (num_gids
!= 0) ? 1 : 0;
2969 r_u
->num_entries2
= num_gids
;
2974 r_u
->num_entries
= 0;
2979 r_u
->status
= status
;
2982 /*******************************************************************
2983 reads or writes a structure.
2984 ********************************************************************/
2986 BOOL
samr_io_gids(const char *desc
, uint32
*num_gids
, DOM_GID
** gid
,
2987 prs_struct
*ps
, int depth
)
2993 prs_debug(ps
, depth
, desc
, "samr_io_gids");
2999 if(!prs_uint32("num_gids", ps
, depth
, num_gids
))
3002 if ((*num_gids
) != 0) {
3003 if (UNMARSHALLING(ps
)) {
3004 (*gid
) = PRS_ALLOC_MEM(ps
,DOM_GID
,*num_gids
);
3007 if ((*gid
) == NULL
) {
3011 for (i
= 0; i
< (*num_gids
); i
++) {
3012 if(!smb_io_gid("gids", &(*gid
)[i
], ps
, depth
))
3020 /*******************************************************************
3021 reads or writes a structure.
3022 ********************************************************************/
3024 BOOL
samr_io_r_query_usergroups(const char *desc
, SAMR_R_QUERY_USERGROUPS
* r_u
,
3025 prs_struct
*ps
, int depth
)
3030 prs_debug(ps
, depth
, desc
, "samr_io_r_query_usergroups");
3036 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
3039 if (r_u
->ptr_0
!= 0) {
3040 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
3042 if(!prs_uint32("ptr_1 ", ps
, depth
, &r_u
->ptr_1
))
3045 if (r_u
->num_entries
!= 0 && r_u
->ptr_1
!= 0) {
3046 if(!samr_io_gids("gids", &r_u
->num_entries2
, &r_u
->gid
, ps
, depth
))
3053 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3059 /*******************************************************************
3060 inits a SAMR_Q_ENUM_DOMAINS structure.
3061 ********************************************************************/
3063 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS
* q_e
,
3065 uint32 start_idx
, uint32 size
)
3067 DEBUG(5, ("init_samr_q_enum_domains\n"));
3071 q_e
->start_idx
= start_idx
;
3072 q_e
->max_size
= size
;
3075 /*******************************************************************
3076 reads or writes a structure.
3077 ********************************************************************/
3079 BOOL
samr_io_q_enum_domains(const char *desc
, SAMR_Q_ENUM_DOMAINS
* q_e
,
3080 prs_struct
*ps
, int depth
)
3085 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_domains");
3091 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3094 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3096 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3102 /*******************************************************************
3103 inits a SAMR_R_ENUM_DOMAINS structure.
3104 ********************************************************************/
3106 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS
* r_u
,
3107 uint32 next_idx
, uint32 num_sam_entries
)
3109 DEBUG(5, ("init_samr_r_enum_domains\n"));
3111 r_u
->next_idx
= next_idx
;
3113 if (num_sam_entries
!= 0) {
3114 r_u
->ptr_entries1
= 1;
3115 r_u
->ptr_entries2
= 1;
3116 r_u
->num_entries2
= num_sam_entries
;
3117 r_u
->num_entries3
= num_sam_entries
;
3119 r_u
->num_entries4
= num_sam_entries
;
3121 r_u
->ptr_entries1
= 0;
3122 r_u
->num_entries2
= num_sam_entries
;
3123 r_u
->ptr_entries2
= 1;
3127 /*******************************************************************
3128 reads or writes a structure.
3129 ********************************************************************/
3131 BOOL
samr_io_r_enum_domains(const char *desc
, SAMR_R_ENUM_DOMAINS
* r_u
,
3132 prs_struct
*ps
, int depth
)
3139 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_domains");
3145 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3147 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3150 if (r_u
->ptr_entries1
!= 0) {
3151 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3153 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3155 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3158 if (UNMARSHALLING(ps
)) {
3159 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
,r_u
->num_entries2
);
3160 r_u
->uni_dom_name
= PRS_ALLOC_MEM(ps
,UNISTR2
,r_u
->num_entries2
);
3163 if ((r_u
->sam
== NULL
|| r_u
->uni_dom_name
== NULL
) && r_u
->num_entries2
!= 0) {
3164 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
3165 r_u
->num_entries4
= 0;
3166 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3170 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3172 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
3173 if(!sam_io_sam_entry(tmp
, &r_u
->sam
[i
], ps
, depth
))
3177 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3179 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
3180 if(!smb_io_unistr2(tmp
, &r_u
->uni_dom_name
[i
],
3181 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3190 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3192 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3198 /*******************************************************************
3199 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
3200 ********************************************************************/
3202 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
3204 uint32 start_idx
, uint32 size
)
3206 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
3210 q_e
->start_idx
= start_idx
;
3211 q_e
->max_size
= size
;
3214 /*******************************************************************
3215 reads or writes a structure.
3216 ********************************************************************/
3218 BOOL
samr_io_q_enum_dom_groups(const char *desc
, SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
3219 prs_struct
*ps
, int depth
)
3224 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_groups");
3230 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
3233 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3235 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3241 /*******************************************************************
3242 inits a SAMR_R_ENUM_DOM_GROUPS structure.
3243 ********************************************************************/
3245 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3246 uint32 next_idx
, uint32 num_sam_entries
)
3248 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
3250 r_u
->next_idx
= next_idx
;
3252 if (num_sam_entries
!= 0) {
3253 r_u
->ptr_entries1
= 1;
3254 r_u
->ptr_entries2
= 1;
3255 r_u
->num_entries2
= num_sam_entries
;
3256 r_u
->num_entries3
= num_sam_entries
;
3258 r_u
->num_entries4
= num_sam_entries
;
3260 r_u
->ptr_entries1
= 0;
3261 r_u
->num_entries2
= num_sam_entries
;
3262 r_u
->ptr_entries2
= 1;
3266 /*******************************************************************
3267 reads or writes a structure.
3268 ********************************************************************/
3270 BOOL
samr_io_r_enum_dom_groups(const char *desc
, SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3271 prs_struct
*ps
, int depth
)
3278 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_groups");
3284 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3286 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3289 if (r_u
->ptr_entries1
!= 0) {
3290 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3292 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3294 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3297 if (UNMARSHALLING(ps
)) {
3298 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
,r_u
->num_entries2
);
3299 r_u
->uni_grp_name
= PRS_ALLOC_MEM(ps
,UNISTR2
,r_u
->num_entries2
);
3302 if ((r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
) && r_u
->num_entries2
!= 0) {
3304 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3305 r_u
->num_entries4
= 0;
3306 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3310 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3311 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3315 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3316 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3317 r_u
->sam
[i
].hdr_name
.buffer
, ps
, depth
))
3324 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3326 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3332 /*******************************************************************
3333 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3334 ********************************************************************/
3336 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3337 POLICY_HND
*pol
, uint32 start_idx
,
3340 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3344 q_e
->start_idx
= start_idx
;
3345 q_e
->max_size
= size
;
3349 /*******************************************************************
3350 reads or writes a structure.
3351 ********************************************************************/
3353 BOOL
samr_io_q_enum_dom_aliases(const char *desc
, SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3354 prs_struct
*ps
, int depth
)
3359 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_aliases");
3365 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3368 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3370 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3376 /*******************************************************************
3377 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3378 ********************************************************************/
3380 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES
*r_u
, uint32 next_idx
, uint32 num_sam_entries
)
3382 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3384 r_u
->next_idx
= next_idx
;
3386 if (num_sam_entries
!= 0) {
3387 r_u
->ptr_entries1
= 1;
3388 r_u
->ptr_entries2
= 1;
3389 r_u
->num_entries2
= num_sam_entries
;
3390 r_u
->num_entries3
= num_sam_entries
;
3392 r_u
->num_entries4
= num_sam_entries
;
3394 r_u
->ptr_entries1
= 0;
3395 r_u
->num_entries2
= num_sam_entries
;
3396 r_u
->ptr_entries2
= 1;
3400 /*******************************************************************
3401 reads or writes a structure.
3402 ********************************************************************/
3404 BOOL
samr_io_r_enum_dom_aliases(const char *desc
, SAMR_R_ENUM_DOM_ALIASES
* r_u
,
3405 prs_struct
*ps
, int depth
)
3412 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_aliases");
3418 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3420 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3423 if (r_u
->ptr_entries1
!= 0) {
3424 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3426 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3428 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3431 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
> 0)) {
3432 r_u
->sam
= PRS_ALLOC_MEM(ps
,SAM_ENTRY
,r_u
->num_entries2
);
3433 r_u
->uni_grp_name
= PRS_ALLOC_MEM(ps
,UNISTR2
,r_u
->num_entries2
);
3436 if (r_u
->num_entries2
!= 0 &&
3437 (r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
)) {
3438 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3439 r_u
->num_entries4
= 0;
3440 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3444 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3445 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3449 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3450 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3451 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3459 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3461 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3467 /*******************************************************************
3468 inits a ALIAS_INFO1 structure.
3469 ********************************************************************/
3471 void init_samr_alias_info1(ALIAS_INFO1
* al1
, char *acct_name
, uint32 num_member
, char *acct_desc
)
3473 DEBUG(5, ("init_samr_alias_info1\n"));
3475 init_unistr4(&al1
->name
, acct_name
, UNI_FLAGS_NONE
);
3476 al1
->num_member
= num_member
;
3477 init_unistr4(&al1
->description
, acct_desc
, UNI_FLAGS_NONE
);
3480 /*******************************************************************
3481 reads or writes a structure.
3482 ********************************************************************/
3484 BOOL
samr_io_alias_info1(const char *desc
, ALIAS_INFO1
* al1
,
3485 prs_struct
*ps
, int depth
)
3490 prs_debug(ps
, depth
, desc
, "samr_io_alias_info1");
3496 if ( !prs_unistr4_hdr("name", ps
, depth
, &al1
->name
) )
3498 if ( !prs_uint32("num_member", ps
, depth
, &al1
->num_member
) )
3500 if ( !prs_unistr4_hdr("description", ps
, depth
, &al1
->description
) )
3503 if ( !prs_unistr4_str("name", ps
, depth
, &al1
->name
) )
3505 if ( !prs_align(ps
) )
3507 if ( !prs_unistr4_str("description", ps
, depth
, &al1
->description
) )
3509 if ( !prs_align(ps
) )
3515 /*******************************************************************
3516 inits a ALIAS_INFO3 structure.
3517 ********************************************************************/
3519 void init_samr_alias_info3(ALIAS_INFO3
* al3
, const char *acct_desc
)
3521 DEBUG(5, ("init_samr_alias_info3\n"));
3523 init_unistr4(&al3
->description
, acct_desc
, UNI_FLAGS_NONE
);
3526 /*******************************************************************
3527 reads or writes a structure.
3528 ********************************************************************/
3530 BOOL
samr_io_alias_info3(const char *desc
, ALIAS_INFO3
*al3
,
3531 prs_struct
*ps
, int depth
)
3536 prs_debug(ps
, depth
, desc
, "samr_io_alias_info3");
3542 if (!prs_unistr4("description", ps
, depth
, &al3
->description
))
3548 /*******************************************************************
3549 reads or writes a structure.
3550 ********************************************************************/
3552 BOOL
samr_alias_info_ctr(const char *desc
, prs_struct
*ps
, int depth
, ALIAS_INFO_CTR
* ctr
)
3557 prs_debug(ps
, depth
, desc
, "samr_alias_info_ctr");
3560 if ( !prs_uint16("level", ps
, depth
, &ctr
->level
) )
3565 switch (ctr
->level
) {
3567 if(!samr_io_alias_info1("alias_info1", &ctr
->alias
.info1
, ps
, depth
))
3571 if(!samr_io_alias_info3("alias_info3", &ctr
->alias
.info3
, ps
, depth
))
3575 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3582 /*******************************************************************
3583 inits a SAMR_Q_QUERY_ALIASINFO structure.
3584 ********************************************************************/
3586 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO
* q_e
,
3587 POLICY_HND
*pol
, uint32 switch_level
)
3589 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3592 q_e
->level
= switch_level
;
3595 /*******************************************************************
3596 reads or writes a structure.
3597 ********************************************************************/
3599 BOOL
samr_io_q_query_aliasinfo(const char *desc
, SAMR_Q_QUERY_ALIASINFO
*in
,
3600 prs_struct
*ps
, int depth
)
3605 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasinfo");
3611 if ( !smb_io_pol_hnd("pol", &(in
->pol
), ps
, depth
) )
3614 if ( !prs_uint16("level", ps
, depth
, &in
->level
) )
3620 /*******************************************************************
3621 inits a SAMR_R_QUERY_ALIASINFO structure.
3622 ********************************************************************/
3624 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO
*out
,
3625 ALIAS_INFO_CTR
* ctr
, NTSTATUS status
)
3627 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3630 out
->status
= status
;
3633 /*******************************************************************
3634 reads or writes a structure.
3635 ********************************************************************/
3637 BOOL
samr_io_r_query_aliasinfo(const char *desc
, SAMR_R_QUERY_ALIASINFO
*out
,
3638 prs_struct
*ps
, int depth
)
3643 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasinfo");
3649 if ( !prs_pointer("alias", ps
, depth
, (void**)&out
->ctr
, sizeof(ALIAS_INFO_CTR
), (PRS_POINTER_CAST
)samr_alias_info_ctr
))
3654 if(!prs_ntstatus("status", ps
, depth
, &out
->status
))
3660 /*******************************************************************
3661 inits a SAMR_Q_SET_ALIASINFO structure.
3662 ********************************************************************/
3664 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO
* q_u
,
3665 POLICY_HND
*hnd
, ALIAS_INFO_CTR
* ctr
)
3667 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3669 q_u
->alias_pol
= *hnd
;
3673 /*******************************************************************
3674 reads or writes a structure.
3675 ********************************************************************/
3677 BOOL
samr_io_q_set_aliasinfo(const char *desc
, SAMR_Q_SET_ALIASINFO
* q_u
,
3678 prs_struct
*ps
, int depth
)
3683 prs_debug(ps
, depth
, desc
, "samr_io_q_set_aliasinfo");
3689 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
3691 if(!samr_alias_info_ctr("ctr", ps
, depth
, &q_u
->ctr
))
3697 /*******************************************************************
3698 reads or writes a structure.
3699 ********************************************************************/
3701 BOOL
samr_io_r_set_aliasinfo(const char *desc
, SAMR_R_SET_ALIASINFO
* r_u
,
3702 prs_struct
*ps
, int depth
)
3707 prs_debug(ps
, depth
, desc
, "samr_io_r_set_aliasinfo");
3712 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3718 /*******************************************************************
3719 inits a SAMR_Q_QUERY_USERALIASES structure.
3720 ********************************************************************/
3722 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES
* q_u
,
3725 uint32
*ptr_sid
, DOM_SID2
* sid
)
3727 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3731 q_u
->num_sids1
= num_sids
;
3733 q_u
->num_sids2
= num_sids
;
3735 q_u
->ptr_sid
= ptr_sid
;
3739 /*******************************************************************
3740 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3741 ********************************************************************/
3743 BOOL
samr_io_q_query_useraliases(const char *desc
, SAMR_Q_QUERY_USERALIASES
* q_u
,
3744 prs_struct
*ps
, int depth
)
3752 prs_debug(ps
, depth
, desc
, "samr_io_q_query_useraliases");
3758 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3761 if(!prs_uint32("num_sids1", ps
, depth
, &q_u
->num_sids1
))
3763 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3769 if(!prs_uint32("num_sids2", ps
, depth
, &q_u
->num_sids2
))
3772 if (UNMARSHALLING(ps
) && (q_u
->num_sids2
!= 0)) {
3773 q_u
->ptr_sid
= PRS_ALLOC_MEM(ps
,uint32
,q_u
->num_sids2
);
3774 if (q_u
->ptr_sid
== NULL
)
3777 q_u
->sid
= PRS_ALLOC_MEM(ps
, DOM_SID2
, q_u
->num_sids2
);
3778 if (q_u
->sid
== NULL
)
3782 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3783 slprintf(tmp
, sizeof(tmp
) - 1, "ptr[%02d]", i
);
3784 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->ptr_sid
[i
]))
3788 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3789 if (q_u
->ptr_sid
[i
] != 0) {
3790 slprintf(tmp
, sizeof(tmp
) - 1, "sid[%02d]", i
);
3791 if(!smb_io_dom_sid2(tmp
, &q_u
->sid
[i
], ps
, depth
))
3799 /*******************************************************************
3800 inits a SAMR_R_QUERY_USERALIASES structure.
3801 ********************************************************************/
3803 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES
* r_u
,
3804 uint32 num_rids
, uint32
*rid
,
3807 DEBUG(5, ("init_samr_r_query_useraliases\n"));
3809 if (NT_STATUS_IS_OK(status
)) {
3810 r_u
->num_entries
= num_rids
;
3812 r_u
->num_entries2
= num_rids
;
3816 r_u
->num_entries
= 0;
3818 r_u
->num_entries2
= 0;
3821 r_u
->status
= status
;
3824 /*******************************************************************
3825 reads or writes a structure.
3826 ********************************************************************/
3828 BOOL
samr_io_rids(const char *desc
, uint32
*num_rids
, uint32
**rid
,
3829 prs_struct
*ps
, int depth
)
3836 prs_debug(ps
, depth
, desc
, "samr_io_rids");
3842 if(!prs_uint32("num_rids", ps
, depth
, num_rids
))
3845 if ((*num_rids
) != 0) {
3846 if (UNMARSHALLING(ps
)) {
3848 (*rid
) = PRS_ALLOC_MEM(ps
,uint32
, *num_rids
);
3853 for (i
= 0; i
< (*num_rids
); i
++) {
3854 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d]", i
);
3855 if(!prs_uint32(tmp
, ps
, depth
, &((*rid
)[i
])))
3863 /*******************************************************************
3864 reads or writes a structure.
3865 ********************************************************************/
3867 BOOL
samr_io_r_query_useraliases(const char *desc
, SAMR_R_QUERY_USERALIASES
* r_u
,
3868 prs_struct
*ps
, int depth
)
3873 prs_debug(ps
, depth
, desc
, "samr_io_r_query_useraliases");
3879 if(!prs_uint32("num_entries", ps
, depth
, &r_u
->num_entries
))
3881 if(!prs_uint32("ptr ", ps
, depth
, &r_u
->ptr
))
3884 if (r_u
->ptr
!= 0) {
3885 if(!samr_io_rids("rids", &r_u
->num_entries2
, &r_u
->rid
, ps
, depth
))
3891 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3897 /*******************************************************************
3898 inits a SAMR_Q_OPEN_ALIAS structure.
3899 ********************************************************************/
3901 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS
* q_u
, POLICY_HND
*pol
,
3902 uint32 access_mask
, uint32 rid
)
3904 DEBUG(5, ("init_samr_q_open_alias\n"));
3906 q_u
->dom_pol
= *pol
;
3907 q_u
->access_mask
= access_mask
;
3908 q_u
->rid_alias
= rid
;
3911 /*******************************************************************
3912 reads or writes a structure.
3913 ********************************************************************/
3915 BOOL
samr_io_q_open_alias(const char *desc
, SAMR_Q_OPEN_ALIAS
* q_u
,
3916 prs_struct
*ps
, int depth
)
3921 prs_debug(ps
, depth
, desc
, "samr_io_q_open_alias");
3927 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
3930 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
3932 if(!prs_uint32("rid_alias", ps
, depth
, &q_u
->rid_alias
))
3938 /*******************************************************************
3939 reads or writes a structure.
3940 ********************************************************************/
3942 BOOL
samr_io_r_open_alias(const char *desc
, SAMR_R_OPEN_ALIAS
* r_u
,
3943 prs_struct
*ps
, int depth
)
3948 prs_debug(ps
, depth
, desc
, "samr_io_r_open_alias");
3954 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
3957 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
3963 /*******************************************************************
3964 inits a SAMR_Q_LOOKUP_RIDS structure.
3965 ********************************************************************/
3967 void init_samr_q_lookup_rids(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_RIDS
* q_u
,
3968 POLICY_HND
*pol
, uint32 flags
,
3969 uint32 num_rids
, uint32
*rid
)
3971 DEBUG(5, ("init_samr_q_lookup_rids\n"));
3975 q_u
->num_rids1
= num_rids
;
3978 q_u
->num_rids2
= num_rids
;
3979 q_u
->rid
= TALLOC_ZERO_ARRAY(ctx
, uint32
, num_rids
);
3980 if (q_u
->rid
== NULL
) {
3984 memcpy(q_u
->rid
, rid
, num_rids
* sizeof(q_u
->rid
[0]));
3988 /*******************************************************************
3989 reads or writes a structure.
3990 ********************************************************************/
3992 BOOL
samr_io_q_lookup_rids(const char *desc
, SAMR_Q_LOOKUP_RIDS
* q_u
,
3993 prs_struct
*ps
, int depth
)
4001 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_rids");
4004 if (UNMARSHALLING(ps
))
4010 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4013 if(!prs_uint32("num_rids1", ps
, depth
, &q_u
->num_rids1
))
4015 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
4017 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
4019 if(!prs_uint32("num_rids2", ps
, depth
, &q_u
->num_rids2
))
4022 if (UNMARSHALLING(ps
) && (q_u
->num_rids2
!= 0)) {
4023 q_u
->rid
= PRS_ALLOC_MEM(ps
, uint32
, q_u
->num_rids2
);
4024 if (q_u
->rid
== NULL
)
4028 for (i
= 0; i
< q_u
->num_rids2
; i
++) {
4029 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
4030 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->rid
[i
]))
4037 /*******************************************************************
4038 inits a SAMR_R_LOOKUP_RIDS structure.
4039 ********************************************************************/
4041 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS
* r_u
,
4042 uint32 num_names
, UNIHDR
* hdr_name
,
4043 UNISTR2
*uni_name
, uint32
*type
)
4045 DEBUG(5, ("init_samr_r_lookup_rids\n"));
4047 r_u
->hdr_name
= NULL
;
4048 r_u
->uni_name
= NULL
;
4051 if (num_names
!= 0) {
4052 r_u
->num_names1
= num_names
;
4054 r_u
->num_names2
= num_names
;
4056 r_u
->num_types1
= num_names
;
4058 r_u
->num_types2
= num_names
;
4060 r_u
->hdr_name
= hdr_name
;
4061 r_u
->uni_name
= uni_name
;
4064 r_u
->num_names1
= num_names
;
4066 r_u
->num_names2
= num_names
;
4068 r_u
->num_types1
= num_names
;
4070 r_u
->num_types2
= num_names
;
4074 /*******************************************************************
4075 reads or writes a structure.
4076 ********************************************************************/
4078 BOOL
samr_io_r_lookup_rids(const char *desc
, SAMR_R_LOOKUP_RIDS
* r_u
,
4079 prs_struct
*ps
, int depth
)
4086 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_rids");
4092 if(!prs_uint32("num_names1", ps
, depth
, &r_u
->num_names1
))
4094 if(!prs_uint32("ptr_names ", ps
, depth
, &r_u
->ptr_names
))
4097 if (r_u
->ptr_names
!= 0) {
4099 if(!prs_uint32("num_names2", ps
, depth
, &r_u
->num_names2
))
4103 if (UNMARSHALLING(ps
) && (r_u
->num_names2
!= 0)) {
4104 r_u
->hdr_name
= PRS_ALLOC_MEM(ps
, UNIHDR
, r_u
->num_names2
);
4105 if (r_u
->hdr_name
== NULL
)
4108 r_u
->uni_name
= PRS_ALLOC_MEM(ps
, UNISTR2
, r_u
->num_names2
);
4109 if (r_u
->uni_name
== NULL
)
4113 for (i
= 0; i
< r_u
->num_names2
; i
++) {
4114 slprintf(tmp
, sizeof(tmp
) - 1, "hdr[%02d] ", i
);
4115 if(!smb_io_unihdr("", &r_u
->hdr_name
[i
], ps
, depth
))
4118 for (i
= 0; i
< r_u
->num_names2
; i
++) {
4119 slprintf(tmp
, sizeof(tmp
) - 1, "str[%02d] ", i
);
4120 if(!smb_io_unistr2("", &r_u
->uni_name
[i
], r_u
->hdr_name
[i
].buffer
, ps
, depth
))
4128 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
4130 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
4133 if (r_u
->ptr_types
!= 0) {
4135 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
4138 if (UNMARSHALLING(ps
) && (r_u
->num_types2
!= 0)) {
4139 r_u
->type
= PRS_ALLOC_MEM(ps
, uint32
, r_u
->num_types2
);
4140 if (r_u
->type
== NULL
)
4144 for (i
= 0; i
< r_u
->num_types2
; i
++) {
4145 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
4146 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->type
[i
]))
4151 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4157 /*******************************************************************
4158 inits a SAMR_Q_OPEN_ALIAS structure.
4159 ********************************************************************/
4161 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_u
, POLICY_HND
*hnd
)
4163 DEBUG(5, ("init_samr_q_delete_alias\n"));
4165 q_u
->alias_pol
= *hnd
;
4168 /*******************************************************************
4169 reads or writes a structure.
4170 ********************************************************************/
4172 BOOL
samr_io_q_delete_alias(const char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4173 prs_struct
*ps
, int depth
)
4178 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_alias");
4184 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4190 /*******************************************************************
4191 reads or writes a structure.
4192 ********************************************************************/
4194 BOOL
samr_io_r_delete_alias(const char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4195 prs_struct
*ps
, int depth
)
4200 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_alias");
4206 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
4208 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4214 /*******************************************************************
4215 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
4216 ********************************************************************/
4218 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
4219 POLICY_HND
*hnd
, const char *acct_desc
)
4221 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
4223 q_u
->dom_pol
= *hnd
;
4225 init_unistr2(&q_u
->uni_acct_desc
, acct_desc
, UNI_FLAGS_NONE
);
4226 init_uni_hdr(&q_u
->hdr_acct_desc
, &q_u
->uni_acct_desc
);
4228 q_u
->access_mask
= MAXIMUM_ALLOWED_ACCESS
;
4231 /*******************************************************************
4232 reads or writes a structure.
4233 ********************************************************************/
4235 BOOL
samr_io_q_create_dom_alias(const char *desc
, SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
4236 prs_struct
*ps
, int depth
)
4241 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_alias");
4247 if(!smb_io_pol_hnd("dom_pol", &q_u
->dom_pol
, ps
, depth
))
4250 if(!smb_io_unihdr("hdr_acct_desc", &q_u
->hdr_acct_desc
, ps
, depth
))
4252 if(!smb_io_unistr2("uni_acct_desc", &q_u
->uni_acct_desc
,
4253 q_u
->hdr_acct_desc
.buffer
, ps
, depth
))
4258 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4264 /*******************************************************************
4265 reads or writes a structure.
4266 ********************************************************************/
4268 BOOL
samr_io_r_create_dom_alias(const char *desc
, SAMR_R_CREATE_DOM_ALIAS
* r_u
,
4269 prs_struct
*ps
, int depth
)
4274 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_alias");
4280 if(!smb_io_pol_hnd("alias_pol", &r_u
->alias_pol
, ps
, depth
))
4283 if(!prs_uint32("rid", ps
, depth
, &r_u
->rid
))
4286 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4292 /*******************************************************************
4293 inits a SAMR_Q_ADD_ALIASMEM structure.
4294 ********************************************************************/
4296 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4299 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
4301 q_u
->alias_pol
= *hnd
;
4302 init_dom_sid2(&q_u
->sid
, sid
);
4305 /*******************************************************************
4306 reads or writes a structure.
4307 ********************************************************************/
4309 BOOL
samr_io_q_add_aliasmem(const char *desc
, SAMR_Q_ADD_ALIASMEM
* q_u
,
4310 prs_struct
*ps
, int depth
)
4315 prs_debug(ps
, depth
, desc
, "samr_io_q_add_aliasmem");
4321 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4323 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4329 /*******************************************************************
4330 reads or writes a structure.
4331 ********************************************************************/
4333 BOOL
samr_io_r_add_aliasmem(const char *desc
, SAMR_R_ADD_ALIASMEM
* r_u
,
4334 prs_struct
*ps
, int depth
)
4339 prs_debug(ps
, depth
, desc
, "samr_io_r_add_aliasmem");
4345 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4351 /*******************************************************************
4352 inits a SAMR_Q_DEL_ALIASMEM structure.
4353 ********************************************************************/
4355 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4358 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4360 q_u
->alias_pol
= *hnd
;
4361 init_dom_sid2(&q_u
->sid
, sid
);
4364 /*******************************************************************
4365 reads or writes a structure.
4366 ********************************************************************/
4368 BOOL
samr_io_q_del_aliasmem(const char *desc
, SAMR_Q_DEL_ALIASMEM
* q_u
,
4369 prs_struct
*ps
, int depth
)
4374 prs_debug(ps
, depth
, desc
, "samr_io_q_del_aliasmem");
4380 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4382 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4388 /*******************************************************************
4389 reads or writes a structure.
4390 ********************************************************************/
4392 BOOL
samr_io_r_del_aliasmem(const char *desc
, SAMR_R_DEL_ALIASMEM
* r_u
,
4393 prs_struct
*ps
, int depth
)
4398 prs_debug(ps
, depth
, desc
, "samr_io_r_del_aliasmem");
4404 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4410 /*******************************************************************
4411 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4412 ********************************************************************/
4414 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_c
,
4417 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4419 q_c
->alias_pol
= *hnd
;
4422 /*******************************************************************
4423 reads or writes a structure.
4424 ********************************************************************/
4426 BOOL
samr_io_q_delete_dom_alias(const char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4427 prs_struct
*ps
, int depth
)
4432 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_alias");
4438 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4444 /*******************************************************************
4445 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4446 ********************************************************************/
4448 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4451 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4453 r_u
->status
= status
;
4456 /*******************************************************************
4457 reads or writes a structure.
4458 ********************************************************************/
4460 BOOL
samr_io_r_delete_dom_alias(const char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4461 prs_struct
*ps
, int depth
)
4466 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_alias");
4472 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4478 /*******************************************************************
4479 inits a SAMR_Q_QUERY_ALIASMEM structure.
4480 ********************************************************************/
4482 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM
* q_c
,
4485 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4487 q_c
->alias_pol
= *hnd
;
4490 /*******************************************************************
4491 reads or writes a structure.
4492 ********************************************************************/
4494 BOOL
samr_io_q_query_aliasmem(const char *desc
, SAMR_Q_QUERY_ALIASMEM
* q_u
,
4495 prs_struct
*ps
, int depth
)
4500 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasmem");
4506 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4512 /*******************************************************************
4513 inits a SAMR_R_QUERY_ALIASMEM structure.
4514 ********************************************************************/
4516 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM
* r_u
,
4517 uint32 num_sids
, DOM_SID2
* sid
,
4520 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4522 if (NT_STATUS_IS_OK(status
)) {
4523 r_u
->num_sids
= num_sids
;
4524 r_u
->ptr
= (num_sids
!= 0) ? 1 : 0;
4525 r_u
->num_sids1
= num_sids
;
4533 r_u
->status
= status
;
4536 /*******************************************************************
4537 reads or writes a structure.
4538 ********************************************************************/
4540 BOOL
samr_io_r_query_aliasmem(const char *desc
, SAMR_R_QUERY_ALIASMEM
* r_u
,
4541 prs_struct
*ps
, int depth
)
4548 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasmem");
4554 if(!prs_uint32("num_sids ", ps
, depth
, &r_u
->num_sids
))
4556 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
4559 if (r_u
->ptr
!= 0 && r_u
->num_sids
!= 0) {
4560 uint32
*ptr_sid
= NULL
;
4562 if(!prs_uint32("num_sids1", ps
, depth
, &r_u
->num_sids1
))
4565 ptr_sid
= TALLOC_ARRAY(ps
->mem_ctx
, uint32
, r_u
->num_sids1
);
4570 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4572 if(!prs_uint32("ptr_sid", ps
, depth
, &ptr_sid
[i
]))
4576 if (UNMARSHALLING(ps
)) {
4577 r_u
->sid
= TALLOC_ARRAY(ps
->mem_ctx
, DOM_SID2
, r_u
->num_sids1
);
4580 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4581 if (ptr_sid
[i
] != 0) {
4582 if(!smb_io_dom_sid2("sid", &r_u
->sid
[i
], ps
, depth
))
4590 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4596 /*******************************************************************
4597 inits a SAMR_Q_LOOKUP_NAMES structure.
4598 ********************************************************************/
4600 NTSTATUS
init_samr_q_lookup_names(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4601 POLICY_HND
*pol
, uint32 flags
,
4602 uint32 num_names
, const char **name
)
4606 DEBUG(5, ("init_samr_q_lookup_names\n"));
4610 q_u
->num_names1
= num_names
;
4613 q_u
->num_names2
= num_names
;
4615 if (!(q_u
->hdr_name
= TALLOC_ZERO_ARRAY(ctx
, UNIHDR
, num_names
)))
4616 return NT_STATUS_NO_MEMORY
;
4618 if (!(q_u
->uni_name
= TALLOC_ZERO_ARRAY(ctx
, UNISTR2
, num_names
)))
4619 return NT_STATUS_NO_MEMORY
;
4621 for (i
= 0; i
< num_names
; i
++) {
4622 init_unistr2(&q_u
->uni_name
[i
], name
[i
], UNI_FLAGS_NONE
); /* unicode string for machine account */
4623 init_uni_hdr(&q_u
->hdr_name
[i
], &q_u
->uni_name
[i
]); /* unicode header for user_name */
4626 return NT_STATUS_OK
;
4629 /*******************************************************************
4630 reads or writes a structure.
4631 ********************************************************************/
4633 BOOL
samr_io_q_lookup_names(const char *desc
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4634 prs_struct
*ps
, int depth
)
4641 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_names");
4644 if (UNMARSHALLING(ps
))
4650 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4653 if(!prs_uint32("num_names1", ps
, depth
, &q_u
->num_names1
))
4655 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
4657 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
4659 if(!prs_uint32("num_names2", ps
, depth
, &q_u
->num_names2
))
4662 if (UNMARSHALLING(ps
) && (q_u
->num_names2
!= 0)) {
4663 q_u
->hdr_name
= PRS_ALLOC_MEM(ps
, UNIHDR
, q_u
->num_names2
);
4664 q_u
->uni_name
= PRS_ALLOC_MEM(ps
, UNISTR2
, q_u
->num_names2
);
4665 if (!q_u
->hdr_name
|| !q_u
->uni_name
)
4669 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4670 if(!smb_io_unihdr("", &q_u
->hdr_name
[i
], ps
, depth
))
4674 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4675 if(!smb_io_unistr2("", &q_u
->uni_name
[i
], q_u
->hdr_name
[i
].buffer
, ps
, depth
))
4682 /*******************************************************************
4683 inits a SAMR_R_LOOKUP_NAMES structure.
4684 ********************************************************************/
4686 NTSTATUS
init_samr_r_lookup_names(TALLOC_CTX
*ctx
, SAMR_R_LOOKUP_NAMES
* r_u
,
4688 uint32
*rid
, uint32
*type
,
4691 DEBUG(5, ("init_samr_r_lookup_names\n"));
4693 if (NT_STATUS_IS_OK(status
) && (num_rids
!= 0)) {
4696 r_u
->num_types1
= num_rids
;
4698 r_u
->num_types2
= num_rids
;
4700 r_u
->num_rids1
= num_rids
;
4702 r_u
->num_rids2
= num_rids
;
4704 if (!(r_u
->rids
= TALLOC_ZERO_ARRAY(ctx
, uint32
, num_rids
)))
4705 return NT_STATUS_NO_MEMORY
;
4706 if (!(r_u
->types
= TALLOC_ZERO_ARRAY(ctx
, uint32
, num_rids
)))
4707 return NT_STATUS_NO_MEMORY
;
4709 if (!r_u
->rids
|| !r_u
->types
)
4712 for (i
= 0; i
< num_rids
; i
++) {
4713 r_u
->rids
[i
] = rid
[i
];
4714 r_u
->types
[i
] = type
[i
];
4719 r_u
->num_types1
= 0;
4721 r_u
->num_types2
= 0;
4731 r_u
->status
= status
;
4733 return NT_STATUS_OK
;
4736 /*******************************************************************
4737 reads or writes a structure.
4738 ********************************************************************/
4740 BOOL
samr_io_r_lookup_names(const char *desc
, SAMR_R_LOOKUP_NAMES
* r_u
,
4741 prs_struct
*ps
, int depth
)
4749 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_names");
4752 if (UNMARSHALLING(ps
))
4758 if(!prs_uint32("num_rids1", ps
, depth
, &r_u
->num_rids1
))
4760 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
4763 if (r_u
->ptr_rids
!= 0) {
4764 if(!prs_uint32("num_rids2", ps
, depth
, &r_u
->num_rids2
))
4767 if (r_u
->num_rids2
!= r_u
->num_rids1
) {
4772 if (UNMARSHALLING(ps
))
4773 r_u
->rids
= PRS_ALLOC_MEM(ps
, uint32
, r_u
->num_rids2
);
4776 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
4780 for (i
= 0; i
< r_u
->num_rids2
; i
++) {
4781 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
4782 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->rids
[i
]))
4787 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
4789 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
4792 if (r_u
->ptr_types
!= 0) {
4793 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
4796 if (r_u
->num_types2
!= r_u
->num_types1
) {
4801 if (UNMARSHALLING(ps
))
4802 r_u
->types
= PRS_ALLOC_MEM(ps
, uint32
, r_u
->num_types2
);
4805 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
4809 for (i
= 0; i
< r_u
->num_types2
; i
++) {
4810 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
4811 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->types
[i
]))
4816 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4822 /*******************************************************************
4823 inits a SAMR_Q_DELETE_DOM_USER structure.
4824 ********************************************************************/
4826 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER
* q_c
,
4829 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
4831 q_c
->user_pol
= *hnd
;
4834 /*******************************************************************
4835 reads or writes a structure.
4836 ********************************************************************/
4838 BOOL
samr_io_q_delete_dom_user(const char *desc
, SAMR_Q_DELETE_DOM_USER
* q_u
,
4839 prs_struct
*ps
, int depth
)
4844 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_user");
4850 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
4856 /*******************************************************************
4857 reads or writes a structure.
4858 ********************************************************************/
4860 BOOL
samr_io_r_delete_dom_user(const char *desc
, SAMR_R_DELETE_DOM_USER
* r_u
,
4861 prs_struct
*ps
, int depth
)
4866 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_user");
4872 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
4874 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4880 /*******************************************************************
4881 reads or writes a structure.
4882 ********************************************************************/
4884 void init_samr_q_open_user(SAMR_Q_OPEN_USER
* q_u
,
4886 uint32 access_mask
, uint32 rid
)
4888 DEBUG(5, ("samr_init_samr_q_open_user\n"));
4890 q_u
->domain_pol
= *pol
;
4891 q_u
->access_mask
= access_mask
;
4892 q_u
->user_rid
= rid
;
4895 /*******************************************************************
4896 reads or writes a structure.
4897 ********************************************************************/
4899 BOOL
samr_io_q_open_user(const char *desc
, SAMR_Q_OPEN_USER
* q_u
,
4900 prs_struct
*ps
, int depth
)
4905 prs_debug(ps
, depth
, desc
, "samr_io_q_open_user");
4911 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4914 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4916 if(!prs_uint32("user_rid ", ps
, depth
, &q_u
->user_rid
))
4922 /*******************************************************************
4923 reads or writes a structure.
4924 ********************************************************************/
4926 BOOL
samr_io_r_open_user(const char *desc
, SAMR_R_OPEN_USER
* r_u
,
4927 prs_struct
*ps
, int depth
)
4932 prs_debug(ps
, depth
, desc
, "samr_io_r_open_user");
4938 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
4941 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
4948 /*******************************************************************
4949 reads or writes a structure.
4950 ********************************************************************/
4952 void init_samr_q_create_user(SAMR_Q_CREATE_USER
* q_u
,
4955 uint32 acb_info
, uint32 access_mask
)
4957 DEBUG(5, ("samr_init_samr_q_create_user\n"));
4959 q_u
->domain_pol
= *pol
;
4961 init_unistr2(&q_u
->uni_name
, name
, UNI_FLAGS_NONE
);
4962 init_uni_hdr(&q_u
->hdr_name
, &q_u
->uni_name
);
4964 q_u
->acb_info
= acb_info
;
4965 q_u
->access_mask
= access_mask
;
4968 /*******************************************************************
4969 reads or writes a structure.
4970 ********************************************************************/
4972 BOOL
samr_io_q_create_user(const char *desc
, SAMR_Q_CREATE_USER
* q_u
,
4973 prs_struct
*ps
, int depth
)
4978 prs_debug(ps
, depth
, desc
, "samr_io_q_create_user");
4984 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4987 if(!smb_io_unihdr("hdr_name", &q_u
->hdr_name
, ps
, depth
))
4989 if(!smb_io_unistr2("uni_name", &q_u
->uni_name
, q_u
->hdr_name
.buffer
, ps
, depth
))
4994 if(!prs_uint32("acb_info ", ps
, depth
, &q_u
->acb_info
))
4996 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
5002 /*******************************************************************
5003 reads or writes a structure.
5004 ********************************************************************/
5006 BOOL
samr_io_r_create_user(const char *desc
, SAMR_R_CREATE_USER
* r_u
,
5007 prs_struct
*ps
, int depth
)
5012 prs_debug(ps
, depth
, desc
, "samr_io_r_create_user");
5018 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
5021 if(!prs_uint32("access_granted", ps
, depth
, &r_u
->access_granted
))
5023 if(!prs_uint32("user_rid ", ps
, depth
, &r_u
->user_rid
))
5025 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
5031 /*******************************************************************
5032 inits a SAMR_Q_QUERY_USERINFO structure.
5033 ********************************************************************/
5035 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO
* q_u
,
5036 POLICY_HND
*hnd
, uint16 switch_value
)
5038 DEBUG(5, ("init_samr_q_query_userinfo\n"));
5041 q_u
->switch_value
= switch_value
;
5044 /*******************************************************************
5045 reads or writes a structure.
5046 ********************************************************************/
5048 BOOL
samr_io_q_query_userinfo(const char *desc
, SAMR_Q_QUERY_USERINFO
* q_u
,
5049 prs_struct
*ps
, int depth
)
5054 prs_debug(ps
, depth
, desc
, "samr_io_q_query_userinfo");
5060 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
5063 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
)) /* 0x0015 or 0x0011 */
5069 /*******************************************************************
5070 reads or writes a LOGON_HRS structure.
5071 ********************************************************************/
5073 static BOOL
sam_io_logon_hrs(const char *desc
, LOGON_HRS
* hrs
,
5074 prs_struct
*ps
, int depth
)
5079 prs_debug(ps
, depth
, desc
, "sam_io_logon_hrs");
5085 if(!prs_uint32("maxlen", ps
, depth
, &hrs
->max_len
))
5088 if(!prs_uint32("offset", ps
, depth
, &hrs
->offset
))
5091 if(!prs_uint32("len ", ps
, depth
, &hrs
->len
))
5094 if (hrs
->len
> sizeof(hrs
->hours
)) {
5095 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs
->len
));
5096 hrs
->len
= sizeof(hrs
->hours
);
5099 if(!prs_uint8s(False
, "hours", ps
, depth
, hrs
->hours
, hrs
->len
))
5105 /*******************************************************************
5106 inits a SAM_USER_INFO_18 structure.
5107 ********************************************************************/
5109 void init_sam_user_info18(SAM_USER_INFO_18
* usr
,
5110 const uint8 lm_pwd
[16], const uint8 nt_pwd
[16])
5112 DEBUG(5, ("init_sam_user_info18\n"));
5114 usr
->lm_pwd_active
=
5115 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
)) ? 1 : 0;
5116 usr
->nt_pwd_active
=
5117 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
)) ? 1 : 0;
5120 /*******************************************************************
5121 reads or writes a structure.
5122 ********************************************************************/
5124 static BOOL
sam_io_user_info18(const char *desc
, SAM_USER_INFO_18
* u
,
5125 prs_struct
*ps
, int depth
)
5130 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info18");
5136 if(!prs_uint8s(False
, "lm_pwd", ps
, depth
, u
->lm_pwd
, sizeof(u
->lm_pwd
)))
5138 if(!prs_uint8s(False
, "nt_pwd", ps
, depth
, u
->nt_pwd
, sizeof(u
->nt_pwd
)))
5141 if(!prs_uint8("lm_pwd_active", ps
, depth
, &u
->lm_pwd_active
))
5143 if(!prs_uint8("nt_pwd_active", ps
, depth
, &u
->nt_pwd_active
))
5149 /*******************************************************************
5150 inits a SAM_USER_INFO_7 structure.
5151 ********************************************************************/
5153 void init_sam_user_info7(SAM_USER_INFO_7
* usr
, const char *name
)
5155 DEBUG(5, ("init_sam_user_info7\n"));
5157 init_unistr2(&usr
->uni_name
, name
, UNI_FLAGS_NONE
); /* unicode string for name */
5158 init_uni_hdr(&usr
->hdr_name
, &usr
->uni_name
); /* unicode header for name */
5162 /*******************************************************************
5163 reads or writes a structure.
5164 ********************************************************************/
5166 static BOOL
sam_io_user_info7(const char *desc
, SAM_USER_INFO_7
* usr
,
5167 prs_struct
*ps
, int depth
)
5172 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info7");
5178 if(!smb_io_unihdr("unihdr", &usr
->hdr_name
, ps
, depth
))
5181 if(!smb_io_unistr2("unistr2", &usr
->uni_name
, True
, ps
, depth
))
5187 /*******************************************************************
5188 inits a SAM_USER_INFO_16 structure.
5189 ********************************************************************/
5191 void init_sam_user_info16(SAM_USER_INFO_16
* usr
, uint32 acb_info
)
5193 DEBUG(5, ("init_sam_user_info16\n"));
5195 usr
->acb_info
= acb_info
;
5198 /*******************************************************************
5199 reads or writes a structure.
5200 ********************************************************************/
5202 static BOOL
sam_io_user_info16(const char *desc
, SAM_USER_INFO_16
* usr
,
5203 prs_struct
*ps
, int depth
)
5208 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info16");
5214 if(!prs_uint32("acb_info", ps
, depth
, &usr
->acb_info
))
5220 /*******************************************************************
5221 inits a SAM_USER_INFO_17 structure.
5222 ********************************************************************/
5224 void init_sam_user_info17(SAM_USER_INFO_17
* usr
,
5227 uint32 rid_user
, uint32 rid_group
, uint16 acct_ctrl
)
5229 DEBUG(5, ("init_sam_user_info17\n"));
5231 memcpy(&usr
->expiry
, expiry
, sizeof(usr
->expiry
)); /* expiry time or something? */
5232 ZERO_STRUCT(usr
->padding_1
); /* 0 - padding 24 bytes */
5234 usr
->padding_2
= 0; /* 0 - padding 4 bytes */
5236 usr
->ptr_1
= 1; /* pointer */
5237 ZERO_STRUCT(usr
->padding_3
); /* 0 - padding 32 bytes */
5238 usr
->padding_4
= 0; /* 0 - padding 4 bytes */
5240 usr
->ptr_2
= 1; /* pointer */
5241 usr
->padding_5
= 0; /* 0 - padding 4 bytes */
5243 usr
->ptr_3
= 1; /* pointer */
5244 ZERO_STRUCT(usr
->padding_6
); /* 0 - padding 32 bytes */
5246 usr
->rid_user
= rid_user
;
5247 usr
->rid_group
= rid_group
;
5249 usr
->acct_ctrl
= acct_ctrl
;
5250 usr
->unknown_3
= 0x0000;
5252 usr
->unknown_4
= 0x003f; /* 0x003f - 16 bit unknown */
5253 usr
->unknown_5
= 0x003c; /* 0x003c - 16 bit unknown */
5255 ZERO_STRUCT(usr
->padding_7
); /* 0 - padding 16 bytes */
5256 usr
->padding_8
= 0; /* 0 - padding 4 bytes */
5258 init_unistr2(&usr
->uni_mach_acct
, mach_acct
, UNI_FLAGS_NONE
); /* unicode string for machine account */
5259 init_uni_hdr(&usr
->hdr_mach_acct
, &usr
->uni_mach_acct
); /* unicode header for machine account */
5262 /*******************************************************************
5263 reads or writes a structure.
5264 ********************************************************************/
5266 static BOOL
sam_io_user_info17(const char *desc
, SAM_USER_INFO_17
* usr
,
5267 prs_struct
*ps
, int depth
)
5272 prs_debug(ps
, depth
, desc
, "samr_io_r_unknown_17");
5278 if(!prs_uint8s(False
, "padding_0", ps
, depth
, usr
->padding_0
, sizeof(usr
->padding_0
)))
5281 if(!smb_io_time("time", &usr
->expiry
, ps
, depth
))
5284 if(!prs_uint8s(False
, "padding_1", ps
, depth
, usr
->padding_1
, sizeof(usr
->padding_1
)))
5287 if(!smb_io_unihdr("unihdr", &usr
->hdr_mach_acct
, ps
, depth
))
5290 if(!prs_uint32("padding_2", ps
, depth
, &usr
->padding_2
))
5293 if(!prs_uint32("ptr_1 ", ps
, depth
, &usr
->ptr_1
))
5295 if(!prs_uint8s(False
, "padding_3", ps
, depth
, usr
->padding_3
, sizeof(usr
->padding_3
)))
5298 if(!prs_uint32("padding_4", ps
, depth
, &usr
->padding_4
))
5301 if(!prs_uint32("ptr_2 ", ps
, depth
, &usr
->ptr_2
))
5303 if(!prs_uint32("padding_5", ps
, depth
, &usr
->padding_5
))
5306 if(!prs_uint32("ptr_3 ", ps
, depth
, &usr
->ptr_3
))
5308 if(!prs_uint8s(False
, "padding_6", ps
, depth
, usr
->padding_6
,sizeof(usr
->padding_6
)))
5311 if(!prs_uint32("rid_user ", ps
, depth
, &usr
->rid_user
))
5313 if(!prs_uint32("rid_group", ps
, depth
, &usr
->rid_group
))
5315 if(!prs_uint16("acct_ctrl", ps
, depth
, &usr
->acct_ctrl
))
5317 if(!prs_uint16("unknown_3", ps
, depth
, &usr
->unknown_3
))
5319 if(!prs_uint16("unknown_4", ps
, depth
, &usr
->unknown_4
))
5321 if(!prs_uint16("unknown_5", ps
, depth
, &usr
->unknown_5
))
5324 if(!prs_uint8s(False
, "padding_7", ps
, depth
, usr
->padding_7
, sizeof(usr
->padding_7
)))
5327 if(!prs_uint32("padding_8", ps
, depth
, &(usr
->padding_8
)))
5330 if(!smb_io_unistr2("unistr2", &usr
->uni_mach_acct
, True
, ps
, depth
))
5336 if(!prs_uint8s(False
, "padding_9", ps
, depth
, usr
->padding_9
, sizeof(usr
->padding_9
)))
5342 /*************************************************************************
5344 *************************************************************************/
5346 void init_sam_user_info24(SAM_USER_INFO_24
* usr
, char newpass
[516], uint16 pw_len
)
5348 DEBUG(10, ("init_sam_user_info24:\n"));
5349 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5350 usr
->pw_len
= pw_len
;
5353 /*******************************************************************
5354 reads or writes a structure.
5355 ********************************************************************/
5357 static BOOL
sam_io_user_info24(const char *desc
, SAM_USER_INFO_24
* usr
,
5358 prs_struct
*ps
, int depth
)
5363 prs_debug(ps
, depth
, desc
, "sam_io_user_info24");
5369 if(!prs_uint8s(False
, "password", ps
, depth
, usr
->pass
,
5373 if (MARSHALLING(ps
) && (usr
->pw_len
!= 0)) {
5374 if (!prs_uint16("pw_len", ps
, depth
, &usr
->pw_len
))
5383 /*************************************************************************
5384 init_sam_user_info23
5386 unknown_6 = 0x0000 04ec
5388 *************************************************************************/
5390 void init_sam_user_info23W(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5391 NTTIME
* logoff_time
, /* all zeros */
5392 NTTIME
* kickoff_time
, /* all zeros */
5393 NTTIME
* pass_last_set_time
, /* all zeros */
5394 NTTIME
* pass_can_change_time
, /* all zeros */
5395 NTTIME
* pass_must_change_time
, /* all zeros */
5406 uint32 user_rid
, /* 0x0000 0000 */
5409 uint32 fields_present
,
5412 uint16 bad_password_count
,
5416 usr
->logon_time
= *logon_time
; /* all zeros */
5417 usr
->logoff_time
= *logoff_time
; /* all zeros */
5418 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5419 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5420 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5421 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5423 ZERO_STRUCT(usr
->nt_pwd
);
5424 ZERO_STRUCT(usr
->lm_pwd
);
5426 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5427 usr
->group_rid
= group_rid
;
5428 usr
->acb_info
= acb_info
;
5429 usr
->fields_present
= fields_present
; /* 09f8 27fa */
5431 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5432 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5434 if (nt_time_is_zero(pass_must_change_time
)) {
5435 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
5437 usr
->passmustchange
=0;
5440 ZERO_STRUCT(usr
->padding1
);
5441 ZERO_STRUCT(usr
->padding2
);
5443 usr
->bad_password_count
= bad_password_count
;
5444 usr
->logon_count
= logon_count
;
5446 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5448 copy_unistr2(&usr
->uni_user_name
, user_name
);
5449 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
5451 copy_unistr2(&usr
->uni_full_name
, full_name
);
5452 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
5454 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5455 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
5457 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5458 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
5460 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5461 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
5463 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5464 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
5466 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5467 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
5469 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5470 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
5472 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5473 init_uni_hdr(&usr
->hdr_unknown_str
, &usr
->uni_unknown_str
);
5475 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5476 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
5478 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5481 /*************************************************************************
5482 init_sam_user_info23
5484 unknown_6 = 0x0000 04ec
5486 *************************************************************************/
5488 void init_sam_user_info23A(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5489 NTTIME
* logoff_time
, /* all zeros */
5490 NTTIME
* kickoff_time
, /* all zeros */
5491 NTTIME
* pass_last_set_time
, /* all zeros */
5492 NTTIME
* pass_can_change_time
, /* all zeros */
5493 NTTIME
* pass_must_change_time
, /* all zeros */
5494 char *user_name
, /* NULL */
5496 char *home_dir
, char *dir_drive
, char *log_scr
,
5497 char *prof_path
, const char *desc
, char *wkstas
,
5498 char *unk_str
, char *mung_dial
, uint32 user_rid
, /* 0x0000 0000 */
5499 uint32 group_rid
, uint32 acb_info
,
5500 uint32 fields_present
, uint16 logon_divs
,
5501 LOGON_HRS
* hrs
, uint16 bad_password_count
, uint16 logon_count
,
5504 DATA_BLOB blob
= base64_decode_data_blob(mung_dial
);
5506 usr
->logon_time
= *logon_time
; /* all zeros */
5507 usr
->logoff_time
= *logoff_time
; /* all zeros */
5508 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5509 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5510 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5511 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5513 ZERO_STRUCT(usr
->nt_pwd
);
5514 ZERO_STRUCT(usr
->lm_pwd
);
5516 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5517 usr
->group_rid
= group_rid
;
5518 usr
->acb_info
= acb_info
;
5519 usr
->fields_present
= fields_present
; /* 09f8 27fa */
5521 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5522 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5524 if (nt_time_is_zero(pass_must_change_time
)) {
5525 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
5527 usr
->passmustchange
=0;
5530 ZERO_STRUCT(usr
->padding1
);
5531 ZERO_STRUCT(usr
->padding2
);
5533 usr
->bad_password_count
= bad_password_count
;
5534 usr
->logon_count
= logon_count
;
5536 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5538 init_unistr2(&usr
->uni_user_name
, user_name
, UNI_FLAGS_NONE
);
5539 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
5541 init_unistr2(&usr
->uni_full_name
, full_name
, UNI_FLAGS_NONE
);
5542 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
5544 init_unistr2(&usr
->uni_home_dir
, home_dir
, UNI_FLAGS_NONE
);
5545 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
5547 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, UNI_FLAGS_NONE
);
5548 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
5550 init_unistr2(&usr
->uni_logon_script
, log_scr
, UNI_FLAGS_NONE
);
5551 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
5553 init_unistr2(&usr
->uni_profile_path
, prof_path
, UNI_FLAGS_NONE
);
5554 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
5556 init_unistr2(&usr
->uni_acct_desc
, desc
, UNI_FLAGS_NONE
);
5557 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
5559 init_unistr2(&usr
->uni_workstations
, wkstas
, UNI_FLAGS_NONE
);
5560 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
5562 init_unistr2(&usr
->uni_unknown_str
, unk_str
, UNI_FLAGS_NONE
);
5563 init_uni_hdr(&usr
->hdr_unknown_str
, &usr
->uni_unknown_str
);
5565 init_unistr2_from_datablob(&usr
->uni_munged_dial
, &blob
);
5566 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
5568 data_blob_free(&blob
);
5570 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5573 /*******************************************************************
5574 reads or writes a structure.
5575 ********************************************************************/
5577 static BOOL
sam_io_user_info23(const char *desc
, SAM_USER_INFO_23
* usr
,
5578 prs_struct
*ps
, int depth
)
5583 prs_debug(ps
, depth
, desc
, "sam_io_user_info23");
5589 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5591 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5593 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5595 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
5597 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
5599 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5602 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5604 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5606 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5608 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5610 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5612 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5614 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5616 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5618 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5620 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5623 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5625 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5628 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5630 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5632 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5635 if(!prs_uint32("fields_present ", ps
, depth
, &usr
->fields_present
))
5637 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5641 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5644 if(!prs_uint16("bad_password_count ", ps
, depth
, &usr
->bad_password_count
))
5646 if(!prs_uint16("logon_count ", ps
, depth
, &usr
->logon_count
))
5649 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
5651 if(!prs_uint8("passmustchange ", ps
, depth
, &usr
->passmustchange
))
5653 if(!prs_uint8("padding2 ", ps
, depth
, &usr
->padding2
))
5657 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5660 /* here begins pointed-to data */
5662 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5665 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5668 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5671 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5674 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5677 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5680 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5683 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5686 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5689 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
5692 /* ok, this is only guess-work (as usual) */
5693 if (usr
->ptr_logon_hrs
) {
5694 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5701 /*******************************************************************
5702 reads or writes a structure.
5703 NB. This structure is *definately* incorrect. It's my best guess
5704 currently for W2K SP2. The password field is encrypted in a different
5705 way than normal... And there are definately other problems. JRA.
5706 ********************************************************************/
5708 static BOOL
sam_io_user_info25(const char *desc
, SAM_USER_INFO_25
* usr
, prs_struct
*ps
, int depth
)
5713 prs_debug(ps
, depth
, desc
, "sam_io_user_info25");
5719 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5721 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5723 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5725 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
5727 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
5729 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5732 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5734 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5736 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5738 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5740 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5742 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5744 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5746 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5748 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5750 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5753 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5755 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5758 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5760 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5762 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5765 if(!prs_uint32s(False
, "unknown_6 ", ps
, depth
, usr
->unknown_6
, 6))
5768 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5771 /* here begins pointed-to data */
5773 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5776 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5779 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5782 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5785 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5788 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5791 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5794 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5797 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5800 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
5803 #if 0 /* JRA - unknown... */
5804 /* ok, this is only guess-work (as usual) */
5805 if (usr
->ptr_logon_hrs
) {
5806 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5815 /*************************************************************************
5816 init_sam_user_info21W
5818 unknown_6 = 0x0000 04ec
5820 *************************************************************************/
5822 void init_sam_user_info21W(SAM_USER_INFO_21
* usr
,
5823 NTTIME
* logon_time
,
5824 NTTIME
* logoff_time
,
5825 NTTIME
* kickoff_time
,
5826 NTTIME
* pass_last_set_time
,
5827 NTTIME
* pass_can_change_time
,
5828 NTTIME
* pass_must_change_time
,
5844 uint32 fields_present
,
5847 uint16 bad_password_count
,
5850 usr
->logon_time
= *logon_time
;
5851 usr
->logoff_time
= *logoff_time
;
5852 usr
->kickoff_time
= *kickoff_time
;
5853 usr
->pass_last_set_time
= *pass_last_set_time
;
5854 usr
->pass_can_change_time
= *pass_can_change_time
;
5855 usr
->pass_must_change_time
= *pass_must_change_time
;
5857 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
));
5858 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
));
5860 usr
->user_rid
= user_rid
;
5861 usr
->group_rid
= group_rid
;
5862 usr
->acb_info
= acb_info
;
5863 usr
->fields_present
= fields_present
; /* 0x00ff ffff */
5865 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5866 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5867 usr
->bad_password_count
= bad_password_count
;
5868 usr
->logon_count
= logon_count
;
5870 if (nt_time_is_zero(pass_must_change_time
)) {
5871 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
5873 usr
->passmustchange
=0;
5876 ZERO_STRUCT(usr
->padding1
);
5877 ZERO_STRUCT(usr
->padding2
);
5879 copy_unistr2(&usr
->uni_user_name
, user_name
);
5880 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
5882 copy_unistr2(&usr
->uni_full_name
, full_name
);
5883 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
5885 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5886 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
5888 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5889 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
5891 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5892 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
5894 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5895 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
5897 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5898 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
5900 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5901 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
5903 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5904 init_uni_hdr(&usr
->hdr_unknown_str
, &usr
->uni_unknown_str
);
5906 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5907 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
5909 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5912 /*************************************************************************
5913 init_sam_user_info21
5915 unknown_6 = 0x0000 04ec
5917 *************************************************************************/
5919 NTSTATUS
init_sam_user_info21A(SAM_USER_INFO_21
*usr
, SAM_ACCOUNT
*pw
, DOM_SID
*domain_sid
)
5921 NTTIME logon_time
, logoff_time
, kickoff_time
,
5922 pass_last_set_time
, pass_can_change_time
,
5923 pass_must_change_time
;
5925 const char* user_name
= pdb_get_username(pw
);
5926 const char* full_name
= pdb_get_fullname(pw
);
5927 const char* home_dir
= pdb_get_homedir(pw
);
5928 const char* dir_drive
= pdb_get_dir_drive(pw
);
5929 const char* logon_script
= pdb_get_logon_script(pw
);
5930 const char* profile_path
= pdb_get_profile_path(pw
);
5931 const char* description
= pdb_get_acct_desc(pw
);
5932 const char* workstations
= pdb_get_workstations(pw
);
5933 const char* munged_dial
= pdb_get_munged_dial(pw
);
5934 DATA_BLOB munged_dial_blob
;
5937 const DOM_SID
*user_sid
;
5940 const DOM_SID
*group_sid
;
5943 munged_dial_blob
= base64_decode_data_blob(munged_dial
);
5945 munged_dial_blob
= data_blob(NULL
, 0);
5948 /* Create NTTIME structs */
5949 unix_to_nt_time (&logon_time
, pdb_get_logon_time(pw
));
5950 unix_to_nt_time (&logoff_time
, pdb_get_logoff_time(pw
));
5951 unix_to_nt_time (&kickoff_time
, pdb_get_kickoff_time(pw
));
5952 unix_to_nt_time (&pass_last_set_time
, pdb_get_pass_last_set_time(pw
));
5953 unix_to_nt_time (&pass_can_change_time
, pdb_get_pass_can_change_time(pw
));
5954 unix_to_nt_time (&pass_must_change_time
,pdb_get_pass_must_change_time(pw
));
5956 /* structure assignment */
5957 usr
->logon_time
= logon_time
;
5958 usr
->logoff_time
= logoff_time
;
5959 usr
->kickoff_time
= kickoff_time
;
5960 usr
->pass_last_set_time
= pass_last_set_time
;
5961 usr
->pass_can_change_time
= pass_can_change_time
;
5962 usr
->pass_must_change_time
= pass_must_change_time
;
5964 ZERO_STRUCT(usr
->nt_pwd
);
5965 ZERO_STRUCT(usr
->lm_pwd
);
5967 user_sid
= pdb_get_user_sid(pw
);
5969 if (!sid_peek_check_rid(domain_sid
, user_sid
, &user_rid
)) {
5970 fstring user_sid_string
;
5971 fstring domain_sid_string
;
5972 DEBUG(0, ("init_sam_user_info_21A: User %s has SID %s, \nwhich conflicts with "
5973 "the domain sid %s. Failing operation.\n",
5975 sid_to_string(user_sid_string
, user_sid
),
5976 sid_to_string(domain_sid_string
, domain_sid
)));
5977 data_blob_free(&munged_dial_blob
);
5978 return NT_STATUS_UNSUCCESSFUL
;
5981 group_sid
= pdb_get_group_sid(pw
);
5983 if (!sid_peek_check_rid(domain_sid
, group_sid
, &group_rid
)) {
5984 fstring group_sid_string
;
5985 fstring domain_sid_string
;
5986 DEBUG(0, ("init_sam_user_info_21A: User %s has Primary Group SID %s, \n"
5987 "which conflicts with the domain sid %s. Failing operation.\n",
5989 sid_to_string(group_sid_string
, group_sid
),
5990 sid_to_string(domain_sid_string
, domain_sid
)));
5991 data_blob_free(&munged_dial_blob
);
5992 return NT_STATUS_UNSUCCESSFUL
;
5995 usr
->user_rid
= user_rid
;
5996 usr
->group_rid
= group_rid
;
5997 usr
->acb_info
= pdb_get_acct_ctrl(pw
);
6000 Look at a user on a real NT4 PDC with usrmgr, press
6001 'ok'. Then you will see that fields_present is set to
6002 0x08f827fa. Look at the user immediately after that again,
6003 and you will see that 0x00fffff is returned. This solves
6004 the problem that you get access denied after having looked
6008 usr
->fields_present
= pdb_build_fields_present(pw
);
6010 usr
->logon_divs
= pdb_get_logon_divs(pw
);
6011 usr
->ptr_logon_hrs
= pdb_get_hours(pw
) ? 1 : 0;
6012 usr
->bad_password_count
= pdb_get_bad_password_count(pw
);
6013 usr
->logon_count
= pdb_get_logon_count(pw
);
6015 if (pdb_get_pass_must_change_time(pw
) == 0) {
6016 usr
->passmustchange
=PASS_MUST_CHANGE_AT_NEXT_LOGON
;
6018 usr
->passmustchange
=0;
6021 ZERO_STRUCT(usr
->padding1
);
6022 ZERO_STRUCT(usr
->padding2
);
6024 init_unistr2(&usr
->uni_user_name
, user_name
, UNI_STR_TERMINATE
);
6025 init_uni_hdr(&usr
->hdr_user_name
, &usr
->uni_user_name
);
6027 init_unistr2(&usr
->uni_full_name
, full_name
, UNI_STR_TERMINATE
);
6028 init_uni_hdr(&usr
->hdr_full_name
, &usr
->uni_full_name
);
6030 init_unistr2(&usr
->uni_home_dir
, home_dir
, UNI_STR_TERMINATE
);
6031 init_uni_hdr(&usr
->hdr_home_dir
, &usr
->uni_home_dir
);
6033 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, UNI_STR_TERMINATE
);
6034 init_uni_hdr(&usr
->hdr_dir_drive
, &usr
->uni_dir_drive
);
6036 init_unistr2(&usr
->uni_logon_script
, logon_script
, UNI_STR_TERMINATE
);
6037 init_uni_hdr(&usr
->hdr_logon_script
, &usr
->uni_logon_script
);
6039 init_unistr2(&usr
->uni_profile_path
, profile_path
, UNI_STR_TERMINATE
);
6040 init_uni_hdr(&usr
->hdr_profile_path
, &usr
->uni_profile_path
);
6042 init_unistr2(&usr
->uni_acct_desc
, description
, UNI_STR_TERMINATE
);
6043 init_uni_hdr(&usr
->hdr_acct_desc
, &usr
->uni_acct_desc
);
6045 init_unistr2(&usr
->uni_workstations
, workstations
, UNI_STR_TERMINATE
);
6046 init_uni_hdr(&usr
->hdr_workstations
, &usr
->uni_workstations
);
6048 init_unistr2(&usr
->uni_unknown_str
, NULL
, UNI_STR_TERMINATE
);
6049 init_uni_hdr(&usr
->hdr_unknown_str
, &usr
->uni_unknown_str
);
6051 init_unistr2_from_datablob(&usr
->uni_munged_dial
, &munged_dial_blob
);
6052 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
6053 data_blob_free(&munged_dial_blob
);
6055 if (pdb_get_hours(pw
)) {
6056 usr
->logon_hrs
.max_len
= 1260;
6057 usr
->logon_hrs
.offset
= 0;
6058 usr
->logon_hrs
.len
= pdb_get_hours_len(pw
);
6059 memcpy(&usr
->logon_hrs
.hours
, pdb_get_hours(pw
), MAX_HOURS_LEN
);
6061 usr
->logon_hrs
.max_len
= 1260;
6062 usr
->logon_hrs
.offset
= 0;
6063 usr
->logon_hrs
.len
= 0;
6064 memset(&usr
->logon_hrs
, 0xff, sizeof(usr
->logon_hrs
));
6067 return NT_STATUS_OK
;
6070 /*******************************************************************
6071 reads or writes a structure.
6072 ********************************************************************/
6074 static BOOL
sam_io_user_info21(const char *desc
, SAM_USER_INFO_21
* usr
,
6075 prs_struct
*ps
, int depth
)
6080 prs_debug(ps
, depth
, desc
, "sam_io_user_info21");
6086 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
6088 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
6090 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
,depth
))
6092 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
6094 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
,depth
))
6096 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
6099 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
6101 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
6103 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
6105 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
6107 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
6109 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
6111 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
6113 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
6115 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
6117 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
6120 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
6122 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
6125 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
6127 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
6129 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
6132 if(!prs_uint32("fields_present ", ps
, depth
, &usr
->fields_present
))
6134 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
6138 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
6141 if(!prs_uint16("bad_password_count ", ps
, depth
, &usr
->bad_password_count
))
6143 if(!prs_uint16("logon_count ", ps
, depth
, &usr
->logon_count
))
6146 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
6148 if(!prs_uint8("passmustchange ", ps
, depth
, &usr
->passmustchange
))
6150 if(!prs_uint8("padding2 ", ps
, depth
, &usr
->padding2
))
6153 /* here begins pointed-to data */
6155 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
,usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
6157 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
6159 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
6161 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
6163 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
6165 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
6167 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
6169 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
6171 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
6173 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
)) /* worksations user can log on from */
6176 /* ok, this is only guess-work (as usual) */
6177 if (usr
->ptr_logon_hrs
) {
6178 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
6185 void init_sam_user_info20A(SAM_USER_INFO_20
*usr
, SAM_ACCOUNT
*pw
)
6187 const char *munged_dial
= pdb_get_munged_dial(pw
);
6188 DATA_BLOB blob
= base64_decode_data_blob(munged_dial
);
6190 init_unistr2_from_datablob(&usr
->uni_munged_dial
, &blob
);
6191 init_uni_hdr(&usr
->hdr_munged_dial
, &usr
->uni_munged_dial
);
6192 data_blob_free(&blob
);
6195 /*******************************************************************
6196 reads or writes a structure.
6197 ********************************************************************/
6199 static BOOL
sam_io_user_info20(const char *desc
, SAM_USER_INFO_20
*usr
,
6200 prs_struct
*ps
, int depth
)
6205 prs_debug(ps
, depth
, desc
, "sam_io_user_info20");
6211 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
6214 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
)) /* worksations user can log on from */
6220 /*******************************************************************
6221 inits a SAM_USERINFO_CTR structure.
6222 ********************************************************************/
6224 NTSTATUS
make_samr_userinfo_ctr_usr21(TALLOC_CTX
*ctx
, SAM_USERINFO_CTR
* ctr
,
6225 uint16 switch_value
,
6226 SAM_USER_INFO_21
* usr
)
6228 DEBUG(5, ("make_samr_userinfo_ctr_usr21\n"));
6230 ctr
->switch_value
= switch_value
;
6231 ctr
->info
.id
= NULL
;
6233 switch (switch_value
) {
6235 ctr
->info
.id16
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_16
);
6236 if (ctr
->info
.id16
== NULL
)
6237 return NT_STATUS_NO_MEMORY
;
6239 init_sam_user_info16(ctr
->info
.id16
, usr
->acb_info
);
6242 /* whoops - got this wrong. i think. or don't understand what's happening. */
6246 info
= (void *)&id11
;
6248 expire
.low
= 0xffffffff;
6249 expire
.high
= 0x7fffffff;
6251 ctr
->info
.id
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_17
);
6252 init_sam_user_info11(ctr
->info
.id17
, &expire
,
6253 "BROOKFIELDS$", /* name */
6254 0x03ef, /* user rid */
6255 0x201, /* group rid */
6256 0x0080); /* acb info */
6262 ctr
->info
.id18
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_18
);
6263 if (ctr
->info
.id18
== NULL
)
6264 return NT_STATUS_NO_MEMORY
;
6266 init_sam_user_info18(ctr
->info
.id18
, usr
->lm_pwd
, usr
->nt_pwd
);
6270 SAM_USER_INFO_21
*cusr
;
6271 cusr
= TALLOC_ZERO_P(ctx
,SAM_USER_INFO_21
);
6272 ctr
->info
.id21
= cusr
;
6273 if (ctr
->info
.id21
== NULL
)
6274 return NT_STATUS_NO_MEMORY
;
6275 memcpy(cusr
, usr
, sizeof(*usr
));
6276 memset(cusr
->lm_pwd
, 0, sizeof(cusr
->lm_pwd
));
6277 memset(cusr
->nt_pwd
, 0, sizeof(cusr
->nt_pwd
));
6281 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
6282 return NT_STATUS_INVALID_INFO_CLASS
;
6285 return NT_STATUS_OK
;
6288 /*******************************************************************
6289 inits a SAM_USERINFO_CTR structure.
6290 ********************************************************************/
6292 static void init_samr_userinfo_ctr(SAM_USERINFO_CTR
* ctr
, DATA_BLOB
*sess_key
,
6293 uint16 switch_value
, void *info
)
6295 DEBUG(5, ("init_samr_userinfo_ctr\n"));
6297 ctr
->switch_value
= switch_value
;
6298 ctr
->info
.id
= info
;
6300 switch (switch_value
) {
6302 SamOEMhashBlob(ctr
->info
.id24
->pass
, 516, sess_key
);
6303 dump_data(100, (char *)sess_key
->data
, sess_key
->length
);
6304 dump_data(100, (char *)ctr
->info
.id24
->pass
, 516);
6307 SamOEMhashBlob(ctr
->info
.id23
->pass
, 516, sess_key
);
6308 dump_data(100, (char *)sess_key
->data
, sess_key
->length
);
6309 dump_data(100, (char *)ctr
->info
.id23
->pass
, 516);
6314 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value
));
6318 /*******************************************************************
6319 reads or writes a structure.
6320 ********************************************************************/
6322 static BOOL
samr_io_userinfo_ctr(const char *desc
, SAM_USERINFO_CTR
**ppctr
,
6323 prs_struct
*ps
, int depth
)
6326 SAM_USERINFO_CTR
*ctr
;
6328 prs_debug(ps
, depth
, desc
, "samr_io_userinfo_ctr");
6331 if (UNMARSHALLING(ps
)) {
6332 ctr
= PRS_ALLOC_MEM(ps
,SAM_USERINFO_CTR
,1);
6340 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
6342 if(!prs_uint16("switch_value", ps
, depth
, &ctr
->switch_value
))
6349 switch (ctr
->switch_value
) {
6351 if (UNMARSHALLING(ps
))
6352 ctr
->info
.id7
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_7
,1);
6353 if (ctr
->info
.id7
== NULL
) {
6354 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6357 ret
= sam_io_user_info7("", ctr
->info
.id7
, ps
, depth
);
6360 if (UNMARSHALLING(ps
))
6361 ctr
->info
.id16
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_16
,1);
6362 if (ctr
->info
.id16
== NULL
) {
6363 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6366 ret
= sam_io_user_info16("", ctr
->info
.id16
, ps
, depth
);
6369 if (UNMARSHALLING(ps
))
6370 ctr
->info
.id17
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_17
,1);
6372 if (ctr
->info
.id17
== NULL
) {
6373 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6376 ret
= sam_io_user_info17("", ctr
->info
.id17
, ps
, depth
);
6379 if (UNMARSHALLING(ps
))
6380 ctr
->info
.id18
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_18
,1);
6382 if (ctr
->info
.id18
== NULL
) {
6383 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6386 ret
= sam_io_user_info18("", ctr
->info
.id18
, ps
, depth
);
6389 if (UNMARSHALLING(ps
))
6390 ctr
->info
.id20
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_20
,1);
6392 if (ctr
->info
.id20
== NULL
) {
6393 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6396 ret
= sam_io_user_info20("", ctr
->info
.id20
, ps
, depth
);
6399 if (UNMARSHALLING(ps
))
6400 ctr
->info
.id21
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_21
,1);
6402 if (ctr
->info
.id21
== NULL
) {
6403 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6406 ret
= sam_io_user_info21("", ctr
->info
.id21
, ps
, depth
);
6409 if (UNMARSHALLING(ps
))
6410 ctr
->info
.id23
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_23
,1);
6412 if (ctr
->info
.id23
== NULL
) {
6413 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6416 ret
= sam_io_user_info23("", ctr
->info
.id23
, ps
, depth
);
6419 if (UNMARSHALLING(ps
))
6420 ctr
->info
.id24
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_24
,1);
6422 if (ctr
->info
.id24
== NULL
) {
6423 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6426 ret
= sam_io_user_info24("", ctr
->info
.id24
, ps
, depth
);
6429 if (UNMARSHALLING(ps
))
6430 ctr
->info
.id25
= PRS_ALLOC_MEM(ps
,SAM_USER_INFO_25
,1);
6432 if (ctr
->info
.id25
== NULL
) {
6433 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
6436 ret
= sam_io_user_info25("", ctr
->info
.id25
, ps
, depth
);
6439 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr
->switch_value
));
6447 /*******************************************************************
6448 inits a SAMR_R_QUERY_USERINFO structure.
6449 ********************************************************************/
6451 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO
* r_u
,
6452 SAM_USERINFO_CTR
* ctr
, NTSTATUS status
)
6454 DEBUG(5, ("init_samr_r_query_userinfo\n"));
6459 if (NT_STATUS_IS_OK(status
)) {
6464 r_u
->status
= status
; /* return status */
6467 /*******************************************************************
6468 reads or writes a structure.
6469 ********************************************************************/
6471 BOOL
samr_io_r_query_userinfo(const char *desc
, SAMR_R_QUERY_USERINFO
* r_u
,
6472 prs_struct
*ps
, int depth
)
6477 prs_debug(ps
, depth
, desc
, "samr_io_r_query_userinfo");
6483 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
6486 if (r_u
->ptr
!= 0) {
6487 if(!samr_io_userinfo_ctr("ctr", &r_u
->ctr
, ps
, depth
))
6493 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6499 /*******************************************************************
6500 inits a SAMR_Q_SET_USERINFO structure.
6501 ********************************************************************/
6503 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO
* q_u
,
6504 POLICY_HND
*hnd
, DATA_BLOB
*sess_key
,
6505 uint16 switch_value
, void *info
)
6507 DEBUG(5, ("init_samr_q_set_userinfo\n"));
6510 q_u
->switch_value
= switch_value
;
6511 init_samr_userinfo_ctr(q_u
->ctr
, sess_key
, switch_value
, info
);
6514 /*******************************************************************
6515 reads or writes a structure.
6516 ********************************************************************/
6518 BOOL
samr_io_q_set_userinfo(const char *desc
, SAMR_Q_SET_USERINFO
* q_u
,
6519 prs_struct
*ps
, int depth
)
6524 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo");
6530 smb_io_pol_hnd("pol", &(q_u
->pol
), ps
, depth
);
6532 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6534 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6540 /*******************************************************************
6541 inits a SAMR_R_SET_USERINFO structure.
6542 ********************************************************************/
6544 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO
* r_u
, NTSTATUS status
)
6546 DEBUG(5, ("init_samr_r_set_userinfo\n"));
6548 r_u
->status
= status
; /* return status */
6551 /*******************************************************************
6552 reads or writes a structure.
6553 ********************************************************************/
6555 BOOL
samr_io_r_set_userinfo(const char *desc
, SAMR_R_SET_USERINFO
* r_u
,
6556 prs_struct
*ps
, int depth
)
6561 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo");
6567 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6573 /*******************************************************************
6574 inits a SAMR_Q_SET_USERINFO2 structure.
6575 ********************************************************************/
6577 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2
* q_u
,
6578 POLICY_HND
*hnd
, DATA_BLOB
*sess_key
,
6579 uint16 switch_value
, SAM_USERINFO_CTR
* ctr
)
6581 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
6584 q_u
->switch_value
= switch_value
;
6587 if (q_u
->ctr
!= NULL
)
6588 q_u
->ctr
->switch_value
= switch_value
;
6590 switch (switch_value
) {
6592 SamOEMhashBlob(ctr
->info
.id18
->lm_pwd
, 16, sess_key
);
6593 SamOEMhashBlob(ctr
->info
.id18
->nt_pwd
, 16, sess_key
);
6594 dump_data(100, (char *)sess_key
->data
, sess_key
->length
);
6595 dump_data(100, (char *)ctr
->info
.id18
->lm_pwd
, 16);
6596 dump_data(100, (char *)ctr
->info
.id18
->nt_pwd
, 16);
6601 /*******************************************************************
6602 reads or writes a structure.
6603 ********************************************************************/
6605 BOOL
samr_io_q_set_userinfo2(const char *desc
, SAMR_Q_SET_USERINFO2
* q_u
,
6606 prs_struct
*ps
, int depth
)
6611 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo2");
6617 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
6620 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6622 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6628 /*******************************************************************
6629 inits a SAMR_R_SET_USERINFO2 structure.
6630 ********************************************************************/
6632 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2
* r_u
, NTSTATUS status
)
6634 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
6636 r_u
->status
= status
; /* return status */
6639 /*******************************************************************
6640 reads or writes a structure.
6641 ********************************************************************/
6643 BOOL
samr_io_r_set_userinfo2(const char *desc
, SAMR_R_SET_USERINFO2
* r_u
,
6644 prs_struct
*ps
, int depth
)
6649 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo2");
6655 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6661 /*******************************************************************
6662 inits a SAMR_Q_CONNECT structure.
6663 ********************************************************************/
6665 void init_samr_q_connect(SAMR_Q_CONNECT
* q_u
,
6666 char *srv_name
, uint32 access_mask
)
6668 DEBUG(5, ("init_samr_q_connect\n"));
6670 /* make PDC server name \\server */
6671 q_u
->ptr_srv_name
= (srv_name
!= NULL
&& *srv_name
) ? 1 : 0;
6672 init_unistr2(&q_u
->uni_srv_name
, srv_name
, UNI_STR_TERMINATE
);
6674 /* example values: 0x0000 0002 */
6675 q_u
->access_mask
= access_mask
;
6678 /*******************************************************************
6679 reads or writes a structure.
6680 ********************************************************************/
6682 BOOL
samr_io_q_connect(const char *desc
, SAMR_Q_CONNECT
* q_u
,
6683 prs_struct
*ps
, int depth
)
6688 prs_debug(ps
, depth
, desc
, "samr_io_q_connect");
6694 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
6696 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
6701 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6707 /*******************************************************************
6708 reads or writes a structure.
6709 ********************************************************************/
6711 BOOL
samr_io_r_connect(const char *desc
, SAMR_R_CONNECT
* r_u
,
6712 prs_struct
*ps
, int depth
)
6717 prs_debug(ps
, depth
, desc
, "samr_io_r_connect");
6723 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6726 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6732 /*******************************************************************
6733 inits a SAMR_Q_CONNECT4 structure.
6734 ********************************************************************/
6736 void init_samr_q_connect4(SAMR_Q_CONNECT4
* q_u
,
6737 char *srv_name
, uint32 access_mask
)
6739 DEBUG(5, ("init_samr_q_connect\n"));
6741 /* make PDC server name \\server */
6742 q_u
->ptr_srv_name
= (srv_name
!= NULL
&& *srv_name
) ? 1 : 0;
6743 init_unistr2(&q_u
->uni_srv_name
, srv_name
, UNI_STR_TERMINATE
);
6745 /* Only value we've seen, possibly an address type ? */
6748 /* example values: 0x0000 0002 */
6749 q_u
->access_mask
= access_mask
;
6752 /*******************************************************************
6753 reads or writes a structure.
6754 ********************************************************************/
6756 BOOL
samr_io_q_connect4(const char *desc
, SAMR_Q_CONNECT4
* q_u
,
6757 prs_struct
*ps
, int depth
)
6762 prs_debug(ps
, depth
, desc
, "samr_io_q_connect4");
6768 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
6770 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
6775 if(!prs_uint32("unk_0", ps
, depth
, &q_u
->unk_0
))
6777 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6783 /*******************************************************************
6784 reads or writes a structure.
6785 ********************************************************************/
6787 BOOL
samr_io_r_connect4(const char *desc
, SAMR_R_CONNECT4
* r_u
,
6788 prs_struct
*ps
, int depth
)
6793 prs_debug(ps
, depth
, desc
, "samr_io_r_connect4");
6799 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6802 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6808 /*******************************************************************
6809 inits a SAMR_Q_CONNECT_ANON structure.
6810 ********************************************************************/
6812 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON
* q_u
)
6814 DEBUG(5, ("init_samr_q_connect_anon\n"));
6817 q_u
->unknown_0
= 0x5c; /* server name (?!!) */
6818 q_u
->unknown_1
= 0x01;
6819 q_u
->access_mask
= 0x20;
6822 /*******************************************************************
6823 reads or writes a structure.
6824 ********************************************************************/
6826 BOOL
samr_io_q_connect_anon(const char *desc
, SAMR_Q_CONNECT_ANON
* q_u
,
6827 prs_struct
*ps
, int depth
)
6832 prs_debug(ps
, depth
, desc
, "samr_io_q_connect_anon");
6838 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
6840 if(!prs_uint16("unknown_0", ps
, depth
, &q_u
->unknown_0
))
6842 if(!prs_uint16("unknown_1", ps
, depth
, &q_u
->unknown_1
))
6844 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6850 /*******************************************************************
6851 reads or writes a structure.
6852 ********************************************************************/
6854 BOOL
samr_io_r_connect_anon(const char *desc
, SAMR_R_CONNECT_ANON
* r_u
,
6855 prs_struct
*ps
, int depth
)
6860 prs_debug(ps
, depth
, desc
, "samr_io_r_connect_anon");
6866 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6869 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6875 /*******************************************************************
6876 inits a SAMR_Q_GET_DOM_PWINFO structure.
6877 ********************************************************************/
6879 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO
* q_u
,
6882 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
6885 init_unistr2(&q_u
->uni_srv_name
, srv_name
, UNI_FLAGS_NONE
);
6886 init_uni_hdr(&q_u
->hdr_srv_name
, &q_u
->uni_srv_name
);
6889 /*******************************************************************
6890 reads or writes a structure.
6891 ********************************************************************/
6893 BOOL
samr_io_q_get_dom_pwinfo(const char *desc
, SAMR_Q_GET_DOM_PWINFO
* q_u
,
6894 prs_struct
*ps
, int depth
)
6899 prs_debug(ps
, depth
, desc
, "samr_io_q_get_dom_pwinfo");
6905 if(!prs_uint32("ptr", ps
, depth
, &q_u
->ptr
))
6907 if (q_u
->ptr
!= 0) {
6908 if(!smb_io_unihdr("", &q_u
->hdr_srv_name
, ps
, depth
))
6910 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->hdr_srv_name
.buffer
, ps
, depth
))
6917 /*******************************************************************
6918 reads or writes a structure.
6919 ********************************************************************/
6921 BOOL
samr_io_r_get_dom_pwinfo(const char *desc
, SAMR_R_GET_DOM_PWINFO
* r_u
,
6922 prs_struct
*ps
, int depth
)
6927 prs_debug(ps
, depth
, desc
, "samr_io_r_get_dom_pwinfo");
6934 * see the Samba4 IDL for what these actually are.
6937 if(!prs_uint16("unk_0", ps
, depth
, &r_u
->unk_0
))
6941 if(!prs_uint32("unk_1", ps
, depth
, &r_u
->unk_1
))
6944 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
6950 /*******************************************************************
6951 make a SAMR_ENC_PASSWD structure.
6952 ********************************************************************/
6954 void init_enc_passwd(SAMR_ENC_PASSWD
* pwd
, const char pass
[512])
6962 memcpy(pwd
->pass
, pass
, sizeof(pwd
->pass
));
6966 /*******************************************************************
6967 reads or writes a SAMR_ENC_PASSWD structure.
6968 ********************************************************************/
6970 BOOL
samr_io_enc_passwd(const char *desc
, SAMR_ENC_PASSWD
* pwd
,
6971 prs_struct
*ps
, int depth
)
6976 prs_debug(ps
, depth
, desc
, "samr_io_enc_passwd");
6982 if(!prs_uint32("ptr", ps
, depth
, &pwd
->ptr
))
6985 if (pwd
->ptr
!= 0) {
6986 if(!prs_uint8s(False
, "pwd", ps
, depth
, pwd
->pass
, sizeof(pwd
->pass
)))
6993 /*******************************************************************
6994 inits a SAMR_ENC_HASH structure.
6995 ********************************************************************/
6997 void init_enc_hash(SAMR_ENC_HASH
* hsh
, const uchar hash
[16])
7005 memcpy(hsh
->hash
, hash
, sizeof(hsh
->hash
));
7009 /*******************************************************************
7010 reads or writes a SAMR_ENC_HASH structure.
7011 ********************************************************************/
7013 BOOL
samr_io_enc_hash(const char *desc
, SAMR_ENC_HASH
* hsh
,
7014 prs_struct
*ps
, int depth
)
7019 prs_debug(ps
, depth
, desc
, "samr_io_enc_hash");
7025 if(!prs_uint32("ptr ", ps
, depth
, &hsh
->ptr
))
7027 if (hsh
->ptr
!= 0) {
7028 if(!prs_uint8s(False
, "hash", ps
, depth
, hsh
->hash
,sizeof(hsh
->hash
)))
7035 /*******************************************************************
7036 inits a SAMR_R_GET_DOM_PWINFO structure.
7037 ********************************************************************/
7039 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER
* q_u
,
7040 const char *dest_host
, const char *user_name
,
7041 const char nt_newpass
[516],
7042 const uchar nt_oldhash
[16],
7043 const char lm_newpass
[516],
7044 const uchar lm_oldhash
[16])
7046 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
7049 init_unistr2(&q_u
->uni_dest_host
, dest_host
, UNI_FLAGS_NONE
);
7050 init_uni_hdr(&q_u
->hdr_dest_host
, &q_u
->uni_dest_host
);
7052 init_unistr2(&q_u
->uni_user_name
, user_name
, UNI_FLAGS_NONE
);
7053 init_uni_hdr(&q_u
->hdr_user_name
, &q_u
->uni_user_name
);
7055 init_enc_passwd(&q_u
->nt_newpass
, nt_newpass
);
7056 init_enc_hash(&q_u
->nt_oldhash
, nt_oldhash
);
7058 q_u
->unknown
= 0x01;
7060 init_enc_passwd(&q_u
->lm_newpass
, lm_newpass
);
7061 init_enc_hash(&q_u
->lm_oldhash
, lm_oldhash
);
7064 /*******************************************************************
7065 reads or writes a structure.
7066 ********************************************************************/
7068 BOOL
samr_io_q_chgpasswd_user(const char *desc
, SAMR_Q_CHGPASSWD_USER
* q_u
,
7069 prs_struct
*ps
, int depth
)
7074 prs_debug(ps
, depth
, desc
, "samr_io_q_chgpasswd_user");
7080 if(!prs_uint32("ptr_0", ps
, depth
, &q_u
->ptr_0
))
7083 if(!smb_io_unihdr("", &q_u
->hdr_dest_host
, ps
, depth
))
7085 if(!smb_io_unistr2("", &q_u
->uni_dest_host
, q_u
->hdr_dest_host
.buffer
, ps
, depth
))
7090 if(!smb_io_unihdr("", &q_u
->hdr_user_name
, ps
, depth
))
7092 if(!smb_io_unistr2("", &q_u
->uni_user_name
, q_u
->hdr_user_name
.buffer
,ps
, depth
))
7095 if(!samr_io_enc_passwd("nt_newpass", &q_u
->nt_newpass
, ps
, depth
))
7097 if(!samr_io_enc_hash("nt_oldhash", &q_u
->nt_oldhash
, ps
, depth
))
7100 if(!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
7103 if(!samr_io_enc_passwd("lm_newpass", &q_u
->lm_newpass
, ps
, depth
))
7105 if(!samr_io_enc_hash("lm_oldhash", &q_u
->lm_oldhash
, ps
, depth
))
7111 /*******************************************************************
7112 inits a SAMR_R_CHGPASSWD_USER structure.
7113 ********************************************************************/
7115 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER
* r_u
, NTSTATUS status
)
7117 DEBUG(5, ("init_r_chgpasswd_user\n"));
7119 r_u
->status
= status
;
7122 /*******************************************************************
7123 reads or writes a structure.
7124 ********************************************************************/
7126 BOOL
samr_io_r_chgpasswd_user(const char *desc
, SAMR_R_CHGPASSWD_USER
* r_u
,
7127 prs_struct
*ps
, int depth
)
7132 prs_debug(ps
, depth
, desc
, "samr_io_r_chgpasswd_user");
7138 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7144 /*******************************************************************
7145 reads or writes a structure.
7146 ********************************************************************/
7148 void init_samr_q_unknown_2e(SAMR_Q_UNKNOWN_2E
*q_u
,
7149 POLICY_HND
*domain_pol
, uint16 switch_value
)
7151 DEBUG(5, ("init_samr_q_unknown_2e\n"));
7153 q_u
->domain_pol
= *domain_pol
;
7154 q_u
->switch_value
= switch_value
;
7157 /*******************************************************************
7158 reads or writes a structure.
7159 ********************************************************************/
7161 BOOL
samr_io_q_unknown_2e(const char *desc
, SAMR_Q_UNKNOWN_2E
*q_u
,
7162 prs_struct
*ps
, int depth
)
7167 prs_debug(ps
, depth
, desc
, "samr_io_q_unknown_2e");
7173 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
7176 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
7182 /*******************************************************************
7183 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7184 ********************************************************************/
7186 void init_samr_r_samr_unknown_2e(SAMR_R_UNKNOWN_2E
* r_u
,
7187 uint16 switch_value
, SAM_UNK_CTR
* ctr
,
7190 DEBUG(5, ("init_samr_r_samr_unknown_2e\n"));
7193 r_u
->switch_value
= 0;
7194 r_u
->status
= status
; /* return status */
7196 if (NT_STATUS_IS_OK(status
)) {
7197 r_u
->switch_value
= switch_value
;
7203 /*******************************************************************
7204 reads or writes a structure.
7205 ********************************************************************/
7207 BOOL
samr_io_r_samr_unknown_2e(const char *desc
, SAMR_R_UNKNOWN_2E
* r_u
,
7208 prs_struct
*ps
, int depth
)
7213 prs_debug(ps
, depth
, desc
, "samr_io_r_samr_unknown_2e");
7219 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
7222 if (r_u
->ptr_0
!= 0 && r_u
->ctr
!= NULL
) {
7223 if(!prs_uint16("switch_value", ps
, depth
, &r_u
->switch_value
))
7228 switch (r_u
->switch_value
) {
7230 if(!sam_io_unk_info12("unk_inf12", &r_u
->ctr
->info
.inf12
, ps
, depth
))
7234 if(!sam_io_unk_info7("unk_inf7",&r_u
->ctr
->info
.inf7
, ps
,depth
))
7238 if(!sam_io_unk_info6("unk_inf6",&r_u
->ctr
->info
.inf6
, ps
,depth
))
7242 if(!sam_io_unk_info5("unk_inf5",&r_u
->ctr
->info
.inf5
, ps
,depth
))
7246 if(!sam_io_unk_info3("unk_inf3",&r_u
->ctr
->info
.inf3
, ps
,depth
))
7250 if(!sam_io_unk_info2("unk_inf2",&r_u
->ctr
->info
.inf2
, ps
,depth
))
7254 if(!sam_io_unk_info1("unk_inf1",&r_u
->ctr
->info
.inf1
, ps
,depth
))
7258 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
7259 r_u
->switch_value
));
7260 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
7268 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
7275 /*******************************************************************
7276 reads or writes a structure.
7277 ********************************************************************/
7279 void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO
*q_u
,
7280 POLICY_HND
*domain_pol
, uint16 switch_value
, SAM_UNK_CTR
*ctr
)
7282 DEBUG(5, ("init_samr_q_set_domain_info\n"));
7284 q_u
->domain_pol
= *domain_pol
;
7285 q_u
->switch_value0
= switch_value
;
7287 q_u
->switch_value
= switch_value
;
7292 /*******************************************************************
7293 reads or writes a structure.
7294 ********************************************************************/
7296 BOOL
samr_io_q_set_domain_info(const char *desc
, SAMR_Q_SET_DOMAIN_INFO
*q_u
,
7297 prs_struct
*ps
, int depth
)
7302 prs_debug(ps
, depth
, desc
, "samr_io_q_set_domain_info");
7308 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
7311 if(!prs_uint16("switch_value0", ps
, depth
, &q_u
->switch_value0
))
7314 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
7320 if ((q_u
->ctr
= PRS_ALLOC_MEM(ps
, SAM_UNK_CTR
, 1)) == NULL
)
7323 switch (q_u
->switch_value
) {
7326 if(!sam_io_unk_info12("unk_inf12", &q_u
->ctr
->info
.inf12
, ps
, depth
))
7330 if(!sam_io_unk_info7("unk_inf7",&q_u
->ctr
->info
.inf7
, ps
,depth
))
7334 if(!sam_io_unk_info6("unk_inf6",&q_u
->ctr
->info
.inf6
, ps
,depth
))
7338 if(!sam_io_unk_info5("unk_inf5",&q_u
->ctr
->info
.inf5
, ps
,depth
))
7342 if(!sam_io_unk_info3("unk_inf3",&q_u
->ctr
->info
.inf3
, ps
,depth
))
7346 if(!sam_io_unk_info2("unk_inf2",&q_u
->ctr
->info
.inf2
, ps
,depth
))
7350 if(!sam_io_unk_info1("unk_inf1",&q_u
->ctr
->info
.inf1
, ps
,depth
))
7354 DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
7355 q_u
->switch_value
));
7362 /*******************************************************************
7363 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
7364 ********************************************************************/
7366 void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO
* r_u
, NTSTATUS status
)
7368 DEBUG(5, ("init_samr_r_set_domain_info\n"));
7370 r_u
->status
= status
; /* return status */
7373 /*******************************************************************
7374 reads or writes a structure.
7375 ********************************************************************/
7377 BOOL
samr_io_r_set_domain_info(const char *desc
, SAMR_R_SET_DOMAIN_INFO
* r_u
,
7378 prs_struct
*ps
, int depth
)
7383 prs_debug(ps
, depth
, desc
, "samr_io_r_samr_unknown_2e");
7389 if(!prs_ntstatus("status", ps
, depth
, &r_u
->status
))