2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-2000,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
7 * Copyright (C) Paul Ashton 1997-2000,
8 * Copyright (C) Elrond 2000,
9 * Copyright (C) Jeremy Allison 2001
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include "rpc_parse.h"
31 extern int DEBUGLEVEL
;
33 /*******************************************************************
34 inits a SAMR_Q_CLOSE_HND structure.
35 ********************************************************************/
37 void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND
* q_c
, POLICY_HND
*hnd
)
39 DEBUG(5, ("init_samr_q_close_hnd\n"));
44 /*******************************************************************
45 reads or writes a structure.
46 ********************************************************************/
48 BOOL
samr_io_q_close_hnd(char *desc
, SAMR_Q_CLOSE_HND
* q_u
,
49 prs_struct
*ps
, int depth
)
54 prs_debug(ps
, depth
, desc
, "samr_io_q_close_hnd");
60 return smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
);
63 /*******************************************************************
64 reads or writes a structure.
65 ********************************************************************/
67 BOOL
samr_io_r_close_hnd(char *desc
, SAMR_R_CLOSE_HND
* r_u
,
68 prs_struct
*ps
, int depth
)
73 prs_debug(ps
, depth
, desc
, "samr_io_r_close_hnd");
79 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
82 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
88 /*******************************************************************
89 inits a SAMR_Q_LOOKUP_DOMAIN structure.
90 ********************************************************************/
92 void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN
* q_u
,
93 POLICY_HND
*pol
, char *dom_name
)
95 int len_name
= strlen(dom_name
);
97 DEBUG(5, ("init_samr_q_lookup_domain\n"));
99 q_u
->connect_pol
= *pol
;
101 init_uni_hdr(&q_u
->hdr_domain
, len_name
);
102 init_unistr2(&q_u
->uni_domain
, dom_name
, len_name
);
105 /*******************************************************************
106 reads or writes a structure.
107 ********************************************************************/
108 BOOL
samr_io_q_lookup_domain(char *desc
, SAMR_Q_LOOKUP_DOMAIN
* q_u
,
109 prs_struct
*ps
, int depth
)
114 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_domain");
120 if(!smb_io_pol_hnd("connect_pol", &q_u
->connect_pol
, ps
, depth
))
123 if(!smb_io_unihdr("hdr_domain", &q_u
->hdr_domain
, ps
, depth
))
126 if(!smb_io_unistr2("uni_domain", &q_u
->uni_domain
, q_u
->hdr_domain
.buffer
, ps
, depth
))
132 /*******************************************************************
133 inits a SAMR_R_LOOKUP_DOMAIN structure.
134 ********************************************************************/
136 void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN
* r_u
,
137 DOM_SID
*dom_sid
, uint32 status
)
139 DEBUG(5, ("init_samr_r_lookup_domain\n"));
141 r_u
->status
= status
;
145 init_dom_sid2(&r_u
->dom_sid
, dom_sid
);
149 /*******************************************************************
150 reads or writes a structure.
151 ********************************************************************/
153 BOOL
samr_io_r_lookup_domain(char *desc
, SAMR_R_LOOKUP_DOMAIN
* r_u
,
154 prs_struct
*ps
, int depth
)
159 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_domain");
165 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr_sid
))
168 if (r_u
->ptr_sid
!= 0) {
169 if(!smb_io_dom_sid2("sid", &r_u
->dom_sid
, ps
, depth
))
175 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
181 /*******************************************************************
182 reads or writes a structure.
183 ********************************************************************/
185 void init_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D
* q_u
, POLICY_HND
*dom_pol
, DOM_SID
*sid
)
187 DEBUG(5, ("samr_init_samr_q_unknown_2d\n"));
189 q_u
->dom_pol
= *dom_pol
;
190 init_dom_sid2(&q_u
->sid
, sid
);
193 /*******************************************************************
194 reads or writes a structure.
195 ********************************************************************/
197 BOOL
samr_io_q_unknown_2d(char *desc
, SAMR_Q_UNKNOWN_2D
* q_u
,
198 prs_struct
*ps
, int depth
)
203 prs_debug(ps
, depth
, desc
, "samr_io_q_unknown_2d");
209 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
212 if(!smb_io_dom_sid2("sid", &q_u
->sid
, ps
, depth
))
221 /*******************************************************************
222 reads or writes a structure.
223 ********************************************************************/
225 BOOL
samr_io_r_unknown_2d(char *desc
, SAMR_R_UNKNOWN_2D
* r_u
,
226 prs_struct
*ps
, int depth
)
231 prs_debug(ps
, depth
, desc
, "samr_io_r_unknown_2d");
237 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
243 /*******************************************************************
244 reads or writes a structure.
245 ********************************************************************/
247 void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN
* q_u
,
248 POLICY_HND
*pol
, uint32 flags
,
251 DEBUG(5, ("samr_init_samr_q_open_domain\n"));
255 init_dom_sid2(&q_u
->dom_sid
, sid
);
258 /*******************************************************************
259 reads or writes a structure.
260 ********************************************************************/
262 BOOL
samr_io_q_open_domain(char *desc
, SAMR_Q_OPEN_DOMAIN
* q_u
,
263 prs_struct
*ps
, int depth
)
268 prs_debug(ps
, depth
, desc
, "samr_io_q_open_domain");
274 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
277 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
280 if(!smb_io_dom_sid2("sid", &q_u
->dom_sid
, ps
, depth
))
286 /*******************************************************************
287 reads or writes a structure.
288 ********************************************************************/
290 BOOL
samr_io_r_open_domain(char *desc
, SAMR_R_OPEN_DOMAIN
* r_u
,
291 prs_struct
*ps
, int depth
)
296 prs_debug(ps
, depth
, desc
, "samr_io_r_open_domain");
302 if(!smb_io_pol_hnd("domain_pol", &r_u
->domain_pol
, ps
, depth
))
305 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
311 /*******************************************************************
312 reads or writes a structure.
313 ********************************************************************/
315 void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
316 POLICY_HND
*user_pol
)
318 DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
320 q_u
->user_pol
= *user_pol
;
323 /*******************************************************************
324 reads or writes a structure.
325 ********************************************************************/
327 BOOL
samr_io_q_get_usrdom_pwinfo(char *desc
, SAMR_Q_GET_USRDOM_PWINFO
* q_u
,
328 prs_struct
*ps
, int depth
)
333 prs_debug(ps
, depth
, desc
, "samr_io_q_get_usrdom_pwinfo");
339 return smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
);
342 /*******************************************************************
344 ********************************************************************/
346 void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO
*r_u
, uint32 status
)
348 DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
350 r_u
->unknown_0
= 0x0000;
351 r_u
->unknown_1
= 0x0015;
352 r_u
->unknown_2
= 0x00000000;
354 r_u
->status
= status
;
357 /*******************************************************************
358 reads or writes a structure.
359 ********************************************************************/
361 BOOL
samr_io_r_get_usrdom_pwinfo(char *desc
, SAMR_R_GET_USRDOM_PWINFO
* r_u
,
362 prs_struct
*ps
, int depth
)
367 prs_debug(ps
, depth
, desc
, "samr_io_r_get_usrdom_pwinfo");
373 if(!prs_uint16("unknown_0", ps
, depth
, &r_u
->unknown_0
))
375 if(!prs_uint16("unknown_1", ps
, depth
, &r_u
->unknown_1
))
377 if(!prs_uint32("unknown_2", ps
, depth
, &r_u
->unknown_2
))
379 if(!prs_uint32("status ", ps
, depth
, &r_u
->status
))
385 /*******************************************************************
386 reads or writes a structure.
387 ********************************************************************/
389 void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ
* q_u
,
390 POLICY_HND
*user_pol
, uint32 sec_info
)
392 DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
394 q_u
->user_pol
= *user_pol
;
395 q_u
->sec_info
= sec_info
;
399 /*******************************************************************
400 reads or writes a structure.
401 ********************************************************************/
403 BOOL
samr_io_q_query_sec_obj(char *desc
, SAMR_Q_QUERY_SEC_OBJ
* q_u
,
404 prs_struct
*ps
, int depth
)
409 prs_debug(ps
, depth
, desc
, "samr_io_q_query_sec_obj");
415 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
418 if(!prs_uint32("sec_info", ps
, depth
, &q_u
->sec_info
))
424 /*******************************************************************
425 reads or writes a structure.
426 ********************************************************************/
428 void init_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
429 POLICY_HND
*domain_pol
, uint16 switch_value
)
431 DEBUG(5, ("samr_init_samr_q_query_dom_info\n"));
433 q_u
->domain_pol
= *domain_pol
;
434 q_u
->switch_value
= switch_value
;
437 /*******************************************************************
438 reads or writes a structure.
439 ********************************************************************/
441 BOOL
samr_io_q_query_dom_info(char *desc
, SAMR_Q_QUERY_DOMAIN_INFO
* q_u
,
442 prs_struct
*ps
, int depth
)
447 prs_debug(ps
, depth
, desc
, "samr_io_q_query_dom_info");
453 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
456 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
463 /*******************************************************************
465 ********************************************************************/
467 void init_unk_info3(SAM_UNK_INFO_3
* u_3
)
469 u_3
->unknown_0
= 0x00000000;
470 u_3
->unknown_1
= 0x80000000;
473 /*******************************************************************
474 reads or writes a structure.
475 ********************************************************************/
477 static BOOL
sam_io_unk_info3(char *desc
, SAM_UNK_INFO_3
* u_3
,
478 prs_struct
*ps
, int depth
)
483 prs_debug(ps
, depth
, desc
, "sam_io_unk_info3");
486 if(!prs_uint32("unknown_0", ps
, depth
, &u_3
->unknown_0
)) /* 0x0000 0000 */
488 if(!prs_uint32("unknown_1", ps
, depth
, &u_3
->unknown_1
)) /* 0x8000 0000 */
494 /*******************************************************************
496 ********************************************************************/
498 void init_unk_info6(SAM_UNK_INFO_6
* u_6
)
500 u_6
->unknown_0
= 0x00000000;
502 memset(u_6
->padding
, 0, sizeof(u_6
->padding
)); /* 12 bytes zeros */
505 /*******************************************************************
506 reads or writes a structure.
507 ********************************************************************/
509 static BOOL
sam_io_unk_info6(char *desc
, SAM_UNK_INFO_6
* u_6
,
510 prs_struct
*ps
, int depth
)
515 prs_debug(ps
, depth
, desc
, "sam_io_unk_info6");
518 if(!prs_uint32("unknown_0", ps
, depth
, &u_6
->unknown_0
)) /* 0x0000 0000 */
520 if(!prs_uint32("ptr_0", ps
, depth
, &u_6
->ptr_0
)) /* pointer to unknown structure */
522 if(!prs_uint8s(False
, "padding", ps
, depth
, u_6
->padding
, sizeof(u_6
->padding
))) /* 12 bytes zeros */
528 /*******************************************************************
530 ********************************************************************/
532 void init_unk_info7(SAM_UNK_INFO_7
* u_7
)
534 u_7
->unknown_0
= 0x0003;
537 /*******************************************************************
538 reads or writes a structure.
539 ********************************************************************/
541 static BOOL
sam_io_unk_info7(char *desc
, SAM_UNK_INFO_7
* u_7
,
542 prs_struct
*ps
, int depth
)
547 prs_debug(ps
, depth
, desc
, "sam_io_unk_info7");
550 if(!prs_uint16("unknown_0", ps
, depth
, &u_7
->unknown_0
)) /* 0x0003 */
556 /*******************************************************************
558 ********************************************************************/
560 void init_unk_info12(SAM_UNK_INFO_12
* u_12
)
562 u_12
->unknown_0
= 0xcf1dcc00;
563 u_12
->unknown_1
= 0xfffffffb;
564 u_12
->unknown_2
= 0xcf1dcc00;
565 u_12
->unknown_3
= 0xfffffffb;
567 u_12
->unknown_4
= 0x8a880000;
570 /*******************************************************************
571 reads or writes a structure.
572 ********************************************************************/
574 static BOOL
sam_io_unk_info12(char *desc
, SAM_UNK_INFO_12
* u_12
,
575 prs_struct
*ps
, int depth
)
580 prs_debug(ps
, depth
, desc
, "sam_io_unk_info12");
583 if(!prs_uint32("unknown_0", ps
, depth
, &u_12
->unknown_0
))
585 if(!prs_uint32("unknown_1", ps
, depth
, &u_12
->unknown_1
))
587 if(!prs_uint32("unknown_2", ps
, depth
, &u_12
->unknown_2
))
589 if(!prs_uint32("unknown_3", ps
, depth
, &u_12
->unknown_3
))
591 if(!prs_uint32("unknown_4", ps
, depth
, &u_12
->unknown_4
))
597 /*******************************************************************
599 ********************************************************************/
600 void init_unk_info2(SAM_UNK_INFO_2
* u_2
,
601 char *domain
, char *server
,
604 int len_domain
= strlen(domain
);
605 int len_server
= strlen(server
);
607 u_2
->unknown_0
= 0x00000000;
608 u_2
->unknown_1
= 0x80000000;
609 u_2
->unknown_2
= 0x00000000;
612 init_uni_hdr(&u_2
->hdr_domain
, len_domain
);
613 init_uni_hdr(&u_2
->hdr_server
, len_server
);
615 u_2
->seq_num
= seq_num
;
616 u_2
->unknown_3
= 0x00000000;
618 u_2
->unknown_4
= 0x00000001;
619 u_2
->unknown_5
= 0x00000003;
620 u_2
->unknown_6
= 0x00000001;
621 u_2
->num_domain_usrs
= MAX_SAM_ENTRIES
;
622 u_2
->num_domain_grps
= MAX_SAM_ENTRIES
;
623 u_2
->num_local_grps
= MAX_SAM_ENTRIES
;
625 memset(u_2
->padding
, 0, sizeof(u_2
->padding
)); /* 12 bytes zeros */
627 init_unistr2(&u_2
->uni_domain
, domain
, len_domain
);
628 init_unistr2(&u_2
->uni_server
, server
, len_server
);
631 /*******************************************************************
632 reads or writes a structure.
633 ********************************************************************/
635 static BOOL
sam_io_unk_info2(char *desc
, SAM_UNK_INFO_2
* u_2
,
636 prs_struct
*ps
, int depth
)
641 prs_debug(ps
, depth
, desc
, "sam_io_unk_info2");
644 if(!prs_uint32("unknown_0", ps
, depth
, &u_2
->unknown_0
)) /* 0x0000 0000 */
646 if(!prs_uint32("unknown_1", ps
, depth
, &u_2
->unknown_1
)) /* 0x8000 0000 */
648 if(!prs_uint32("unknown_2", ps
, depth
, &u_2
->unknown_2
)) /* 0x0000 0000 */
651 if(!prs_uint32("ptr_0", ps
, depth
, &u_2
->ptr_0
))
653 if(!smb_io_unihdr("hdr_domain", &u_2
->hdr_domain
, ps
, depth
))
655 if(!smb_io_unihdr("hdr_server", &u_2
->hdr_server
, ps
, depth
))
658 /* put all the data in here, at the moment, including what the above
659 pointer is referring to
662 if(!prs_uint32("seq_num ", ps
, depth
, &u_2
->seq_num
)) /* 0x0000 0099 or 0x1000 0000 */
664 if(!prs_uint32("unknown_3 ", ps
, depth
, &u_2
->unknown_3
)) /* 0x0000 0000 */
667 if(!prs_uint32("unknown_4 ", ps
, depth
, &u_2
->unknown_4
)) /* 0x0000 0001 */
669 if(!prs_uint32("unknown_5 ", ps
, depth
, &u_2
->unknown_5
)) /* 0x0000 0003 */
671 if(!prs_uint32("unknown_6 ", ps
, depth
, &u_2
->unknown_6
)) /* 0x0000 0001 */
673 if(!prs_uint32("num_domain_usrs ", ps
, depth
, &u_2
->num_domain_usrs
))
675 if(!prs_uint32("num_domain_grps", ps
, depth
, &u_2
->num_domain_grps
))
677 if(!prs_uint32("num_local_grps", ps
, depth
, &u_2
->num_local_grps
))
680 if(!prs_uint8s(False
, "padding", ps
, depth
, u_2
->padding
,sizeof(u_2
->padding
)))
683 if(!smb_io_unistr2("uni_domain", &u_2
->uni_domain
, u_2
->hdr_domain
.buffer
, ps
, depth
))
685 if(!smb_io_unistr2("uni_server", &u_2
->uni_server
, u_2
->hdr_server
.buffer
, ps
, depth
))
691 /*******************************************************************
693 ********************************************************************/
695 void init_unk_info1(SAM_UNK_INFO_1
* u_1
)
697 memset(u_1
->padding
, 0, sizeof(u_1
->padding
)); /* 12 bytes zeros */
698 u_1
->unknown_1
= 0x80000000;
699 u_1
->unknown_2
= 0x00000000;
702 /*******************************************************************
703 reads or writes a structure.
704 ********************************************************************/
706 static BOOL
sam_io_unk_info1(char *desc
, SAM_UNK_INFO_1
* u_1
,
707 prs_struct
*ps
, int depth
)
712 prs_debug(ps
, depth
, desc
, "sam_io_unk_info1");
715 if(!prs_uint8s(False
, "padding", ps
, depth
, u_1
->padding
, sizeof(u_1
->padding
)))
718 if(!prs_uint32("unknown_1", ps
, depth
, &u_1
->unknown_1
)) /* 0x8000 0000 */
720 if(!prs_uint32("unknown_2", ps
, depth
, &u_1
->unknown_2
)) /* 0x0000 0000 */
726 /*******************************************************************
727 inits a SAMR_R_QUERY_DOMAIN_INFO structure.
728 ********************************************************************/
730 void init_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
731 uint16 switch_value
, SAM_UNK_CTR
* ctr
,
734 DEBUG(5, ("init_samr_r_query_dom_info\n"));
737 r_u
->switch_value
= 0;
738 r_u
->status
= status
; /* return status */
741 r_u
->switch_value
= switch_value
;
747 /*******************************************************************
748 reads or writes a structure.
749 ********************************************************************/
751 BOOL
samr_io_r_query_dom_info(char *desc
, SAMR_R_QUERY_DOMAIN_INFO
* r_u
,
752 prs_struct
*ps
, int depth
)
757 prs_debug(ps
, depth
, desc
, "samr_io_r_query_dom_info");
763 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
766 if (r_u
->ptr_0
!= 0 && r_u
->ctr
!= NULL
) {
767 if(!prs_uint16("switch_value", ps
, depth
, &r_u
->switch_value
))
772 switch (r_u
->switch_value
) {
774 if(!sam_io_unk_info12("unk_inf12", &r_u
->ctr
->info
.inf12
, ps
, depth
))
778 if(!sam_io_unk_info7("unk_inf7",&r_u
->ctr
->info
.inf7
, ps
,depth
))
782 if(!sam_io_unk_info6("unk_inf6",&r_u
->ctr
->info
.inf6
, ps
,depth
))
786 if(!sam_io_unk_info3("unk_inf3",&r_u
->ctr
->info
.inf3
, ps
,depth
))
790 if(!sam_io_unk_info2("unk_inf2",&r_u
->ctr
->info
.inf2
, ps
,depth
))
794 if(!sam_io_unk_info1("unk_inf1",&r_u
->ctr
->info
.inf1
, ps
,depth
))
798 DEBUG(0, ("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
800 r_u
->status
= NT_STATUS_INVALID_INFO_CLASS
;
808 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
814 /*******************************************************************
815 reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
816 ********************************************************************/
818 BOOL
samr_io_r_query_sec_obj(char *desc
, SAMR_R_QUERY_SEC_OBJ
* r_u
,
819 prs_struct
*ps
, int depth
)
824 prs_debug(ps
, depth
, desc
, "samr_io_r_query_sec_obj");
830 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
833 if(!sec_io_desc_buf("sec", &r_u
->buf
, ps
, depth
))
837 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
843 /*******************************************************************
844 reads or writes a SAM_STR1 structure.
845 ********************************************************************/
847 static BOOL
sam_io_sam_str1(char *desc
, SAM_STR1
* sam
, uint32 acct_buf
,
848 uint32 name_buf
, uint32 desc_buf
,
849 prs_struct
*ps
, int depth
)
854 prs_debug(ps
, depth
, desc
, "sam_io_sam_str1");
859 if (!smb_io_unistr2("name", &sam
->uni_acct_name
, acct_buf
, ps
, depth
))
862 if (!smb_io_unistr2("desc", &sam
->uni_acct_desc
, desc_buf
, ps
, depth
))
865 if (!smb_io_unistr2("full", &sam
->uni_full_name
, name_buf
, ps
, depth
))
871 /*******************************************************************
872 inits a SAM_ENTRY1 structure.
873 ********************************************************************/
875 static void init_sam_entry1(SAM_ENTRY1
* sam
, uint32 user_idx
,
876 uint32 len_sam_name
, uint32 len_sam_full
,
877 uint32 len_sam_desc
, uint32 rid_user
,
880 DEBUG(5, ("init_sam_entry1\n"));
884 sam
->user_idx
= user_idx
;
885 sam
->rid_user
= rid_user
;
886 sam
->acb_info
= acb_info
;
889 init_uni_hdr(&sam
->hdr_acct_name
, len_sam_name
);
890 init_uni_hdr(&sam
->hdr_user_name
, len_sam_full
);
891 init_uni_hdr(&sam
->hdr_user_desc
, len_sam_desc
);
894 /*******************************************************************
895 reads or writes a SAM_ENTRY1 structure.
896 ********************************************************************/
898 static BOOL
sam_io_sam_entry1(char *desc
, SAM_ENTRY1
* sam
,
899 prs_struct
*ps
, int depth
)
904 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry1");
910 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
913 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
915 if(!prs_uint16("acb_info ", ps
, depth
, &sam
->acb_info
))
917 if(!prs_uint16("pad ", ps
, depth
, &sam
->pad
))
920 if (!smb_io_unihdr("hdr_acct_name", &sam
->hdr_acct_name
, ps
, depth
))
922 if (!smb_io_unihdr("hdr_user_desc", &sam
->hdr_user_desc
, ps
, depth
))
924 if (!smb_io_unihdr("hdr_user_name", &sam
->hdr_user_name
, ps
, depth
))
930 /*******************************************************************
931 reads or writes a SAM_STR2 structure.
932 ********************************************************************/
934 static BOOL
sam_io_sam_str2(char *desc
, SAM_STR2
* sam
, uint32 acct_buf
,
935 uint32 desc_buf
, prs_struct
*ps
, int depth
)
940 prs_debug(ps
, depth
, desc
, "sam_io_sam_str2");
946 if(!smb_io_unistr2("uni_srv_name", &sam
->uni_srv_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
948 if(!smb_io_unistr2("uni_srv_desc", &sam
->uni_srv_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
954 /*******************************************************************
955 inits a SAM_ENTRY2 structure.
956 ********************************************************************/
957 static void init_sam_entry2(SAM_ENTRY2
* sam
, uint32 user_idx
,
958 uint32 len_sam_name
, uint32 len_sam_desc
,
959 uint32 rid_user
, uint16 acb_info
)
961 DEBUG(5, ("init_sam_entry2\n"));
963 sam
->user_idx
= user_idx
;
964 sam
->rid_user
= rid_user
;
965 sam
->acb_info
= acb_info
;
968 init_uni_hdr(&sam
->hdr_srv_name
, len_sam_name
);
969 init_uni_hdr(&sam
->hdr_srv_desc
, len_sam_desc
);
972 /*******************************************************************
973 reads or writes a SAM_ENTRY2 structure.
974 ********************************************************************/
976 static BOOL
sam_io_sam_entry2(char *desc
, SAM_ENTRY2
* sam
,
977 prs_struct
*ps
, int depth
)
982 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry2");
988 if(!prs_uint32("user_idx ", ps
, depth
, &sam
->user_idx
))
991 if(!prs_uint32("rid_user ", ps
, depth
, &sam
->rid_user
))
993 if(!prs_uint16("acb_info ", ps
, depth
, &sam
->acb_info
))
995 if(!prs_uint16("pad ", ps
, depth
, &sam
->pad
))
998 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_name
, ps
, depth
)) /* account name unicode string header */
1000 if(!smb_io_unihdr("unihdr", &sam
->hdr_srv_desc
, ps
, depth
)) /* account name unicode string header */
1006 /*******************************************************************
1007 reads or writes a SAM_STR3 structure.
1008 ********************************************************************/
1010 static BOOL
sam_io_sam_str3(char *desc
, SAM_STR3
* sam
, uint32 acct_buf
,
1011 uint32 desc_buf
, prs_struct
*ps
, int depth
)
1016 prs_debug(ps
, depth
, desc
, "sam_io_sam_str3");
1022 if(!smb_io_unistr2("uni_grp_name", &sam
->uni_grp_name
, acct_buf
, ps
, depth
)) /* account name unicode string */
1024 if(!smb_io_unistr2("uni_grp_desc", &sam
->uni_grp_desc
, desc_buf
, ps
, depth
)) /* account desc unicode string */
1030 /*******************************************************************
1031 inits a SAM_ENTRY3 structure.
1032 ********************************************************************/
1034 static void init_sam_entry3(SAM_ENTRY3
* sam
, uint32 grp_idx
,
1035 uint32 len_grp_name
, uint32 len_grp_desc
,
1038 DEBUG(5, ("init_sam_entry3\n"));
1040 sam
->grp_idx
= grp_idx
;
1041 sam
->rid_grp
= rid_grp
;
1042 sam
->attr
= 0x07; /* group rid attributes - gets ignored by nt 4.0 */
1044 init_uni_hdr(&sam
->hdr_grp_name
, len_grp_name
);
1045 init_uni_hdr(&sam
->hdr_grp_desc
, len_grp_desc
);
1048 /*******************************************************************
1049 reads or writes a SAM_ENTRY3 structure.
1050 ********************************************************************/
1052 static BOOL
sam_io_sam_entry3(char *desc
, SAM_ENTRY3
* sam
,
1053 prs_struct
*ps
, int depth
)
1058 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry3");
1064 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1067 if(!prs_uint32("rid_grp", ps
, depth
, &sam
->rid_grp
))
1069 if(!prs_uint32("attr ", ps
, depth
, &sam
->attr
))
1072 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_name
, ps
, depth
)) /* account name unicode string header */
1074 if(!smb_io_unihdr("unihdr", &sam
->hdr_grp_desc
, ps
, depth
)) /* account name unicode string header */
1080 /*******************************************************************
1081 inits a SAM_ENTRY4 structure.
1082 ********************************************************************/
1084 static void init_sam_entry4(SAM_ENTRY4
* sam
, uint32 user_idx
,
1085 uint32 len_acct_name
)
1087 DEBUG(5, ("init_sam_entry4\n"));
1089 sam
->user_idx
= user_idx
;
1090 init_str_hdr(&sam
->hdr_acct_name
, len_acct_name
, len_acct_name
,
1091 len_acct_name
!= 0);
1094 /*******************************************************************
1095 reads or writes a SAM_ENTRY4 structure.
1096 ********************************************************************/
1098 static BOOL
sam_io_sam_entry4(char *desc
, SAM_ENTRY4
* sam
,
1099 prs_struct
*ps
, int depth
)
1104 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry4");
1110 if(!prs_uint32("user_idx", ps
, depth
, &sam
->user_idx
))
1112 if(!smb_io_strhdr("strhdr", &sam
->hdr_acct_name
, ps
, depth
))
1118 /*******************************************************************
1119 inits a SAM_ENTRY5 structure.
1120 ********************************************************************/
1122 static void init_sam_entry5(SAM_ENTRY5
* sam
, uint32 grp_idx
,
1123 uint32 len_grp_name
)
1125 DEBUG(5, ("init_sam_entry5\n"));
1127 sam
->grp_idx
= grp_idx
;
1128 init_str_hdr(&sam
->hdr_grp_name
, len_grp_name
, len_grp_name
,
1132 /*******************************************************************
1133 reads or writes a SAM_ENTRY5 structure.
1134 ********************************************************************/
1136 static BOOL
sam_io_sam_entry5(char *desc
, SAM_ENTRY5
* sam
,
1137 prs_struct
*ps
, int depth
)
1142 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry5");
1148 if(!prs_uint32("grp_idx", ps
, depth
, &sam
->grp_idx
))
1150 if(!smb_io_strhdr("strhdr", &sam
->hdr_grp_name
, ps
, depth
))
1156 /*******************************************************************
1157 inits a SAM_ENTRY structure.
1158 ********************************************************************/
1160 void init_sam_entry(SAM_ENTRY
* sam
, uint32 len_sam_name
, uint32 rid
)
1162 DEBUG(10, ("init_sam_entry: %d %d\n", len_sam_name
, rid
));
1165 init_uni_hdr(&sam
->hdr_name
, len_sam_name
);
1168 /*******************************************************************
1169 reads or writes a SAM_ENTRY structure.
1170 ********************************************************************/
1172 static BOOL
sam_io_sam_entry(char *desc
, SAM_ENTRY
* sam
,
1173 prs_struct
*ps
, int depth
)
1178 prs_debug(ps
, depth
, desc
, "sam_io_sam_entry");
1183 if(!prs_uint32("rid", ps
, depth
, &sam
->rid
))
1185 if(!smb_io_unihdr("unihdr", &sam
->hdr_name
, ps
, depth
)) /* account name unicode string header */
1191 /*******************************************************************
1192 inits a SAMR_Q_ENUM_DOM_USERS structure.
1193 ********************************************************************/
1195 void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS
* q_e
, POLICY_HND
*pol
,
1197 uint16 acb_mask
, uint16 unk_1
, uint32 size
)
1199 DEBUG(5, ("init_samr_q_enum_dom_users\n"));
1203 q_e
->start_idx
= start_idx
; /* zero indicates lots */
1204 q_e
->acb_mask
= acb_mask
;
1205 q_e
->unknown_1
= unk_1
;
1206 q_e
->max_size
= size
;
1209 /*******************************************************************
1210 reads or writes a structure.
1211 ********************************************************************/
1213 BOOL
samr_io_q_enum_dom_users(char *desc
, SAMR_Q_ENUM_DOM_USERS
* q_e
,
1214 prs_struct
*ps
, int depth
)
1219 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_users");
1225 if(!smb_io_pol_hnd("domain_pol", &q_e
->pol
, ps
, depth
))
1228 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
1230 if(!prs_uint16("acb_mask ", ps
, depth
, &q_e
->acb_mask
))
1232 if(!prs_uint16("unknown_1", ps
, depth
, &q_e
->unknown_1
))
1235 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1242 /*******************************************************************
1243 inits a SAMR_R_ENUM_DOM_USERS structure.
1244 ********************************************************************/
1246 void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS
* r_u
,
1247 uint32 next_idx
, uint32 num_sam_entries
)
1249 DEBUG(5, ("init_samr_r_enum_dom_users\n"));
1251 r_u
->next_idx
= next_idx
;
1253 if (num_sam_entries
!= 0) {
1254 r_u
->ptr_entries1
= 1;
1255 r_u
->ptr_entries2
= 1;
1256 r_u
->num_entries2
= num_sam_entries
;
1257 r_u
->num_entries3
= num_sam_entries
;
1259 r_u
->num_entries4
= num_sam_entries
;
1261 r_u
->ptr_entries1
= 0;
1262 r_u
->num_entries2
= num_sam_entries
;
1263 r_u
->ptr_entries2
= 1;
1267 /*******************************************************************
1268 reads or writes a structure.
1269 ********************************************************************/
1271 BOOL
samr_io_r_enum_dom_users(char *desc
, SAMR_R_ENUM_DOM_USERS
* r_u
,
1272 prs_struct
*ps
, int depth
)
1279 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_users");
1285 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
1287 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
1290 if (r_u
->ptr_entries1
!= 0) {
1291 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
1293 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
1295 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
1298 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
!= 0)) {
1299 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
1300 r_u
->uni_acct_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
1303 if ((r_u
->sam
== NULL
|| r_u
->uni_acct_name
== NULL
) && r_u
->num_entries2
!= 0) {
1304 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
1305 r_u
->num_entries4
= 0;
1306 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
1310 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1311 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
1315 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
1316 if(!smb_io_unistr2("", &r_u
->uni_acct_name
[i
],r_u
->sam
[i
].hdr_name
.buffer
, ps
,depth
))
1325 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
1327 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
1333 /*******************************************************************
1334 inits a SAMR_Q_QUERY_DISPINFO structure.
1335 ********************************************************************/
1337 void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO
* q_e
, POLICY_HND
*pol
,
1338 uint16 switch_level
, uint32 start_idx
,
1341 DEBUG(5, ("init_samr_q_query_dispinfo\n"));
1343 q_e
->domain_pol
= *pol
;
1345 q_e
->switch_level
= switch_level
;
1347 q_e
->start_idx
= start_idx
;
1348 q_e
->max_entries
= max_entries
;
1349 q_e
->max_size
= 0xffff; /* Not especially useful */
1352 /*******************************************************************
1353 reads or writes a structure.
1354 ********************************************************************/
1356 BOOL
samr_io_q_query_dispinfo(char *desc
, SAMR_Q_QUERY_DISPINFO
* q_e
,
1357 prs_struct
*ps
, int depth
)
1362 prs_debug(ps
, depth
, desc
, "samr_io_q_query_dispinfo");
1368 if(!smb_io_pol_hnd("domain_pol", &q_e
->domain_pol
, ps
, depth
))
1371 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
1376 if(!prs_uint32("start_idx ", ps
, depth
, &q_e
->start_idx
))
1378 if(!prs_uint32("max_entries ", ps
, depth
, &q_e
->max_entries
))
1380 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
1386 /*******************************************************************
1387 inits a SAM_DISPINFO_1 structure.
1388 ********************************************************************/
1390 void init_sam_dispinfo_1(SAM_DISPINFO_1
* sam
, uint32
*num_entries
,
1391 uint32
*data_size
, uint32 start_idx
,
1392 SAM_USER_INFO_21 pass
[MAX_SAM_ENTRIES
])
1394 uint32 len_sam_name
, len_sam_full
, len_sam_desc
;
1395 uint32 max_entries
, max_data_size
;
1401 max_entries
= *num_entries
;
1402 max_data_size
= *data_size
;
1404 DEBUG(5, ("init_sam_dispinfo_1: max_entries: %d max_dsize: 0x%x\n",
1405 max_entries
, max_data_size
));
1407 for (i
= 0; (i
< max_entries
) && (dsize
< max_data_size
); i
++) {
1408 len_sam_name
= pass
[i
].uni_user_name
.uni_str_len
;
1409 len_sam_full
= pass
[i
].uni_full_name
.uni_str_len
;
1410 len_sam_desc
= pass
[i
].uni_acct_desc
.uni_str_len
;
1412 init_sam_entry1(&sam
->sam
[i
], start_idx
+ i
+ 1,
1413 len_sam_name
, len_sam_full
, len_sam_desc
,
1414 pass
[i
].user_rid
, pass
[i
].acb_info
);
1416 copy_unistr2(&sam
->str
[i
].uni_acct_name
, &pass
[i
].uni_user_name
);
1417 copy_unistr2(&sam
->str
[i
].uni_full_name
, &pass
[i
].uni_full_name
);
1418 copy_unistr2(&sam
->str
[i
].uni_acct_desc
, &pass
[i
].uni_acct_desc
);
1420 dsize
+= sizeof(SAM_ENTRY1
);
1421 dsize
+= len_sam_name
+ len_sam_full
+ len_sam_desc
;
1428 /*******************************************************************
1429 reads or writes a structure.
1430 ********************************************************************/
1432 static BOOL
sam_io_sam_dispinfo_1(char *desc
, SAM_DISPINFO_1
* sam
,
1434 prs_struct
*ps
, int depth
)
1441 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_1");
1447 SMB_ASSERT_ARRAY(sam
->sam
, num_entries
);
1449 for (i
= 0; i
< num_entries
; i
++) {
1450 if(!sam_io_sam_entry1("", &sam
->sam
[i
], ps
, depth
))
1454 for (i
= 0; i
< num_entries
; i
++) {
1455 if(!sam_io_sam_str1("", &sam
->str
[i
],
1456 sam
->sam
[i
].hdr_acct_name
.buffer
,
1457 sam
->sam
[i
].hdr_user_name
.buffer
,
1458 sam
->sam
[i
].hdr_user_desc
.buffer
, ps
, depth
))
1465 /*******************************************************************
1466 inits a SAM_DISPINFO_2 structure.
1467 ********************************************************************/
1469 void init_sam_dispinfo_2(SAM_DISPINFO_2
* sam
, uint32
*num_entries
,
1470 uint32
*data_size
, uint32 start_idx
,
1471 SAM_USER_INFO_21 pass
[MAX_SAM_ENTRIES
])
1473 uint32 len_sam_name
, len_sam_desc
;
1474 uint32 max_entries
, max_data_size
;
1478 DEBUG(5, ("init_sam_dispinfo_2\n"));
1482 max_entries
= *num_entries
;
1483 max_data_size
= *data_size
;
1485 for (i
= 0; (i
< max_entries
) && (dsize
< max_data_size
); i
++) {
1486 len_sam_name
= pass
[i
].uni_user_name
.uni_str_len
;
1487 len_sam_desc
= pass
[i
].uni_acct_desc
.uni_str_len
;
1489 init_sam_entry2(&sam
->sam
[i
], start_idx
+ i
+ 1,
1490 len_sam_name
, len_sam_desc
,
1491 pass
[i
].user_rid
, pass
[i
].acb_info
);
1493 copy_unistr2(&sam
->str
[i
].uni_srv_name
,
1494 &pass
[i
].uni_user_name
);
1495 copy_unistr2(&sam
->str
[i
].uni_srv_desc
,
1496 &pass
[i
].uni_acct_desc
);
1498 dsize
+= sizeof(SAM_ENTRY2
);
1499 dsize
+= len_sam_name
+ len_sam_desc
;
1506 /*******************************************************************
1507 reads or writes a structure.
1508 ********************************************************************/
1510 static BOOL
sam_io_sam_dispinfo_2(char *desc
, SAM_DISPINFO_2
* sam
,
1512 prs_struct
*ps
, int depth
)
1519 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_2");
1525 SMB_ASSERT_ARRAY(sam
->sam
, num_entries
);
1527 for (i
= 0; i
< num_entries
; i
++) {
1528 if(!sam_io_sam_entry2("", &sam
->sam
[i
], ps
, depth
))
1532 for (i
= 0; i
< num_entries
; i
++) {
1533 if(!sam_io_sam_str2("", &sam
->str
[i
],
1534 sam
->sam
[i
].hdr_srv_name
.buffer
,
1535 sam
->sam
[i
].hdr_srv_desc
.buffer
, ps
, depth
))
1542 /*******************************************************************
1543 inits a SAM_DISPINFO_3 structure.
1544 ********************************************************************/
1546 void init_sam_dispinfo_3(SAM_DISPINFO_3
* sam
, uint32
*num_entries
,
1547 uint32
*data_size
, uint32 start_idx
,
1550 uint32 len_sam_name
, len_sam_desc
;
1551 uint32 max_entries
, max_data_size
;
1555 DEBUG(5, ("init_sam_dispinfo_3\n"));
1559 max_entries
= *num_entries
;
1560 max_data_size
= *data_size
;
1562 for (i
= 0; (i
< max_entries
) && (dsize
< max_data_size
); i
++) {
1563 len_sam_name
= strlen(grp
[i
].name
);
1564 len_sam_desc
= strlen(grp
[i
].comment
);
1566 init_sam_entry3(&sam
->sam
[i
], start_idx
+ i
+ 1, len_sam_name
, len_sam_desc
, grp
[i
].rid
);
1568 init_unistr2(&sam
->str
[i
].uni_grp_name
, grp
[i
].name
, len_sam_name
);
1569 init_unistr2(&sam
->str
[i
].uni_grp_desc
, grp
[i
].comment
, len_sam_desc
);
1571 dsize
+= sizeof(SAM_ENTRY3
);
1572 dsize
+= (len_sam_name
+ len_sam_desc
) * 2;
1580 /*******************************************************************
1581 reads or writes a structure.
1582 ********************************************************************/
1584 static BOOL
sam_io_sam_dispinfo_3(char *desc
, SAM_DISPINFO_3
* sam
,
1586 prs_struct
*ps
, int depth
)
1593 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_3");
1599 SMB_ASSERT_ARRAY(sam
->sam
, num_entries
);
1601 for (i
= 0; i
< num_entries
; i
++) {
1602 if(!sam_io_sam_entry3("", &sam
->sam
[i
], ps
, depth
))
1606 for (i
= 0; i
< num_entries
; i
++) {
1607 if(!sam_io_sam_str3("", &sam
->str
[i
],
1608 sam
->sam
[i
].hdr_grp_name
.buffer
,
1609 sam
->sam
[i
].hdr_grp_desc
.buffer
, ps
, depth
))
1616 /*******************************************************************
1617 inits a SAM_DISPINFO_4 structure.
1618 ********************************************************************/
1620 void init_sam_dispinfo_4(SAM_DISPINFO_4
* sam
, uint32
*num_entries
,
1621 uint32
*data_size
, uint32 start_idx
,
1622 SAM_USER_INFO_21 pass
[MAX_SAM_ENTRIES
])
1625 uint32 len_sam_name
;
1626 uint32 max_entries
, max_data_size
;
1630 DEBUG(5, ("init_sam_dispinfo_4\n"));
1634 max_entries
= *num_entries
;
1635 max_data_size
= *data_size
;
1637 for (i
= 0; (i
< max_entries
) && (dsize
< max_data_size
); i
++) {
1638 len_sam_name
= pass
[i
].uni_user_name
.uni_str_len
;
1640 init_sam_entry4(&sam
->sam
[i
], start_idx
+ i
+ 1,
1643 unistr2_to_ascii(sam_name
, &pass
[i
].uni_user_name
,
1645 init_string2(&sam
->str
[i
].acct_name
, sam_name
,
1648 dsize
+= sizeof(SAM_ENTRY4
);
1649 dsize
+= len_sam_name
;
1656 /*******************************************************************
1657 reads or writes a structure.
1658 ********************************************************************/
1660 static BOOL
sam_io_sam_dispinfo_4(char *desc
, SAM_DISPINFO_4
* sam
,
1662 prs_struct
*ps
, int depth
)
1669 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_4");
1675 SMB_ASSERT_ARRAY(sam
->sam
, num_entries
);
1677 for (i
= 0; i
< num_entries
; i
++) {
1678 if(!sam_io_sam_entry4("", &sam
->sam
[i
], ps
, depth
))
1682 for (i
= 0; i
< num_entries
; i
++) {
1683 if(!smb_io_string2("acct_name", &sam
->str
[i
].acct_name
,
1684 sam
->sam
[i
].hdr_acct_name
.buffer
, ps
, depth
))
1693 /*******************************************************************
1694 inits a SAM_DISPINFO_5 structure.
1695 ********************************************************************/
1697 void init_sam_dispinfo_5(SAM_DISPINFO_5
* sam
, uint32
*num_entries
,
1698 uint32
*data_size
, uint32 start_idx
,
1701 uint32 len_sam_name
;
1702 uint32 max_entries
, max_data_size
;
1706 DEBUG(5, ("init_sam_dispinfo_5\n"));
1710 max_entries
= *num_entries
;
1711 max_data_size
= *data_size
;
1713 for (i
= 0; (i
< max_entries
) && (dsize
< max_data_size
); i
++) {
1714 len_sam_name
= strlen(grp
[i
].name
);
1716 init_sam_entry5(&sam
->sam
[i
], start_idx
+ i
+ 1,
1719 init_string2(&sam
->str
[i
].grp_name
, grp
[i
].name
,
1722 dsize
+= sizeof(SAM_ENTRY5
);
1723 dsize
+= len_sam_name
;
1730 /*******************************************************************
1731 reads or writes a structure.
1732 ********************************************************************/
1734 static BOOL
sam_io_sam_dispinfo_5(char *desc
, SAM_DISPINFO_5
* sam
,
1736 prs_struct
*ps
, int depth
)
1743 prs_debug(ps
, depth
, desc
, "sam_io_sam_dispinfo_5");
1749 SMB_ASSERT_ARRAY(sam
->sam
, num_entries
);
1751 for (i
= 0; i
< num_entries
; i
++) {
1752 if(!sam_io_sam_entry5("", &sam
->sam
[i
], ps
, depth
))
1756 for (i
= 0; i
< num_entries
; i
++) {
1757 if(!smb_io_string2("grp_name", &sam
->str
[i
].grp_name
,
1758 sam
->sam
[i
].hdr_grp_name
.buffer
, ps
, depth
))
1767 /*******************************************************************
1768 inits a SAMR_R_QUERY_DISPINFO structure.
1769 ********************************************************************/
1771 void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO
* r_u
,
1772 uint32 num_entries
, uint32 data_size
,
1773 uint16 switch_level
, SAM_DISPINFO_CTR
* ctr
,
1776 DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level
));
1778 r_u
->total_size
= data_size
; /* not calculated */
1779 r_u
->data_size
= data_size
;
1781 r_u
->switch_level
= switch_level
;
1782 r_u
->num_entries
= num_entries
;
1785 r_u
->ptr_entries
= 0;
1787 r_u
->ptr_entries
= 1;
1789 r_u
->num_entries2
= num_entries
;
1792 r_u
->status
= status
;
1795 /*******************************************************************
1796 reads or writes a structure.
1797 ********************************************************************/
1799 BOOL
samr_io_r_query_dispinfo(char *desc
, SAMR_R_QUERY_DISPINFO
* r_u
,
1800 prs_struct
*ps
, int depth
)
1805 prs_debug(ps
, depth
, desc
, "samr_io_r_query_dispinfo");
1811 if(!prs_uint32("total_size ", ps
, depth
, &r_u
->total_size
))
1813 if(!prs_uint32("data_size ", ps
, depth
, &r_u
->data_size
))
1815 if(!prs_uint16("switch_level", ps
, depth
, &r_u
->switch_level
))
1820 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
1822 if(!prs_uint32("ptr_entries ", ps
, depth
, &r_u
->ptr_entries
))
1825 if (r_u
->ptr_entries
==0) {
1828 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
1834 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
1837 switch (r_u
->switch_level
) {
1839 if(!sam_io_sam_dispinfo_1("users", r_u
->ctr
->sam
.info1
,
1840 r_u
->num_entries
, ps
, depth
))
1844 if(!sam_io_sam_dispinfo_2("servers", r_u
->ctr
->sam
.info2
,
1845 r_u
->num_entries
, ps
, depth
))
1849 if(!sam_io_sam_dispinfo_3("groups", r_u
->ctr
->sam
.info3
,
1850 r_u
->num_entries
, ps
, depth
))
1854 if(!sam_io_sam_dispinfo_4("user list",
1855 r_u
->ctr
->sam
.info4
,
1856 r_u
->num_entries
, ps
, depth
))
1860 if(!sam_io_sam_dispinfo_5("group list",
1861 r_u
->ctr
->sam
.info5
,
1862 r_u
->num_entries
, ps
, depth
))
1866 DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
1872 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
1878 /*******************************************************************
1879 inits a SAMR_Q_OPEN_GROUP structure.
1880 ********************************************************************/
1882 void init_samr_q_open_group(SAMR_Q_OPEN_GROUP
* q_c
,
1884 uint32 access_mask
, uint32 rid
)
1886 DEBUG(5, ("init_samr_q_open_group\n"));
1888 q_c
->domain_pol
= *hnd
;
1889 q_c
->access_mask
= access_mask
;
1890 q_c
->rid_group
= rid
;
1893 /*******************************************************************
1894 reads or writes a structure.
1895 ********************************************************************/
1897 BOOL
samr_io_q_open_group(char *desc
, SAMR_Q_OPEN_GROUP
* q_u
,
1898 prs_struct
*ps
, int depth
)
1903 prs_debug(ps
, depth
, desc
, "samr_io_q_open_group");
1909 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
1912 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
1914 if(!prs_uint32("rid_group", ps
, depth
, &q_u
->rid_group
))
1920 /*******************************************************************
1921 reads or writes a structure.
1922 ********************************************************************/
1924 BOOL
samr_io_r_open_group(char *desc
, SAMR_R_OPEN_GROUP
* r_u
,
1925 prs_struct
*ps
, int depth
)
1930 prs_debug(ps
, depth
, desc
, "samr_io_r_open_group");
1936 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
1939 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
1945 /*******************************************************************
1946 inits a GROUP_INFO1 structure.
1947 ********************************************************************/
1949 void init_samr_group_info1(GROUP_INFO1
* gr1
,
1950 char *acct_name
, char *acct_desc
,
1953 int desc_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
1954 int acct_len
= acct_name
!= NULL
? strlen(acct_name
) : 0;
1956 DEBUG(5, ("init_samr_group_info1\n"));
1958 init_uni_hdr(&gr1
->hdr_acct_name
, acct_len
);
1960 gr1
->unknown_1
= 0x3;
1961 gr1
->num_members
= num_members
;
1963 init_uni_hdr(&gr1
->hdr_acct_desc
, desc_len
);
1965 init_unistr2(&gr1
->uni_acct_name
, acct_name
, acct_len
);
1966 init_unistr2(&gr1
->uni_acct_desc
, acct_desc
, desc_len
);
1969 /*******************************************************************
1970 reads or writes a structure.
1971 ********************************************************************/
1973 BOOL
samr_io_group_info1(char *desc
, GROUP_INFO1
* gr1
,
1974 prs_struct
*ps
, int depth
)
1979 prs_debug(ps
, depth
, desc
, "samr_io_group_info1");
1985 if(!smb_io_unihdr("hdr_acct_name", &gr1
->hdr_acct_name
, ps
, depth
))
1988 if(!prs_uint32("unknown_1", ps
, depth
, &gr1
->unknown_1
))
1990 if(!prs_uint32("num_members", ps
, depth
, &gr1
->num_members
))
1993 if(!smb_io_unihdr("hdr_acct_desc", &gr1
->hdr_acct_desc
, ps
, depth
))
1996 if(!smb_io_unistr2("uni_acct_name", &gr1
->uni_acct_name
,
1997 gr1
->hdr_acct_name
.buffer
, ps
, depth
))
2000 if(!smb_io_unistr2("uni_acct_desc", &gr1
->uni_acct_desc
,
2001 gr1
->hdr_acct_desc
.buffer
, ps
, depth
))
2007 /*******************************************************************
2008 inits a GROUP_INFO4 structure.
2009 ********************************************************************/
2011 void init_samr_group_info4(GROUP_INFO4
* gr4
, char *acct_desc
)
2013 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
2015 DEBUG(5, ("init_samr_group_info4\n"));
2017 init_uni_hdr(&gr4
->hdr_acct_desc
, acct_len
);
2018 init_unistr2(&gr4
->uni_acct_desc
, acct_desc
, acct_len
);
2021 /*******************************************************************
2022 reads or writes a structure.
2023 ********************************************************************/
2025 BOOL
samr_io_group_info4(char *desc
, GROUP_INFO4
* gr4
,
2026 prs_struct
*ps
, int depth
)
2031 prs_debug(ps
, depth
, desc
, "samr_io_group_info4");
2037 if(!smb_io_unihdr("hdr_acct_desc", &gr4
->hdr_acct_desc
, ps
, depth
))
2039 if(!smb_io_unistr2("uni_acct_desc", &gr4
->uni_acct_desc
,
2040 gr4
->hdr_acct_desc
.buffer
, ps
, depth
))
2046 /*******************************************************************
2047 reads or writes a structure.
2048 ********************************************************************/
2050 static BOOL
samr_group_info_ctr(char *desc
, GROUP_INFO_CTR
**ctr
,
2051 prs_struct
*ps
, int depth
)
2053 if (UNMARSHALLING(ps
))
2054 *ctr
= (GROUP_INFO_CTR
*)prs_alloc_mem(ps
,sizeof(GROUP_INFO_CTR
));
2059 prs_debug(ps
, depth
, desc
, "samr_group_info_ctr");
2062 if(!prs_uint16("switch_value1", ps
, depth
, &(*ctr
)->switch_value1
))
2064 if(!prs_uint16("switch_value2", ps
, depth
, &(*ctr
)->switch_value2
))
2067 switch ((*ctr
)->switch_value1
) {
2069 if(!samr_io_group_info1("group_info1",
2070 &(*ctr
)->group
.info1
, ps
, depth
))
2074 if(!samr_io_group_info4("group_info4",
2075 &(*ctr
)->group
.info4
, ps
, depth
))
2079 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2086 /*******************************************************************
2087 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2088 ********************************************************************/
2090 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2091 POLICY_HND
*pol
, char *acct_desc
,
2094 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
2096 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2100 init_uni_hdr(&q_e
->hdr_acct_desc
, acct_len
);
2101 init_unistr2(&q_e
->uni_acct_desc
, acct_desc
, acct_len
);
2103 q_e
->access_mask
= access_mask
;
2106 /*******************************************************************
2107 reads or writes a structure.
2108 ********************************************************************/
2110 BOOL
samr_io_q_create_dom_group(char *desc
, SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2111 prs_struct
*ps
, int depth
)
2116 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_group");
2122 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2125 if(!smb_io_unihdr("hdr_acct_desc", &q_e
->hdr_acct_desc
, ps
, depth
))
2127 if(!smb_io_unistr2("uni_acct_desc", &q_e
->uni_acct_desc
,
2128 q_e
->hdr_acct_desc
.buffer
, ps
, depth
))
2133 if(!prs_uint32("access", ps
, depth
, &q_e
->access_mask
))
2139 /*******************************************************************
2140 reads or writes a structure.
2141 ********************************************************************/
2143 BOOL
samr_io_r_create_dom_group(char *desc
, SAMR_R_CREATE_DOM_GROUP
* r_u
,
2144 prs_struct
*ps
, int depth
)
2149 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_group");
2155 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2158 if(!prs_uint32("rid ", ps
, depth
, &r_u
->rid
))
2160 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2166 /*******************************************************************
2167 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2168 ********************************************************************/
2170 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP
* q_c
,
2173 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2175 q_c
->group_pol
= *hnd
;
2178 /*******************************************************************
2179 reads or writes a structure.
2180 ********************************************************************/
2182 BOOL
samr_io_q_delete_dom_group(char *desc
, SAMR_Q_DELETE_DOM_GROUP
* q_u
,
2183 prs_struct
*ps
, int depth
)
2188 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_group");
2194 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2200 /*******************************************************************
2201 reads or writes a structure.
2202 ********************************************************************/
2204 BOOL
samr_io_r_delete_dom_group(char *desc
, SAMR_R_DELETE_DOM_GROUP
* r_u
,
2205 prs_struct
*ps
, int depth
)
2210 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_group");
2216 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2222 /*******************************************************************
2223 inits a SAMR_Q_DEL_GROUPMEM structure.
2224 ********************************************************************/
2226 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM
* q_e
,
2227 POLICY_HND
*pol
, uint32 rid
)
2229 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2235 /*******************************************************************
2236 reads or writes a structure.
2237 ********************************************************************/
2239 BOOL
samr_io_q_del_groupmem(char *desc
, SAMR_Q_DEL_GROUPMEM
* q_e
,
2240 prs_struct
*ps
, int depth
)
2245 prs_debug(ps
, depth
, desc
, "samr_io_q_del_groupmem");
2251 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2254 if(!prs_uint32("rid", ps
, depth
, &q_e
->rid
))
2260 /*******************************************************************
2261 inits a SAMR_R_DEL_GROUPMEM structure.
2262 ********************************************************************/
2264 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2267 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2269 r_u
->status
= status
;
2272 /*******************************************************************
2273 reads or writes a structure.
2274 ********************************************************************/
2276 BOOL
samr_io_r_del_groupmem(char *desc
, SAMR_R_DEL_GROUPMEM
* r_u
,
2277 prs_struct
*ps
, int depth
)
2282 prs_debug(ps
, depth
, desc
, "samr_io_r_del_groupmem");
2288 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2294 /*******************************************************************
2295 inits a SAMR_Q_ADD_GROUPMEM structure.
2296 ********************************************************************/
2298 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM
* q_e
,
2299 POLICY_HND
*pol
, uint32 rid
)
2301 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2305 q_e
->unknown
= 0x0005;
2308 /*******************************************************************
2309 reads or writes a structure.
2310 ********************************************************************/
2312 BOOL
samr_io_q_add_groupmem(char *desc
, SAMR_Q_ADD_GROUPMEM
* q_e
,
2313 prs_struct
*ps
, int depth
)
2318 prs_debug(ps
, depth
, desc
, "samr_io_q_add_groupmem");
2324 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2327 if(!prs_uint32("rid ", ps
, depth
, &q_e
->rid
))
2329 if(!prs_uint32("unknown", ps
, depth
, &q_e
->unknown
))
2335 /*******************************************************************
2336 inits a SAMR_R_ADD_GROUPMEM structure.
2337 ********************************************************************/
2339 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2342 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2344 r_u
->status
= status
;
2347 /*******************************************************************
2348 reads or writes a structure.
2349 ********************************************************************/
2351 BOOL
samr_io_r_add_groupmem(char *desc
, SAMR_R_ADD_GROUPMEM
* r_u
,
2352 prs_struct
*ps
, int depth
)
2357 prs_debug(ps
, depth
, desc
, "samr_io_r_add_groupmem");
2363 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2369 /*******************************************************************
2370 inits a SAMR_Q_SET_GROUPINFO structure.
2371 ********************************************************************/
2373 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO
* q_e
,
2374 POLICY_HND
*pol
, GROUP_INFO_CTR
* ctr
)
2376 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2382 /*******************************************************************
2383 reads or writes a structure.
2384 ********************************************************************/
2386 BOOL
samr_io_q_set_groupinfo(char *desc
, SAMR_Q_SET_GROUPINFO
* q_e
,
2387 prs_struct
*ps
, int depth
)
2392 prs_debug(ps
, depth
, desc
, "samr_io_q_set_groupinfo");
2398 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2401 if(!samr_group_info_ctr("ctr", &q_e
->ctr
, ps
, depth
))
2407 /*******************************************************************
2408 inits a SAMR_R_SET_GROUPINFO structure.
2409 ********************************************************************/
2411 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO
* r_u
, uint32 status
)
2413 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2415 r_u
->status
= status
;
2418 /*******************************************************************
2419 reads or writes a structure.
2420 ********************************************************************/
2422 BOOL
samr_io_r_set_groupinfo(char *desc
, SAMR_R_SET_GROUPINFO
* r_u
,
2423 prs_struct
*ps
, int depth
)
2428 prs_debug(ps
, depth
, desc
, "samr_io_r_set_groupinfo");
2434 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2440 /*******************************************************************
2441 inits a SAMR_Q_QUERY_GROUPINFO structure.
2442 ********************************************************************/
2444 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO
* q_e
,
2445 POLICY_HND
*pol
, uint16 switch_level
)
2447 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2451 q_e
->switch_level
= switch_level
;
2454 /*******************************************************************
2455 reads or writes a structure.
2456 ********************************************************************/
2458 BOOL
samr_io_q_query_groupinfo(char *desc
, SAMR_Q_QUERY_GROUPINFO
* q_e
,
2459 prs_struct
*ps
, int depth
)
2464 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupinfo");
2470 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2473 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
2479 /*******************************************************************
2480 inits a SAMR_R_QUERY_GROUPINFO structure.
2481 ********************************************************************/
2483 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO
* r_u
,
2484 GROUP_INFO_CTR
* ctr
, uint32 status
)
2486 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2488 r_u
->ptr
= (status
== 0x0 && ctr
!= NULL
) ? 1 : 0;
2490 r_u
->status
= status
;
2493 /*******************************************************************
2494 reads or writes a structure.
2495 ********************************************************************/
2497 BOOL
samr_io_r_query_groupinfo(char *desc
, SAMR_R_QUERY_GROUPINFO
* r_u
,
2498 prs_struct
*ps
, int depth
)
2503 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupinfo");
2509 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2512 if (r_u
->ptr
!= 0) {
2513 if(!samr_group_info_ctr("ctr", &r_u
->ctr
, ps
, depth
))
2519 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2525 /*******************************************************************
2526 inits a SAMR_Q_QUERY_GROUPMEM structure.
2527 ********************************************************************/
2529 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM
* q_c
, POLICY_HND
*hnd
)
2531 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2533 q_c
->group_pol
= *hnd
;
2536 /*******************************************************************
2537 reads or writes a structure.
2538 ********************************************************************/
2540 BOOL
samr_io_q_query_groupmem(char *desc
, SAMR_Q_QUERY_GROUPMEM
* q_u
,
2541 prs_struct
*ps
, int depth
)
2546 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupmem");
2552 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2558 /*******************************************************************
2559 inits a SAMR_R_QUERY_GROUPMEM structure.
2560 ********************************************************************/
2562 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM
* r_u
,
2563 uint32 num_entries
, uint32
*rid
,
2564 uint32
*attr
, uint32 status
)
2566 DEBUG(5, ("init_samr_r_query_groupmem\n"));
2568 if (status
== 0x0) {
2570 r_u
->num_entries
= num_entries
;
2572 r_u
->ptr_attrs
= attr
!= NULL
? 1 : 0;
2573 r_u
->ptr_rids
= rid
!= NULL
? 1 : 0;
2575 r_u
->num_rids
= num_entries
;
2578 r_u
->num_attrs
= num_entries
;
2582 r_u
->num_entries
= 0;
2585 r_u
->status
= status
;
2588 /*******************************************************************
2589 reads or writes a structure.
2590 ********************************************************************/
2592 BOOL
samr_io_r_query_groupmem(char *desc
, SAMR_R_QUERY_GROUPMEM
* r_u
,
2593 prs_struct
*ps
, int depth
)
2600 if (UNMARSHALLING(ps
))
2603 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupmem");
2609 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2611 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2614 if (r_u
->ptr
!= 0) {
2615 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
2617 if(!prs_uint32("ptr_attrs", ps
, depth
, &r_u
->ptr_attrs
))
2620 if (r_u
->ptr_rids
!= 0) {
2621 if(!prs_uint32("num_rids", ps
, depth
, &r_u
->num_rids
))
2623 if (UNMARSHALLING(ps
) && r_u
->num_rids
!= 0) {
2624 r_u
->rid
= (uint32
*)prs_alloc_mem(ps
,sizeof(r_u
->rid
[0])*r_u
->num_rids
);
2625 if (r_u
->rid
== NULL
)
2629 for (i
= 0; i
< r_u
->num_rids
; i
++) {
2630 if(!prs_uint32("", ps
, depth
, &r_u
->rid
[i
]))
2635 if (r_u
->ptr_attrs
!= 0) {
2636 if(!prs_uint32("num_attrs", ps
, depth
, &r_u
->num_attrs
))
2639 if (UNMARSHALLING(ps
) && r_u
->num_attrs
!= 0) {
2640 r_u
->attr
= (uint32
*)prs_alloc_mem(ps
,sizeof(r_u
->attr
[0])*r_u
->num_attrs
);
2641 if (r_u
->attr
== NULL
)
2645 for (i
= 0; i
< r_u
->num_attrs
; i
++) {
2646 if(!prs_uint32("", ps
, depth
, &r_u
->attr
[i
]))
2652 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2658 /*******************************************************************
2659 inits a SAMR_Q_QUERY_USERGROUPS structure.
2660 ********************************************************************/
2662 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS
* q_u
,
2665 DEBUG(5, ("init_samr_q_query_usergroups\n"));
2670 /*******************************************************************
2671 reads or writes a structure.
2672 ********************************************************************/
2674 BOOL
samr_io_q_query_usergroups(char *desc
, SAMR_Q_QUERY_USERGROUPS
* q_u
,
2675 prs_struct
*ps
, int depth
)
2680 prs_debug(ps
, depth
, desc
, "samr_io_q_query_usergroups");
2686 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
2692 /*******************************************************************
2693 inits a SAMR_R_QUERY_USERGROUPS structure.
2694 ********************************************************************/
2696 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS
* r_u
,
2697 uint32 num_gids
, DOM_GID
* gid
,
2700 DEBUG(5, ("init_samr_r_query_usergroups\n"));
2704 r_u
->num_entries
= num_gids
;
2705 r_u
->ptr_1
= (num_gids
!= 0) ? 1 : 0;
2706 r_u
->num_entries2
= num_gids
;
2711 r_u
->num_entries
= 0;
2716 r_u
->status
= status
;
2719 /*******************************************************************
2720 reads or writes a structure.
2721 ********************************************************************/
2723 BOOL
samr_io_gids(char *desc
, uint32
*num_gids
, DOM_GID
** gid
,
2724 prs_struct
*ps
, int depth
)
2730 prs_debug(ps
, depth
, desc
, "samr_io_gids");
2736 if(!prs_uint32("num_gids", ps
, depth
, num_gids
))
2739 if ((*num_gids
) != 0) {
2740 if (UNMARSHALLING(ps
)) {
2741 (*gid
) = (DOM_GID
*)prs_alloc_mem(ps
,sizeof(DOM_GID
)*(*num_gids
));
2744 if ((*gid
) == NULL
) {
2748 for (i
= 0; i
< (*num_gids
); i
++) {
2749 if(!smb_io_gid("gids", &(*gid
)[i
], ps
, depth
))
2757 /*******************************************************************
2758 reads or writes a structure.
2759 ********************************************************************/
2761 BOOL
samr_io_r_query_usergroups(char *desc
, SAMR_R_QUERY_USERGROUPS
* r_u
,
2762 prs_struct
*ps
, int depth
)
2767 prs_debug(ps
, depth
, desc
, "samr_io_r_query_usergroups");
2773 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
2776 if (r_u
->ptr_0
!= 0) {
2777 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2779 if(!prs_uint32("ptr_1 ", ps
, depth
, &r_u
->ptr_1
))
2782 if (r_u
->num_entries
!= 0 && r_u
->ptr_1
!= 0) {
2783 if(!samr_io_gids("gids", &r_u
->num_entries2
, &r_u
->gid
, ps
, depth
))
2790 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2796 /*******************************************************************
2797 inits a SAMR_Q_ENUM_DOMAINS structure.
2798 ********************************************************************/
2800 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS
* q_e
,
2802 uint32 start_idx
, uint32 size
)
2804 DEBUG(5, ("init_samr_q_enum_domains\n"));
2808 q_e
->start_idx
= start_idx
;
2809 q_e
->max_size
= size
;
2812 /*******************************************************************
2813 reads or writes a structure.
2814 ********************************************************************/
2816 BOOL
samr_io_q_enum_domains(char *desc
, SAMR_Q_ENUM_DOMAINS
* q_e
,
2817 prs_struct
*ps
, int depth
)
2822 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_domains");
2828 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2831 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
2833 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
2839 /*******************************************************************
2840 inits a SAMR_R_ENUM_DOMAINS structure.
2841 ********************************************************************/
2843 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS
* r_u
,
2844 uint32 next_idx
, uint32 num_sam_entries
)
2846 DEBUG(5, ("init_samr_r_enum_domains\n"));
2848 r_u
->next_idx
= next_idx
;
2850 if (num_sam_entries
!= 0) {
2851 r_u
->ptr_entries1
= 1;
2852 r_u
->ptr_entries2
= 1;
2853 r_u
->num_entries2
= num_sam_entries
;
2854 r_u
->num_entries3
= num_sam_entries
;
2856 r_u
->num_entries4
= num_sam_entries
;
2858 r_u
->ptr_entries1
= 0;
2859 r_u
->num_entries2
= num_sam_entries
;
2860 r_u
->ptr_entries2
= 1;
2864 /*******************************************************************
2865 reads or writes a structure.
2866 ********************************************************************/
2868 BOOL
samr_io_r_enum_domains(char *desc
, SAMR_R_ENUM_DOMAINS
* r_u
,
2869 prs_struct
*ps
, int depth
)
2876 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_domains");
2882 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
2884 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
2887 if (r_u
->ptr_entries1
!= 0) {
2888 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
2890 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
2892 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
2895 if (UNMARSHALLING(ps
)) {
2896 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
2897 r_u
->uni_dom_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
2900 if ((r_u
->sam
== NULL
|| r_u
->uni_dom_name
== NULL
) && r_u
->num_entries2
!= 0) {
2901 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
2902 r_u
->num_entries4
= 0;
2903 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
2907 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
2909 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
2910 if(!sam_io_sam_entry(tmp
, &r_u
->sam
[i
], ps
, depth
))
2914 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
2916 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
2917 if(!smb_io_unistr2(tmp
, &r_u
->uni_dom_name
[i
],
2918 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
2927 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
2929 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2935 /*******************************************************************
2936 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
2937 ********************************************************************/
2939 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
2941 uint32 start_idx
, uint32 size
)
2943 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
2947 q_e
->start_idx
= start_idx
;
2948 q_e
->max_size
= size
;
2951 /*******************************************************************
2952 reads or writes a structure.
2953 ********************************************************************/
2955 BOOL
samr_io_q_enum_dom_groups(char *desc
, SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
2956 prs_struct
*ps
, int depth
)
2961 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_groups");
2967 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
2970 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
2972 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
2978 /*******************************************************************
2979 inits a SAMR_R_ENUM_DOM_GROUPS structure.
2980 ********************************************************************/
2982 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS
* r_u
,
2983 uint32 next_idx
, uint32 num_sam_entries
)
2985 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
2987 r_u
->next_idx
= next_idx
;
2989 if (num_sam_entries
!= 0) {
2990 r_u
->ptr_entries1
= 1;
2991 r_u
->ptr_entries2
= 1;
2992 r_u
->num_entries2
= num_sam_entries
;
2993 r_u
->num_entries3
= num_sam_entries
;
2995 r_u
->num_entries4
= num_sam_entries
;
2997 r_u
->ptr_entries1
= 0;
2998 r_u
->num_entries2
= num_sam_entries
;
2999 r_u
->ptr_entries2
= 1;
3003 /*******************************************************************
3004 reads or writes a structure.
3005 ********************************************************************/
3007 BOOL
samr_io_r_enum_dom_groups(char *desc
, SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3008 prs_struct
*ps
, int depth
)
3015 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_groups");
3021 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3023 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3026 if (r_u
->ptr_entries1
!= 0) {
3027 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3029 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3031 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3034 if (UNMARSHALLING(ps
)) {
3035 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
3036 r_u
->uni_grp_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
3039 if ((r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
) && r_u
->num_entries2
!= 0) {
3041 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3042 r_u
->num_entries4
= 0;
3043 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3047 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3048 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3052 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3053 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3054 r_u
->sam
[i
].hdr_name
.buffer
, ps
, depth
))
3061 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3063 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3069 /*******************************************************************
3070 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3071 ********************************************************************/
3073 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3074 POLICY_HND
*pol
, uint32 start_idx
,
3077 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3081 q_e
->start_idx
= start_idx
;
3082 q_e
->max_size
= size
;
3086 /*******************************************************************
3087 reads or writes a structure.
3088 ********************************************************************/
3090 BOOL
samr_io_q_enum_dom_aliases(char *desc
, SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3091 prs_struct
*ps
, int depth
)
3096 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_aliases");
3102 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3105 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3107 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3113 /*******************************************************************
3114 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3115 ********************************************************************/
3117 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES
*r_u
, uint32 next_idx
, uint32 num_sam_entries
)
3119 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3121 r_u
->next_idx
= next_idx
;
3123 if (num_sam_entries
!= 0) {
3124 r_u
->ptr_entries1
= 1;
3125 r_u
->ptr_entries2
= 1;
3126 r_u
->num_entries2
= num_sam_entries
;
3127 r_u
->num_entries3
= num_sam_entries
;
3129 r_u
->num_entries4
= num_sam_entries
;
3131 r_u
->ptr_entries1
= 0;
3132 r_u
->num_entries2
= num_sam_entries
;
3133 r_u
->ptr_entries2
= 1;
3137 /*******************************************************************
3138 reads or writes a structure.
3139 ********************************************************************/
3141 BOOL
samr_io_r_enum_dom_aliases(char *desc
, SAMR_R_ENUM_DOM_ALIASES
* r_u
,
3142 prs_struct
*ps
, int depth
)
3149 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_aliases");
3155 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3157 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3160 if (r_u
->ptr_entries1
!= 0) {
3161 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3163 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3165 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3168 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
> 0)) {
3169 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
3170 r_u
->uni_grp_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
3173 if (r_u
->num_entries2
!= 0 &&
3174 (r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
)) {
3175 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3176 r_u
->num_entries4
= 0;
3177 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3181 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3182 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3186 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3187 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3188 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3196 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3198 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3204 /*******************************************************************
3205 inits a ALIAS_INFO3 structure.
3206 ********************************************************************/
3208 void init_samr_alias_info3(ALIAS_INFO3
* al3
, char *acct_desc
)
3210 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
3212 DEBUG(5, ("init_samr_alias_info3\n"));
3214 init_uni_hdr(&al3
->hdr_acct_desc
, acct_len
);
3215 init_unistr2(&al3
->uni_acct_desc
, acct_desc
, acct_len
);
3218 /*******************************************************************
3219 reads or writes a structure.
3220 ********************************************************************/
3222 BOOL
samr_io_alias_info3(char *desc
, ALIAS_INFO3
* al3
,
3223 prs_struct
*ps
, int depth
)
3228 prs_debug(ps
, depth
, desc
, "samr_io_alias_info3");
3234 if(!smb_io_unihdr("hdr_acct_desc", &al3
->hdr_acct_desc
, ps
, depth
))
3236 if(!smb_io_unistr2("uni_acct_desc", &al3
->uni_acct_desc
,
3237 al3
->hdr_acct_desc
.buffer
, ps
, depth
))
3243 /*******************************************************************
3244 reads or writes a structure.
3245 ********************************************************************/
3247 BOOL
samr_alias_info_ctr(char *desc
, ALIAS_INFO_CTR
* ctr
,
3248 prs_struct
*ps
, int depth
)
3253 prs_debug(ps
, depth
, desc
, "samr_alias_info_ctr");
3256 if(!prs_uint16("switch_value1", ps
, depth
, &ctr
->switch_value1
))
3258 if(!prs_uint16("switch_value2", ps
, depth
, &ctr
->switch_value2
))
3261 switch (ctr
->switch_value1
) {
3263 if(!samr_io_alias_info3("alias_info3", &ctr
->alias
.info3
, ps
, depth
))
3267 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3274 /*******************************************************************
3275 inits a SAMR_Q_QUERY_ALIASINFO structure.
3276 ********************************************************************/
3278 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO
* q_e
,
3279 POLICY_HND
*pol
, uint16 switch_level
)
3281 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3284 q_e
->switch_level
= switch_level
;
3287 /*******************************************************************
3288 reads or writes a structure.
3289 ********************************************************************/
3291 BOOL
samr_io_q_query_aliasinfo(char *desc
, SAMR_Q_QUERY_ALIASINFO
* q_e
,
3292 prs_struct
*ps
, int depth
)
3297 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasinfo");
3303 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
3306 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
3312 /*******************************************************************
3313 inits a SAMR_R_QUERY_ALIASINFO structure.
3314 ********************************************************************/
3316 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO
* r_u
,
3317 ALIAS_INFO_CTR
* ctr
, uint32 status
)
3319 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3321 r_u
->ptr
= (status
== 0x0 && ctr
!= NULL
) ? 1 : 0;
3323 r_u
->status
= status
;
3326 /*******************************************************************
3327 reads or writes a structure.
3328 ********************************************************************/
3330 BOOL
samr_io_r_query_aliasinfo(char *desc
, SAMR_R_QUERY_ALIASINFO
* r_u
,
3331 prs_struct
*ps
, int depth
)
3336 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasinfo");
3342 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
3345 if (r_u
->ptr
!= 0) {
3346 if(!samr_alias_info_ctr("ctr", &r_u
->ctr
, ps
, depth
))
3352 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3358 /*******************************************************************
3359 inits a SAMR_Q_SET_ALIASINFO structure.
3360 ********************************************************************/
3362 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO
* q_u
,
3363 POLICY_HND
*hnd
, ALIAS_INFO_CTR
* ctr
)
3365 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3367 q_u
->alias_pol
= *hnd
;
3371 /*******************************************************************
3372 reads or writes a structure.
3373 ********************************************************************/
3375 BOOL
samr_io_q_set_aliasinfo(char *desc
, SAMR_Q_SET_ALIASINFO
* q_u
,
3376 prs_struct
*ps
, int depth
)
3381 prs_debug(ps
, depth
, desc
, "samr_io_q_set_aliasinfo");
3387 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
3389 if(!samr_alias_info_ctr("ctr", &q_u
->ctr
, ps
, depth
))
3395 /*******************************************************************
3396 reads or writes a structure.
3397 ********************************************************************/
3399 BOOL
samr_io_r_set_aliasinfo(char *desc
, SAMR_R_SET_ALIASINFO
* r_u
,
3400 prs_struct
*ps
, int depth
)
3405 prs_debug(ps
, depth
, desc
, "samr_io_r_set_aliasinfo");
3410 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3416 /*******************************************************************
3417 inits a SAMR_Q_QUERY_USERALIASES structure.
3418 ********************************************************************/
3420 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES
* q_u
,
3423 uint32
*ptr_sid
, DOM_SID2
* sid
)
3425 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3429 q_u
->num_sids1
= num_sids
;
3431 q_u
->num_sids2
= num_sids
;
3433 q_u
->ptr_sid
= ptr_sid
;
3437 /*******************************************************************
3438 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3439 ********************************************************************/
3441 BOOL
samr_io_q_query_useraliases(char *desc
, SAMR_Q_QUERY_USERALIASES
* q_u
,
3442 prs_struct
*ps
, int depth
)
3450 prs_debug(ps
, depth
, desc
, "samr_io_q_query_useraliases");
3456 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3459 if(!prs_uint32("num_sids1", ps
, depth
, &q_u
->num_sids1
))
3461 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3467 if(!prs_uint32("num_sids2", ps
, depth
, &q_u
->num_sids2
))
3470 if (UNMARSHALLING(ps
) && (q_u
->num_sids2
!= 0)) {
3471 q_u
->ptr_sid
= (uint32
*)prs_alloc_mem(ps
,sizeof(q_u
->ptr_sid
[0])*q_u
->num_sids2
);
3472 if (q_u
->ptr_sid
== NULL
)
3475 q_u
->sid
= (DOM_SID2
*)prs_alloc_mem(ps
, sizeof(q_u
->sid
[0]) * q_u
->num_sids2
);
3476 if (q_u
->sid
== NULL
)
3480 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3481 slprintf(tmp
, sizeof(tmp
) - 1, "ptr[%02d]", i
);
3482 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->ptr_sid
[i
]))
3486 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3487 if (q_u
->ptr_sid
[i
] != 0) {
3488 slprintf(tmp
, sizeof(tmp
) - 1, "sid[%02d]", i
);
3489 if(!smb_io_dom_sid2(tmp
, &q_u
->sid
[i
], ps
, depth
))
3497 /*******************************************************************
3498 inits a SAMR_R_QUERY_USERALIASES structure.
3499 ********************************************************************/
3501 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES
* r_u
,
3502 uint32 num_rids
, uint32
*rid
,
3505 DEBUG(5, ("init_samr_r_query_useraliases\n"));
3507 if (status
== 0x0) {
3508 r_u
->num_entries
= num_rids
;
3510 r_u
->num_entries2
= num_rids
;
3514 r_u
->num_entries
= 0;
3516 r_u
->num_entries2
= 0;
3519 r_u
->status
= status
;
3522 /*******************************************************************
3523 reads or writes a structure.
3524 ********************************************************************/
3526 BOOL
samr_io_rids(char *desc
, uint32
*num_rids
, uint32
**rid
,
3527 prs_struct
*ps
, int depth
)
3534 prs_debug(ps
, depth
, desc
, "samr_io_rids");
3540 if(!prs_uint32("num_rids", ps
, depth
, num_rids
))
3543 if ((*num_rids
) != 0) {
3544 if (UNMARSHALLING(ps
)) {
3546 (*rid
) = (uint32
*)prs_alloc_mem(ps
,sizeof(uint32
)*(*num_rids
));
3551 for (i
= 0; i
< (*num_rids
); i
++) {
3552 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d]", i
);
3553 if(!prs_uint32(tmp
, ps
, depth
, &((*rid
)[i
])))
3561 /*******************************************************************
3562 reads or writes a structure.
3563 ********************************************************************/
3565 BOOL
samr_io_r_query_useraliases(char *desc
, SAMR_R_QUERY_USERALIASES
* r_u
,
3566 prs_struct
*ps
, int depth
)
3571 prs_debug(ps
, depth
, desc
, "samr_io_r_query_useraliases");
3577 if(!prs_uint32("num_entries", ps
, depth
, &r_u
->num_entries
))
3579 if(!prs_uint32("ptr ", ps
, depth
, &r_u
->ptr
))
3582 if (r_u
->ptr
!= 0) {
3583 if(!samr_io_rids("rids", &r_u
->num_entries2
, &r_u
->rid
, ps
, depth
))
3589 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3595 /*******************************************************************
3596 inits a SAMR_Q_OPEN_ALIAS structure.
3597 ********************************************************************/
3599 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS
* q_u
, POLICY_HND
*pol
,
3600 uint32 access_mask
, uint32 rid
)
3602 DEBUG(5, ("init_samr_q_open_alias\n"));
3604 q_u
->dom_pol
= *pol
;
3605 q_u
->access_mask
= access_mask
;
3606 q_u
->rid_alias
= rid
;
3609 /*******************************************************************
3610 reads or writes a structure.
3611 ********************************************************************/
3613 BOOL
samr_io_q_open_alias(char *desc
, SAMR_Q_OPEN_ALIAS
* q_u
,
3614 prs_struct
*ps
, int depth
)
3619 prs_debug(ps
, depth
, desc
, "samr_io_q_open_alias");
3625 if(!smb_io_pol_hnd("domain_pol", &q_u
->dom_pol
, ps
, depth
))
3628 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
3630 if(!prs_uint32("rid_alias", ps
, depth
, &q_u
->rid_alias
))
3636 /*******************************************************************
3637 reads or writes a structure.
3638 ********************************************************************/
3640 BOOL
samr_io_r_open_alias(char *desc
, SAMR_R_OPEN_ALIAS
* r_u
,
3641 prs_struct
*ps
, int depth
)
3646 prs_debug(ps
, depth
, desc
, "samr_io_r_open_alias");
3652 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
3655 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3661 /*******************************************************************
3662 inits a SAMR_Q_LOOKUP_RIDS structure.
3663 ********************************************************************/
3665 void init_samr_q_lookup_rids(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_RIDS
* q_u
,
3666 POLICY_HND
*pol
, uint32 flags
,
3667 uint32 num_rids
, uint32
*rid
)
3669 DEBUG(5, ("init_samr_q_lookup_rids\n"));
3673 q_u
->num_rids1
= num_rids
;
3676 q_u
->num_rids2
= num_rids
;
3677 q_u
->rid
= (uint32
*)talloc_zero(ctx
, num_rids
* sizeof(q_u
->rid
[0]));
3678 if (q_u
->rid
== NULL
) {
3682 memcpy(q_u
->rid
, rid
, num_rids
* sizeof(q_u
->rid
[0]));
3686 /*******************************************************************
3687 reads or writes a structure.
3688 ********************************************************************/
3690 BOOL
samr_io_q_lookup_rids(char *desc
, SAMR_Q_LOOKUP_RIDS
* q_u
,
3691 prs_struct
*ps
, int depth
)
3699 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_rids");
3702 if (UNMARSHALLING(ps
))
3708 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3711 if(!prs_uint32("num_rids1", ps
, depth
, &q_u
->num_rids1
))
3713 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
3715 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3717 if(!prs_uint32("num_rids2", ps
, depth
, &q_u
->num_rids2
))
3720 if (UNMARSHALLING(ps
) && (q_u
->num_rids2
!= 0)) {
3721 q_u
->rid
= (uint32
*)prs_alloc_mem(ps
, sizeof(q_u
->rid
[0])*q_u
->num_rids2
);
3722 if (q_u
->rid
== NULL
)
3726 for (i
= 0; i
< q_u
->num_rids2
; i
++) {
3727 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
3728 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->rid
[i
]))
3735 /*******************************************************************
3736 inits a SAMR_R_LOOKUP_RIDS structure.
3737 ********************************************************************/
3739 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS
* r_u
,
3740 uint32 num_names
, UNIHDR
* hdr_name
,
3741 UNISTR2
*uni_name
, uint32
*type
)
3743 DEBUG(5, ("init_samr_r_lookup_rids\n"));
3745 r_u
->hdr_name
= NULL
;
3746 r_u
->uni_name
= NULL
;
3749 if (num_names
!= 0) {
3750 r_u
->num_names1
= num_names
;
3752 r_u
->num_names2
= num_names
;
3754 r_u
->num_types1
= num_names
;
3756 r_u
->num_types2
= num_names
;
3758 r_u
->hdr_name
= hdr_name
;
3759 r_u
->uni_name
= uni_name
;
3762 r_u
->num_names1
= num_names
;
3764 r_u
->num_names2
= num_names
;
3766 r_u
->num_types1
= num_names
;
3768 r_u
->num_types2
= num_names
;
3772 /*******************************************************************
3773 reads or writes a structure.
3774 ********************************************************************/
3776 BOOL
samr_io_r_lookup_rids(char *desc
, SAMR_R_LOOKUP_RIDS
* r_u
,
3777 prs_struct
*ps
, int depth
)
3784 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_rids");
3790 if(!prs_uint32("num_names1", ps
, depth
, &r_u
->num_names1
))
3792 if(!prs_uint32("ptr_names ", ps
, depth
, &r_u
->ptr_names
))
3795 if (r_u
->ptr_names
!= 0) {
3797 if(!prs_uint32("num_names2", ps
, depth
, &r_u
->num_names2
))
3801 if (UNMARSHALLING(ps
) && (r_u
->num_names2
!= 0)) {
3802 r_u
->hdr_name
= (UNIHDR
*) prs_alloc_mem(ps
, r_u
->num_names2
* sizeof(r_u
->hdr_name
[0]));
3803 if (r_u
->hdr_name
== NULL
)
3806 r_u
->uni_name
= (UNISTR2
*)prs_alloc_mem(ps
, r_u
->num_names2
* sizeof(r_u
->uni_name
[0]));
3807 if (r_u
->uni_name
== NULL
)
3811 for (i
= 0; i
< r_u
->num_names2
; i
++) {
3812 slprintf(tmp
, sizeof(tmp
) - 1, "hdr[%02d] ", i
);
3813 if(!smb_io_unihdr("", &r_u
->hdr_name
[i
], ps
, depth
))
3816 for (i
= 0; i
< r_u
->num_names2
; i
++) {
3817 slprintf(tmp
, sizeof(tmp
) - 1, "str[%02d] ", i
);
3818 if(!smb_io_unistr2("", &r_u
->uni_name
[i
], r_u
->hdr_name
[i
].buffer
, ps
, depth
))
3826 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
3828 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
3831 if (r_u
->ptr_types
!= 0) {
3833 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
3836 if (UNMARSHALLING(ps
) && (r_u
->num_types2
!= 0)) {
3837 r_u
->type
= (uint32
*)prs_alloc_mem(ps
, r_u
->num_types2
* sizeof(r_u
->type
[0]));
3838 if (r_u
->type
== NULL
)
3842 for (i
= 0; i
< r_u
->num_types2
; i
++) {
3843 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
3844 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->type
[i
]))
3849 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3855 /*******************************************************************
3856 inits a SAMR_Q_OPEN_ALIAS structure.
3857 ********************************************************************/
3859 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_u
, POLICY_HND
*hnd
)
3861 DEBUG(5, ("init_samr_q_delete_alias\n"));
3863 q_u
->alias_pol
= *hnd
;
3866 /*******************************************************************
3867 reads or writes a structure.
3868 ********************************************************************/
3870 BOOL
samr_io_q_delete_alias(char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
3871 prs_struct
*ps
, int depth
)
3876 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_alias");
3882 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
3888 /*******************************************************************
3889 reads or writes a structure.
3890 ********************************************************************/
3892 BOOL
samr_io_r_delete_alias(char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
3893 prs_struct
*ps
, int depth
)
3898 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_alias");
3904 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
3906 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3912 /*******************************************************************
3913 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
3914 ********************************************************************/
3916 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
3917 POLICY_HND
*hnd
, char *acct_desc
)
3919 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
3921 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
3923 q_u
->dom_pol
= *hnd
;
3925 init_uni_hdr(&q_u
->hdr_acct_desc
, acct_len
);
3926 init_unistr2(&q_u
->uni_acct_desc
, acct_desc
, acct_len
);
3928 q_u
->access_mask
= 0x001f000f;
3931 /*******************************************************************
3932 reads or writes a structure.
3933 ********************************************************************/
3935 BOOL
samr_io_q_create_dom_alias(char *desc
, SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
3936 prs_struct
*ps
, int depth
)
3941 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_alias");
3947 if(!smb_io_pol_hnd("dom_pol", &q_u
->dom_pol
, ps
, depth
))
3950 if(!smb_io_unihdr("hdr_acct_desc", &q_u
->hdr_acct_desc
, ps
, depth
))
3952 if(!smb_io_unistr2("uni_acct_desc", &q_u
->uni_acct_desc
,
3953 q_u
->hdr_acct_desc
.buffer
, ps
, depth
))
3958 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
3964 /*******************************************************************
3965 reads or writes a structure.
3966 ********************************************************************/
3968 BOOL
samr_io_r_create_dom_alias(char *desc
, SAMR_R_CREATE_DOM_ALIAS
* r_u
,
3969 prs_struct
*ps
, int depth
)
3974 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_alias");
3980 if(!smb_io_pol_hnd("alias_pol", &r_u
->alias_pol
, ps
, depth
))
3983 if(!prs_uint32("rid", ps
, depth
, &r_u
->rid
))
3986 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3992 /*******************************************************************
3993 inits a SAMR_Q_ADD_ALIASMEM structure.
3994 ********************************************************************/
3996 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
3999 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
4001 q_u
->alias_pol
= *hnd
;
4002 init_dom_sid2(&q_u
->sid
, sid
);
4005 /*******************************************************************
4006 reads or writes a structure.
4007 ********************************************************************/
4009 BOOL
samr_io_q_add_aliasmem(char *desc
, SAMR_Q_ADD_ALIASMEM
* q_u
,
4010 prs_struct
*ps
, int depth
)
4015 prs_debug(ps
, depth
, desc
, "samr_io_q_add_aliasmem");
4021 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4023 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4029 /*******************************************************************
4030 reads or writes a structure.
4031 ********************************************************************/
4033 BOOL
samr_io_r_add_aliasmem(char *desc
, SAMR_R_ADD_ALIASMEM
* r_u
,
4034 prs_struct
*ps
, int depth
)
4039 prs_debug(ps
, depth
, desc
, "samr_io_r_add_aliasmem");
4045 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4051 /*******************************************************************
4052 inits a SAMR_Q_DEL_ALIASMEM structure.
4053 ********************************************************************/
4055 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4058 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4060 q_u
->alias_pol
= *hnd
;
4061 init_dom_sid2(&q_u
->sid
, sid
);
4064 /*******************************************************************
4065 reads or writes a structure.
4066 ********************************************************************/
4068 BOOL
samr_io_q_del_aliasmem(char *desc
, SAMR_Q_DEL_ALIASMEM
* q_u
,
4069 prs_struct
*ps
, int depth
)
4074 prs_debug(ps
, depth
, desc
, "samr_io_q_del_aliasmem");
4080 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4082 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4088 /*******************************************************************
4089 reads or writes a structure.
4090 ********************************************************************/
4092 BOOL
samr_io_r_del_aliasmem(char *desc
, SAMR_R_DEL_ALIASMEM
* r_u
,
4093 prs_struct
*ps
, int depth
)
4098 prs_debug(ps
, depth
, desc
, "samr_io_r_del_aliasmem");
4104 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4110 /*******************************************************************
4111 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4112 ********************************************************************/
4114 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_c
,
4117 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4119 q_c
->alias_pol
= *hnd
;
4122 /*******************************************************************
4123 reads or writes a structure.
4124 ********************************************************************/
4126 BOOL
samr_io_q_delete_dom_alias(char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4127 prs_struct
*ps
, int depth
)
4132 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_alias");
4138 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4144 /*******************************************************************
4145 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4146 ********************************************************************/
4148 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4151 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4153 r_u
->status
= status
;
4156 /*******************************************************************
4157 reads or writes a structure.
4158 ********************************************************************/
4160 BOOL
samr_io_r_delete_dom_alias(char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4161 prs_struct
*ps
, int depth
)
4166 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_alias");
4172 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4178 /*******************************************************************
4179 inits a SAMR_Q_QUERY_ALIASMEM structure.
4180 ********************************************************************/
4182 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM
* q_c
,
4185 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4187 q_c
->alias_pol
= *hnd
;
4190 /*******************************************************************
4191 reads or writes a structure.
4192 ********************************************************************/
4194 BOOL
samr_io_q_query_aliasmem(char *desc
, SAMR_Q_QUERY_ALIASMEM
* q_u
,
4195 prs_struct
*ps
, int depth
)
4200 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasmem");
4206 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4212 /*******************************************************************
4213 inits a SAMR_R_QUERY_ALIASMEM structure.
4214 ********************************************************************/
4216 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM
* r_u
,
4217 uint32 num_sids
, DOM_SID2
* sid
,
4220 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4223 r_u
->num_sids
= num_sids
;
4224 r_u
->ptr
= (num_sids
!= 0) ? 1 : 0;
4225 r_u
->num_sids1
= num_sids
;
4233 r_u
->status
= status
;
4236 /*******************************************************************
4237 reads or writes a structure.
4238 ********************************************************************/
4240 BOOL
samr_io_r_query_aliasmem(char *desc
, SAMR_R_QUERY_ALIASMEM
* r_u
,
4241 prs_struct
*ps
, int depth
)
4244 uint32 ptr_sid
[MAX_LOOKUP_SIDS
];
4249 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasmem");
4255 if(!prs_uint32("num_sids ", ps
, depth
, &r_u
->num_sids
))
4257 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
4260 if (r_u
->ptr
!= 0) {
4261 SMB_ASSERT_ARRAY(ptr_sid
, r_u
->num_sids
);
4263 if (r_u
->num_sids
!= 0) {
4264 if(!prs_uint32("num_sids1", ps
, depth
, &r_u
->num_sids1
))
4267 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4269 if(!prs_uint32("", ps
, depth
, &ptr_sid
[i
]))
4273 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4274 if (ptr_sid
[i
] != 0) {
4275 if(!smb_io_dom_sid2("", &r_u
->sid
[i
], ps
, depth
))
4284 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4290 /*******************************************************************
4291 inits a SAMR_Q_LOOKUP_NAMES structure.
4292 ********************************************************************/
4294 void init_samr_q_lookup_names(TALLOC_CTX
*ctx
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4295 POLICY_HND
*pol
, uint32 flags
,
4296 uint32 num_names
, char **name
)
4300 DEBUG(5, ("init_samr_q_lookup_names\n"));
4304 q_u
->num_names1
= num_names
;
4307 q_u
->num_names2
= num_names
;
4309 q_u
->hdr_name
= (UNIHDR
*)talloc_zero(ctx
, num_names
* sizeof(UNIHDR
));
4310 q_u
->uni_name
= (UNISTR2
*)talloc_zero(ctx
, num_names
* sizeof(UNISTR2
));
4312 for (i
= 0; i
< num_names
; i
++) {
4313 int len_name
= name
[i
] != NULL
? strlen(name
[i
]) : 0;
4314 init_uni_hdr(&q_u
->hdr_name
[i
], len_name
); /* unicode header for user_name */
4315 init_unistr2(&q_u
->uni_name
[i
], name
[i
], len_name
); /* unicode string for machine account */
4319 /*******************************************************************
4320 reads or writes a structure.
4321 ********************************************************************/
4323 BOOL
samr_io_q_lookup_names(char *desc
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4324 prs_struct
*ps
, int depth
)
4331 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_names");
4334 if (UNMARSHALLING(ps
))
4340 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4343 if(!prs_uint32("num_names1", ps
, depth
, &q_u
->num_names1
))
4345 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
4347 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
4349 if(!prs_uint32("num_names2", ps
, depth
, &q_u
->num_names2
))
4352 if (UNMARSHALLING(ps
) && (q_u
->num_names2
!= 0)) {
4353 q_u
->hdr_name
= (UNIHDR
*)prs_alloc_mem(ps
, sizeof(UNIHDR
) *
4355 q_u
->uni_name
= (UNISTR2
*)prs_alloc_mem(ps
, sizeof(UNISTR2
) *
4357 if (!q_u
->hdr_name
|| q_u
->uni_name
)
4361 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4362 if(!smb_io_unihdr("", &q_u
->hdr_name
[i
], ps
, depth
))
4366 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4367 if(!smb_io_unistr2("", &q_u
->uni_name
[i
], q_u
->hdr_name
[i
].buffer
, ps
, depth
))
4374 /*******************************************************************
4375 inits a SAMR_R_LOOKUP_NAMES structure.
4376 ********************************************************************/
4378 void init_samr_r_lookup_names(TALLOC_CTX
*ctx
, SAMR_R_LOOKUP_NAMES
* r_u
,
4380 uint32
*rid
, uint32
*type
,
4383 DEBUG(5, ("init_samr_r_lookup_names\n"));
4385 if ((status
== 0) && (num_rids
!= 0)) {
4388 r_u
->num_types1
= num_rids
;
4390 r_u
->num_types2
= num_rids
;
4392 r_u
->num_rids1
= num_rids
;
4394 r_u
->num_rids2
= num_rids
;
4396 r_u
->rids
= (uint32
*)talloc_zero(ctx
, sizeof(uint32
)*num_rids
);
4397 r_u
->types
= (uint32
*)talloc_zero(ctx
, sizeof(uint32
)*num_rids
);
4399 if (!r_u
->rids
|| !r_u
->types
)
4402 for (i
= 0; i
< num_rids
; i
++) {
4403 r_u
->rids
[i
] = rid
[i
];
4404 r_u
->types
[i
] = type
[i
];
4409 r_u
->num_types1
= 0;
4411 r_u
->num_types2
= 0;
4421 r_u
->status
= status
;
4424 /*******************************************************************
4425 reads or writes a structure.
4426 ********************************************************************/
4428 BOOL
samr_io_r_lookup_names(char *desc
, SAMR_R_LOOKUP_NAMES
* r_u
,
4429 prs_struct
*ps
, int depth
)
4437 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_names");
4440 if (UNMARSHALLING(ps
))
4446 if(!prs_uint32("num_rids1", ps
, depth
, &r_u
->num_rids1
))
4448 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
4451 if (r_u
->ptr_rids
!= 0) {
4452 if(!prs_uint32("num_rids2", ps
, depth
, &r_u
->num_rids2
))
4455 if (r_u
->num_rids2
!= r_u
->num_rids1
) {
4460 if (UNMARSHALLING(ps
))
4461 r_u
->rids
= (uint32
*)prs_alloc_mem(ps
, sizeof(uint32
)*r_u
->num_rids2
);
4464 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
4468 for (i
= 0; i
< r_u
->num_rids2
; i
++) {
4469 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
4470 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->rids
[i
]))
4475 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
4477 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
4480 if (r_u
->ptr_types
!= 0) {
4481 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
4484 if (r_u
->num_types2
!= r_u
->num_types1
) {
4489 if (UNMARSHALLING(ps
))
4490 r_u
->types
= (uint32
*)prs_alloc_mem(ps
, sizeof(uint32
)*r_u
->num_types2
);
4493 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
4497 for (i
= 0; i
< r_u
->num_types2
; i
++) {
4498 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
4499 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->types
[i
]))
4504 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4510 /*******************************************************************
4511 inits a SAMR_Q_DELETE_DOM_USER structure.
4512 ********************************************************************/
4514 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER
* q_c
,
4517 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
4519 q_c
->user_pol
= *hnd
;
4522 /*******************************************************************
4523 reads or writes a structure.
4524 ********************************************************************/
4526 BOOL
samr_io_q_delete_dom_user(char *desc
, SAMR_Q_DELETE_DOM_USER
* q_u
,
4527 prs_struct
*ps
, int depth
)
4532 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_user");
4538 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
4544 /*******************************************************************
4545 reads or writes a structure.
4546 ********************************************************************/
4548 BOOL
samr_io_r_delete_dom_user(char *desc
, SAMR_R_DELETE_DOM_USER
* r_u
,
4549 prs_struct
*ps
, int depth
)
4554 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_user");
4560 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4566 /*******************************************************************
4567 reads or writes a structure.
4568 ********************************************************************/
4570 void init_samr_q_open_user(SAMR_Q_OPEN_USER
* q_u
,
4572 uint32 access_mask
, uint32 rid
)
4574 DEBUG(5, ("samr_init_samr_q_open_user\n"));
4576 q_u
->domain_pol
= *pol
;
4577 q_u
->access_mask
= access_mask
;
4578 q_u
->user_rid
= rid
;
4581 /*******************************************************************
4582 reads or writes a structure.
4583 ********************************************************************/
4585 BOOL
samr_io_q_open_user(char *desc
, SAMR_Q_OPEN_USER
* q_u
,
4586 prs_struct
*ps
, int depth
)
4591 prs_debug(ps
, depth
, desc
, "samr_io_q_open_user");
4597 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4600 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4602 if(!prs_uint32("user_rid ", ps
, depth
, &q_u
->user_rid
))
4608 /*******************************************************************
4609 reads or writes a structure.
4610 ********************************************************************/
4612 BOOL
samr_io_r_open_user(char *desc
, SAMR_R_OPEN_USER
* r_u
,
4613 prs_struct
*ps
, int depth
)
4618 prs_debug(ps
, depth
, desc
, "samr_io_r_open_user");
4624 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
4627 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4634 /*******************************************************************
4635 reads or writes a structure.
4636 ********************************************************************/
4638 void init_samr_q_create_user(SAMR_Q_CREATE_USER
* q_u
,
4641 uint32 acb_info
, uint32 access_mask
)
4644 len_name
= strlen(name
);
4646 DEBUG(5, ("samr_init_samr_q_create_user\n"));
4648 q_u
->domain_pol
= *pol
;
4650 init_uni_hdr(&q_u
->hdr_name
, len_name
);
4651 init_unistr2(&q_u
->uni_name
, name
, len_name
);
4653 q_u
->acb_info
= acb_info
;
4654 q_u
->access_mask
= access_mask
;
4657 /*******************************************************************
4658 reads or writes a structure.
4659 ********************************************************************/
4661 BOOL
samr_io_q_create_user(char *desc
, SAMR_Q_CREATE_USER
* q_u
,
4662 prs_struct
*ps
, int depth
)
4667 prs_debug(ps
, depth
, desc
, "samr_io_q_create_user");
4673 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4676 if(!smb_io_unihdr("hdr_name", &q_u
->hdr_name
, ps
, depth
))
4678 if(!smb_io_unistr2("uni_name", &q_u
->uni_name
, q_u
->hdr_name
.buffer
, ps
, depth
))
4683 if(!prs_uint32("acb_info ", ps
, depth
, &q_u
->acb_info
))
4685 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4691 /*******************************************************************
4692 reads or writes a structure.
4693 ********************************************************************/
4695 BOOL
samr_io_r_create_user(char *desc
, SAMR_R_CREATE_USER
* r_u
,
4696 prs_struct
*ps
, int depth
)
4701 prs_debug(ps
, depth
, desc
, "samr_io_r_create_user");
4707 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
4710 if(!prs_uint32("unknown_0", ps
, depth
, &r_u
->unknown_0
))
4712 if(!prs_uint32("user_rid ", ps
, depth
, &r_u
->user_rid
))
4714 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4720 /*******************************************************************
4721 inits a SAMR_Q_QUERY_USERINFO structure.
4722 ********************************************************************/
4724 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO
* q_u
,
4725 POLICY_HND
*hnd
, uint16 switch_value
)
4727 DEBUG(5, ("init_samr_q_query_userinfo\n"));
4730 q_u
->switch_value
= switch_value
;
4733 /*******************************************************************
4734 reads or writes a structure.
4735 ********************************************************************/
4737 BOOL
samr_io_q_query_userinfo(char *desc
, SAMR_Q_QUERY_USERINFO
* q_u
,
4738 prs_struct
*ps
, int depth
)
4743 prs_debug(ps
, depth
, desc
, "samr_io_q_query_userinfo");
4749 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4752 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
)) /* 0x0015 or 0x0011 */
4758 /*******************************************************************
4759 reads or writes a LOGON_HRS structure.
4760 ********************************************************************/
4762 static BOOL
sam_io_logon_hrs(char *desc
, LOGON_HRS
* hrs
,
4763 prs_struct
*ps
, int depth
)
4768 prs_debug(ps
, depth
, desc
, "sam_io_logon_hrs");
4774 if(!prs_uint32("len ", ps
, depth
, &hrs
->len
))
4777 if (hrs
->len
> sizeof(hrs
->hours
)) {
4778 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs
->len
));
4779 hrs
->len
= sizeof(hrs
->hours
);
4782 if(!prs_uint8s(False
, "hours", ps
, depth
, hrs
->hours
, hrs
->len
))
4788 /*******************************************************************
4789 inits a SAM_USER_INFO_12 structure.
4790 ********************************************************************/
4792 void init_sam_user_info12(SAM_USER_INFO_12
* usr
,
4793 uint8 lm_pwd
[16], uint8 nt_pwd
[16])
4795 DEBUG(5, ("init_sam_user_info12\n"));
4797 usr
->lm_pwd_active
=
4798 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
)) ? 1 : 0;
4799 usr
->nt_pwd_active
=
4800 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
)) ? 1 : 0;
4803 /*******************************************************************
4804 reads or writes a structure.
4805 ********************************************************************/
4807 static BOOL
sam_io_user_info12(char *desc
, SAM_USER_INFO_12
* u
,
4808 prs_struct
*ps
, int depth
)
4813 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info12");
4819 if(!prs_uint8s(False
, "lm_pwd", ps
, depth
, u
->lm_pwd
, sizeof(u
->lm_pwd
)))
4821 if(!prs_uint8s(False
, "nt_pwd", ps
, depth
, u
->nt_pwd
, sizeof(u
->nt_pwd
)))
4824 if(!prs_uint8("lm_pwd_active", ps
, depth
, &u
->lm_pwd_active
))
4826 if(!prs_uint8("nt_pwd_active", ps
, depth
, &u
->nt_pwd_active
))
4832 /*******************************************************************
4833 inits a SAM_USER_INFO_10 structure.
4834 ********************************************************************/
4836 void init_sam_user_info10(SAM_USER_INFO_10
* usr
, uint32 acb_info
)
4838 DEBUG(5, ("init_sam_user_info10\n"));
4840 usr
->acb_info
= acb_info
;
4843 /*******************************************************************
4844 reads or writes a structure.
4845 ********************************************************************/
4847 static BOOL
sam_io_user_info10(char *desc
, SAM_USER_INFO_10
* usr
,
4848 prs_struct
*ps
, int depth
)
4853 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info10");
4859 if(!prs_uint32("acb_info", ps
, depth
, &usr
->acb_info
))
4865 /*******************************************************************
4866 inits a SAM_USER_INFO_11 structure.
4867 ********************************************************************/
4869 void init_sam_user_info11(SAM_USER_INFO_11
* usr
,
4872 uint32 rid_user
, uint32 rid_group
, uint16 acct_ctrl
)
4876 DEBUG(5, ("init_sam_user_info11\n"));
4878 len_mach_acct
= strlen(mach_acct
);
4880 memcpy(&(usr
->expiry
), expiry
, sizeof(usr
->expiry
)); /* expiry time or something? */
4881 ZERO_STRUCT(usr
->padding_1
); /* 0 - padding 24 bytes */
4883 init_uni_hdr(&usr
->hdr_mach_acct
, len_mach_acct
); /* unicode header for machine account */
4884 usr
->padding_2
= 0; /* 0 - padding 4 bytes */
4886 usr
->ptr_1
= 1; /* pointer */
4887 ZERO_STRUCT(usr
->padding_3
); /* 0 - padding 32 bytes */
4888 usr
->padding_4
= 0; /* 0 - padding 4 bytes */
4890 usr
->ptr_2
= 1; /* pointer */
4891 usr
->padding_5
= 0; /* 0 - padding 4 bytes */
4893 usr
->ptr_3
= 1; /* pointer */
4894 ZERO_STRUCT(usr
->padding_6
); /* 0 - padding 32 bytes */
4896 usr
->rid_user
= rid_user
;
4897 usr
->rid_group
= rid_group
;
4899 usr
->acct_ctrl
= acct_ctrl
;
4900 usr
->unknown_3
= 0x0000;
4902 usr
->unknown_4
= 0x003f; /* 0x003f - 16 bit unknown */
4903 usr
->unknown_5
= 0x003c; /* 0x003c - 16 bit unknown */
4905 ZERO_STRUCT(usr
->padding_7
); /* 0 - padding 16 bytes */
4906 usr
->padding_8
= 0; /* 0 - padding 4 bytes */
4908 init_unistr2(&usr
->uni_mach_acct
, mach_acct
, len_mach_acct
); /* unicode string for machine account */
4911 /*******************************************************************
4912 reads or writes a structure.
4913 ********************************************************************/
4915 static BOOL
sam_io_user_info11(char *desc
, SAM_USER_INFO_11
* usr
,
4916 prs_struct
*ps
, int depth
)
4921 prs_debug(ps
, depth
, desc
, "samr_io_r_unknown_11");
4927 if(!prs_uint8s(False
, "padding_0", ps
, depth
, usr
->padding_0
, sizeof(usr
->padding_0
)))
4930 if(!smb_io_time("time", &usr
->expiry
, ps
, depth
))
4933 if(!prs_uint8s(False
, "padding_1", ps
, depth
, usr
->padding_1
, sizeof(usr
->padding_1
)))
4936 if(!smb_io_unihdr("unihdr", &usr
->hdr_mach_acct
, ps
, depth
))
4939 if(!prs_uint32("padding_2", ps
, depth
, &usr
->padding_2
))
4942 if(!prs_uint32("ptr_1 ", ps
, depth
, &usr
->ptr_1
))
4944 if(!prs_uint8s(False
, "padding_3", ps
, depth
, usr
->padding_3
, sizeof(usr
->padding_3
)))
4947 if(!prs_uint32("padding_4", ps
, depth
, &usr
->padding_4
))
4950 if(!prs_uint32("ptr_2 ", ps
, depth
, &usr
->ptr_2
))
4952 if(!prs_uint32("padding_5", ps
, depth
, &usr
->padding_5
))
4955 if(!prs_uint32("ptr_3 ", ps
, depth
, &usr
->ptr_3
))
4957 if(!prs_uint8s(False
, "padding_6", ps
, depth
, usr
->padding_6
,sizeof(usr
->padding_6
)))
4960 if(!prs_uint32("rid_user ", ps
, depth
, &usr
->rid_user
))
4962 if(!prs_uint32("rid_group", ps
, depth
, &usr
->rid_group
))
4964 if(!prs_uint16("acct_ctrl", ps
, depth
, &usr
->acct_ctrl
))
4966 if(!prs_uint16("unknown_3", ps
, depth
, &usr
->unknown_3
))
4968 if(!prs_uint16("unknown_4", ps
, depth
, &usr
->unknown_4
))
4970 if(!prs_uint16("unknown_5", ps
, depth
, &usr
->unknown_5
))
4973 if(!prs_uint8s(False
, "padding_7", ps
, depth
, usr
->padding_7
, sizeof(usr
->padding_7
)))
4976 if(!prs_uint32("padding_8", ps
, depth
, &(usr
->padding_8
)))
4979 if(!smb_io_unistr2("unistr2", &usr
->uni_mach_acct
, True
, ps
, depth
))
4985 if(!prs_uint8s(False
, "padding_9", ps
, depth
, usr
->padding_9
, sizeof(usr
->padding_9
)))
4991 /*************************************************************************
4994 unknown_3 = 0x09f8 27fa
4995 unknown_5 = 0x0001 0000
4996 unknown_6 = 0x0000 04ec
4998 *************************************************************************/
5000 void init_sam_user_info24(SAM_USER_INFO_24
* usr
,
5001 char newpass
[516], uint16 passlen
)
5003 DEBUG(10, ("init_sam_user_info24: passlen: %d\n", passlen
));
5004 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5007 /*******************************************************************
5008 reads or writes a structure.
5009 ********************************************************************/
5011 static BOOL
sam_io_user_info24(char *desc
, SAM_USER_INFO_24
* usr
,
5012 prs_struct
*ps
, int depth
)
5017 prs_debug(ps
, depth
, desc
, "sam_io_user_info24");
5023 if(!prs_uint8s(False
, "password", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5029 /*************************************************************************
5030 init_sam_user_info23
5032 unknown_3 = 0x09f8 27fa
5033 unknown_5 = 0x0001 0000
5034 unknown_6 = 0x0000 04ec
5036 *************************************************************************/
5038 void init_sam_user_info23W(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5039 NTTIME
* logoff_time
, /* all zeros */
5040 NTTIME
* kickoff_time
, /* all zeros */
5041 NTTIME
* pass_last_set_time
, /* all zeros */
5042 NTTIME
* pass_can_change_time
, /* all zeros */
5043 NTTIME
* pass_must_change_time
, /* all zeros */
5054 uint32 user_rid
, /* 0x0000 0000 */
5061 char newpass
[516], uint32 unknown_6
)
5063 int len_user_name
= user_name
!= NULL
? user_name
->uni_str_len
: 0;
5064 int len_full_name
= full_name
!= NULL
? full_name
->uni_str_len
: 0;
5065 int len_home_dir
= home_dir
!= NULL
? home_dir
->uni_str_len
: 0;
5066 int len_dir_drive
= dir_drive
!= NULL
? dir_drive
->uni_str_len
: 0;
5067 int len_logon_script
= log_scr
!= NULL
? log_scr
->uni_str_len
: 0;
5068 int len_profile_path
= prof_path
!= NULL
? prof_path
->uni_str_len
: 0;
5069 int len_description
= desc
!= NULL
? desc
->uni_str_len
: 0;
5070 int len_workstations
= wkstas
!= NULL
? wkstas
->uni_str_len
: 0;
5071 int len_unknown_str
= unk_str
!= NULL
? unk_str
->uni_str_len
: 0;
5072 int len_munged_dial
= mung_dial
!= NULL
? mung_dial
->uni_str_len
: 0;
5074 usr
->logon_time
= *logon_time
; /* all zeros */
5075 usr
->logoff_time
= *logoff_time
; /* all zeros */
5076 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5077 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5078 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5079 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5081 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
); /* NULL */
5082 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5083 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5084 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5085 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5086 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5087 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5088 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5089 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5090 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5092 ZERO_STRUCT(usr
->nt_pwd
);
5093 ZERO_STRUCT(usr
->lm_pwd
);
5095 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5096 usr
->group_rid
= group_rid
;
5097 usr
->acb_info
= acb_info
;
5098 usr
->unknown_3
= unknown_3
; /* 09f8 27fa */
5100 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5101 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5103 ZERO_STRUCT(usr
->padding1
);
5105 usr
->unknown_5
= unknown_5
; /* 0x0001 0000 */
5107 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5109 copy_unistr2(&usr
->uni_user_name
, user_name
);
5110 copy_unistr2(&usr
->uni_full_name
, full_name
);
5111 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5112 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5113 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5114 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5115 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5116 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5117 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5118 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5120 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5123 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5126 /*************************************************************************
5127 init_sam_user_info23
5129 unknown_3 = 0x09f8 27fa
5130 unknown_5 = 0x0001 0000
5131 unknown_6 = 0x0000 04ec
5133 *************************************************************************/
5135 void init_sam_user_info23A(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5136 NTTIME
* logoff_time
, /* all zeros */
5137 NTTIME
* kickoff_time
, /* all zeros */
5138 NTTIME
* pass_last_set_time
, /* all zeros */
5139 NTTIME
* pass_can_change_time
, /* all zeros */
5140 NTTIME
* pass_must_change_time
, /* all zeros */
5141 char *user_name
, /* NULL */
5143 char *home_dir
, char *dir_drive
, char *log_scr
,
5144 char *prof_path
, char *desc
, char *wkstas
,
5145 char *unk_str
, char *mung_dial
, uint32 user_rid
, /* 0x0000 0000 */
5146 uint32 group_rid
, uint32 acb_info
,
5147 uint32 unknown_3
, uint16 logon_divs
,
5148 LOGON_HRS
* hrs
, uint32 unknown_5
,
5149 char newpass
[516], uint32 unknown_6
)
5151 int len_user_name
= user_name
!= NULL
? strlen(user_name
) : 0;
5152 int len_full_name
= full_name
!= NULL
? strlen(full_name
) : 0;
5153 int len_home_dir
= home_dir
!= NULL
? strlen(home_dir
) : 0;
5154 int len_dir_drive
= dir_drive
!= NULL
? strlen(dir_drive
) : 0;
5155 int len_logon_script
= log_scr
!= NULL
? strlen(log_scr
) : 0;
5156 int len_profile_path
= prof_path
!= NULL
? strlen(prof_path
) : 0;
5157 int len_description
= desc
!= NULL
? strlen(desc
) : 0;
5158 int len_workstations
= wkstas
!= NULL
? strlen(wkstas
) : 0;
5159 int len_unknown_str
= unk_str
!= NULL
? strlen(unk_str
) : 0;
5160 int len_munged_dial
= mung_dial
!= NULL
? strlen(mung_dial
) : 0;
5162 usr
->logon_time
= *logon_time
; /* all zeros */
5163 usr
->logoff_time
= *logoff_time
; /* all zeros */
5164 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5165 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5166 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5167 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5169 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
); /* NULL */
5170 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5171 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5172 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5173 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5174 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5175 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5176 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5177 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5178 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5180 ZERO_STRUCT(usr
->nt_pwd
);
5181 ZERO_STRUCT(usr
->lm_pwd
);
5183 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5184 usr
->group_rid
= group_rid
;
5185 usr
->acb_info
= acb_info
;
5186 usr
->unknown_3
= unknown_3
; /* 09f8 27fa */
5188 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5189 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5191 ZERO_STRUCT(usr
->padding1
);
5193 usr
->unknown_5
= unknown_5
; /* 0x0001 0000 */
5195 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5197 init_unistr2(&usr
->uni_user_name
, user_name
, len_user_name
); /* NULL */
5198 init_unistr2(&usr
->uni_full_name
, full_name
, len_full_name
);
5199 init_unistr2(&usr
->uni_home_dir
, home_dir
, len_home_dir
);
5200 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, len_dir_drive
);
5201 init_unistr2(&usr
->uni_logon_script
, log_scr
, len_logon_script
);
5202 init_unistr2(&usr
->uni_profile_path
, prof_path
, len_profile_path
);
5203 init_unistr2(&usr
->uni_acct_desc
, desc
, len_description
);
5204 init_unistr2(&usr
->uni_workstations
, wkstas
, len_workstations
);
5205 init_unistr2(&usr
->uni_unknown_str
, unk_str
, len_unknown_str
);
5206 init_unistr2(&usr
->uni_munged_dial
, mung_dial
, len_munged_dial
);
5208 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5211 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5214 /*******************************************************************
5215 reads or writes a structure.
5216 ********************************************************************/
5218 static BOOL
sam_io_user_info23(char *desc
, SAM_USER_INFO_23
* usr
,
5219 prs_struct
*ps
, int depth
)
5224 prs_debug(ps
, depth
, desc
, "sam_io_user_info23");
5230 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5232 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5234 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5236 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
5238 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
5240 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5243 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5245 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5247 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5249 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5251 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5253 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5255 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5257 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5259 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5261 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5264 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5266 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5269 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5271 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5273 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5276 if(!prs_uint32("unknown_3 ", ps
, depth
, &usr
->unknown_3
))
5278 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5282 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5284 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
5286 if(!prs_uint32("unknown_5 ", ps
, depth
, &usr
->unknown_5
))
5289 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5292 /* here begins pointed-to data */
5294 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5297 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5300 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5303 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5306 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5309 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5312 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5315 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5318 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5321 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
5324 /* ok, this is only guess-work (as usual) */
5325 if (usr
->ptr_logon_hrs
) {
5326 if(!prs_uint32("unknown_6 ", ps
, depth
, &usr
->unknown_6
))
5328 if(!prs_uint32("padding4 ", ps
, depth
, &usr
->padding4
))
5330 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5332 } else if (UNMARSHALLING(ps
)) {
5341 /*************************************************************************
5342 init_sam_user_info21W
5344 unknown_3 = 0x00ff ffff
5345 unknown_5 = 0x0002 0000
5346 unknown_6 = 0x0000 04ec
5348 *************************************************************************/
5350 void init_sam_user_info21W(SAM_USER_INFO_21
* usr
,
5351 NTTIME
* logon_time
,
5352 NTTIME
* logoff_time
,
5353 NTTIME
* kickoff_time
,
5354 NTTIME
* pass_last_set_time
,
5355 NTTIME
* pass_can_change_time
,
5356 NTTIME
* pass_must_change_time
,
5375 uint32 unknown_5
, uint32 unknown_6
)
5377 int len_user_name
= user_name
!= NULL
? user_name
->uni_str_len
: 0;
5378 int len_full_name
= full_name
!= NULL
? full_name
->uni_str_len
: 0;
5379 int len_home_dir
= home_dir
!= NULL
? home_dir
->uni_str_len
: 0;
5380 int len_dir_drive
= dir_drive
!= NULL
? dir_drive
->uni_str_len
: 0;
5381 int len_logon_script
= log_scr
!= NULL
? log_scr
->uni_str_len
: 0;
5382 int len_profile_path
= prof_path
!= NULL
? prof_path
->uni_str_len
: 0;
5383 int len_description
= desc
!= NULL
? desc
->uni_str_len
: 0;
5384 int len_workstations
= wkstas
!= NULL
? wkstas
->uni_str_len
: 0;
5385 int len_unknown_str
= unk_str
!= NULL
? unk_str
->uni_str_len
: 0;
5386 int len_munged_dial
= mung_dial
!= NULL
? mung_dial
->uni_str_len
: 0;
5388 usr
->logon_time
= *logon_time
;
5389 usr
->logoff_time
= *logoff_time
;
5390 usr
->kickoff_time
= *kickoff_time
;
5391 usr
->pass_last_set_time
= *pass_last_set_time
;
5392 usr
->pass_can_change_time
= *pass_can_change_time
;
5393 usr
->pass_must_change_time
= *pass_must_change_time
;
5395 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
);
5396 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5397 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5398 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5399 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5400 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5401 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5402 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5403 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5404 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5406 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
));
5407 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
));
5409 usr
->user_rid
= user_rid
;
5410 usr
->group_rid
= group_rid
;
5411 usr
->acb_info
= acb_info
;
5412 usr
->unknown_3
= unknown_3
; /* 0x00ff ffff */
5414 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5415 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5416 usr
->unknown_5
= unknown_5
; /* 0x0002 0000 */
5418 ZERO_STRUCT(usr
->padding1
);
5420 copy_unistr2(&usr
->uni_user_name
, user_name
);
5421 copy_unistr2(&usr
->uni_full_name
, full_name
);
5422 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5423 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5424 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5425 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5426 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5427 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5428 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5429 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5431 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5434 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5437 /*************************************************************************
5438 init_sam_user_info21
5440 unknown_3 = 0x00ff ffff
5441 unknown_5 = 0x0002 0000
5442 unknown_6 = 0x0000 04ec
5444 *************************************************************************/
5446 void init_sam_user_info21A(SAM_USER_INFO_21
* usr
,
5447 NTTIME
* logon_time
,
5448 NTTIME
* logoff_time
,
5449 NTTIME
* kickoff_time
,
5450 NTTIME
* pass_last_set_time
,
5451 NTTIME
* pass_can_change_time
,
5452 NTTIME
* pass_must_change_time
,
5469 uint32 unknown_5
, uint32 unknown_6
)
5471 int len_user_name
= user_name
!= NULL
? strlen(user_name
) : 0;
5472 int len_full_name
= full_name
!= NULL
? strlen(full_name
) : 0;
5473 int len_home_dir
= home_dir
!= NULL
? strlen(home_dir
) : 0;
5474 int len_dir_drive
= dir_drive
!= NULL
? strlen(dir_drive
) : 0;
5475 int len_logon_script
= log_scr
!= NULL
? strlen(log_scr
) : 0;
5476 int len_profile_path
= prof_path
!= NULL
? strlen(prof_path
) : 0;
5477 int len_description
= desc
!= NULL
? strlen(desc
) : 0;
5478 int len_workstations
= wkstas
!= NULL
? strlen(wkstas
) : 0;
5479 int len_unknown_str
= unk_str
!= NULL
? strlen(unk_str
) : 0;
5480 int len_munged_dial
= mung_dial
!= NULL
? strlen(mung_dial
) : 0;
5482 usr
->logon_time
= *logon_time
;
5483 usr
->logoff_time
= *logoff_time
;
5484 usr
->kickoff_time
= *kickoff_time
;
5485 usr
->pass_last_set_time
= *pass_last_set_time
;
5486 usr
->pass_can_change_time
= *pass_can_change_time
;
5487 usr
->pass_must_change_time
= *pass_must_change_time
;
5489 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
);
5490 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5491 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5492 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5493 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5494 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5495 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5496 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5497 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5498 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5500 ZERO_STRUCT(usr
->nt_pwd
);
5501 ZERO_STRUCT(usr
->lm_pwd
);
5503 usr
->user_rid
= user_rid
;
5504 usr
->group_rid
= group_rid
;
5505 usr
->acb_info
= acb_info
;
5506 usr
->unknown_3
= unknown_3
; /* 0x00ff ffff */
5508 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5509 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5510 usr
->unknown_5
= unknown_5
; /* 0x0002 0000 */
5512 ZERO_STRUCT(usr
->padding1
);
5514 init_unistr2(&usr
->uni_user_name
, user_name
, len_user_name
);
5515 init_unistr2(&usr
->uni_full_name
, full_name
, len_full_name
);
5516 init_unistr2(&usr
->uni_home_dir
, home_dir
, len_home_dir
);
5517 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, len_dir_drive
);
5518 init_unistr2(&usr
->uni_logon_script
, log_scr
, len_logon_script
);
5519 init_unistr2(&usr
->uni_profile_path
, prof_path
, len_profile_path
);
5520 init_unistr2(&usr
->uni_acct_desc
, desc
, len_description
);
5521 init_unistr2(&usr
->uni_workstations
, wkstas
, len_workstations
);
5522 init_unistr2(&usr
->uni_unknown_str
, unk_str
, len_unknown_str
);
5523 init_unistr2(&usr
->uni_munged_dial
, mung_dial
, len_munged_dial
);
5525 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5528 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5531 /*******************************************************************
5532 reads or writes a structure.
5533 ********************************************************************/
5535 static BOOL
sam_io_user_info21(char *desc
, SAM_USER_INFO_21
* usr
,
5536 prs_struct
*ps
, int depth
)
5541 prs_debug(ps
, depth
, desc
, "sam_io_user_info21");
5547 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5549 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5551 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
,depth
))
5553 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5555 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
,depth
))
5557 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5560 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5562 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5564 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5566 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5568 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5570 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5572 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5574 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5576 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5578 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5581 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5583 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5586 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5588 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5590 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5593 if(!prs_uint32("unknown_3 ", ps
, depth
, &usr
->unknown_3
))
5595 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5599 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5601 if(!prs_uint32("unknown_5 ", ps
, depth
, &usr
->unknown_5
))
5604 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
5607 /* here begins pointed-to data */
5609 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
,usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5611 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5613 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5615 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5617 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5619 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5621 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5623 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5625 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5627 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
)) /* worksations user can log on from */
5630 /* ok, this is only guess-work (as usual) */
5631 if (usr
->ptr_logon_hrs
) {
5634 if(!prs_uint32("unknown_6 ", ps
, depth
, &usr
->unknown_6
))
5636 if(!prs_uint32("padding4 ", ps
, depth
, &usr
->padding4
))
5638 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5640 } else if (UNMARSHALLING(ps
)) {
5648 /*******************************************************************
5649 inits a SAM_USERINFO_CTR structure.
5650 ********************************************************************/
5652 uint32
make_samr_userinfo_ctr_usr21(TALLOC_CTX
*ctx
, SAM_USERINFO_CTR
* ctr
,
5653 uint16 switch_value
,
5654 SAM_USER_INFO_21
* usr
)
5656 DEBUG(5, ("init_samr_userinfo_ctr\n"));
5658 ctr
->switch_value
= switch_value
;
5659 ctr
->info
.id
= NULL
;
5661 switch (switch_value
) {
5663 ctr
->info
.id10
= (SAM_USER_INFO_10
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_10
));
5664 if (ctr
->info
.id10
== NULL
)
5665 return NT_STATUS_NO_MEMORY
;
5667 init_sam_user_info10(ctr
->info
.id10
, usr
->acb_info
);
5670 /* whoops - got this wrong. i think. or don't understand what's happening. */
5674 info
= (void *)&id11
;
5676 expire
.low
= 0xffffffff;
5677 expire
.high
= 0x7fffffff;
5679 ctr
->info
.id
= (SAM_USER_INFO_11
*) talloc_zero(ctx
,sizeof(*ctr
->info
.id11
));
5680 init_sam_user_info11(ctr
->info
.id11
, &expire
,
5681 "BROOKFIELDS$", /* name */
5682 0x03ef, /* user rid */
5683 0x201, /* group rid */
5684 0x0080); /* acb info */
5690 ctr
->info
.id12
= (SAM_USER_INFO_12
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_12
));
5691 if (ctr
->info
.id12
== NULL
)
5692 return NT_STATUS_NO_MEMORY
;
5694 init_sam_user_info12(ctr
->info
.id12
, usr
->lm_pwd
, usr
->nt_pwd
);
5698 SAM_USER_INFO_21
*cusr
;
5699 cusr
= (SAM_USER_INFO_21
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_21
));
5700 ctr
->info
.id21
= cusr
;
5701 if (ctr
->info
.id21
== NULL
)
5702 return NT_STATUS_NO_MEMORY
;
5703 memcpy(cusr
, usr
, sizeof(*usr
));
5704 memset(cusr
->lm_pwd
, 0, sizeof(cusr
->lm_pwd
));
5705 memset(cusr
->nt_pwd
, 0, sizeof(cusr
->nt_pwd
));
5709 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
5710 return NT_STATUS_INVALID_INFO_CLASS
;
5713 return NT_STATUS_NOPROBLEMO
;
5716 /*******************************************************************
5717 inits a SAM_USERINFO_CTR structure.
5718 ********************************************************************/
5720 void init_samr_userinfo_ctr(SAM_USERINFO_CTR
* ctr
, uchar
* sess_key
,
5721 uint16 switch_value
, void *info
)
5723 DEBUG(5, ("init_samr_userinfo_ctr\n"));
5725 ctr
->switch_value
= switch_value
;
5726 ctr
->info
.id
= info
;
5728 switch (switch_value
) {
5730 SamOEMhash(ctr
->info
.id24
->pass
, sess_key
, 1);
5731 dump_data(100, (char *)sess_key
, 16);
5732 dump_data(100, (char *)ctr
->info
.id24
->pass
, 516);
5735 SamOEMhash(ctr
->info
.id23
->pass
, sess_key
, 1);
5736 dump_data(100, (char *)sess_key
, 16);
5737 dump_data(100, (char *)ctr
->info
.id23
->pass
, 516);
5740 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level\n"));
5744 /*******************************************************************
5745 reads or writes a structure.
5746 ********************************************************************/
5748 static BOOL
samr_io_userinfo_ctr(char *desc
, SAM_USERINFO_CTR
**ppctr
,
5749 prs_struct
*ps
, int depth
)
5752 SAM_USERINFO_CTR
*ctr
;
5754 prs_debug(ps
, depth
, desc
, "samr_io_userinfo_ctr");
5757 if (UNMARSHALLING(ps
)) {
5758 ctr
= (SAM_USERINFO_CTR
*)prs_alloc_mem(ps
,sizeof(SAM_USERINFO_CTR
));
5766 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
5768 if(!prs_uint16("switch_value", ps
, depth
, &ctr
->switch_value
))
5775 switch (ctr
->switch_value
) {
5777 if (UNMARSHALLING(ps
))
5778 ctr
->info
.id10
= (SAM_USER_INFO_10
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_10
));
5779 if (ctr
->info
.id10
== NULL
) {
5780 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5783 ret
= sam_io_user_info10("", ctr
->info
.id10
, ps
, depth
);
5786 if (UNMARSHALLING(ps
))
5787 ctr
->info
.id11
= (SAM_USER_INFO_11
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_11
));
5789 if (ctr
->info
.id11
== NULL
) {
5790 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5793 ret
= sam_io_user_info11("", ctr
->info
.id11
, ps
, depth
);
5796 if (UNMARSHALLING(ps
))
5797 ctr
->info
.id12
= (SAM_USER_INFO_12
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_12
));
5799 if (ctr
->info
.id12
== NULL
) {
5800 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5803 ret
= sam_io_user_info12("", ctr
->info
.id12
, ps
, depth
);
5806 if (UNMARSHALLING(ps
))
5807 ctr
->info
.id21
= (SAM_USER_INFO_21
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_21
));
5809 if (ctr
->info
.id21
== NULL
) {
5810 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5813 ret
= sam_io_user_info21("", ctr
->info
.id21
, ps
, depth
);
5816 if (UNMARSHALLING(ps
))
5817 ctr
->info
.id23
= (SAM_USER_INFO_23
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_23
));
5819 if (ctr
->info
.id23
== NULL
) {
5820 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5823 ret
= sam_io_user_info23("", ctr
->info
.id23
, ps
, depth
);
5826 if (UNMARSHALLING(ps
))
5827 ctr
->info
.id24
= (SAM_USER_INFO_24
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_24
));
5829 if (ctr
->info
.id24
== NULL
) {
5830 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5833 ret
= sam_io_user_info24("", ctr
->info
.id24
, ps
, depth
);
5836 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr
->switch_value
));
5844 /*******************************************************************
5845 inits a SAMR_R_QUERY_USERINFO structure.
5846 ********************************************************************/
5848 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO
* r_u
,
5849 SAM_USERINFO_CTR
* ctr
, uint32 status
)
5851 DEBUG(5, ("init_samr_r_query_userinfo\n"));
5861 r_u
->status
= status
; /* return status */
5864 /*******************************************************************
5865 reads or writes a structure.
5866 ********************************************************************/
5868 BOOL
samr_io_r_query_userinfo(char *desc
, SAMR_R_QUERY_USERINFO
* r_u
,
5869 prs_struct
*ps
, int depth
)
5874 prs_debug(ps
, depth
, desc
, "samr_io_r_query_userinfo");
5880 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
5883 if (r_u
->ptr
!= 0) {
5884 if(!samr_io_userinfo_ctr("ctr", &r_u
->ctr
, ps
, depth
))
5890 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
5896 /*******************************************************************
5897 inits a SAMR_Q_SET_USERINFO structure.
5898 ********************************************************************/
5900 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO
* q_u
,
5901 POLICY_HND
*hnd
, unsigned char sess_key
[16],
5902 uint16 switch_value
, void *info
)
5904 DEBUG(5, ("init_samr_q_set_userinfo\n"));
5907 q_u
->switch_value
= switch_value
;
5908 init_samr_userinfo_ctr(q_u
->ctr
, sess_key
, switch_value
, info
);
5911 /*******************************************************************
5912 reads or writes a structure.
5913 ********************************************************************/
5915 BOOL
samr_io_q_set_userinfo(char *desc
, SAMR_Q_SET_USERINFO
* q_u
,
5916 prs_struct
*ps
, int depth
)
5921 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo");
5927 smb_io_pol_hnd("pol", &(q_u
->pol
), ps
, depth
);
5929 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
5931 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
5937 /*******************************************************************
5938 inits a SAMR_R_SET_USERINFO structure.
5939 ********************************************************************/
5941 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO
* r_u
, uint32 status
)
5943 DEBUG(5, ("init_samr_r_set_userinfo\n"));
5945 r_u
->status
= status
; /* return status */
5948 /*******************************************************************
5949 reads or writes a structure.
5950 ********************************************************************/
5952 BOOL
samr_io_r_set_userinfo(char *desc
, SAMR_R_SET_USERINFO
* r_u
,
5953 prs_struct
*ps
, int depth
)
5958 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo");
5964 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
5970 /*******************************************************************
5971 inits a SAMR_Q_SET_USERINFO2 structure.
5972 ********************************************************************/
5974 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2
* q_u
,
5975 POLICY_HND
*hnd
, unsigned char sess_key
[16],
5976 uint16 switch_value
, SAM_USERINFO_CTR
* ctr
)
5978 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
5981 q_u
->switch_value
= switch_value
;
5984 if (q_u
->ctr
!= NULL
)
5985 q_u
->ctr
->switch_value
= switch_value
;
5987 switch (switch_value
) {
5989 SamOEMhash(ctr
->info
.id12
->lm_pwd
, sess_key
, 0);
5990 SamOEMhash(ctr
->info
.id12
->nt_pwd
, sess_key
, 0);
5991 dump_data(100, (char *)sess_key
, 16);
5992 dump_data(100, (char *)ctr
->info
.id12
->lm_pwd
, 16);
5993 dump_data(100, (char *)ctr
->info
.id12
->nt_pwd
, 16);
5998 /*******************************************************************
5999 reads or writes a structure.
6000 ********************************************************************/
6002 BOOL
samr_io_q_set_userinfo2(char *desc
, SAMR_Q_SET_USERINFO2
* q_u
,
6003 prs_struct
*ps
, int depth
)
6008 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo2");
6014 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
6017 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6019 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6025 /*******************************************************************
6026 inits a SAMR_R_SET_USERINFO2 structure.
6027 ********************************************************************/
6029 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2
* r_u
, uint32 status
)
6031 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
6033 r_u
->status
= status
; /* return status */
6036 /*******************************************************************
6037 reads or writes a structure.
6038 ********************************************************************/
6040 BOOL
samr_io_r_set_userinfo2(char *desc
, SAMR_R_SET_USERINFO2
* r_u
,
6041 prs_struct
*ps
, int depth
)
6046 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo2");
6052 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6058 /*******************************************************************
6059 inits a SAMR_Q_CONNECT structure.
6060 ********************************************************************/
6062 void init_samr_q_connect(SAMR_Q_CONNECT
* q_u
,
6063 char *srv_name
, uint32 access_mask
)
6065 int len_srv_name
= strlen(srv_name
);
6067 DEBUG(5, ("init_samr_q_connect\n"));
6069 /* make PDC server name \\server */
6070 q_u
->ptr_srv_name
= len_srv_name
> 0 ? 1 : 0;
6071 init_unistr2(&q_u
->uni_srv_name
, srv_name
, len_srv_name
+ 1);
6073 /* example values: 0x0000 0002 */
6074 q_u
->access_mask
= access_mask
;
6077 /*******************************************************************
6078 reads or writes a structure.
6079 ********************************************************************/
6081 BOOL
samr_io_q_connect(char *desc
, SAMR_Q_CONNECT
* q_u
,
6082 prs_struct
*ps
, int depth
)
6087 prs_debug(ps
, depth
, desc
, "samr_io_q_connect");
6093 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
6095 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
6100 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6106 /*******************************************************************
6107 reads or writes a structure.
6108 ********************************************************************/
6110 BOOL
samr_io_r_connect(char *desc
, SAMR_R_CONNECT
* r_u
,
6111 prs_struct
*ps
, int depth
)
6116 prs_debug(ps
, depth
, desc
, "samr_io_r_connect");
6122 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6125 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6131 /*******************************************************************
6132 inits a SAMR_Q_CONNECT_ANON structure.
6133 ********************************************************************/
6135 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON
* q_u
)
6137 DEBUG(5, ("init_samr_q_connect_anon\n"));
6140 q_u
->unknown_0
= 0x5c; /* server name (?!!) */
6141 q_u
->unknown_1
= 0x01;
6142 q_u
->access_mask
= 0x20;
6145 /*******************************************************************
6146 reads or writes a structure.
6147 ********************************************************************/
6149 BOOL
samr_io_q_connect_anon(char *desc
, SAMR_Q_CONNECT_ANON
* q_u
,
6150 prs_struct
*ps
, int depth
)
6155 prs_debug(ps
, depth
, desc
, "samr_io_q_connect_anon");
6161 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
6163 if(!prs_uint16("unknown_0", ps
, depth
, &q_u
->unknown_0
))
6165 if(!prs_uint16("unknown_1", ps
, depth
, &q_u
->unknown_1
))
6167 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6173 /*******************************************************************
6174 reads or writes a structure.
6175 ********************************************************************/
6177 BOOL
samr_io_r_connect_anon(char *desc
, SAMR_R_CONNECT_ANON
* r_u
,
6178 prs_struct
*ps
, int depth
)
6183 prs_debug(ps
, depth
, desc
, "samr_io_r_connect_anon");
6189 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6192 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6198 /*******************************************************************
6199 inits a SAMR_Q_GET_DOM_PWINFO structure.
6200 ********************************************************************/
6202 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO
* q_u
,
6205 int len_srv_name
= strlen(srv_name
);
6207 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
6210 init_uni_hdr(&q_u
->hdr_srv_name
, len_srv_name
);
6211 init_unistr2(&q_u
->uni_srv_name
, srv_name
, len_srv_name
);
6214 /*******************************************************************
6215 reads or writes a structure.
6216 ********************************************************************/
6218 BOOL
samr_io_q_get_dom_pwinfo(char *desc
, SAMR_Q_GET_DOM_PWINFO
* q_u
,
6219 prs_struct
*ps
, int depth
)
6224 prs_debug(ps
, depth
, desc
, "samr_io_q_get_dom_pwinfo");
6230 if(!prs_uint32("ptr", ps
, depth
, &q_u
->ptr
))
6232 if (q_u
->ptr
!= 0) {
6233 if(!smb_io_unihdr("", &q_u
->hdr_srv_name
, ps
, depth
))
6235 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->hdr_srv_name
.buffer
, ps
, depth
))
6242 /*******************************************************************
6243 reads or writes a structure.
6244 ********************************************************************/
6246 BOOL
samr_io_r_get_dom_pwinfo(char *desc
, SAMR_R_GET_DOM_PWINFO
* r_u
,
6247 prs_struct
*ps
, int depth
)
6252 prs_debug(ps
, depth
, desc
, "samr_io_r_get_dom_pwinfo");
6258 if(!prs_uint16("unk_0", ps
, depth
, &r_u
->unk_0
))
6262 if(!prs_uint16("unk_1", ps
, depth
, &r_u
->unk_1
))
6266 if(!prs_uint16("unk_2", ps
, depth
, &r_u
->unk_2
))
6271 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6277 /*******************************************************************
6278 make a SAMR_ENC_PASSWD structure.
6279 ********************************************************************/
6281 void init_enc_passwd(SAMR_ENC_PASSWD
* pwd
, char pass
[512])
6289 memcpy(pwd
->pass
, pass
, sizeof(pwd
->pass
));
6293 /*******************************************************************
6294 reads or writes a SAMR_ENC_PASSWD structure.
6295 ********************************************************************/
6297 BOOL
samr_io_enc_passwd(char *desc
, SAMR_ENC_PASSWD
* pwd
,
6298 prs_struct
*ps
, int depth
)
6303 prs_debug(ps
, depth
, desc
, "samr_io_enc_passwd");
6309 if(!prs_uint32("ptr", ps
, depth
, &pwd
->ptr
))
6312 if (pwd
->ptr
!= 0) {
6313 if(!prs_uint8s(False
, "pwd", ps
, depth
, pwd
->pass
, sizeof(pwd
->pass
)))
6320 /*******************************************************************
6321 inits a SAMR_ENC_HASH structure.
6322 ********************************************************************/
6324 void init_enc_hash(SAMR_ENC_HASH
* hsh
, uchar hash
[16])
6332 memcpy(hsh
->hash
, hash
, sizeof(hsh
->hash
));
6336 /*******************************************************************
6337 reads or writes a SAMR_ENC_HASH structure.
6338 ********************************************************************/
6340 BOOL
samr_io_enc_hash(char *desc
, SAMR_ENC_HASH
* hsh
,
6341 prs_struct
*ps
, int depth
)
6346 prs_debug(ps
, depth
, desc
, "samr_io_enc_hash");
6352 if(!prs_uint32("ptr ", ps
, depth
, &hsh
->ptr
))
6354 if (hsh
->ptr
!= 0) {
6355 if(!prs_uint8s(False
, "hash", ps
, depth
, hsh
->hash
,sizeof(hsh
->hash
)))
6362 /*******************************************************************
6363 inits a SAMR_R_GET_DOM_PWINFO structure.
6364 ********************************************************************/
6366 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER
* q_u
,
6367 char *dest_host
, char *user_name
,
6368 char nt_newpass
[516],
6369 uchar nt_oldhash
[16],
6370 char lm_newpass
[516],
6371 uchar lm_oldhash
[16])
6373 int len_dest_host
= strlen(dest_host
);
6374 int len_user_name
= strlen(user_name
);
6376 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
6379 init_uni_hdr(&q_u
->hdr_dest_host
, len_dest_host
);
6380 init_unistr2(&q_u
->uni_dest_host
, dest_host
, len_dest_host
);
6381 init_uni_hdr(&q_u
->hdr_user_name
, len_user_name
);
6382 init_unistr2(&q_u
->uni_user_name
, user_name
, len_user_name
);
6384 init_enc_passwd(&q_u
->nt_newpass
, nt_newpass
);
6385 init_enc_hash(&q_u
->nt_oldhash
, nt_oldhash
);
6387 q_u
->unknown
= 0x01;
6389 init_enc_passwd(&q_u
->lm_newpass
, lm_newpass
);
6390 init_enc_hash(&q_u
->lm_oldhash
, lm_oldhash
);
6393 /*******************************************************************
6394 reads or writes a structure.
6395 ********************************************************************/
6397 BOOL
samr_io_q_chgpasswd_user(char *desc
, SAMR_Q_CHGPASSWD_USER
* q_u
,
6398 prs_struct
*ps
, int depth
)
6403 prs_debug(ps
, depth
, desc
, "samr_io_q_chgpasswd_user");
6409 if(!prs_uint32("ptr_0", ps
, depth
, &q_u
->ptr_0
))
6412 if(!smb_io_unihdr("", &q_u
->hdr_dest_host
, ps
, depth
))
6414 if(!smb_io_unistr2("", &q_u
->uni_dest_host
, q_u
->hdr_dest_host
.buffer
, ps
, depth
))
6419 if(!smb_io_unihdr("", &q_u
->hdr_user_name
, ps
, depth
))
6421 if(!smb_io_unistr2("", &q_u
->uni_user_name
, q_u
->hdr_user_name
.buffer
,ps
, depth
))
6424 if(!samr_io_enc_passwd("nt_newpass", &q_u
->nt_newpass
, ps
, depth
))
6426 if(!samr_io_enc_hash("nt_oldhash", &q_u
->nt_oldhash
, ps
, depth
))
6429 if(!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
6432 if(!samr_io_enc_passwd("lm_newpass", &q_u
->lm_newpass
, ps
, depth
))
6434 if(!samr_io_enc_hash("lm_oldhash", &q_u
->lm_oldhash
, ps
, depth
))
6440 /*******************************************************************
6441 inits a SAMR_R_CHGPASSWD_USER structure.
6442 ********************************************************************/
6444 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER
* r_u
, uint32 status
)
6446 DEBUG(5, ("init_r_chgpasswd_user\n"));
6448 r_u
->status
= status
;
6451 /*******************************************************************
6452 reads or writes a structure.
6453 ********************************************************************/
6455 BOOL
samr_io_r_chgpasswd_user(char *desc
, SAMR_R_CHGPASSWD_USER
* r_u
,
6456 prs_struct
*ps
, int depth
)
6461 prs_debug(ps
, depth
, desc
, "samr_io_r_chgpasswd_user");
6467 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))