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
)
2056 prs_debug(ps
, depth
, desc
, "samr_group_info_ctr");
2059 if(!prs_uint16("switch_value1", ps
, depth
, &ctr
->switch_value1
))
2061 if(!prs_uint16("switch_value2", ps
, depth
, &ctr
->switch_value2
))
2064 switch (ctr
->switch_value1
) {
2066 if(!samr_io_group_info1("group_info1",
2067 &ctr
->group
.info1
, ps
, depth
))
2071 if(!samr_io_group_info4("group_info4",
2072 &ctr
->group
.info4
, ps
, depth
))
2076 DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
2083 /*******************************************************************
2084 inits a SAMR_Q_CREATE_DOM_GROUP structure.
2085 ********************************************************************/
2087 void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2088 POLICY_HND
*pol
, char *acct_desc
,
2091 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
2093 DEBUG(5, ("init_samr_q_create_dom_group\n"));
2097 init_uni_hdr(&q_e
->hdr_acct_desc
, acct_len
);
2098 init_unistr2(&q_e
->uni_acct_desc
, acct_desc
, acct_len
);
2100 q_e
->access_mask
= access_mask
;
2103 /*******************************************************************
2104 reads or writes a structure.
2105 ********************************************************************/
2107 BOOL
samr_io_q_create_dom_group(char *desc
, SAMR_Q_CREATE_DOM_GROUP
* q_e
,
2108 prs_struct
*ps
, int depth
)
2113 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_group");
2119 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2122 if(!smb_io_unihdr("hdr_acct_desc", &q_e
->hdr_acct_desc
, ps
, depth
))
2124 if(!smb_io_unistr2("uni_acct_desc", &q_e
->uni_acct_desc
,
2125 q_e
->hdr_acct_desc
.buffer
, ps
, depth
))
2130 if(!prs_uint32("access", ps
, depth
, &q_e
->access_mask
))
2136 /*******************************************************************
2137 reads or writes a structure.
2138 ********************************************************************/
2140 BOOL
samr_io_r_create_dom_group(char *desc
, SAMR_R_CREATE_DOM_GROUP
* r_u
,
2141 prs_struct
*ps
, int depth
)
2146 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_group");
2152 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
2155 if(!prs_uint32("rid ", ps
, depth
, &r_u
->rid
))
2157 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2163 /*******************************************************************
2164 inits a SAMR_Q_DELETE_DOM_GROUP structure.
2165 ********************************************************************/
2167 void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP
* q_c
,
2170 DEBUG(5, ("init_samr_q_delete_dom_group\n"));
2172 q_c
->group_pol
= *hnd
;
2175 /*******************************************************************
2176 reads or writes a structure.
2177 ********************************************************************/
2179 BOOL
samr_io_q_delete_dom_group(char *desc
, SAMR_Q_DELETE_DOM_GROUP
* q_u
,
2180 prs_struct
*ps
, int depth
)
2185 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_group");
2191 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2197 /*******************************************************************
2198 reads or writes a structure.
2199 ********************************************************************/
2201 BOOL
samr_io_r_delete_dom_group(char *desc
, SAMR_R_DELETE_DOM_GROUP
* r_u
,
2202 prs_struct
*ps
, int depth
)
2207 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_group");
2213 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2219 /*******************************************************************
2220 inits a SAMR_Q_DEL_GROUPMEM structure.
2221 ********************************************************************/
2223 void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM
* q_e
,
2224 POLICY_HND
*pol
, uint32 rid
)
2226 DEBUG(5, ("init_samr_q_del_groupmem\n"));
2232 /*******************************************************************
2233 reads or writes a structure.
2234 ********************************************************************/
2236 BOOL
samr_io_q_del_groupmem(char *desc
, SAMR_Q_DEL_GROUPMEM
* q_e
,
2237 prs_struct
*ps
, int depth
)
2242 prs_debug(ps
, depth
, desc
, "samr_io_q_del_groupmem");
2248 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2251 if(!prs_uint32("rid", ps
, depth
, &q_e
->rid
))
2257 /*******************************************************************
2258 inits a SAMR_R_DEL_GROUPMEM structure.
2259 ********************************************************************/
2261 void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2264 DEBUG(5, ("init_samr_r_del_groupmem\n"));
2266 r_u
->status
= status
;
2269 /*******************************************************************
2270 reads or writes a structure.
2271 ********************************************************************/
2273 BOOL
samr_io_r_del_groupmem(char *desc
, SAMR_R_DEL_GROUPMEM
* r_u
,
2274 prs_struct
*ps
, int depth
)
2279 prs_debug(ps
, depth
, desc
, "samr_io_r_del_groupmem");
2285 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2291 /*******************************************************************
2292 inits a SAMR_Q_ADD_GROUPMEM structure.
2293 ********************************************************************/
2295 void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM
* q_e
,
2296 POLICY_HND
*pol
, uint32 rid
)
2298 DEBUG(5, ("init_samr_q_add_groupmem\n"));
2302 q_e
->unknown
= 0x0005;
2305 /*******************************************************************
2306 reads or writes a structure.
2307 ********************************************************************/
2309 BOOL
samr_io_q_add_groupmem(char *desc
, SAMR_Q_ADD_GROUPMEM
* q_e
,
2310 prs_struct
*ps
, int depth
)
2315 prs_debug(ps
, depth
, desc
, "samr_io_q_add_groupmem");
2321 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2324 if(!prs_uint32("rid ", ps
, depth
, &q_e
->rid
))
2326 if(!prs_uint32("unknown", ps
, depth
, &q_e
->unknown
))
2332 /*******************************************************************
2333 inits a SAMR_R_ADD_GROUPMEM structure.
2334 ********************************************************************/
2336 void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM
* r_u
, POLICY_HND
*pol
,
2339 DEBUG(5, ("init_samr_r_add_groupmem\n"));
2341 r_u
->status
= status
;
2344 /*******************************************************************
2345 reads or writes a structure.
2346 ********************************************************************/
2348 BOOL
samr_io_r_add_groupmem(char *desc
, SAMR_R_ADD_GROUPMEM
* r_u
,
2349 prs_struct
*ps
, int depth
)
2354 prs_debug(ps
, depth
, desc
, "samr_io_r_add_groupmem");
2360 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2366 /*******************************************************************
2367 inits a SAMR_Q_SET_GROUPINFO structure.
2368 ********************************************************************/
2370 void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO
* q_e
,
2371 POLICY_HND
*pol
, GROUP_INFO_CTR
* ctr
)
2373 DEBUG(5, ("init_samr_q_set_groupinfo\n"));
2379 /*******************************************************************
2380 reads or writes a structure.
2381 ********************************************************************/
2383 BOOL
samr_io_q_set_groupinfo(char *desc
, SAMR_Q_SET_GROUPINFO
* q_e
,
2384 prs_struct
*ps
, int depth
)
2389 prs_debug(ps
, depth
, desc
, "samr_io_q_set_groupinfo");
2395 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2398 if(!samr_group_info_ctr("ctr", q_e
->ctr
, ps
, depth
))
2404 /*******************************************************************
2405 inits a SAMR_R_SET_GROUPINFO structure.
2406 ********************************************************************/
2408 void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO
* r_u
, uint32 status
)
2410 DEBUG(5, ("init_samr_r_set_groupinfo\n"));
2412 r_u
->status
= status
;
2415 /*******************************************************************
2416 reads or writes a structure.
2417 ********************************************************************/
2419 BOOL
samr_io_r_set_groupinfo(char *desc
, SAMR_R_SET_GROUPINFO
* r_u
,
2420 prs_struct
*ps
, int depth
)
2425 prs_debug(ps
, depth
, desc
, "samr_io_r_set_groupinfo");
2431 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2437 /*******************************************************************
2438 inits a SAMR_Q_QUERY_GROUPINFO structure.
2439 ********************************************************************/
2441 void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO
* q_e
,
2442 POLICY_HND
*pol
, uint16 switch_level
)
2444 DEBUG(5, ("init_samr_q_query_groupinfo\n"));
2448 q_e
->switch_level
= switch_level
;
2451 /*******************************************************************
2452 reads or writes a structure.
2453 ********************************************************************/
2455 BOOL
samr_io_q_query_groupinfo(char *desc
, SAMR_Q_QUERY_GROUPINFO
* q_e
,
2456 prs_struct
*ps
, int depth
)
2461 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupinfo");
2467 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2470 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
2476 /*******************************************************************
2477 inits a SAMR_R_QUERY_GROUPINFO structure.
2478 ********************************************************************/
2480 void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO
* r_u
,
2481 GROUP_INFO_CTR
* ctr
, uint32 status
)
2483 DEBUG(5, ("init_samr_r_query_groupinfo\n"));
2485 r_u
->ptr
= (status
== 0x0 && ctr
!= NULL
) ? 1 : 0;
2487 r_u
->status
= status
;
2490 /*******************************************************************
2491 reads or writes a structure.
2492 ********************************************************************/
2494 BOOL
samr_io_r_query_groupinfo(char *desc
, SAMR_R_QUERY_GROUPINFO
* r_u
,
2495 prs_struct
*ps
, int depth
)
2500 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupinfo");
2506 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2509 if (r_u
->ptr
!= 0) {
2510 if(!samr_group_info_ctr("ctr", r_u
->ctr
, ps
, depth
))
2516 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2522 /*******************************************************************
2523 inits a SAMR_Q_QUERY_GROUPMEM structure.
2524 ********************************************************************/
2526 void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM
* q_c
, POLICY_HND
*hnd
)
2528 DEBUG(5, ("init_samr_q_query_groupmem\n"));
2530 q_c
->group_pol
= *hnd
;
2533 /*******************************************************************
2534 reads or writes a structure.
2535 ********************************************************************/
2537 BOOL
samr_io_q_query_groupmem(char *desc
, SAMR_Q_QUERY_GROUPMEM
* q_u
,
2538 prs_struct
*ps
, int depth
)
2543 prs_debug(ps
, depth
, desc
, "samr_io_q_query_groupmem");
2549 if(!smb_io_pol_hnd("group_pol", &q_u
->group_pol
, ps
, depth
))
2555 /*******************************************************************
2556 inits a SAMR_R_QUERY_GROUPMEM structure.
2557 ********************************************************************/
2559 void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM
* r_u
,
2560 uint32 num_entries
, uint32
*rid
,
2561 uint32
*attr
, uint32 status
)
2563 DEBUG(5, ("init_samr_r_query_groupmem\n"));
2565 if (status
== 0x0) {
2567 r_u
->num_entries
= num_entries
;
2569 r_u
->ptr_attrs
= attr
!= NULL
? 1 : 0;
2570 r_u
->ptr_rids
= rid
!= NULL
? 1 : 0;
2572 r_u
->num_rids
= num_entries
;
2575 r_u
->num_attrs
= num_entries
;
2579 r_u
->num_entries
= 0;
2582 r_u
->status
= status
;
2585 /*******************************************************************
2586 reads or writes a structure.
2587 ********************************************************************/
2589 BOOL
samr_io_r_query_groupmem(char *desc
, SAMR_R_QUERY_GROUPMEM
* r_u
,
2590 prs_struct
*ps
, int depth
)
2597 if (UNMARSHALLING(ps
))
2600 prs_debug(ps
, depth
, desc
, "samr_io_r_query_groupmem");
2606 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
2608 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2611 if (r_u
->ptr
!= 0) {
2612 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
2614 if(!prs_uint32("ptr_attrs", ps
, depth
, &r_u
->ptr_attrs
))
2617 if (r_u
->ptr_rids
!= 0) {
2618 if(!prs_uint32("num_rids", ps
, depth
, &r_u
->num_rids
))
2620 if (UNMARSHALLING(ps
) && r_u
->num_rids
!= 0) {
2621 r_u
->rid
= (uint32
*)prs_alloc_mem(ps
,sizeof(r_u
->rid
[0])*r_u
->num_rids
);
2622 if (r_u
->rid
== NULL
)
2626 for (i
= 0; i
< r_u
->num_rids
; i
++) {
2627 if(!prs_uint32("", ps
, depth
, &r_u
->rid
[i
]))
2632 if (r_u
->ptr_attrs
!= 0) {
2633 if(!prs_uint32("num_attrs", ps
, depth
, &r_u
->num_attrs
))
2636 if (UNMARSHALLING(ps
) && r_u
->num_attrs
!= 0) {
2637 r_u
->attr
= (uint32
*)prs_alloc_mem(ps
,sizeof(r_u
->attr
[0])*r_u
->num_attrs
);
2638 if (r_u
->attr
== NULL
)
2642 for (i
= 0; i
< r_u
->num_attrs
; i
++) {
2643 if(!prs_uint32("", ps
, depth
, &r_u
->attr
[i
]))
2649 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2655 /*******************************************************************
2656 inits a SAMR_Q_QUERY_USERGROUPS structure.
2657 ********************************************************************/
2659 void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS
* q_u
,
2662 DEBUG(5, ("init_samr_q_query_usergroups\n"));
2667 /*******************************************************************
2668 reads or writes a structure.
2669 ********************************************************************/
2671 BOOL
samr_io_q_query_usergroups(char *desc
, SAMR_Q_QUERY_USERGROUPS
* q_u
,
2672 prs_struct
*ps
, int depth
)
2677 prs_debug(ps
, depth
, desc
, "samr_io_q_query_usergroups");
2683 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
2689 /*******************************************************************
2690 inits a SAMR_R_QUERY_USERGROUPS structure.
2691 ********************************************************************/
2693 void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS
* r_u
,
2694 uint32 num_gids
, DOM_GID
* gid
,
2697 DEBUG(5, ("init_samr_r_query_usergroups\n"));
2701 r_u
->num_entries
= num_gids
;
2702 r_u
->ptr_1
= (num_gids
!= 0) ? 1 : 0;
2703 r_u
->num_entries2
= num_gids
;
2708 r_u
->num_entries
= 0;
2713 r_u
->status
= status
;
2716 /*******************************************************************
2717 reads or writes a structure.
2718 ********************************************************************/
2720 BOOL
samr_io_gids(char *desc
, uint32
*num_gids
, DOM_GID
** gid
,
2721 prs_struct
*ps
, int depth
)
2727 prs_debug(ps
, depth
, desc
, "samr_io_gids");
2733 if(!prs_uint32("num_gids", ps
, depth
, num_gids
))
2736 if ((*num_gids
) != 0) {
2737 if (UNMARSHALLING(ps
)) {
2738 (*gid
) = (DOM_GID
*)prs_alloc_mem(ps
,sizeof(DOM_GID
)*(*num_gids
));
2741 if ((*gid
) == NULL
) {
2745 for (i
= 0; i
< (*num_gids
); i
++) {
2746 if(!smb_io_gid("gids", &(*gid
)[i
], ps
, depth
))
2754 /*******************************************************************
2755 reads or writes a structure.
2756 ********************************************************************/
2758 BOOL
samr_io_r_query_usergroups(char *desc
, SAMR_R_QUERY_USERGROUPS
* r_u
,
2759 prs_struct
*ps
, int depth
)
2764 prs_debug(ps
, depth
, desc
, "samr_io_r_query_usergroups");
2770 if(!prs_uint32("ptr_0 ", ps
, depth
, &r_u
->ptr_0
))
2773 if (r_u
->ptr_0
!= 0) {
2774 if(!prs_uint32("num_entries ", ps
, depth
, &r_u
->num_entries
))
2776 if(!prs_uint32("ptr_1 ", ps
, depth
, &r_u
->ptr_1
))
2779 if (r_u
->num_entries
!= 0 && r_u
->ptr_1
!= 0) {
2780 if(!samr_io_gids("gids", &r_u
->num_entries2
, &r_u
->gid
, ps
, depth
))
2787 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2793 /*******************************************************************
2794 inits a SAMR_Q_ENUM_DOMAINS structure.
2795 ********************************************************************/
2797 void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS
* q_e
,
2799 uint32 start_idx
, uint32 size
)
2801 DEBUG(5, ("init_samr_q_enum_domains\n"));
2805 q_e
->start_idx
= start_idx
;
2806 q_e
->max_size
= size
;
2809 /*******************************************************************
2810 reads or writes a structure.
2811 ********************************************************************/
2813 BOOL
samr_io_q_enum_domains(char *desc
, SAMR_Q_ENUM_DOMAINS
* q_e
,
2814 prs_struct
*ps
, int depth
)
2819 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_domains");
2825 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
2828 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
2830 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
2836 /*******************************************************************
2837 inits a SAMR_R_ENUM_DOMAINS structure.
2838 ********************************************************************/
2840 void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS
* r_u
,
2841 uint32 next_idx
, uint32 num_sam_entries
)
2843 DEBUG(5, ("init_samr_r_enum_domains\n"));
2845 r_u
->next_idx
= next_idx
;
2847 if (num_sam_entries
!= 0) {
2848 r_u
->ptr_entries1
= 1;
2849 r_u
->ptr_entries2
= 1;
2850 r_u
->num_entries2
= num_sam_entries
;
2851 r_u
->num_entries3
= num_sam_entries
;
2853 r_u
->num_entries4
= num_sam_entries
;
2855 r_u
->ptr_entries1
= 0;
2856 r_u
->num_entries2
= num_sam_entries
;
2857 r_u
->ptr_entries2
= 1;
2861 /*******************************************************************
2862 reads or writes a structure.
2863 ********************************************************************/
2865 BOOL
samr_io_r_enum_domains(char *desc
, SAMR_R_ENUM_DOMAINS
* r_u
,
2866 prs_struct
*ps
, int depth
)
2873 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_domains");
2879 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
2881 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
2884 if (r_u
->ptr_entries1
!= 0) {
2885 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
2887 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
2889 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
2892 if (UNMARSHALLING(ps
)) {
2893 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
2894 r_u
->uni_dom_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
2897 if ((r_u
->sam
== NULL
|| r_u
->uni_dom_name
== NULL
) && r_u
->num_entries2
!= 0) {
2898 DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
2899 r_u
->num_entries4
= 0;
2900 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
2904 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
2906 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
2907 if(!sam_io_sam_entry(tmp
, &r_u
->sam
[i
], ps
, depth
))
2911 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
2913 slprintf(tmp
, sizeof(tmp
) - 1, "dom[%d]", i
);
2914 if(!smb_io_unistr2(tmp
, &r_u
->uni_dom_name
[i
],
2915 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
2924 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
2926 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
2932 /*******************************************************************
2933 inits a SAMR_Q_ENUM_DOM_GROUPS structure.
2934 ********************************************************************/
2936 void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
2938 uint32 start_idx
, uint32 size
)
2940 DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
2944 q_e
->start_idx
= start_idx
;
2945 q_e
->max_size
= size
;
2948 /*******************************************************************
2949 reads or writes a structure.
2950 ********************************************************************/
2952 BOOL
samr_io_q_enum_dom_groups(char *desc
, SAMR_Q_ENUM_DOM_GROUPS
* q_e
,
2953 prs_struct
*ps
, int depth
)
2958 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_groups");
2964 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
2967 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
2969 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
2975 /*******************************************************************
2976 inits a SAMR_R_ENUM_DOM_GROUPS structure.
2977 ********************************************************************/
2979 void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS
* r_u
,
2980 uint32 next_idx
, uint32 num_sam_entries
)
2982 DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
2984 r_u
->next_idx
= next_idx
;
2986 if (num_sam_entries
!= 0) {
2987 r_u
->ptr_entries1
= 1;
2988 r_u
->ptr_entries2
= 1;
2989 r_u
->num_entries2
= num_sam_entries
;
2990 r_u
->num_entries3
= num_sam_entries
;
2992 r_u
->num_entries4
= num_sam_entries
;
2994 r_u
->ptr_entries1
= 0;
2995 r_u
->num_entries2
= num_sam_entries
;
2996 r_u
->ptr_entries2
= 1;
3000 /*******************************************************************
3001 reads or writes a structure.
3002 ********************************************************************/
3004 BOOL
samr_io_r_enum_dom_groups(char *desc
, SAMR_R_ENUM_DOM_GROUPS
* r_u
,
3005 prs_struct
*ps
, int depth
)
3012 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_groups");
3018 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3020 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3023 if (r_u
->ptr_entries1
!= 0) {
3024 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3026 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3028 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3031 if (UNMARSHALLING(ps
)) {
3032 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
3033 r_u
->uni_grp_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
3036 if ((r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
) && r_u
->num_entries2
!= 0) {
3038 ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
3039 r_u
->num_entries4
= 0;
3040 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3044 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3045 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3049 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3050 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3051 r_u
->sam
[i
].hdr_name
.buffer
, ps
, depth
))
3058 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3060 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3066 /*******************************************************************
3067 inits a SAMR_Q_ENUM_DOM_ALIASES structure.
3068 ********************************************************************/
3070 void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3071 POLICY_HND
*pol
, uint32 start_idx
,
3074 DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
3078 q_e
->start_idx
= start_idx
;
3079 q_e
->max_size
= size
;
3083 /*******************************************************************
3084 reads or writes a structure.
3085 ********************************************************************/
3087 BOOL
samr_io_q_enum_dom_aliases(char *desc
, SAMR_Q_ENUM_DOM_ALIASES
* q_e
,
3088 prs_struct
*ps
, int depth
)
3093 prs_debug(ps
, depth
, desc
, "samr_io_q_enum_dom_aliases");
3099 if(!smb_io_pol_hnd("pol", &q_e
->pol
, ps
, depth
))
3102 if(!prs_uint32("start_idx", ps
, depth
, &q_e
->start_idx
))
3104 if(!prs_uint32("max_size ", ps
, depth
, &q_e
->max_size
))
3110 /*******************************************************************
3111 inits a SAMR_R_ENUM_DOM_ALIASES structure.
3112 ********************************************************************/
3114 void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES
*r_u
, uint32 next_idx
, uint32 num_sam_entries
)
3116 DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
3118 r_u
->next_idx
= next_idx
;
3120 if (num_sam_entries
!= 0) {
3121 r_u
->ptr_entries1
= 1;
3122 r_u
->ptr_entries2
= 1;
3123 r_u
->num_entries2
= num_sam_entries
;
3124 r_u
->num_entries3
= num_sam_entries
;
3126 r_u
->num_entries4
= num_sam_entries
;
3128 r_u
->ptr_entries1
= 0;
3129 r_u
->num_entries2
= num_sam_entries
;
3130 r_u
->ptr_entries2
= 1;
3134 /*******************************************************************
3135 reads or writes a structure.
3136 ********************************************************************/
3138 BOOL
samr_io_r_enum_dom_aliases(char *desc
, SAMR_R_ENUM_DOM_ALIASES
* r_u
,
3139 prs_struct
*ps
, int depth
)
3146 prs_debug(ps
, depth
, desc
, "samr_io_r_enum_dom_aliases");
3152 if(!prs_uint32("next_idx ", ps
, depth
, &r_u
->next_idx
))
3154 if(!prs_uint32("ptr_entries1", ps
, depth
, &r_u
->ptr_entries1
))
3157 if (r_u
->ptr_entries1
!= 0) {
3158 if(!prs_uint32("num_entries2", ps
, depth
, &r_u
->num_entries2
))
3160 if(!prs_uint32("ptr_entries2", ps
, depth
, &r_u
->ptr_entries2
))
3162 if(!prs_uint32("num_entries3", ps
, depth
, &r_u
->num_entries3
))
3165 if (UNMARSHALLING(ps
) && (r_u
->num_entries2
> 0)) {
3166 r_u
->sam
= (SAM_ENTRY
*)prs_alloc_mem(ps
,sizeof(SAM_ENTRY
)*r_u
->num_entries2
);
3167 r_u
->uni_grp_name
= (UNISTR2
*)prs_alloc_mem(ps
,sizeof(UNISTR2
)*r_u
->num_entries2
);
3170 if (r_u
->num_entries2
!= 0 &&
3171 (r_u
->sam
== NULL
|| r_u
->uni_grp_name
== NULL
)) {
3172 DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
3173 r_u
->num_entries4
= 0;
3174 r_u
->status
= NT_STATUS_MEMORY_NOT_ALLOCATED
;
3178 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3179 if(!sam_io_sam_entry("", &r_u
->sam
[i
], ps
, depth
))
3183 for (i
= 0; i
< r_u
->num_entries2
; i
++) {
3184 if(!smb_io_unistr2("", &r_u
->uni_grp_name
[i
],
3185 r_u
->sam
[i
].hdr_name
.buffer
, ps
,
3193 if(!prs_uint32("num_entries4", ps
, depth
, &r_u
->num_entries4
))
3195 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3201 /*******************************************************************
3202 inits a ALIAS_INFO3 structure.
3203 ********************************************************************/
3205 void init_samr_alias_info3(ALIAS_INFO3
* al3
, char *acct_desc
)
3207 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
3209 DEBUG(5, ("init_samr_alias_info3\n"));
3211 init_uni_hdr(&al3
->hdr_acct_desc
, acct_len
);
3212 init_unistr2(&al3
->uni_acct_desc
, acct_desc
, acct_len
);
3215 /*******************************************************************
3216 reads or writes a structure.
3217 ********************************************************************/
3219 BOOL
samr_io_alias_info3(char *desc
, ALIAS_INFO3
* al3
,
3220 prs_struct
*ps
, int depth
)
3225 prs_debug(ps
, depth
, desc
, "samr_io_alias_info3");
3231 if(!smb_io_unihdr("hdr_acct_desc", &al3
->hdr_acct_desc
, ps
, depth
))
3233 if(!smb_io_unistr2("uni_acct_desc", &al3
->uni_acct_desc
,
3234 al3
->hdr_acct_desc
.buffer
, ps
, depth
))
3240 /*******************************************************************
3241 reads or writes a structure.
3242 ********************************************************************/
3244 BOOL
samr_alias_info_ctr(char *desc
, ALIAS_INFO_CTR
* ctr
,
3245 prs_struct
*ps
, int depth
)
3250 prs_debug(ps
, depth
, desc
, "samr_alias_info_ctr");
3253 if(!prs_uint16("switch_value1", ps
, depth
, &ctr
->switch_value1
))
3255 if(!prs_uint16("switch_value2", ps
, depth
, &ctr
->switch_value2
))
3258 switch (ctr
->switch_value1
) {
3260 if(!samr_io_alias_info3("alias_info3", &ctr
->alias
.info3
, ps
, depth
))
3264 DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
3271 /*******************************************************************
3272 inits a SAMR_Q_QUERY_ALIASINFO structure.
3273 ********************************************************************/
3275 void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO
* q_e
,
3276 POLICY_HND
*pol
, uint16 switch_level
)
3278 DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
3281 q_e
->switch_level
= switch_level
;
3284 /*******************************************************************
3285 reads or writes a structure.
3286 ********************************************************************/
3288 BOOL
samr_io_q_query_aliasinfo(char *desc
, SAMR_Q_QUERY_ALIASINFO
* q_e
,
3289 prs_struct
*ps
, int depth
)
3294 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasinfo");
3300 if(!smb_io_pol_hnd("pol", &(q_e
->pol
), ps
, depth
))
3303 if(!prs_uint16("switch_level", ps
, depth
, &q_e
->switch_level
))
3309 /*******************************************************************
3310 inits a SAMR_R_QUERY_ALIASINFO structure.
3311 ********************************************************************/
3313 void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO
* r_u
,
3314 ALIAS_INFO_CTR
* ctr
, uint32 status
)
3316 DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
3318 r_u
->ptr
= (status
== 0x0 && ctr
!= NULL
) ? 1 : 0;
3320 r_u
->status
= status
;
3323 /*******************************************************************
3324 reads or writes a structure.
3325 ********************************************************************/
3327 BOOL
samr_io_r_query_aliasinfo(char *desc
, SAMR_R_QUERY_ALIASINFO
* r_u
,
3328 prs_struct
*ps
, int depth
)
3333 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasinfo");
3339 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
3342 if (r_u
->ptr
!= 0) {
3343 if(!samr_alias_info_ctr("ctr", &r_u
->ctr
, ps
, depth
))
3349 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3355 /*******************************************************************
3356 inits a SAMR_Q_SET_ALIASINFO structure.
3357 ********************************************************************/
3359 void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO
* q_u
,
3360 POLICY_HND
*hnd
, ALIAS_INFO_CTR
* ctr
)
3362 DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
3364 q_u
->alias_pol
= *hnd
;
3368 /*******************************************************************
3369 reads or writes a structure.
3370 ********************************************************************/
3372 BOOL
samr_io_q_set_aliasinfo(char *desc
, SAMR_Q_SET_ALIASINFO
* q_u
,
3373 prs_struct
*ps
, int depth
)
3378 prs_debug(ps
, depth
, desc
, "samr_io_q_set_aliasinfo");
3384 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
3386 if(!samr_alias_info_ctr("ctr", &q_u
->ctr
, ps
, depth
))
3392 /*******************************************************************
3393 reads or writes a structure.
3394 ********************************************************************/
3396 BOOL
samr_io_r_set_aliasinfo(char *desc
, SAMR_R_SET_ALIASINFO
* r_u
,
3397 prs_struct
*ps
, int depth
)
3402 prs_debug(ps
, depth
, desc
, "samr_io_r_set_aliasinfo");
3407 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3413 /*******************************************************************
3414 inits a SAMR_Q_QUERY_USERALIASES structure.
3415 ********************************************************************/
3417 void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES
* q_u
,
3420 uint32
*ptr_sid
, DOM_SID2
* sid
)
3422 DEBUG(5, ("init_samr_q_query_useraliases\n"));
3426 q_u
->num_sids1
= num_sids
;
3428 q_u
->num_sids2
= num_sids
;
3430 q_u
->ptr_sid
= ptr_sid
;
3434 /*******************************************************************
3435 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
3436 ********************************************************************/
3438 BOOL
samr_io_q_query_useraliases(char *desc
, SAMR_Q_QUERY_USERALIASES
* q_u
,
3439 prs_struct
*ps
, int depth
)
3447 prs_debug(ps
, depth
, desc
, "samr_io_q_query_useraliases");
3453 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3456 if(!prs_uint32("num_sids1", ps
, depth
, &q_u
->num_sids1
))
3458 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3464 if(!prs_uint32("num_sids2", ps
, depth
, &q_u
->num_sids2
))
3467 if (UNMARSHALLING(ps
) && (q_u
->num_sids2
!= 0)) {
3468 q_u
->ptr_sid
= (uint32
*)prs_alloc_mem(ps
,sizeof(q_u
->ptr_sid
[0])*q_u
->num_sids2
);
3469 if (q_u
->ptr_sid
== NULL
)
3472 q_u
->sid
= (DOM_SID2
*)prs_alloc_mem(ps
, sizeof(q_u
->sid
[0]) * q_u
->num_sids2
);
3473 if (q_u
->sid
== NULL
)
3477 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3478 slprintf(tmp
, sizeof(tmp
) - 1, "ptr[%02d]", i
);
3479 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->ptr_sid
[i
]))
3483 for (i
= 0; i
< q_u
->num_sids2
; i
++) {
3484 if (q_u
->ptr_sid
[i
] != 0) {
3485 slprintf(tmp
, sizeof(tmp
) - 1, "sid[%02d]", i
);
3486 if(!smb_io_dom_sid2(tmp
, &q_u
->sid
[i
], ps
, depth
))
3494 /*******************************************************************
3495 inits a SAMR_R_QUERY_USERALIASES structure.
3496 ********************************************************************/
3498 void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES
* r_u
,
3499 uint32 num_rids
, uint32
*rid
,
3502 DEBUG(5, ("init_samr_r_query_useraliases\n"));
3504 if (status
== 0x0) {
3505 r_u
->num_entries
= num_rids
;
3507 r_u
->num_entries2
= num_rids
;
3511 r_u
->num_entries
= 0;
3513 r_u
->num_entries2
= 0;
3516 r_u
->status
= status
;
3519 /*******************************************************************
3520 reads or writes a structure.
3521 ********************************************************************/
3523 BOOL
samr_io_rids(char *desc
, uint32
*num_rids
, uint32
**rid
,
3524 prs_struct
*ps
, int depth
)
3531 prs_debug(ps
, depth
, desc
, "samr_io_rids");
3537 if(!prs_uint32("num_rids", ps
, depth
, num_rids
))
3540 if ((*num_rids
) != 0) {
3541 if (UNMARSHALLING(ps
)) {
3543 (*rid
) = (uint32
*)prs_alloc_mem(ps
,sizeof(uint32
)*(*num_rids
));
3548 for (i
= 0; i
< (*num_rids
); i
++) {
3549 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d]", i
);
3550 if(!prs_uint32(tmp
, ps
, depth
, &((*rid
)[i
])))
3558 /*******************************************************************
3559 reads or writes a structure.
3560 ********************************************************************/
3562 BOOL
samr_io_r_query_useraliases(char *desc
, SAMR_R_QUERY_USERALIASES
* r_u
,
3563 prs_struct
*ps
, int depth
)
3568 prs_debug(ps
, depth
, desc
, "samr_io_r_query_useraliases");
3574 if(!prs_uint32("num_entries", ps
, depth
, &r_u
->num_entries
))
3576 if(!prs_uint32("ptr ", ps
, depth
, &r_u
->ptr
))
3579 if (r_u
->ptr
!= 0) {
3580 if(!samr_io_rids("rids", &r_u
->num_entries2
, &r_u
->rid
, ps
, depth
))
3586 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3592 /*******************************************************************
3593 inits a SAMR_Q_OPEN_ALIAS structure.
3594 ********************************************************************/
3596 void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS
* q_u
, POLICY_HND
*pol
,
3597 uint32 unknown_0
, uint32 rid
)
3599 DEBUG(5, ("init_samr_q_open_alias\n"));
3601 q_u
->dom_pol
= *pol
;
3603 /* example values: 0x0000 0008 */
3604 q_u
->unknown_0
= unknown_0
;
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("unknown_0", ps
, depth
, &q_u
->unknown_0
))
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
) {
3684 /*******************************************************************
3685 reads or writes a structure.
3686 ********************************************************************/
3688 BOOL
samr_io_q_lookup_rids(char *desc
, SAMR_Q_LOOKUP_RIDS
* q_u
,
3689 prs_struct
*ps
, int depth
)
3697 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_rids");
3700 if (UNMARSHALLING(ps
))
3706 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
3709 if(!prs_uint32("num_rids1", ps
, depth
, &q_u
->num_rids1
))
3711 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
3713 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
3715 if(!prs_uint32("num_rids2", ps
, depth
, &q_u
->num_rids2
))
3718 if (UNMARSHALLING(ps
) && (q_u
->num_rids2
!= 0)) {
3719 q_u
->rid
= (uint32
*)prs_alloc_mem(ps
, sizeof(q_u
->rid
[0])*q_u
->num_rids2
);
3720 if (q_u
->rid
== NULL
)
3724 for (i
= 0; i
< q_u
->num_rids2
; i
++) {
3725 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
3726 if(!prs_uint32(tmp
, ps
, depth
, &q_u
->rid
[i
]))
3733 /*******************************************************************
3734 inits a SAMR_R_LOOKUP_RIDS structure.
3735 ********************************************************************/
3737 void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS
* r_u
,
3738 uint32 num_names
, UNIHDR
* hdr_name
,
3739 UNISTR2
*uni_name
, uint32
*type
)
3741 DEBUG(5, ("init_samr_r_lookup_rids\n"));
3743 r_u
->hdr_name
= NULL
;
3744 r_u
->uni_name
= NULL
;
3747 if (num_names
!= 0) {
3748 r_u
->num_names1
= num_names
;
3750 r_u
->num_names2
= num_names
;
3752 r_u
->num_types1
= num_names
;
3754 r_u
->num_types2
= num_names
;
3756 r_u
->hdr_name
= hdr_name
;
3757 r_u
->uni_name
= uni_name
;
3760 r_u
->num_names1
= num_names
;
3762 r_u
->num_names2
= num_names
;
3764 r_u
->num_types1
= num_names
;
3766 r_u
->num_types2
= num_names
;
3770 /*******************************************************************
3771 reads or writes a structure.
3772 ********************************************************************/
3774 BOOL
samr_io_r_lookup_rids(char *desc
, SAMR_R_LOOKUP_RIDS
* r_u
,
3775 prs_struct
*ps
, int depth
)
3782 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_rids");
3788 if(!prs_uint32("num_names1", ps
, depth
, &r_u
->num_names1
))
3790 if(!prs_uint32("ptr_names ", ps
, depth
, &r_u
->ptr_names
))
3793 if (r_u
->ptr_names
!= 0) {
3795 if(!prs_uint32("num_names2", ps
, depth
, &r_u
->num_names2
))
3799 if (UNMARSHALLING(ps
) && (r_u
->num_names2
!= 0)) {
3800 r_u
->hdr_name
= (UNIHDR
*) prs_alloc_mem(ps
, r_u
->num_names2
* sizeof(r_u
->hdr_name
[0]));
3801 if (r_u
->hdr_name
== NULL
)
3804 r_u
->uni_name
= (UNISTR2
*)prs_alloc_mem(ps
, r_u
->num_names2
* sizeof(r_u
->uni_name
[0]));
3805 if (r_u
->uni_name
== NULL
)
3809 for (i
= 0; i
< r_u
->num_names2
; i
++) {
3810 slprintf(tmp
, sizeof(tmp
) - 1, "hdr[%02d] ", i
);
3811 if(!smb_io_unihdr("", &r_u
->hdr_name
[i
], ps
, depth
))
3814 for (i
= 0; i
< r_u
->num_names2
; i
++) {
3815 slprintf(tmp
, sizeof(tmp
) - 1, "str[%02d] ", i
);
3816 if(!smb_io_unistr2("", &r_u
->uni_name
[i
], r_u
->hdr_name
[i
].buffer
, ps
, depth
))
3824 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
3826 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
3829 if (r_u
->ptr_types
!= 0) {
3831 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
3834 if (UNMARSHALLING(ps
) && (r_u
->num_types2
!= 0)) {
3835 r_u
->type
= (uint32
*)prs_alloc_mem(ps
, r_u
->num_types2
* sizeof(r_u
->type
[0]));
3836 if (r_u
->type
== NULL
)
3840 for (i
= 0; i
< r_u
->num_types2
; i
++) {
3841 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
3842 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->type
[i
]))
3847 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3853 /*******************************************************************
3854 inits a SAMR_Q_OPEN_ALIAS structure.
3855 ********************************************************************/
3857 void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_u
, POLICY_HND
*hnd
)
3859 DEBUG(5, ("init_samr_q_delete_alias\n"));
3861 q_u
->alias_pol
= *hnd
;
3864 /*******************************************************************
3865 reads or writes a structure.
3866 ********************************************************************/
3868 BOOL
samr_io_q_delete_alias(char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
3869 prs_struct
*ps
, int depth
)
3874 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_alias");
3880 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
3886 /*******************************************************************
3887 reads or writes a structure.
3888 ********************************************************************/
3890 BOOL
samr_io_r_delete_alias(char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
3891 prs_struct
*ps
, int depth
)
3896 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_alias");
3902 if(!smb_io_pol_hnd("pol", &r_u
->pol
, ps
, depth
))
3904 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3910 /*******************************************************************
3911 inits a SAMR_Q_CREATE_DOM_ALIAS structure.
3912 ********************************************************************/
3914 void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
3915 POLICY_HND
*hnd
, char *acct_desc
)
3917 int acct_len
= acct_desc
!= NULL
? strlen(acct_desc
) : 0;
3919 DEBUG(5, ("init_samr_q_create_dom_alias\n"));
3921 q_u
->dom_pol
= *hnd
;
3923 init_uni_hdr(&q_u
->hdr_acct_desc
, acct_len
);
3924 init_unistr2(&q_u
->uni_acct_desc
, acct_desc
, acct_len
);
3926 q_u
->access_mask
= 0x001f000f;
3929 /*******************************************************************
3930 reads or writes a structure.
3931 ********************************************************************/
3933 BOOL
samr_io_q_create_dom_alias(char *desc
, SAMR_Q_CREATE_DOM_ALIAS
* q_u
,
3934 prs_struct
*ps
, int depth
)
3939 prs_debug(ps
, depth
, desc
, "samr_io_q_create_dom_alias");
3945 if(!smb_io_pol_hnd("dom_pol", &q_u
->dom_pol
, ps
, depth
))
3948 if(!smb_io_unihdr("hdr_acct_desc", &q_u
->hdr_acct_desc
, ps
, depth
))
3950 if(!smb_io_unistr2("uni_acct_desc", &q_u
->uni_acct_desc
,
3951 q_u
->hdr_acct_desc
.buffer
, ps
, depth
))
3956 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
3962 /*******************************************************************
3963 reads or writes a structure.
3964 ********************************************************************/
3966 BOOL
samr_io_r_create_dom_alias(char *desc
, SAMR_R_CREATE_DOM_ALIAS
* r_u
,
3967 prs_struct
*ps
, int depth
)
3972 prs_debug(ps
, depth
, desc
, "samr_io_r_create_dom_alias");
3978 if(!smb_io_pol_hnd("alias_pol", &r_u
->alias_pol
, ps
, depth
))
3981 if(!prs_uint32("rid", ps
, depth
, &r_u
->rid
))
3984 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
3990 /*******************************************************************
3991 inits a SAMR_Q_ADD_ALIASMEM structure.
3992 ********************************************************************/
3994 void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
3997 DEBUG(5, ("init_samr_q_add_aliasmem\n"));
3999 q_u
->alias_pol
= *hnd
;
4000 init_dom_sid2(&q_u
->sid
, sid
);
4003 /*******************************************************************
4004 reads or writes a structure.
4005 ********************************************************************/
4007 BOOL
samr_io_q_add_aliasmem(char *desc
, SAMR_Q_ADD_ALIASMEM
* q_u
,
4008 prs_struct
*ps
, int depth
)
4013 prs_debug(ps
, depth
, desc
, "samr_io_q_add_aliasmem");
4019 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4021 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4027 /*******************************************************************
4028 reads or writes a structure.
4029 ********************************************************************/
4031 BOOL
samr_io_r_add_aliasmem(char *desc
, SAMR_R_ADD_ALIASMEM
* r_u
,
4032 prs_struct
*ps
, int depth
)
4037 prs_debug(ps
, depth
, desc
, "samr_io_r_add_aliasmem");
4043 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4049 /*******************************************************************
4050 inits a SAMR_Q_DEL_ALIASMEM structure.
4051 ********************************************************************/
4053 void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM
* q_u
, POLICY_HND
*hnd
,
4056 DEBUG(5, ("init_samr_q_del_aliasmem\n"));
4058 q_u
->alias_pol
= *hnd
;
4059 init_dom_sid2(&q_u
->sid
, sid
);
4062 /*******************************************************************
4063 reads or writes a structure.
4064 ********************************************************************/
4066 BOOL
samr_io_q_del_aliasmem(char *desc
, SAMR_Q_DEL_ALIASMEM
* q_u
,
4067 prs_struct
*ps
, int depth
)
4072 prs_debug(ps
, depth
, desc
, "samr_io_q_del_aliasmem");
4078 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4080 if(!smb_io_dom_sid2("sid ", &q_u
->sid
, ps
, depth
))
4086 /*******************************************************************
4087 reads or writes a structure.
4088 ********************************************************************/
4090 BOOL
samr_io_r_del_aliasmem(char *desc
, SAMR_R_DEL_ALIASMEM
* r_u
,
4091 prs_struct
*ps
, int depth
)
4096 prs_debug(ps
, depth
, desc
, "samr_io_r_del_aliasmem");
4102 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4108 /*******************************************************************
4109 inits a SAMR_Q_DELETE_DOM_ALIAS structure.
4110 ********************************************************************/
4112 void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS
* q_c
,
4115 DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
4117 q_c
->alias_pol
= *hnd
;
4120 /*******************************************************************
4121 reads or writes a structure.
4122 ********************************************************************/
4124 BOOL
samr_io_q_delete_dom_alias(char *desc
, SAMR_Q_DELETE_DOM_ALIAS
* q_u
,
4125 prs_struct
*ps
, int depth
)
4130 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_alias");
4136 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4142 /*******************************************************************
4143 inits a SAMR_R_DELETE_DOM_ALIAS structure.
4144 ********************************************************************/
4146 void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4149 DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
4151 r_u
->status
= status
;
4154 /*******************************************************************
4155 reads or writes a structure.
4156 ********************************************************************/
4158 BOOL
samr_io_r_delete_dom_alias(char *desc
, SAMR_R_DELETE_DOM_ALIAS
* r_u
,
4159 prs_struct
*ps
, int depth
)
4164 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_alias");
4170 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4176 /*******************************************************************
4177 inits a SAMR_Q_QUERY_ALIASMEM structure.
4178 ********************************************************************/
4180 void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM
* q_c
,
4183 DEBUG(5, ("init_samr_q_query_aliasmem\n"));
4185 q_c
->alias_pol
= *hnd
;
4188 /*******************************************************************
4189 reads or writes a structure.
4190 ********************************************************************/
4192 BOOL
samr_io_q_query_aliasmem(char *desc
, SAMR_Q_QUERY_ALIASMEM
* q_u
,
4193 prs_struct
*ps
, int depth
)
4198 prs_debug(ps
, depth
, desc
, "samr_io_q_query_aliasmem");
4204 if(!smb_io_pol_hnd("alias_pol", &q_u
->alias_pol
, ps
, depth
))
4210 /*******************************************************************
4211 inits a SAMR_R_QUERY_ALIASMEM structure.
4212 ********************************************************************/
4214 void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM
* r_u
,
4215 uint32 num_sids
, DOM_SID2
* sid
,
4218 DEBUG(5, ("init_samr_r_query_aliasmem\n"));
4221 r_u
->num_sids
= num_sids
;
4222 r_u
->ptr
= (num_sids
!= 0) ? 1 : 0;
4223 r_u
->num_sids1
= num_sids
;
4231 r_u
->status
= status
;
4234 /*******************************************************************
4235 reads or writes a structure.
4236 ********************************************************************/
4238 BOOL
samr_io_r_query_aliasmem(char *desc
, SAMR_R_QUERY_ALIASMEM
* r_u
,
4239 prs_struct
*ps
, int depth
)
4242 uint32 ptr_sid
[MAX_LOOKUP_SIDS
];
4247 prs_debug(ps
, depth
, desc
, "samr_io_r_query_aliasmem");
4253 if(!prs_uint32("num_sids ", ps
, depth
, &r_u
->num_sids
))
4255 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
4258 if (r_u
->ptr
!= 0) {
4259 SMB_ASSERT_ARRAY(ptr_sid
, r_u
->num_sids
);
4261 if (r_u
->num_sids
!= 0) {
4262 if(!prs_uint32("num_sids1", ps
, depth
, &r_u
->num_sids1
))
4265 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4267 if(!prs_uint32("", ps
, depth
, &ptr_sid
[i
]))
4271 for (i
= 0; i
< r_u
->num_sids1
; i
++) {
4272 if (ptr_sid
[i
] != 0) {
4273 if(!smb_io_dom_sid2("", &r_u
->sid
[i
], ps
, depth
))
4282 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4288 /*******************************************************************
4289 inits a SAMR_Q_LOOKUP_NAMES structure.
4290 ********************************************************************/
4292 void init_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES
* q_u
,
4293 POLICY_HND
*pol
, uint32 flags
,
4294 uint32 num_names
, char **name
)
4298 DEBUG(5, ("init_samr_q_lookup_names\n"));
4302 q_u
->num_names1
= num_names
;
4305 q_u
->num_names2
= num_names
;
4307 for (i
= 0; i
< num_names
; i
++) {
4308 int len_name
= name
[i
] != NULL
? strlen(name
[i
]) : 0;
4309 init_uni_hdr(&q_u
->hdr_name
[i
], len_name
); /* unicode header for user_name */
4310 init_unistr2(&q_u
->uni_name
[i
], name
[i
], len_name
); /* unicode string for machine account */
4314 /*******************************************************************
4315 reads or writes a structure.
4316 ********************************************************************/
4318 BOOL
samr_io_q_lookup_names(char *desc
, SAMR_Q_LOOKUP_NAMES
* q_u
,
4319 prs_struct
*ps
, int depth
)
4326 prs_debug(ps
, depth
, desc
, "samr_io_q_lookup_names");
4329 if (UNMARSHALLING(ps
))
4335 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4338 if(!prs_uint32("num_names1", ps
, depth
, &q_u
->num_names1
))
4340 if(!prs_uint32("flags ", ps
, depth
, &q_u
->flags
))
4342 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
4344 if(!prs_uint32("num_names2", ps
, depth
, &q_u
->num_names2
))
4347 SMB_ASSERT_ARRAY(q_u
->hdr_name
, q_u
->num_names2
);
4349 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4350 if(!smb_io_unihdr("", &q_u
->hdr_name
[i
], ps
, depth
))
4354 for (i
= 0; i
< q_u
->num_names2
; i
++) {
4355 if(!smb_io_unistr2("", &q_u
->uni_name
[i
], q_u
->hdr_name
[i
].buffer
, ps
, depth
))
4362 /*******************************************************************
4363 inits a SAMR_R_LOOKUP_NAMES structure.
4364 ********************************************************************/
4366 void init_samr_r_lookup_names(TALLOC_CTX
*ctx
, SAMR_R_LOOKUP_NAMES
* r_u
,
4368 uint32
*rid
, uint32
*type
,
4371 DEBUG(5, ("init_samr_r_lookup_names\n"));
4373 if ((status
== 0) && (num_rids
!= 0)) {
4376 r_u
->num_types1
= num_rids
;
4378 r_u
->num_types2
= num_rids
;
4380 r_u
->num_rids1
= num_rids
;
4382 r_u
->num_rids2
= num_rids
;
4384 r_u
->rids
= (uint32
*)talloc_zero(ctx
, sizeof(uint32
)*num_rids
);
4385 r_u
->types
= (uint32
*)talloc_zero(ctx
, sizeof(uint32
)*num_rids
);
4387 if (!r_u
->rids
|| !r_u
->types
)
4390 for (i
= 0; i
< num_rids
; i
++) {
4391 r_u
->rids
[i
] = rid
[i
];
4392 r_u
->types
[i
] = type
[i
];
4397 r_u
->num_types1
= 0;
4399 r_u
->num_types2
= 0;
4409 r_u
->status
= status
;
4412 /*******************************************************************
4413 reads or writes a structure.
4414 ********************************************************************/
4416 BOOL
samr_io_r_lookup_names(char *desc
, SAMR_R_LOOKUP_NAMES
* r_u
,
4417 prs_struct
*ps
, int depth
)
4425 prs_debug(ps
, depth
, desc
, "samr_io_r_lookup_names");
4428 if (UNMARSHALLING(ps
))
4434 if(!prs_uint32("num_rids1", ps
, depth
, &r_u
->num_rids1
))
4436 if(!prs_uint32("ptr_rids ", ps
, depth
, &r_u
->ptr_rids
))
4439 if (r_u
->ptr_rids
!= 0) {
4440 if(!prs_uint32("num_rids2", ps
, depth
, &r_u
->num_rids2
))
4443 if (r_u
->num_rids2
!= r_u
->num_rids1
) {
4448 if (UNMARSHALLING(ps
))
4449 r_u
->rids
= (uint32
*)prs_alloc_mem(ps
, sizeof(uint32
)*r_u
->num_rids2
);
4452 DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
4456 for (i
= 0; i
< r_u
->num_rids2
; i
++) {
4457 slprintf(tmp
, sizeof(tmp
) - 1, "rid[%02d] ", i
);
4458 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->rids
[i
]))
4463 if(!prs_uint32("num_types1", ps
, depth
, &r_u
->num_types1
))
4465 if(!prs_uint32("ptr_types ", ps
, depth
, &r_u
->ptr_types
))
4468 if (r_u
->ptr_types
!= 0) {
4469 if(!prs_uint32("num_types2", ps
, depth
, &r_u
->num_types2
))
4472 if (r_u
->num_types2
!= r_u
->num_types1
) {
4477 if (UNMARSHALLING(ps
))
4478 r_u
->types
= (uint32
*)prs_alloc_mem(ps
, sizeof(uint32
)*r_u
->num_types2
);
4481 DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
4485 for (i
= 0; i
< r_u
->num_types2
; i
++) {
4486 slprintf(tmp
, sizeof(tmp
) - 1, "type[%02d] ", i
);
4487 if(!prs_uint32(tmp
, ps
, depth
, &r_u
->types
[i
]))
4492 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4498 /*******************************************************************
4499 inits a SAMR_Q_DELETE_DOM_USER structure.
4500 ********************************************************************/
4502 void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER
* q_c
,
4505 DEBUG(5, ("init_samr_q_delete_dom_user\n"));
4507 q_c
->user_pol
= *hnd
;
4510 /*******************************************************************
4511 reads or writes a structure.
4512 ********************************************************************/
4514 BOOL
samr_io_q_delete_dom_user(char *desc
, SAMR_Q_DELETE_DOM_USER
* q_u
,
4515 prs_struct
*ps
, int depth
)
4520 prs_debug(ps
, depth
, desc
, "samr_io_q_delete_dom_user");
4526 if(!smb_io_pol_hnd("user_pol", &q_u
->user_pol
, ps
, depth
))
4532 /*******************************************************************
4533 reads or writes a structure.
4534 ********************************************************************/
4536 BOOL
samr_io_r_delete_dom_user(char *desc
, SAMR_R_DELETE_DOM_USER
* r_u
,
4537 prs_struct
*ps
, int depth
)
4542 prs_debug(ps
, depth
, desc
, "samr_io_r_delete_dom_user");
4548 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4554 /*******************************************************************
4555 reads or writes a structure.
4556 ********************************************************************/
4558 void init_samr_q_open_user(SAMR_Q_OPEN_USER
* q_u
,
4560 uint32 access_mask
, uint32 rid
)
4562 DEBUG(5, ("samr_init_samr_q_open_user\n"));
4564 q_u
->domain_pol
= *pol
;
4565 q_u
->access_mask
= access_mask
;
4566 q_u
->user_rid
= rid
;
4569 /*******************************************************************
4570 reads or writes a structure.
4571 ********************************************************************/
4573 BOOL
samr_io_q_open_user(char *desc
, SAMR_Q_OPEN_USER
* q_u
,
4574 prs_struct
*ps
, int depth
)
4579 prs_debug(ps
, depth
, desc
, "samr_io_q_open_user");
4585 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4588 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4590 if(!prs_uint32("user_rid ", ps
, depth
, &q_u
->user_rid
))
4596 /*******************************************************************
4597 reads or writes a structure.
4598 ********************************************************************/
4600 BOOL
samr_io_r_open_user(char *desc
, SAMR_R_OPEN_USER
* r_u
,
4601 prs_struct
*ps
, int depth
)
4606 prs_debug(ps
, depth
, desc
, "samr_io_r_open_user");
4612 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
4615 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4622 /*******************************************************************
4623 reads or writes a structure.
4624 ********************************************************************/
4626 void init_samr_q_create_user(SAMR_Q_CREATE_USER
* q_u
,
4629 uint32 acb_info
, uint32 access_mask
)
4632 len_name
= strlen(name
);
4634 DEBUG(5, ("samr_init_samr_q_create_user\n"));
4636 q_u
->domain_pol
= *pol
;
4638 init_uni_hdr(&q_u
->hdr_name
, len_name
);
4639 init_unistr2(&q_u
->uni_name
, name
, len_name
);
4641 q_u
->acb_info
= acb_info
;
4642 q_u
->access_mask
= access_mask
;
4645 /*******************************************************************
4646 reads or writes a structure.
4647 ********************************************************************/
4649 BOOL
samr_io_q_create_user(char *desc
, SAMR_Q_CREATE_USER
* q_u
,
4650 prs_struct
*ps
, int depth
)
4655 prs_debug(ps
, depth
, desc
, "samr_io_q_create_user");
4661 if(!smb_io_pol_hnd("domain_pol", &q_u
->domain_pol
, ps
, depth
))
4664 if(!smb_io_unihdr("hdr_name", &q_u
->hdr_name
, ps
, depth
))
4666 if(!smb_io_unistr2("uni_name", &q_u
->uni_name
, q_u
->hdr_name
.buffer
, ps
, depth
))
4671 if(!prs_uint32("acb_info ", ps
, depth
, &q_u
->acb_info
))
4673 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
4679 /*******************************************************************
4680 reads or writes a structure.
4681 ********************************************************************/
4683 BOOL
samr_io_r_create_user(char *desc
, SAMR_R_CREATE_USER
* r_u
,
4684 prs_struct
*ps
, int depth
)
4689 prs_debug(ps
, depth
, desc
, "samr_io_r_create_user");
4695 if(!smb_io_pol_hnd("user_pol", &r_u
->user_pol
, ps
, depth
))
4698 if(!prs_uint32("unknown_0", ps
, depth
, &r_u
->unknown_0
))
4700 if(!prs_uint32("user_rid ", ps
, depth
, &r_u
->user_rid
))
4702 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
4708 /*******************************************************************
4709 inits a SAMR_Q_QUERY_USERINFO structure.
4710 ********************************************************************/
4712 void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO
* q_u
,
4713 POLICY_HND
*hnd
, uint16 switch_value
)
4715 DEBUG(5, ("init_samr_q_query_userinfo\n"));
4718 q_u
->switch_value
= switch_value
;
4721 /*******************************************************************
4722 reads or writes a structure.
4723 ********************************************************************/
4725 BOOL
samr_io_q_query_userinfo(char *desc
, SAMR_Q_QUERY_USERINFO
* q_u
,
4726 prs_struct
*ps
, int depth
)
4731 prs_debug(ps
, depth
, desc
, "samr_io_q_query_userinfo");
4737 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
4740 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
)) /* 0x0015 or 0x0011 */
4746 /*******************************************************************
4747 reads or writes a LOGON_HRS structure.
4748 ********************************************************************/
4750 static BOOL
sam_io_logon_hrs(char *desc
, LOGON_HRS
* hrs
,
4751 prs_struct
*ps
, int depth
)
4756 prs_debug(ps
, depth
, desc
, "sam_io_logon_hrs");
4762 if(!prs_uint32("len ", ps
, depth
, &hrs
->len
))
4765 if (hrs
->len
> sizeof(hrs
->hours
)) {
4766 DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs
->len
));
4767 hrs
->len
= sizeof(hrs
->hours
);
4770 if(!prs_uint8s(False
, "hours", ps
, depth
, hrs
->hours
, hrs
->len
))
4776 /*******************************************************************
4777 inits a SAM_USER_INFO_12 structure.
4778 ********************************************************************/
4780 void init_sam_user_info12(SAM_USER_INFO_12
* usr
,
4781 uint8 lm_pwd
[16], uint8 nt_pwd
[16])
4783 DEBUG(5, ("init_sam_user_info12\n"));
4785 usr
->lm_pwd_active
=
4786 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
)) ? 1 : 0;
4787 usr
->nt_pwd_active
=
4788 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
)) ? 1 : 0;
4791 /*******************************************************************
4792 reads or writes a structure.
4793 ********************************************************************/
4795 static BOOL
sam_io_user_info12(char *desc
, SAM_USER_INFO_12
* u
,
4796 prs_struct
*ps
, int depth
)
4801 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info12");
4807 if(!prs_uint8s(False
, "lm_pwd", ps
, depth
, u
->lm_pwd
, sizeof(u
->lm_pwd
)))
4809 if(!prs_uint8s(False
, "nt_pwd", ps
, depth
, u
->nt_pwd
, sizeof(u
->nt_pwd
)))
4812 if(!prs_uint8("lm_pwd_active", ps
, depth
, &u
->lm_pwd_active
))
4814 if(!prs_uint8("nt_pwd_active", ps
, depth
, &u
->nt_pwd_active
))
4820 /*******************************************************************
4821 inits a SAM_USER_INFO_10 structure.
4822 ********************************************************************/
4824 void init_sam_user_info10(SAM_USER_INFO_10
* usr
, uint32 acb_info
)
4826 DEBUG(5, ("init_sam_user_info10\n"));
4828 usr
->acb_info
= acb_info
;
4831 /*******************************************************************
4832 reads or writes a structure.
4833 ********************************************************************/
4835 static BOOL
sam_io_user_info10(char *desc
, SAM_USER_INFO_10
* usr
,
4836 prs_struct
*ps
, int depth
)
4841 prs_debug(ps
, depth
, desc
, "samr_io_r_user_info10");
4847 if(!prs_uint32("acb_info", ps
, depth
, &usr
->acb_info
))
4853 /*******************************************************************
4854 inits a SAM_USER_INFO_11 structure.
4855 ********************************************************************/
4857 void init_sam_user_info11(SAM_USER_INFO_11
* usr
,
4860 uint32 rid_user
, uint32 rid_group
, uint16 acct_ctrl
)
4864 DEBUG(5, ("init_sam_user_info11\n"));
4866 len_mach_acct
= strlen(mach_acct
);
4868 memcpy(&(usr
->expiry
), expiry
, sizeof(usr
->expiry
)); /* expiry time or something? */
4869 ZERO_STRUCT(usr
->padding_1
); /* 0 - padding 24 bytes */
4871 init_uni_hdr(&usr
->hdr_mach_acct
, len_mach_acct
); /* unicode header for machine account */
4872 usr
->padding_2
= 0; /* 0 - padding 4 bytes */
4874 usr
->ptr_1
= 1; /* pointer */
4875 ZERO_STRUCT(usr
->padding_3
); /* 0 - padding 32 bytes */
4876 usr
->padding_4
= 0; /* 0 - padding 4 bytes */
4878 usr
->ptr_2
= 1; /* pointer */
4879 usr
->padding_5
= 0; /* 0 - padding 4 bytes */
4881 usr
->ptr_3
= 1; /* pointer */
4882 ZERO_STRUCT(usr
->padding_6
); /* 0 - padding 32 bytes */
4884 usr
->rid_user
= rid_user
;
4885 usr
->rid_group
= rid_group
;
4887 usr
->acct_ctrl
= acct_ctrl
;
4888 usr
->unknown_3
= 0x0000;
4890 usr
->unknown_4
= 0x003f; /* 0x003f - 16 bit unknown */
4891 usr
->unknown_5
= 0x003c; /* 0x003c - 16 bit unknown */
4893 ZERO_STRUCT(usr
->padding_7
); /* 0 - padding 16 bytes */
4894 usr
->padding_8
= 0; /* 0 - padding 4 bytes */
4896 init_unistr2(&usr
->uni_mach_acct
, mach_acct
, len_mach_acct
); /* unicode string for machine account */
4899 /*******************************************************************
4900 reads or writes a structure.
4901 ********************************************************************/
4903 static BOOL
sam_io_user_info11(char *desc
, SAM_USER_INFO_11
* usr
,
4904 prs_struct
*ps
, int depth
)
4909 prs_debug(ps
, depth
, desc
, "samr_io_r_unknown_11");
4915 if(!prs_uint8s(False
, "padding_0", ps
, depth
, usr
->padding_0
, sizeof(usr
->padding_0
)))
4918 if(!smb_io_time("time", &usr
->expiry
, ps
, depth
))
4921 if(!prs_uint8s(False
, "padding_1", ps
, depth
, usr
->padding_1
, sizeof(usr
->padding_1
)))
4924 if(!smb_io_unihdr("unihdr", &usr
->hdr_mach_acct
, ps
, depth
))
4927 if(!prs_uint32("padding_2", ps
, depth
, &usr
->padding_2
))
4930 if(!prs_uint32("ptr_1 ", ps
, depth
, &usr
->ptr_1
))
4932 if(!prs_uint8s(False
, "padding_3", ps
, depth
, usr
->padding_3
, sizeof(usr
->padding_3
)))
4935 if(!prs_uint32("padding_4", ps
, depth
, &usr
->padding_4
))
4938 if(!prs_uint32("ptr_2 ", ps
, depth
, &usr
->ptr_2
))
4940 if(!prs_uint32("padding_5", ps
, depth
, &usr
->padding_5
))
4943 if(!prs_uint32("ptr_3 ", ps
, depth
, &usr
->ptr_3
))
4945 if(!prs_uint8s(False
, "padding_6", ps
, depth
, usr
->padding_6
,sizeof(usr
->padding_6
)))
4948 if(!prs_uint32("rid_user ", ps
, depth
, &usr
->rid_user
))
4950 if(!prs_uint32("rid_group", ps
, depth
, &usr
->rid_group
))
4952 if(!prs_uint16("acct_ctrl", ps
, depth
, &usr
->acct_ctrl
))
4954 if(!prs_uint16("unknown_3", ps
, depth
, &usr
->unknown_3
))
4956 if(!prs_uint16("unknown_4", ps
, depth
, &usr
->unknown_4
))
4958 if(!prs_uint16("unknown_5", ps
, depth
, &usr
->unknown_5
))
4961 if(!prs_uint8s(False
, "padding_7", ps
, depth
, usr
->padding_7
, sizeof(usr
->padding_7
)))
4964 if(!prs_uint32("padding_8", ps
, depth
, &(usr
->padding_8
)))
4967 if(!smb_io_unistr2("unistr2", &usr
->uni_mach_acct
, True
, ps
, depth
))
4973 if(!prs_uint8s(False
, "padding_9", ps
, depth
, usr
->padding_9
, sizeof(usr
->padding_9
)))
4979 /*************************************************************************
4982 unknown_3 = 0x09f8 27fa
4983 unknown_5 = 0x0001 0000
4984 unknown_6 = 0x0000 04ec
4986 *************************************************************************/
4988 void init_sam_user_info24(SAM_USER_INFO_24
* usr
,
4989 char newpass
[516], uint16 passlen
)
4991 DEBUG(10, ("init_sam_user_info24: passlen: %d\n", passlen
));
4992 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
4995 /*******************************************************************
4996 reads or writes a structure.
4997 ********************************************************************/
4999 static BOOL
sam_io_user_info24(char *desc
, SAM_USER_INFO_24
* usr
,
5000 prs_struct
*ps
, int depth
)
5005 prs_debug(ps
, depth
, desc
, "sam_io_user_info24");
5011 if(!prs_uint8s(False
, "password", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5017 /*************************************************************************
5018 init_sam_user_info23
5020 unknown_3 = 0x09f8 27fa
5021 unknown_5 = 0x0001 0000
5022 unknown_6 = 0x0000 04ec
5024 *************************************************************************/
5026 void init_sam_user_info23W(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5027 NTTIME
* logoff_time
, /* all zeros */
5028 NTTIME
* kickoff_time
, /* all zeros */
5029 NTTIME
* pass_last_set_time
, /* all zeros */
5030 NTTIME
* pass_can_change_time
, /* all zeros */
5031 NTTIME
* pass_must_change_time
, /* all zeros */
5042 uint32 user_rid
, /* 0x0000 0000 */
5049 char newpass
[516], uint32 unknown_6
)
5051 int len_user_name
= user_name
!= NULL
? user_name
->uni_str_len
: 0;
5052 int len_full_name
= full_name
!= NULL
? full_name
->uni_str_len
: 0;
5053 int len_home_dir
= home_dir
!= NULL
? home_dir
->uni_str_len
: 0;
5054 int len_dir_drive
= dir_drive
!= NULL
? dir_drive
->uni_str_len
: 0;
5055 int len_logon_script
= log_scr
!= NULL
? log_scr
->uni_str_len
: 0;
5056 int len_profile_path
= prof_path
!= NULL
? prof_path
->uni_str_len
: 0;
5057 int len_description
= desc
!= NULL
? desc
->uni_str_len
: 0;
5058 int len_workstations
= wkstas
!= NULL
? wkstas
->uni_str_len
: 0;
5059 int len_unknown_str
= unk_str
!= NULL
? unk_str
->uni_str_len
: 0;
5060 int len_munged_dial
= mung_dial
!= NULL
? mung_dial
->uni_str_len
: 0;
5062 usr
->logon_time
= *logon_time
; /* all zeros */
5063 usr
->logoff_time
= *logoff_time
; /* all zeros */
5064 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5065 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5066 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5067 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5069 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
); /* NULL */
5070 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5071 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5072 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5073 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5074 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5075 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5076 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5077 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5078 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5080 ZERO_STRUCT(usr
->nt_pwd
);
5081 ZERO_STRUCT(usr
->lm_pwd
);
5083 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5084 usr
->group_rid
= group_rid
;
5085 usr
->acb_info
= acb_info
;
5086 usr
->unknown_3
= unknown_3
; /* 09f8 27fa */
5088 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5089 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5091 ZERO_STRUCT(usr
->padding1
);
5093 usr
->unknown_5
= unknown_5
; /* 0x0001 0000 */
5095 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5097 copy_unistr2(&usr
->uni_user_name
, user_name
);
5098 copy_unistr2(&usr
->uni_full_name
, full_name
);
5099 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5100 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5101 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5102 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5103 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5104 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5105 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5106 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5108 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5111 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5114 /*************************************************************************
5115 init_sam_user_info23
5117 unknown_3 = 0x09f8 27fa
5118 unknown_5 = 0x0001 0000
5119 unknown_6 = 0x0000 04ec
5121 *************************************************************************/
5123 void init_sam_user_info23A(SAM_USER_INFO_23
* usr
, NTTIME
* logon_time
, /* all zeros */
5124 NTTIME
* logoff_time
, /* all zeros */
5125 NTTIME
* kickoff_time
, /* all zeros */
5126 NTTIME
* pass_last_set_time
, /* all zeros */
5127 NTTIME
* pass_can_change_time
, /* all zeros */
5128 NTTIME
* pass_must_change_time
, /* all zeros */
5129 char *user_name
, /* NULL */
5131 char *home_dir
, char *dir_drive
, char *log_scr
,
5132 char *prof_path
, char *desc
, char *wkstas
,
5133 char *unk_str
, char *mung_dial
, uint32 user_rid
, /* 0x0000 0000 */
5134 uint32 group_rid
, uint32 acb_info
,
5135 uint32 unknown_3
, uint16 logon_divs
,
5136 LOGON_HRS
* hrs
, uint32 unknown_5
,
5137 char newpass
[516], uint32 unknown_6
)
5139 int len_user_name
= user_name
!= NULL
? strlen(user_name
) : 0;
5140 int len_full_name
= full_name
!= NULL
? strlen(full_name
) : 0;
5141 int len_home_dir
= home_dir
!= NULL
? strlen(home_dir
) : 0;
5142 int len_dir_drive
= dir_drive
!= NULL
? strlen(dir_drive
) : 0;
5143 int len_logon_script
= log_scr
!= NULL
? strlen(log_scr
) : 0;
5144 int len_profile_path
= prof_path
!= NULL
? strlen(prof_path
) : 0;
5145 int len_description
= desc
!= NULL
? strlen(desc
) : 0;
5146 int len_workstations
= wkstas
!= NULL
? strlen(wkstas
) : 0;
5147 int len_unknown_str
= unk_str
!= NULL
? strlen(unk_str
) : 0;
5148 int len_munged_dial
= mung_dial
!= NULL
? strlen(mung_dial
) : 0;
5150 usr
->logon_time
= *logon_time
; /* all zeros */
5151 usr
->logoff_time
= *logoff_time
; /* all zeros */
5152 usr
->kickoff_time
= *kickoff_time
; /* all zeros */
5153 usr
->pass_last_set_time
= *pass_last_set_time
; /* all zeros */
5154 usr
->pass_can_change_time
= *pass_can_change_time
; /* all zeros */
5155 usr
->pass_must_change_time
= *pass_must_change_time
; /* all zeros */
5157 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
); /* NULL */
5158 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5159 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5160 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5161 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5162 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5163 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5164 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5165 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5166 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5168 ZERO_STRUCT(usr
->nt_pwd
);
5169 ZERO_STRUCT(usr
->lm_pwd
);
5171 usr
->user_rid
= user_rid
; /* 0x0000 0000 */
5172 usr
->group_rid
= group_rid
;
5173 usr
->acb_info
= acb_info
;
5174 usr
->unknown_3
= unknown_3
; /* 09f8 27fa */
5176 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5177 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5179 ZERO_STRUCT(usr
->padding1
);
5181 usr
->unknown_5
= unknown_5
; /* 0x0001 0000 */
5183 memcpy(usr
->pass
, newpass
, sizeof(usr
->pass
));
5185 init_unistr2(&usr
->uni_user_name
, user_name
, len_user_name
); /* NULL */
5186 init_unistr2(&usr
->uni_full_name
, full_name
, len_full_name
);
5187 init_unistr2(&usr
->uni_home_dir
, home_dir
, len_home_dir
);
5188 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, len_dir_drive
);
5189 init_unistr2(&usr
->uni_logon_script
, log_scr
, len_logon_script
);
5190 init_unistr2(&usr
->uni_profile_path
, prof_path
, len_profile_path
);
5191 init_unistr2(&usr
->uni_acct_desc
, desc
, len_description
);
5192 init_unistr2(&usr
->uni_workstations
, wkstas
, len_workstations
);
5193 init_unistr2(&usr
->uni_unknown_str
, unk_str
, len_unknown_str
);
5194 init_unistr2(&usr
->uni_munged_dial
, mung_dial
, len_munged_dial
);
5196 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5199 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5202 /*******************************************************************
5203 reads or writes a structure.
5204 ********************************************************************/
5206 static BOOL
sam_io_user_info23(char *desc
, SAM_USER_INFO_23
* usr
,
5207 prs_struct
*ps
, int depth
)
5212 prs_debug(ps
, depth
, desc
, "sam_io_user_info23");
5218 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5220 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5222 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5224 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
, depth
))
5226 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
, depth
))
5228 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5231 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5233 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5235 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5237 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5239 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5241 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5243 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5245 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5247 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5249 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5252 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5254 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5257 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5259 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5261 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5264 if(!prs_uint32("unknown_3 ", ps
, depth
, &usr
->unknown_3
))
5266 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5270 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5272 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
5274 if(!prs_uint32("unknown_5 ", ps
, depth
, &usr
->unknown_5
))
5277 if(!prs_uint8s(False
, "password ", ps
, depth
, usr
->pass
, sizeof(usr
->pass
)))
5280 /* here begins pointed-to data */
5282 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5285 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5288 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5291 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5294 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5297 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5300 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5303 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5306 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5309 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
, usr
->hdr_munged_dial
.buffer
, ps
, depth
))
5312 /* ok, this is only guess-work (as usual) */
5313 if (usr
->ptr_logon_hrs
) {
5314 if(!prs_uint32("unknown_6 ", ps
, depth
, &usr
->unknown_6
))
5316 if(!prs_uint32("padding4 ", ps
, depth
, &usr
->padding4
))
5318 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5320 } else if (UNMARSHALLING(ps
)) {
5329 /*************************************************************************
5330 init_sam_user_info21W
5332 unknown_3 = 0x00ff ffff
5333 unknown_5 = 0x0002 0000
5334 unknown_6 = 0x0000 04ec
5336 *************************************************************************/
5338 void init_sam_user_info21W(SAM_USER_INFO_21
* usr
,
5339 NTTIME
* logon_time
,
5340 NTTIME
* logoff_time
,
5341 NTTIME
* kickoff_time
,
5342 NTTIME
* pass_last_set_time
,
5343 NTTIME
* pass_can_change_time
,
5344 NTTIME
* pass_must_change_time
,
5363 uint32 unknown_5
, uint32 unknown_6
)
5365 int len_user_name
= user_name
!= NULL
? user_name
->uni_str_len
: 0;
5366 int len_full_name
= full_name
!= NULL
? full_name
->uni_str_len
: 0;
5367 int len_home_dir
= home_dir
!= NULL
? home_dir
->uni_str_len
: 0;
5368 int len_dir_drive
= dir_drive
!= NULL
? dir_drive
->uni_str_len
: 0;
5369 int len_logon_script
= log_scr
!= NULL
? log_scr
->uni_str_len
: 0;
5370 int len_profile_path
= prof_path
!= NULL
? prof_path
->uni_str_len
: 0;
5371 int len_description
= desc
!= NULL
? desc
->uni_str_len
: 0;
5372 int len_workstations
= wkstas
!= NULL
? wkstas
->uni_str_len
: 0;
5373 int len_unknown_str
= unk_str
!= NULL
? unk_str
->uni_str_len
: 0;
5374 int len_munged_dial
= mung_dial
!= NULL
? mung_dial
->uni_str_len
: 0;
5376 usr
->logon_time
= *logon_time
;
5377 usr
->logoff_time
= *logoff_time
;
5378 usr
->kickoff_time
= *kickoff_time
;
5379 usr
->pass_last_set_time
= *pass_last_set_time
;
5380 usr
->pass_can_change_time
= *pass_can_change_time
;
5381 usr
->pass_must_change_time
= *pass_must_change_time
;
5383 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
);
5384 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5385 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5386 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5387 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5388 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5389 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5390 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5391 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5392 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5394 memcpy(usr
->lm_pwd
, lm_pwd
, sizeof(usr
->lm_pwd
));
5395 memcpy(usr
->nt_pwd
, nt_pwd
, sizeof(usr
->nt_pwd
));
5397 usr
->user_rid
= user_rid
;
5398 usr
->group_rid
= group_rid
;
5399 usr
->acb_info
= acb_info
;
5400 usr
->unknown_3
= unknown_3
; /* 0x00ff ffff */
5402 usr
->logon_divs
= logon_divs
; /* should be 168 (hours/week) */
5403 usr
->ptr_logon_hrs
= hrs
? 1 : 0;
5404 usr
->unknown_5
= unknown_5
; /* 0x0002 0000 */
5406 ZERO_STRUCT(usr
->padding1
);
5408 copy_unistr2(&usr
->uni_user_name
, user_name
);
5409 copy_unistr2(&usr
->uni_full_name
, full_name
);
5410 copy_unistr2(&usr
->uni_home_dir
, home_dir
);
5411 copy_unistr2(&usr
->uni_dir_drive
, dir_drive
);
5412 copy_unistr2(&usr
->uni_logon_script
, log_scr
);
5413 copy_unistr2(&usr
->uni_profile_path
, prof_path
);
5414 copy_unistr2(&usr
->uni_acct_desc
, desc
);
5415 copy_unistr2(&usr
->uni_workstations
, wkstas
);
5416 copy_unistr2(&usr
->uni_unknown_str
, unk_str
);
5417 copy_unistr2(&usr
->uni_munged_dial
, mung_dial
);
5419 usr
->unknown_6
= unknown_6
; /* 0x0000 04ec */
5422 memcpy(&usr
->logon_hrs
, hrs
, sizeof(usr
->logon_hrs
));
5425 /*************************************************************************
5426 init_sam_user_info21
5428 unknown_3 = 0x00ff ffff
5429 unknown_5 = 0x0002 0000
5430 unknown_6 = 0x0000 04ec
5432 *************************************************************************/
5434 void init_sam_user_info21A(SAM_USER_INFO_21
*usr
, SAM_ACCOUNT
*pw
)
5436 NTTIME logon_time
, logoff_time
, kickoff_time
,
5437 pass_last_set_time
, pass_can_change_time
,
5438 pass_must_change_time
;
5440 int len_user_name
, len_full_name
, len_home_dir
,
5441 len_dir_drive
, len_logon_script
, len_profile_path
,
5442 len_description
, len_workstations
, len_unknown_str
,
5445 char* user_name
= pdb_get_username(pw
);
5446 char* full_name
= pdb_get_fullname(pw
);
5447 char* home_dir
= pdb_get_homedir(pw
);
5448 char* dir_drive
= pdb_get_dirdrive(pw
);
5449 char* logon_script
= pdb_get_logon_script(pw
);
5450 char* profile_path
= pdb_get_profile_path(pw
);
5451 char* description
= pdb_get_acct_desc(pw
);
5452 char* workstations
= pdb_get_workstations(pw
);
5453 char* munged_dial
= pdb_get_munged_dial(pw
);
5455 len_user_name
= user_name
!= NULL
? strlen(user_name
)+1 : 0;
5456 len_full_name
= full_name
!= NULL
? strlen(full_name
)+1 : 0;
5457 len_home_dir
= home_dir
!= NULL
? strlen(home_dir
)+1 : 0;
5458 len_dir_drive
= dir_drive
!= NULL
? strlen(dir_drive
)+1 : 0;
5459 len_logon_script
= logon_script
!= NULL
? strlen(logon_script
)+1 : 0;
5460 len_profile_path
= profile_path
!= NULL
? strlen(profile_path
)+1 : 0;
5461 len_description
= description
!= NULL
? strlen(description
)+1 : 0;
5462 len_workstations
= workstations
!= NULL
? strlen(workstations
)+1 : 0;
5463 len_unknown_str
= 0;
5464 len_munged_dial
= munged_dial
!= NULL
? strlen(munged_dial
)+1 : 0;
5467 /* Create NTTIME structs */
5468 unix_to_nt_time (&logon_time
, pdb_get_logon_time(pw
));
5469 unix_to_nt_time (&logoff_time
, pdb_get_logoff_time(pw
));
5470 unix_to_nt_time (&kickoff_time
, pdb_get_kickoff_time(pw
));
5471 unix_to_nt_time (&pass_last_set_time
, pdb_get_pass_last_set_time(pw
));
5472 unix_to_nt_time (&pass_can_change_time
, pdb_get_pass_can_change_time(pw
));
5473 unix_to_nt_time (&pass_must_change_time
,pdb_get_pass_must_change_time(pw
));
5475 /* structure assignment */
5476 usr
->logon_time
= logon_time
;
5477 usr
->logoff_time
= logoff_time
;
5478 usr
->kickoff_time
= kickoff_time
;
5479 usr
->pass_last_set_time
= pass_last_set_time
;
5480 usr
->pass_can_change_time
= pass_can_change_time
;
5481 usr
->pass_must_change_time
= pass_must_change_time
;
5483 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
);
5484 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
5485 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
5486 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
5487 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
5488 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
5489 init_uni_hdr(&usr
->hdr_acct_desc
, len_description
);
5490 init_uni_hdr(&usr
->hdr_workstations
, len_workstations
);
5491 init_uni_hdr(&usr
->hdr_unknown_str
, len_unknown_str
);
5492 init_uni_hdr(&usr
->hdr_munged_dial
, len_munged_dial
);
5494 ZERO_STRUCT(usr
->nt_pwd
);
5495 ZERO_STRUCT(usr
->lm_pwd
);
5497 usr
->user_rid
= pdb_get_user_rid(pw
);
5498 usr
->group_rid
= pdb_get_group_rid(pw
);
5499 usr
->acb_info
= pdb_get_acct_ctrl(pw
);
5500 usr
->unknown_3
= pdb_get_unknown3(pw
);
5502 usr
->logon_divs
= pdb_get_logon_divs(pw
);
5503 usr
->ptr_logon_hrs
= pdb_get_hours(pw
) ? 1 : 0;
5504 usr
->unknown_5
= pdb_get_unknown5(pw
); /* 0x0002 0000 */
5506 ZERO_STRUCT(usr
->padding1
);
5508 init_unistr2(&usr
->uni_user_name
, user_name
, len_user_name
);
5509 init_unistr2(&usr
->uni_full_name
, full_name
, len_full_name
);
5510 init_unistr2(&usr
->uni_home_dir
, home_dir
, len_home_dir
);
5511 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, len_dir_drive
);
5512 init_unistr2(&usr
->uni_logon_script
, logon_script
, len_logon_script
);
5513 init_unistr2(&usr
->uni_profile_path
, profile_path
, len_profile_path
);
5514 init_unistr2(&usr
->uni_acct_desc
, description
, len_description
);
5515 init_unistr2(&usr
->uni_workstations
, workstations
, len_workstations
);
5516 init_unistr2(&usr
->uni_unknown_str
, NULL
, len_unknown_str
);
5517 init_unistr2(&usr
->uni_munged_dial
, munged_dial
, len_munged_dial
);
5519 usr
->unknown_6
= pdb_get_unknown6(pw
);
5522 if (pdb_get_hours(pw
)) {
5523 usr
->logon_hrs
.len
= pdb_get_hours_len(pw
);
5524 memcpy(&usr
->logon_hrs
.hours
, pdb_get_hours(pw
), MAX_HOURS_LEN
);
5526 memset(&usr
->logon_hrs
, 0xff, sizeof(usr
->logon_hrs
));
5529 /*******************************************************************
5530 reads or writes a structure.
5531 ********************************************************************/
5533 static BOOL
sam_io_user_info21(char *desc
, SAM_USER_INFO_21
* usr
,
5534 prs_struct
*ps
, int depth
)
5539 prs_debug(ps
, depth
, desc
, "sam_io_user_info21");
5545 if(!smb_io_time("logon_time ", &usr
->logon_time
, ps
, depth
))
5547 if(!smb_io_time("logoff_time ", &usr
->logoff_time
, ps
, depth
))
5549 if(!smb_io_time("pass_last_set_time ", &usr
->pass_last_set_time
, ps
,depth
))
5551 if(!smb_io_time("kickoff_time ", &usr
->kickoff_time
, ps
, depth
))
5553 if(!smb_io_time("pass_can_change_time ", &usr
->pass_can_change_time
, ps
,depth
))
5555 if(!smb_io_time("pass_must_change_time", &usr
->pass_must_change_time
, ps
, depth
))
5558 if(!smb_io_unihdr("hdr_user_name ", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
5560 if(!smb_io_unihdr("hdr_full_name ", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
5562 if(!smb_io_unihdr("hdr_home_dir ", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
5564 if(!smb_io_unihdr("hdr_dir_drive ", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive */
5566 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
5568 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
5570 if(!smb_io_unihdr("hdr_acct_desc ", &usr
->hdr_acct_desc
, ps
, depth
)) /* account desc */
5572 if(!smb_io_unihdr("hdr_workstations", &usr
->hdr_workstations
, ps
, depth
)) /* wkstas user can log on from */
5574 if(!smb_io_unihdr("hdr_unknown_str ", &usr
->hdr_unknown_str
, ps
, depth
)) /* unknown string */
5576 if(!smb_io_unihdr("hdr_munged_dial ", &usr
->hdr_munged_dial
, ps
, depth
)) /* wkstas user can log on from */
5579 if(!prs_uint8s(False
, "lm_pwd ", ps
, depth
, usr
->lm_pwd
, sizeof(usr
->lm_pwd
)))
5581 if(!prs_uint8s(False
, "nt_pwd ", ps
, depth
, usr
->nt_pwd
, sizeof(usr
->nt_pwd
)))
5584 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User ID */
5586 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group ID */
5588 if(!prs_uint32("acb_info ", ps
, depth
, &usr
->acb_info
))
5591 if(!prs_uint32("unknown_3 ", ps
, depth
, &usr
->unknown_3
))
5593 if(!prs_uint16("logon_divs ", ps
, depth
, &usr
->logon_divs
)) /* logon divisions per week */
5597 if(!prs_uint32("ptr_logon_hrs ", ps
, depth
, &usr
->ptr_logon_hrs
))
5599 if(!prs_uint32("unknown_5 ", ps
, depth
, &usr
->unknown_5
))
5602 if(!prs_uint8s(False
, "padding1 ", ps
, depth
, usr
->padding1
, sizeof(usr
->padding1
)))
5605 /* here begins pointed-to data */
5607 if(!smb_io_unistr2("uni_user_name ", &usr
->uni_user_name
,usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
5609 if(!smb_io_unistr2("uni_full_name ", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
5611 if(!smb_io_unistr2("uni_home_dir ", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
5613 if(!smb_io_unistr2("uni_dir_drive ", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
5615 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
5617 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
5619 if(!smb_io_unistr2("uni_acct_desc ", &usr
->uni_acct_desc
, usr
->hdr_acct_desc
.buffer
, ps
, depth
)) /* user desc unicode string */
5621 if(!smb_io_unistr2("uni_workstations", &usr
->uni_workstations
, usr
->hdr_workstations
.buffer
, ps
, depth
)) /* worksations user can log on from */
5623 if(!smb_io_unistr2("uni_unknown_str ", &usr
->uni_unknown_str
, usr
->hdr_unknown_str
.buffer
, ps
, depth
)) /* unknown string */
5625 if(!smb_io_unistr2("uni_munged_dial ", &usr
->uni_munged_dial
,usr
->hdr_munged_dial
.buffer
, ps
, depth
)) /* worksations user can log on from */
5628 /* ok, this is only guess-work (as usual) */
5629 if (usr
->ptr_logon_hrs
) {
5632 if(!prs_uint32("unknown_6 ", ps
, depth
, &usr
->unknown_6
))
5634 if(!prs_uint32("padding4 ", ps
, depth
, &usr
->padding4
))
5636 if(!sam_io_logon_hrs("logon_hrs", &usr
->logon_hrs
, ps
, depth
))
5638 } else if (UNMARSHALLING(ps
)) {
5646 /*******************************************************************
5647 inits a SAM_USERINFO_CTR structure.
5648 ********************************************************************/
5650 uint32
make_samr_userinfo_ctr_usr21(TALLOC_CTX
*ctx
, SAM_USERINFO_CTR
* ctr
,
5651 uint16 switch_value
,
5652 SAM_USER_INFO_21
* usr
)
5654 DEBUG(5, ("init_samr_userinfo_ctr\n"));
5656 ctr
->switch_value
= switch_value
;
5657 ctr
->info
.id
= NULL
;
5659 switch (switch_value
) {
5661 ctr
->info
.id10
= (SAM_USER_INFO_10
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_10
));
5662 if (ctr
->info
.id10
== NULL
)
5663 return NT_STATUS_NO_MEMORY
;
5665 init_sam_user_info10(ctr
->info
.id10
, usr
->acb_info
);
5668 /* whoops - got this wrong. i think. or don't understand what's happening. */
5672 info
= (void *)&id11
;
5674 expire
.low
= 0xffffffff;
5675 expire
.high
= 0x7fffffff;
5677 ctr
->info
.id
= (SAM_USER_INFO_11
*) talloc_zero(ctx
,sizeof(*ctr
->info
.id11
));
5678 init_sam_user_info11(ctr
->info
.id11
, &expire
,
5679 "BROOKFIELDS$", /* name */
5680 0x03ef, /* user rid */
5681 0x201, /* group rid */
5682 0x0080); /* acb info */
5688 ctr
->info
.id12
= (SAM_USER_INFO_12
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_12
));
5689 if (ctr
->info
.id12
== NULL
)
5690 return NT_STATUS_NO_MEMORY
;
5692 init_sam_user_info12(ctr
->info
.id12
, usr
->lm_pwd
, usr
->nt_pwd
);
5696 SAM_USER_INFO_21
*cusr
;
5697 cusr
= (SAM_USER_INFO_21
*)talloc_zero(ctx
,sizeof(SAM_USER_INFO_21
));
5698 ctr
->info
.id21
= cusr
;
5699 if (ctr
->info
.id21
== NULL
)
5700 return NT_STATUS_NO_MEMORY
;
5701 memcpy(cusr
, usr
, sizeof(*usr
));
5702 memset(cusr
->lm_pwd
, 0, sizeof(cusr
->lm_pwd
));
5703 memset(cusr
->nt_pwd
, 0, sizeof(cusr
->nt_pwd
));
5707 DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
5708 return NT_STATUS_INVALID_INFO_CLASS
;
5711 return NT_STATUS_NOPROBLEMO
;
5714 /*******************************************************************
5715 inits a SAM_USERINFO_CTR structure.
5716 ********************************************************************/
5718 void init_samr_userinfo_ctr(SAM_USERINFO_CTR
* ctr
, uchar
* sess_key
,
5719 uint16 switch_value
, void *info
)
5721 DEBUG(5, ("init_samr_userinfo_ctr\n"));
5723 ctr
->switch_value
= switch_value
;
5724 ctr
->info
.id
= info
;
5726 switch (switch_value
) {
5728 SamOEMhash(ctr
->info
.id24
->pass
, sess_key
, 1);
5729 dump_data(100, (char *)sess_key
, 16);
5730 dump_data(100, (char *)ctr
->info
.id24
->pass
, 516);
5733 SamOEMhash(ctr
->info
.id23
->pass
, sess_key
, 1);
5734 dump_data(100, (char *)sess_key
, 16);
5735 dump_data(100, (char *)ctr
->info
.id23
->pass
, 516);
5738 DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level\n"));
5742 /*******************************************************************
5743 reads or writes a structure.
5744 ********************************************************************/
5746 static BOOL
samr_io_userinfo_ctr(char *desc
, SAM_USERINFO_CTR
**ppctr
,
5747 prs_struct
*ps
, int depth
)
5750 SAM_USERINFO_CTR
*ctr
;
5752 prs_debug(ps
, depth
, desc
, "samr_io_userinfo_ctr");
5755 if (UNMARSHALLING(ps
)) {
5756 ctr
= (SAM_USERINFO_CTR
*)prs_alloc_mem(ps
,sizeof(SAM_USERINFO_CTR
));
5764 /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
5766 if(!prs_uint16("switch_value", ps
, depth
, &ctr
->switch_value
))
5773 switch (ctr
->switch_value
) {
5775 if (UNMARSHALLING(ps
))
5776 ctr
->info
.id10
= (SAM_USER_INFO_10
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_10
));
5777 if (ctr
->info
.id10
== NULL
) {
5778 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5781 ret
= sam_io_user_info10("", ctr
->info
.id10
, ps
, depth
);
5784 if (UNMARSHALLING(ps
))
5785 ctr
->info
.id11
= (SAM_USER_INFO_11
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_11
));
5787 if (ctr
->info
.id11
== NULL
) {
5788 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5791 ret
= sam_io_user_info11("", ctr
->info
.id11
, ps
, depth
);
5794 if (UNMARSHALLING(ps
))
5795 ctr
->info
.id12
= (SAM_USER_INFO_12
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_12
));
5797 if (ctr
->info
.id12
== NULL
) {
5798 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5801 ret
= sam_io_user_info12("", ctr
->info
.id12
, ps
, depth
);
5804 if (UNMARSHALLING(ps
))
5805 ctr
->info
.id21
= (SAM_USER_INFO_21
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_21
));
5807 if (ctr
->info
.id21
== NULL
) {
5808 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5811 ret
= sam_io_user_info21("", ctr
->info
.id21
, ps
, depth
);
5814 if (UNMARSHALLING(ps
))
5815 ctr
->info
.id23
= (SAM_USER_INFO_23
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_23
));
5817 if (ctr
->info
.id23
== NULL
) {
5818 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5821 ret
= sam_io_user_info23("", ctr
->info
.id23
, ps
, depth
);
5824 if (UNMARSHALLING(ps
))
5825 ctr
->info
.id24
= (SAM_USER_INFO_24
*)prs_alloc_mem(ps
,sizeof(SAM_USER_INFO_24
));
5827 if (ctr
->info
.id24
== NULL
) {
5828 DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
5831 ret
= sam_io_user_info24("", ctr
->info
.id24
, ps
, depth
);
5834 DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr
->switch_value
));
5842 /*******************************************************************
5843 inits a SAMR_R_QUERY_USERINFO structure.
5844 ********************************************************************/
5846 void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO
* r_u
,
5847 SAM_USERINFO_CTR
* ctr
, uint32 status
)
5849 DEBUG(5, ("init_samr_r_query_userinfo\n"));
5859 r_u
->status
= status
; /* return status */
5862 /*******************************************************************
5863 reads or writes a structure.
5864 ********************************************************************/
5866 BOOL
samr_io_r_query_userinfo(char *desc
, SAMR_R_QUERY_USERINFO
* r_u
,
5867 prs_struct
*ps
, int depth
)
5872 prs_debug(ps
, depth
, desc
, "samr_io_r_query_userinfo");
5878 if(!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
5881 if (r_u
->ptr
!= 0) {
5882 if(!samr_io_userinfo_ctr("ctr", &r_u
->ctr
, ps
, depth
))
5888 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
5894 /*******************************************************************
5895 inits a SAMR_Q_SET_USERINFO structure.
5896 ********************************************************************/
5898 void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO
* q_u
,
5899 POLICY_HND
*hnd
, unsigned char sess_key
[16],
5900 uint16 switch_value
, void *info
)
5902 DEBUG(5, ("init_samr_q_set_userinfo\n"));
5905 q_u
->switch_value
= switch_value
;
5906 init_samr_userinfo_ctr(q_u
->ctr
, sess_key
, switch_value
, info
);
5909 /*******************************************************************
5910 reads or writes a structure.
5911 ********************************************************************/
5913 BOOL
samr_io_q_set_userinfo(char *desc
, SAMR_Q_SET_USERINFO
* q_u
,
5914 prs_struct
*ps
, int depth
)
5919 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo");
5925 smb_io_pol_hnd("pol", &(q_u
->pol
), ps
, depth
);
5927 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
5929 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
5935 /*******************************************************************
5936 inits a SAMR_R_SET_USERINFO structure.
5937 ********************************************************************/
5939 void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO
* r_u
, uint32 status
)
5941 DEBUG(5, ("init_samr_r_set_userinfo\n"));
5943 r_u
->status
= status
; /* return status */
5946 /*******************************************************************
5947 reads or writes a structure.
5948 ********************************************************************/
5950 BOOL
samr_io_r_set_userinfo(char *desc
, SAMR_R_SET_USERINFO
* r_u
,
5951 prs_struct
*ps
, int depth
)
5956 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo");
5962 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
5968 /*******************************************************************
5969 inits a SAMR_Q_SET_USERINFO2 structure.
5970 ********************************************************************/
5972 void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2
* q_u
,
5973 POLICY_HND
*hnd
, unsigned char sess_key
[16],
5974 uint16 switch_value
, SAM_USERINFO_CTR
* ctr
)
5976 DEBUG(5, ("init_samr_q_set_userinfo2\n"));
5979 q_u
->switch_value
= switch_value
;
5982 if (q_u
->ctr
!= NULL
)
5983 q_u
->ctr
->switch_value
= switch_value
;
5985 switch (switch_value
) {
5987 SamOEMhash(ctr
->info
.id12
->lm_pwd
, sess_key
, 0);
5988 SamOEMhash(ctr
->info
.id12
->nt_pwd
, sess_key
, 0);
5989 dump_data(100, (char *)sess_key
, 16);
5990 dump_data(100, (char *)ctr
->info
.id12
->lm_pwd
, 16);
5991 dump_data(100, (char *)ctr
->info
.id12
->nt_pwd
, 16);
5996 /*******************************************************************
5997 reads or writes a structure.
5998 ********************************************************************/
6000 BOOL
samr_io_q_set_userinfo2(char *desc
, SAMR_Q_SET_USERINFO2
* q_u
,
6001 prs_struct
*ps
, int depth
)
6006 prs_debug(ps
, depth
, desc
, "samr_io_q_set_userinfo2");
6012 if(!smb_io_pol_hnd("pol", &q_u
->pol
, ps
, depth
))
6015 if(!prs_uint16("switch_value", ps
, depth
, &q_u
->switch_value
))
6017 if(!samr_io_userinfo_ctr("ctr", &q_u
->ctr
, ps
, depth
))
6023 /*******************************************************************
6024 inits a SAMR_R_SET_USERINFO2 structure.
6025 ********************************************************************/
6027 void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2
* r_u
, uint32 status
)
6029 DEBUG(5, ("init_samr_r_set_userinfo2\n"));
6031 r_u
->status
= status
; /* return status */
6034 /*******************************************************************
6035 reads or writes a structure.
6036 ********************************************************************/
6038 BOOL
samr_io_r_set_userinfo2(char *desc
, SAMR_R_SET_USERINFO2
* r_u
,
6039 prs_struct
*ps
, int depth
)
6044 prs_debug(ps
, depth
, desc
, "samr_io_r_set_userinfo2");
6050 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6056 /*******************************************************************
6057 inits a SAMR_Q_CONNECT structure.
6058 ********************************************************************/
6060 void init_samr_q_connect(SAMR_Q_CONNECT
* q_u
,
6061 char *srv_name
, uint32 access_mask
)
6063 int len_srv_name
= strlen(srv_name
);
6065 DEBUG(5, ("init_samr_q_connect\n"));
6067 /* make PDC server name \\server */
6068 q_u
->ptr_srv_name
= len_srv_name
> 0 ? 1 : 0;
6069 init_unistr2(&q_u
->uni_srv_name
, srv_name
, len_srv_name
+ 1);
6071 /* example values: 0x0000 0002 */
6072 q_u
->access_mask
= access_mask
;
6075 /*******************************************************************
6076 reads or writes a structure.
6077 ********************************************************************/
6079 BOOL
samr_io_q_connect(char *desc
, SAMR_Q_CONNECT
* q_u
,
6080 prs_struct
*ps
, int depth
)
6085 prs_debug(ps
, depth
, desc
, "samr_io_q_connect");
6091 if(!prs_uint32("ptr_srv_name", ps
, depth
, &q_u
->ptr_srv_name
))
6093 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->ptr_srv_name
, ps
, depth
))
6098 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6104 /*******************************************************************
6105 reads or writes a structure.
6106 ********************************************************************/
6108 BOOL
samr_io_r_connect(char *desc
, SAMR_R_CONNECT
* r_u
,
6109 prs_struct
*ps
, int depth
)
6114 prs_debug(ps
, depth
, desc
, "samr_io_r_connect");
6120 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6123 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6129 /*******************************************************************
6130 inits a SAMR_Q_CONNECT_ANON structure.
6131 ********************************************************************/
6133 void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON
* q_u
)
6135 DEBUG(5, ("init_samr_q_connect_anon\n"));
6138 q_u
->unknown_0
= 0x5c; /* server name (?!!) */
6139 q_u
->unknown_1
= 0x01;
6140 q_u
->access_mask
= 0x20;
6143 /*******************************************************************
6144 reads or writes a structure.
6145 ********************************************************************/
6147 BOOL
samr_io_q_connect_anon(char *desc
, SAMR_Q_CONNECT_ANON
* q_u
,
6148 prs_struct
*ps
, int depth
)
6153 prs_debug(ps
, depth
, desc
, "samr_io_q_connect_anon");
6159 if(!prs_uint32("ptr ", ps
, depth
, &q_u
->ptr
))
6161 if(!prs_uint16("unknown_0", ps
, depth
, &q_u
->unknown_0
))
6163 if(!prs_uint16("unknown_1", ps
, depth
, &q_u
->unknown_1
))
6165 if(!prs_uint32("access_mask", ps
, depth
, &q_u
->access_mask
))
6171 /*******************************************************************
6172 reads or writes a structure.
6173 ********************************************************************/
6175 BOOL
samr_io_r_connect_anon(char *desc
, SAMR_R_CONNECT_ANON
* r_u
,
6176 prs_struct
*ps
, int depth
)
6181 prs_debug(ps
, depth
, desc
, "samr_io_r_connect_anon");
6187 if(!smb_io_pol_hnd("connect_pol", &r_u
->connect_pol
, ps
, depth
))
6190 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6196 /*******************************************************************
6197 inits a SAMR_Q_GET_DOM_PWINFO structure.
6198 ********************************************************************/
6200 void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO
* q_u
,
6203 int len_srv_name
= strlen(srv_name
);
6205 DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
6208 init_uni_hdr(&q_u
->hdr_srv_name
, len_srv_name
);
6209 init_unistr2(&q_u
->uni_srv_name
, srv_name
, len_srv_name
);
6212 /*******************************************************************
6213 reads or writes a structure.
6214 ********************************************************************/
6216 BOOL
samr_io_q_get_dom_pwinfo(char *desc
, SAMR_Q_GET_DOM_PWINFO
* q_u
,
6217 prs_struct
*ps
, int depth
)
6222 prs_debug(ps
, depth
, desc
, "samr_io_q_get_dom_pwinfo");
6228 if(!prs_uint32("ptr", ps
, depth
, &q_u
->ptr
))
6230 if (q_u
->ptr
!= 0) {
6231 if(!smb_io_unihdr("", &q_u
->hdr_srv_name
, ps
, depth
))
6233 if(!smb_io_unistr2("", &q_u
->uni_srv_name
, q_u
->hdr_srv_name
.buffer
, ps
, depth
))
6240 /*******************************************************************
6241 reads or writes a structure.
6242 ********************************************************************/
6244 BOOL
samr_io_r_get_dom_pwinfo(char *desc
, SAMR_R_GET_DOM_PWINFO
* r_u
,
6245 prs_struct
*ps
, int depth
)
6250 prs_debug(ps
, depth
, desc
, "samr_io_r_get_dom_pwinfo");
6256 if(!prs_uint16("unk_0", ps
, depth
, &r_u
->unk_0
))
6260 if(!prs_uint16("unk_1", ps
, depth
, &r_u
->unk_1
))
6264 if(!prs_uint16("unk_2", ps
, depth
, &r_u
->unk_2
))
6269 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
6275 /*******************************************************************
6276 make a SAMR_ENC_PASSWD structure.
6277 ********************************************************************/
6279 void init_enc_passwd(SAMR_ENC_PASSWD
* pwd
, char pass
[512])
6287 memcpy(pwd
->pass
, pass
, sizeof(pwd
->pass
));
6291 /*******************************************************************
6292 reads or writes a SAMR_ENC_PASSWD structure.
6293 ********************************************************************/
6295 BOOL
samr_io_enc_passwd(char *desc
, SAMR_ENC_PASSWD
* pwd
,
6296 prs_struct
*ps
, int depth
)
6301 prs_debug(ps
, depth
, desc
, "samr_io_enc_passwd");
6307 if(!prs_uint32("ptr", ps
, depth
, &pwd
->ptr
))
6310 if (pwd
->ptr
!= 0) {
6311 if(!prs_uint8s(False
, "pwd", ps
, depth
, pwd
->pass
, sizeof(pwd
->pass
)))
6318 /*******************************************************************
6319 inits a SAMR_ENC_HASH structure.
6320 ********************************************************************/
6322 void init_enc_hash(SAMR_ENC_HASH
* hsh
, uchar hash
[16])
6330 memcpy(hsh
->hash
, hash
, sizeof(hsh
->hash
));
6334 /*******************************************************************
6335 reads or writes a SAMR_ENC_HASH structure.
6336 ********************************************************************/
6338 BOOL
samr_io_enc_hash(char *desc
, SAMR_ENC_HASH
* hsh
,
6339 prs_struct
*ps
, int depth
)
6344 prs_debug(ps
, depth
, desc
, "samr_io_enc_hash");
6350 if(!prs_uint32("ptr ", ps
, depth
, &hsh
->ptr
))
6352 if (hsh
->ptr
!= 0) {
6353 if(!prs_uint8s(False
, "hash", ps
, depth
, hsh
->hash
,sizeof(hsh
->hash
)))
6360 /*******************************************************************
6361 inits a SAMR_R_GET_DOM_PWINFO structure.
6362 ********************************************************************/
6364 void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER
* q_u
,
6365 char *dest_host
, char *user_name
,
6366 char nt_newpass
[516],
6367 uchar nt_oldhash
[16],
6368 char lm_newpass
[516],
6369 uchar lm_oldhash
[16])
6371 int len_dest_host
= strlen(dest_host
);
6372 int len_user_name
= strlen(user_name
);
6374 DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
6377 init_uni_hdr(&q_u
->hdr_dest_host
, len_dest_host
);
6378 init_unistr2(&q_u
->uni_dest_host
, dest_host
, len_dest_host
);
6379 init_uni_hdr(&q_u
->hdr_user_name
, len_user_name
);
6380 init_unistr2(&q_u
->uni_user_name
, user_name
, len_user_name
);
6382 init_enc_passwd(&q_u
->nt_newpass
, nt_newpass
);
6383 init_enc_hash(&q_u
->nt_oldhash
, nt_oldhash
);
6385 q_u
->unknown
= 0x01;
6387 init_enc_passwd(&q_u
->lm_newpass
, lm_newpass
);
6388 init_enc_hash(&q_u
->lm_oldhash
, lm_oldhash
);
6391 /*******************************************************************
6392 reads or writes a structure.
6393 ********************************************************************/
6395 BOOL
samr_io_q_chgpasswd_user(char *desc
, SAMR_Q_CHGPASSWD_USER
* q_u
,
6396 prs_struct
*ps
, int depth
)
6401 prs_debug(ps
, depth
, desc
, "samr_io_q_chgpasswd_user");
6407 if(!prs_uint32("ptr_0", ps
, depth
, &q_u
->ptr_0
))
6410 if(!smb_io_unihdr("", &q_u
->hdr_dest_host
, ps
, depth
))
6412 if(!smb_io_unistr2("", &q_u
->uni_dest_host
, q_u
->hdr_dest_host
.buffer
, ps
, depth
))
6417 if(!smb_io_unihdr("", &q_u
->hdr_user_name
, ps
, depth
))
6419 if(!smb_io_unistr2("", &q_u
->uni_user_name
, q_u
->hdr_user_name
.buffer
,ps
, depth
))
6422 if(!samr_io_enc_passwd("nt_newpass", &q_u
->nt_newpass
, ps
, depth
))
6424 if(!samr_io_enc_hash("nt_oldhash", &q_u
->nt_oldhash
, ps
, depth
))
6427 if(!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
6430 if(!samr_io_enc_passwd("lm_newpass", &q_u
->lm_newpass
, ps
, depth
))
6432 if(!samr_io_enc_hash("lm_oldhash", &q_u
->lm_oldhash
, ps
, depth
))
6438 /*******************************************************************
6439 inits a SAMR_R_CHGPASSWD_USER structure.
6440 ********************************************************************/
6442 void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER
* r_u
, uint32 status
)
6444 DEBUG(5, ("init_r_chgpasswd_user\n"));
6446 r_u
->status
= status
;
6449 /*******************************************************************
6450 reads or writes a structure.
6451 ********************************************************************/
6453 BOOL
samr_io_r_chgpasswd_user(char *desc
, SAMR_R_CHGPASSWD_USER
* r_u
,
6454 prs_struct
*ps
, int depth
)
6459 prs_debug(ps
, depth
, desc
, "samr_io_r_chgpasswd_user");
6465 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))