2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1998,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
7 * Copyright (C) Paul Ashton 1997-1998.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 extern int DEBUGLEVEL;
30 /*******************************************************************
31 makes a SAMR_Q_CLOSE_HND structure.
32 ********************************************************************/
33 void make_samr_q_close_hnd(SAMR_Q_CLOSE_HND *q_c, POLICY_HND *hnd)
35 if (q_c == NULL || hnd == NULL) return;
37 DEBUG(5,("make_samr_q_close_hnd\n"));
39 memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
42 /*******************************************************************
43 reads or writes a structure.
44 ********************************************************************/
45 void samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND *q_u, prs_struct *ps, int depth)
47 if (q_u == NULL) return;
49 prs_debug(ps, depth, desc, "samr_io_q_close_hnd");
54 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
58 /*******************************************************************
59 reads or writes a structure.
60 ********************************************************************/
61 void samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND *r_u, prs_struct *ps, int depth)
63 if (r_u == NULL) return;
65 prs_debug(ps, depth, desc, "samr_io_r_close_hnd");
70 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
73 prs_uint32("status", ps, depth, &(r_u->status));
77 /*******************************************************************
78 reads or writes a structure.
79 ********************************************************************/
80 void make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN *q_u,
81 POLICY_HND *connect_pol, uint32 flags,
84 if (q_u == NULL) return;
86 DEBUG(5,("samr_make_samr_q_open_domain\n"));
88 memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol));
90 make_dom_sid2(&(q_u->dom_sid), sid);
93 /*******************************************************************
94 reads or writes a structure.
95 ********************************************************************/
96 void samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN *q_u, prs_struct *ps, int depth)
98 if (q_u == NULL) return;
100 prs_debug(ps, depth, desc, "samr_io_q_open_domain");
105 smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth);
108 prs_uint32("flags", ps, depth, &(q_u->flags));
110 smb_io_dom_sid2("sid", &(q_u->dom_sid), ps, depth);
115 /*******************************************************************
116 reads or writes a structure.
117 ********************************************************************/
118 void samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN *r_u, prs_struct *ps, int depth)
120 if (r_u == NULL) return;
122 prs_debug(ps, depth, desc, "samr_io_r_open_domain");
127 smb_io_pol_hnd("domain_pol", &(r_u->domain_pol), ps, depth);
130 prs_uint32("status", ps, depth, &(r_u->status));
133 /*******************************************************************
134 reads or writes a structure.
135 ********************************************************************/
136 void make_samr_q_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, POLICY_HND *user_pol)
138 if (q_u == NULL) return;
140 DEBUG(5,("samr_make_samr_q_unknown_2c\n"));
142 memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol));
146 /*******************************************************************
147 reads or writes a structure.
148 ********************************************************************/
149 void samr_io_q_unknown_2c(char *desc, SAMR_Q_UNKNOWN_2C *q_u, prs_struct *ps, int depth)
151 if (q_u == NULL) return;
153 prs_debug(ps, depth, desc, "samr_io_q_unknown_2c");
158 smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth);
162 /*******************************************************************
164 ********************************************************************/
165 void make_samr_r_unknown_2c(SAMR_R_UNKNOWN_2C *q_u, uint32 status)
167 if (q_u == NULL) return;
169 DEBUG(5,("samr_make_r_unknown_2c\n"));
171 q_u->unknown_0 = 0x00160000;
172 q_u->unknown_1 = 0x00000000;
173 q_u->status = status;
177 /*******************************************************************
178 reads or writes a structure.
179 ********************************************************************/
180 void samr_io_r_unknown_2c(char *desc, SAMR_R_UNKNOWN_2C *r_u, prs_struct *ps, int depth)
182 if (r_u == NULL) return;
184 prs_debug(ps, depth, desc, "samr_io_r_unknown_2c");
189 prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0));
190 prs_uint32("unknown_1", ps, depth, &(r_u->unknown_1));
191 prs_uint32("status ", ps, depth, &(r_u->status ));
194 /*******************************************************************
195 reads or writes a structure.
196 ********************************************************************/
197 void make_samr_q_unknown_3(SAMR_Q_UNKNOWN_3 *q_u,
198 POLICY_HND *user_pol, uint16 switch_value)
200 if (q_u == NULL) return;
202 DEBUG(5,("samr_make_samr_q_unknown_3\n"));
204 memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol));
205 q_u->switch_value = switch_value;
209 /*******************************************************************
210 reads or writes a structure.
211 ********************************************************************/
212 void samr_io_q_unknown_3(char *desc, SAMR_Q_UNKNOWN_3 *q_u, prs_struct *ps, int depth)
214 if (q_u == NULL) return;
216 prs_debug(ps, depth, desc, "samr_io_q_unknown_3");
221 smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth);
224 prs_uint16("switch_value", ps, depth, &(q_u->switch_value));
228 /*******************************************************************
229 reads or writes a structure.
230 ********************************************************************/
231 void make_samr_q_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u,
232 POLICY_HND *domain_pol, uint16 switch_value)
234 if (q_u == NULL) return;
236 DEBUG(5,("samr_make_samr_q_query_dom_info\n"));
238 memcpy(&q_u->domain_pol, domain_pol, sizeof(q_u->domain_pol));
239 q_u->switch_value = switch_value;
242 /*******************************************************************
243 reads or writes a structure.
244 ********************************************************************/
245 void samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO *q_u, prs_struct *ps, int depth)
247 if (q_u == NULL) return;
249 prs_debug(ps, depth, desc, "samr_io_q_query_dom_info");
254 smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
257 prs_uint16("switch_value", ps, depth, &(q_u->switch_value));
261 /*******************************************************************
263 ********************************************************************/
264 void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server)
266 int len_domain = strlen(domain);
267 int len_server = strlen(server);
269 if (u_2 == NULL) return;
271 u_2->unknown_0 = 0x00000000;
272 u_2->unknown_1 = 0x80000000;
273 u_2->unknown_2 = 0x00000000;
276 make_uni_hdr(&(u_2->hdr_domain), len_domain, len_domain, 1);
277 make_uni_hdr(&(u_2->hdr_server), len_server, len_server, 1);
279 u_2->seq_num = 0x10000000;
280 u_2->unknown_3 = 0x00000000;
282 u_2->unknown_4 = 0x00000001;
283 u_2->unknown_5 = 0x00000003;
284 u_2->unknown_6 = 0x00000001;
285 u_2->num_domain_usrs = 0x00000008;
286 u_2->num_domain_grps = 0x00000003;
287 u_2->num_local_grps = 0x00000003;
289 memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */
291 make_unistr2(&u_2->uni_domain, domain, len_domain);
292 make_unistr2(&u_2->uni_server, server, len_server);
295 /*******************************************************************
296 reads or writes a structure.
297 ********************************************************************/
298 void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth)
300 if (u_2 == NULL) return;
302 prs_debug(ps, depth, desc, "sam_io_unk_info2");
305 prs_uint32("unknown_0", ps, depth, &u_2->unknown_0); /* 0x0000 0000 */
306 prs_uint32("unknown_1", ps, depth, &u_2->unknown_1); /* 0x8000 0000 */
307 prs_uint32("unknown_2", ps, depth, &u_2->unknown_2); /* 0x0000 0000 */
309 prs_uint32("ptr_0", ps, depth, &u_2->ptr_0); /* pointer to unknown structure */
310 smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth); /* domain name unicode header */
311 smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth); /* server name unicode header */
313 /* put all the data in here, at the moment, including what the above
314 pointer is referring to
317 prs_uint32("seq_num ", ps, depth, &u_2->seq_num ); /* 0x0000 0099 or 0x1000 0000 */
318 prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3 ); /* 0x0000 0000 */
320 prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 ); /* 0x0000 0001 */
321 prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 ); /* 0x0000 0003 */
322 prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6 ); /* 0x0000 0001 */
323 prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs ); /* 0x0000 0008 */
324 prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps); /* 0x0000 0003 */
325 prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps); /* 0x0000 0003 */
327 prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding)); /* 12 bytes zeros */
329 smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth); /* domain name unicode string */
330 smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth); /* server name unicode string */
336 /*******************************************************************
337 makes a SAMR_R_QUERY_DOMAIN_INFO structure.
338 ********************************************************************/
339 void make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u,
340 uint16 switch_value, SAM_UNK_CTR *ctr,
343 if (r_u == NULL || ctr == NULL) return;
345 DEBUG(5,("make_samr_r_query_dom_info\n"));
348 r_u->switch_value = 0;
349 r_u->status = status; /* return status */
353 r_u->switch_value = switch_value;
359 /*******************************************************************
360 reads or writes a structure.
361 ********************************************************************/
362 void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth)
364 if (r_u == NULL) return;
366 prs_debug(ps, depth, desc, "samr_io_r_query_dom_info");
371 prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0));
372 prs_uint16("switch_value", ps, depth, &(r_u->switch_value));
375 if (r_u->ptr_0 != 0 && r_u->ctr != NULL)
377 switch (r_u->switch_value)
381 sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth);
386 DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
395 /*******************************************************************
396 makes a DOM_SID3 structure.
398 calculate length by adding up the size of the components.
399 ********************************************************************/
400 void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid)
402 if (sid3 == NULL) return;
405 sid3->len = 2 + 8 + sid3->sid.num_auths * 4;
408 /*******************************************************************
409 reads or writes a SAM_SID3 structure.
411 this one's odd, because the length (in bytes) is specified at the beginning.
412 the length _includes_ the length of the length, too :-)
414 ********************************************************************/
415 static void sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth)
417 if (sid3 == NULL) return;
419 prs_debug(ps, depth, desc, "sam_io_dom_sid3");
422 prs_uint16("len", ps, depth, &(sid3->len));
424 smb_io_dom_sid("", &(sid3->sid), ps, depth);
427 /*******************************************************************
428 makes a SAMR_R_UNKNOWN3 structure.
433 unknown_4,5 : 0x0000 0014
436 unknown_7 : 0x5800 or 0x0070
438 ********************************************************************/
439 static void make_sam_sid_stuff(SAM_SID_STUFF *stf,
440 uint16 unknown_2, uint16 unknown_3,
441 uint32 unknown_4, uint16 unknown_6, uint16 unknown_7,
442 int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS])
444 stf->unknown_2 = unknown_2;
445 stf->unknown_3 = unknown_3;
447 bzero(stf->padding1, sizeof(stf->padding1));
449 stf->unknown_4 = unknown_4;
450 stf->unknown_5 = unknown_4;
452 stf->unknown_6 = unknown_6;
453 stf->unknown_7 = unknown_7;
455 stf->num_sids = num_sid3s;
457 stf->padding2 = 0x0000;
459 memcpy(stf->sid, sid3, sizeof(DOM_SID3) * num_sid3s);
462 /*******************************************************************
463 reads or writes a SAM_SID_STUFF structure.
464 ********************************************************************/
465 static void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth)
469 if (stf == NULL) return;
471 DEBUG(5,("make_sam_sid_stuff\n"));
473 prs_uint16("unknown_2", ps, depth, &(stf->unknown_2));
474 prs_uint16("unknown_3", ps, depth, &(stf->unknown_3));
476 prs_uint8s(False, "padding1", ps, depth, stf->padding1, sizeof(stf->padding1));
478 prs_uint32("unknown_4", ps, depth, &(stf->unknown_4));
479 prs_uint32("unknown_5", ps, depth, &(stf->unknown_5));
480 prs_uint16("unknown_6", ps, depth, &(stf->unknown_6));
481 prs_uint16("unknown_7", ps, depth, &(stf->unknown_7));
483 prs_uint32("num_sids ", ps, depth, &(stf->num_sids ));
484 prs_uint16("padding2 ", ps, depth, &(stf->padding2 ));
486 SMB_ASSERT_ARRAY(stf->sid, stf->num_sids);
488 for (i = 0; i < stf->num_sids; i++)
490 sam_io_dom_sid3("", &(stf->sid[i]), ps, depth);
494 /*******************************************************************
495 reads or writes a SAMR_R_UNKNOWN3 structure.
496 ********************************************************************/
497 void make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u,
498 uint16 unknown_2, uint16 unknown_3,
499 uint32 unknown_4, uint16 unknown_6, uint16 unknown_7,
500 int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS],
503 if (r_u == NULL) return;
505 DEBUG(5,("samr_make_r_unknown_3\n"));
514 make_sam_sid_stuff(&(r_u->sid_stuff), unknown_2, unknown_3,
515 unknown_4, unknown_6, unknown_7,
519 r_u->status = status;
523 /*******************************************************************
524 reads or writes a SAMR_R_UNKNOWN_3 structure.
526 this one's odd, because the daft buggers use a different mechanism
527 for writing out the array of sids. they put the number of sids in
528 only one place: they've calculated the length of each sid and jumped
529 by that amount. then, retrospectively, the length of the whole buffer
530 is put at the beginning of the data stream.
534 ********************************************************************/
535 void samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth)
539 int ptr_sid_stuff = 0;
541 if (r_u == NULL) return;
543 prs_debug(ps, depth, desc, "samr_io_r_unknown_3");
548 prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 ));
552 /* reading. do the length later */
553 prs_uint32("sid_stuff_len0", ps, depth, &(r_u->sid_stuff_len0));
558 ptr_len0 = ps->offset; ps->offset += 4;
563 prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 ));
566 /* reading. do the length later */
567 prs_uint32("sid_stuff_len1", ps, depth, &(r_u->sid_stuff_len1));
572 ptr_len1 = ps->offset; ps->offset += 4;
577 ptr_sid_stuff = ps->offset;
578 sam_io_sid_stuff("", &(r_u->sid_stuff), ps, depth);
582 if (!(ps->io)) /* storing not reading. do the length, now. */
584 if (ptr_sid_stuff != 0)
586 uint32 sid_stuff_len = ps->offset - ptr_sid_stuff;
587 int old_len = ps->offset;
589 ps->offset = ptr_len0;
590 prs_uint32("sid_stuff_len0", ps, depth, &sid_stuff_len);
592 ps->offset = ptr_len1;
593 prs_uint32("sid_stuff_len1", ps, depth, &sid_stuff_len);
595 ps->offset = old_len;
599 prs_uint32("status", ps, depth, &(r_u->status));
602 /*******************************************************************
603 reads or writes a SAM_STR1 structure.
604 ********************************************************************/
605 static void sam_io_sam_str1(char *desc, SAM_STR1 *sam, uint32 acct_buf, uint32 name_buf, uint32 desc_buf, prs_struct *ps, int depth)
607 if (sam == NULL) return;
609 prs_debug(ps, depth, desc, "sam_io_sam_str1");
614 smb_io_unistr2("unistr2", &(sam->uni_acct_name), acct_buf, ps, depth); /* account name unicode string */
615 smb_io_unistr2("unistr2", &(sam->uni_full_name), name_buf, ps, depth); /* full name unicode string */
616 smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account description unicode string */
619 /*******************************************************************
620 makes a SAM_ENTRY1 structure.
621 ********************************************************************/
622 static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
623 uint32 len_sam_name, uint32 len_sam_full, uint32 len_sam_desc,
624 uint32 rid_user, uint16 acb_info)
626 if (sam == NULL) return;
628 DEBUG(5,("make_sam_entry1\n"));
630 sam->user_idx = user_idx;
631 sam->rid_user = rid_user;
632 sam->acb_info = acb_info;
635 make_uni_hdr(&(sam->hdr_acct_name), len_sam_name, len_sam_name, len_sam_name != 0);
636 make_uni_hdr(&(sam->hdr_user_name), len_sam_full, len_sam_full, len_sam_full != 0);
637 make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0);
640 /*******************************************************************
641 reads or writes a SAM_ENTRY1 structure.
642 ********************************************************************/
643 static void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth)
645 if (sam == NULL) return;
647 prs_debug(ps, depth, desc, "sam_io_sam_entry1");
652 prs_uint32("user_idx ", ps, depth, &(sam->user_idx ));
654 prs_uint32("rid_user ", ps, depth, &(sam->rid_user ));
655 prs_uint16("acb_info ", ps, depth, &(sam->acb_info ));
656 prs_uint16("pad ", ps, depth, &(sam->pad ));
658 smb_io_unihdr("unihdr", &(sam->hdr_acct_name), ps, depth); /* account name unicode string header */
659 smb_io_unihdr("unihdr", &(sam->hdr_user_name), ps, depth); /* account name unicode string header */
660 smb_io_unihdr("unihdr", &(sam->hdr_user_desc), ps, depth); /* account name unicode string header */
663 /*******************************************************************
664 reads or writes a SAM_STR2 structure.
665 ********************************************************************/
666 static void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth)
668 if (sam == NULL) return;
670 prs_debug(ps, depth, desc, "sam_io_sam_str2");
675 smb_io_unistr2("unistr2", &(sam->uni_srv_name), acct_buf, ps, depth); /* account name unicode string */
676 smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account description unicode string */
679 /*******************************************************************
680 makes a SAM_ENTRY2 structure.
681 ********************************************************************/
682 static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx,
683 uint32 len_sam_name, uint32 len_sam_desc,
684 uint32 rid_user, uint16 acb_info)
686 if (sam == NULL) return;
688 DEBUG(5,("make_sam_entry2\n"));
690 sam->user_idx = user_idx;
691 sam->rid_user = rid_user;
692 sam->acb_info = acb_info;
695 make_uni_hdr(&(sam->hdr_srv_name), len_sam_name, len_sam_name, len_sam_name != 0);
696 make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0);
699 /*******************************************************************
700 reads or writes a SAM_ENTRY2 structure.
701 ********************************************************************/
702 static void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth)
704 if (sam == NULL) return;
706 prs_debug(ps, depth, desc, "sam_io_sam_entry2");
711 prs_uint32("user_idx ", ps, depth, &(sam->user_idx ));
713 prs_uint32("rid_user ", ps, depth, &(sam->rid_user ));
714 prs_uint16("acb_info ", ps, depth, &(sam->acb_info ));
715 prs_uint16("pad ", ps, depth, &(sam->pad ));
717 smb_io_unihdr("unihdr", &(sam->hdr_srv_name), ps, depth); /* account name unicode string header */
718 smb_io_unihdr("unihdr", &(sam->hdr_srv_desc), ps, depth); /* account name unicode string header */
721 /*******************************************************************
722 reads or writes a SAM_STR3 structure.
723 ********************************************************************/
724 static void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth)
726 if (sam == NULL) return;
728 prs_debug(ps, depth, desc, "sam_io_sam_str3");
733 smb_io_unistr2("unistr2", &(sam->uni_grp_name), acct_buf, ps, depth); /* account name unicode string */
734 smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account description unicode string */
737 /*******************************************************************
738 makes a SAM_ENTRY3 structure.
739 ********************************************************************/
740 static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx,
741 uint32 len_grp_name, uint32 len_grp_desc, uint32 rid_grp)
743 if (sam == NULL) return;
745 DEBUG(5,("make_sam_entry3\n"));
747 sam->grp_idx = grp_idx;
748 sam->rid_grp = rid_grp;
749 sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */
751 make_uni_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, len_grp_name != 0);
752 make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc, len_grp_desc, len_grp_desc != 0);
755 /*******************************************************************
756 reads or writes a SAM_ENTRY3 structure.
757 ********************************************************************/
758 static void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth)
760 if (sam == NULL) return;
762 prs_debug(ps, depth, desc, "sam_io_sam_entry3");
767 prs_uint32("grp_idx", ps, depth, &(sam->grp_idx));
769 prs_uint32("rid_grp", ps, depth, &(sam->rid_grp));
770 prs_uint32("attr ", ps, depth, &(sam->attr ));
772 smb_io_unihdr("unihdr", &(sam->hdr_grp_name), ps, depth); /* account name unicode string header */
773 smb_io_unihdr("unihdr", &(sam->hdr_grp_desc), ps, depth); /* account name unicode string header */
776 /*******************************************************************
777 makes a SAM_ENTRY structure.
778 ********************************************************************/
779 static void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid)
781 if (sam == NULL) return;
783 DEBUG(5,("make_sam_entry\n"));
786 make_uni_hdr(&(sam->hdr_name), len_sam_name, len_sam_name, len_sam_name != 0);
789 /*******************************************************************
790 reads or writes a SAM_ENTRY structure.
791 ********************************************************************/
792 static void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth)
794 if (sam == NULL) return;
796 prs_debug(ps, depth, desc, "sam_io_sam_entry");
800 prs_uint32("rid", ps, depth, &(sam->rid ));
801 smb_io_unihdr("unihdr", &(sam->hdr_name), ps, depth); /* account name unicode string header */
805 /*******************************************************************
806 makes a SAMR_Q_ENUM_DOM_USERS structure.
807 ********************************************************************/
808 void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol,
809 uint16 req_num_entries, uint16 unk_0,
810 uint16 acb_mask, uint16 unk_1, uint32 size)
812 if (q_e == NULL || pol == NULL) return;
814 DEBUG(5,("make_samr_q_enum_dom_users\n"));
816 memcpy(&(q_e->pol), pol, sizeof(*pol));
818 q_e->req_num_entries = req_num_entries; /* zero indicates lots */
819 q_e->unknown_0 = unk_0; /* this gets returned in the response */
820 q_e->acb_mask = acb_mask;
821 q_e->unknown_1 = unk_1;
822 q_e->max_size = size;
825 /*******************************************************************
826 reads or writes a structure.
827 ********************************************************************/
828 void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth)
830 if (q_e == NULL) return;
832 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
837 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
840 prs_uint16("req_num_entries", ps, depth, &(q_e->req_num_entries));
841 prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 ));
843 prs_uint16("acb_mask ", ps, depth, &(q_e->acb_mask ));
844 prs_uint16("unknown_1 ", ps, depth, &(q_e->unknown_1 ));
846 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
852 /*******************************************************************
853 makes a SAMR_R_ENUM_DOM_USERS structure.
854 ********************************************************************/
855 void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u,
857 uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status)
861 if (r_u == NULL) return;
863 DEBUG(5,("make_samr_r_enum_dom_users\n"));
865 if (num_sam_entries >= MAX_SAM_ENTRIES)
867 num_sam_entries = MAX_SAM_ENTRIES;
868 DEBUG(5,("limiting number of entries to %d\n",
872 r_u->unknown_0 = unk_0;
874 if (num_sam_entries != 0)
876 r_u->ptr_entries1 = 1;
877 r_u->ptr_entries2 = 1;
878 r_u->num_entries2 = num_sam_entries;
879 r_u->num_entries3 = num_sam_entries;
881 SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries);
882 SMB_ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries);
884 for (i = 0; i < num_sam_entries; i++)
886 make_sam_entry(&(r_u->sam[i]),
887 pass[i].uni_user_name.uni_str_len,
890 copy_unistr2(&(r_u->uni_acct_name[i]), &(pass[i].uni_user_name));
893 r_u->num_entries4 = num_sam_entries;
897 r_u->ptr_entries1 = 0;
898 r_u->num_entries2 = num_sam_entries;
899 r_u->ptr_entries2 = 1;
902 r_u->status = status;
905 /*******************************************************************
906 reads or writes a structure.
907 ********************************************************************/
908 void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth)
912 if (r_u == NULL) return;
914 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
919 prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 ));
920 prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1));
922 if (r_u->ptr_entries1 != 0)
924 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
925 prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
926 prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
928 SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2);
930 for (i = 0; i < r_u->num_entries2; i++)
933 sam_io_sam_entry("", &(r_u->sam[i]), ps, depth);
936 SMB_ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2);
938 for (i = 0; i < r_u->num_entries2; i++)
941 smb_io_unistr2("", &(r_u->uni_acct_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
946 prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4));
949 prs_uint32("status", ps, depth, &(r_u->status));
952 /*******************************************************************
953 makes a SAMR_Q_QUERY_DISPINFO structure.
954 ********************************************************************/
955 void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol,
956 uint16 switch_level, uint32 start_idx, uint32 size)
958 if (q_e == NULL || pol == NULL) return;
960 DEBUG(5,("make_samr_q_query_dispinfo\n"));
962 memcpy(&(q_e->pol), pol, sizeof(*pol));
964 q_e->switch_level = switch_level;
967 q_e->start_idx = start_idx;
968 q_e->unknown_1 = 0x000007d0;
969 q_e->max_size = size;
972 /*******************************************************************
973 reads or writes a structure.
974 ********************************************************************/
975 void samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth)
977 if (q_e == NULL) return;
979 prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo");
984 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
987 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
988 prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 ));
989 prs_uint32("start_idx ", ps, depth, &(q_e->start_idx ));
990 prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 ));
991 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
997 /*******************************************************************
998 makes a SAM_INFO_2 structure.
999 ********************************************************************/
1000 void make_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask,
1001 uint32 start_idx, uint32 num_sam_entries,
1002 SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES])
1007 if (sam == NULL) return;
1009 DEBUG(5,("make_sam_info_2\n"));
1011 if (num_sam_entries >= MAX_SAM_ENTRIES)
1013 num_sam_entries = MAX_SAM_ENTRIES;
1014 DEBUG(5,("limiting number of entries to %d\n",
1018 for (i = start_idx, entries_added = 0; i < num_sam_entries; i++)
1020 if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask))
1022 make_sam_entry2(&(sam->sam[entries_added]),
1023 start_idx + entries_added + 1,
1024 pass[i].uni_user_name.uni_str_len,
1025 pass[i].uni_acct_desc.uni_str_len,
1029 copy_unistr2(&(sam->str[entries_added].uni_srv_name), &(pass[i].uni_user_name));
1030 copy_unistr2(&(sam->str[entries_added].uni_srv_desc), &(pass[i].uni_acct_desc));
1035 sam->num_entries = entries_added;
1036 sam->ptr_entries = 1;
1037 sam->num_entries2 = entries_added;
1041 /*******************************************************************
1042 reads or writes a structure.
1043 ********************************************************************/
1044 static void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth)
1048 if (sam == NULL) return;
1050 prs_debug(ps, depth, desc, "sam_io_sam_info_2");
1055 prs_uint32("num_entries ", ps, depth, &(sam->num_entries ));
1056 prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries ));
1058 prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 ));
1060 SMB_ASSERT_ARRAY(sam->sam, sam->num_entries);
1062 for (i = 0; i < sam->num_entries; i++)
1065 sam_io_sam_entry2("", &(sam->sam[i]), ps, depth);
1068 for (i = 0; i < sam->num_entries; i++)
1071 sam_io_sam_str2 ("", &(sam->str[i]),
1072 sam->sam[i].hdr_srv_name.buffer,
1073 sam->sam[i].hdr_srv_desc.buffer,
1079 /*******************************************************************
1080 makes a SAM_INFO_1 structure.
1081 ********************************************************************/
1082 void make_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask,
1083 uint32 start_idx, uint32 num_sam_entries,
1084 SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES])
1089 if (sam == NULL) return;
1091 DEBUG(5,("make_sam_info_1\n"));
1093 if (num_sam_entries >= MAX_SAM_ENTRIES)
1095 num_sam_entries = MAX_SAM_ENTRIES;
1096 DEBUG(5,("limiting number of entries to %d\n",
1100 for (i = start_idx, entries_added = 0; i < num_sam_entries; i++)
1102 if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask))
1104 make_sam_entry1(&(sam->sam[entries_added]),
1105 start_idx + entries_added + 1,
1106 pass[i].uni_user_name.uni_str_len,
1107 pass[i].uni_full_name.uni_str_len,
1108 pass[i].uni_acct_desc.uni_str_len,
1112 copy_unistr2(&(sam->str[entries_added].uni_acct_name), &(pass[i].uni_user_name));
1113 copy_unistr2(&(sam->str[entries_added].uni_full_name), &(pass[i].uni_full_name));
1114 copy_unistr2(&(sam->str[entries_added].uni_acct_desc), &(pass[i].uni_acct_desc));
1120 sam->num_entries = entries_added;
1121 sam->ptr_entries = 1;
1122 sam->num_entries2 = entries_added;
1126 /*******************************************************************
1127 reads or writes a structure.
1128 ********************************************************************/
1129 static void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth)
1133 if (sam == NULL) return;
1135 prs_debug(ps, depth, desc, "sam_io_sam_info_1");
1140 prs_uint32("num_entries ", ps, depth, &(sam->num_entries ));
1141 prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries ));
1143 prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 ));
1145 SMB_ASSERT_ARRAY(sam->sam, sam->num_entries);
1147 for (i = 0; i < sam->num_entries; i++)
1150 sam_io_sam_entry1("", &(sam->sam[i]), ps, depth);
1153 for (i = 0; i < sam->num_entries; i++)
1156 sam_io_sam_str1 ("", &(sam->str[i]),
1157 sam->sam[i].hdr_acct_name.buffer,
1158 sam->sam[i].hdr_user_name.buffer,
1159 sam->sam[i].hdr_user_desc.buffer,
1165 /*******************************************************************
1166 makes a SAMR_R_QUERY_DISPINFO structure.
1167 ********************************************************************/
1168 void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u,
1169 uint16 switch_level, SAM_INFO_CTR *ctr, uint32 status)
1171 if (r_u == NULL) return;
1173 DEBUG(5,("make_samr_r_query_dispinfo\n"));
1177 r_u->unknown_0 = 0x0000001;
1178 r_u->unknown_1 = 0x0000001;
1182 r_u->unknown_0 = 0x0;
1183 r_u->unknown_1 = 0x0;
1186 r_u->switch_level = switch_level;
1188 r_u->status = status;
1192 /*******************************************************************
1193 reads or writes a structure.
1194 ********************************************************************/
1195 void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth)
1197 if (r_u == NULL) return;
1199 prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo");
1204 prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 ));
1205 prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 ));
1206 prs_uint16("switch_level ", ps, depth, &(r_u->switch_level ));
1210 switch (r_u->switch_level)
1214 sam_io_sam_info_1("users", r_u->ctr->sam.info1, ps, depth);
1219 sam_io_sam_info_2("servers", r_u->ctr->sam.info2, ps, depth);
1224 DEBUG(5,("samr_io_r_query_dispinfo: unknown switch value\n"));
1229 prs_uint32("status", ps, depth, &(r_u->status));
1233 /*******************************************************************
1234 makes a SAMR_Q_OPEN_GROUP structure.
1235 ********************************************************************/
1236 void make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c,
1237 POLICY_HND *hnd, uint32 unk, uint32 rid)
1239 if (q_c == NULL || hnd == NULL) return;
1241 DEBUG(5,("make_samr_q_open_group\n"));
1243 memcpy(&(q_c->domain_pol), hnd, sizeof(q_c->domain_pol));
1245 q_c->rid_group = rid;
1248 /*******************************************************************
1249 reads or writes a structure.
1250 ********************************************************************/
1251 void samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth)
1253 if (q_u == NULL) return;
1255 prs_debug(ps, depth, desc, "samr_io_q_open_group");
1260 smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
1262 prs_uint32("unknown ", ps, depth, &(q_u->unknown ));
1263 prs_uint32("rid_group", ps, depth, &(q_u->rid_group));
1266 /*******************************************************************
1267 reads or writes a structure.
1268 ********************************************************************/
1269 void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth)
1271 if (r_u == NULL) return;
1273 prs_debug(ps, depth, desc, "samr_io_r_open_group");
1278 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
1281 prs_uint32("status", ps, depth, &(r_u->status));
1285 /*******************************************************************
1286 makes a GROUP_INFO1 structure.
1287 ********************************************************************/
1288 void make_samr_group_info1(GROUP_INFO1 *gr1,
1289 char *acct_name, char *acct_desc)
1291 int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0;
1292 int acct_len = acct_name != NULL ? strlen(acct_name) : 0;
1293 if (gr1 == NULL) return;
1295 DEBUG(5,("make_samr_group_info1\n"));
1297 make_uni_hdr(&(gr1->hdr_acct_name), acct_len , acct_len, acct_name ? 1 : 0);
1299 gr1->unknown_1 = 0x3;
1300 gr1->unknown_2 = 0x3;
1302 make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0);
1304 make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len);
1305 make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len);
1309 /*******************************************************************
1310 reads or writes a structure.
1311 ********************************************************************/
1312 void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth)
1314 if (gr1 == NULL) return;
1316 prs_debug(ps, depth, desc, "samr_io_group_info1");
1321 smb_io_unihdr ("hdr_acct_name", &(gr1->hdr_acct_name) , ps, depth);
1323 prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1));
1324 prs_uint32("unknown_2", ps, depth, &(gr1->unknown_2));
1326 smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth);
1328 smb_io_unistr2("uni_acct_name", &(gr1->uni_acct_name), gr1->hdr_acct_name.buffer, ps, depth);
1331 smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth);
1334 /*******************************************************************
1335 makes a GROUP_INFO4 structure.
1336 ********************************************************************/
1337 void make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc)
1339 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
1340 if (gr4 == NULL) return;
1342 DEBUG(5,("make_samr_group_info4\n"));
1344 make_uni_hdr(&(gr4->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
1345 make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len);
1349 /*******************************************************************
1350 reads or writes a structure.
1351 ********************************************************************/
1352 void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth)
1354 if (gr4 == NULL) return;
1356 prs_debug(ps, depth, desc, "samr_io_group_info4");
1361 smb_io_unihdr ("hdr_acct_desc", &(gr4->hdr_acct_desc) , ps, depth);
1362 smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), gr4->hdr_acct_desc.buffer, ps, depth);
1365 /*******************************************************************
1366 reads or writes a structure.
1367 ********************************************************************/
1368 void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth)
1370 if (ctr == NULL) return;
1372 prs_debug(ps, depth, desc, "samr_group_info_ctr");
1375 prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1));
1376 prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2));
1378 switch (ctr->switch_value1)
1382 samr_io_group_info1("group_info1", &(ctr->group.info1), ps, depth);
1387 samr_io_group_info4("group_info4", &(ctr->group.info4), ps, depth);
1392 DEBUG(4,("samr_group_info_ctr: unsupported switch level\n"));
1401 /*******************************************************************
1402 makes a SAMR_Q_CREATE_DOM_GROUP structure.
1403 ********************************************************************/
1404 void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e,
1406 const char *acct_desc)
1408 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
1409 if (q_e == NULL || pol == NULL) return;
1411 DEBUG(5,("make_samr_q_create_dom_group\n"));
1413 memcpy(&(q_e->pol), pol, sizeof(*pol));
1415 make_uni_hdr(&(q_e->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
1416 make_unistr2(&(q_e->uni_acct_desc), acct_desc, acct_len);
1418 q_e->unknown_1 = 0x0002;
1419 q_e->unknown_2 = 0x0001;
1423 /*******************************************************************
1424 reads or writes a structure.
1425 ********************************************************************/
1426 void samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth)
1428 if (q_e == NULL) return;
1430 prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
1435 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1438 smb_io_unihdr ("hdr_acct_desc", &(q_e->hdr_acct_desc), ps, depth);
1439 smb_io_unistr2("uni_acct_desc", &(q_e->uni_acct_desc), q_e->hdr_acct_desc.buffer, ps, depth);
1442 prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1));
1443 prs_uint16("unknown_2", ps, depth, &(q_e->unknown_2));
1447 /*******************************************************************
1448 makes a SAMR_R_CREATE_DOM_GROUP structure.
1449 ********************************************************************/
1450 void make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol,
1451 uint32 rid, uint32 status)
1453 if (r_u == NULL) return;
1455 DEBUG(5,("make_samr_r_create_dom_group\n"));
1457 memcpy(&(r_u->pol), pol, sizeof(*pol));
1460 r_u->status = status;
1464 /*******************************************************************
1465 reads or writes a structure.
1466 ********************************************************************/
1467 void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth)
1469 if (r_u == NULL) return;
1471 prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
1476 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
1479 prs_uint32("rid ", ps, depth, &(r_u->rid ));
1480 prs_uint32("status", ps, depth, &(r_u->status));
1483 /*******************************************************************
1484 makes a SAMR_Q_DELETE_DOM_GROUP structure.
1485 ********************************************************************/
1486 void make_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_c, POLICY_HND *hnd)
1488 if (q_c == NULL || hnd == NULL) return;
1490 DEBUG(5,("make_samr_q_delete_dom_group\n"));
1492 memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol));
1495 /*******************************************************************
1496 reads or writes a structure.
1497 ********************************************************************/
1498 void samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP *q_u, prs_struct *ps, int depth)
1500 if (q_u == NULL) return;
1502 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
1507 smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
1510 /*******************************************************************
1511 makes a SAMR_R_DELETE_DOM_GROUP structure.
1512 ********************************************************************/
1513 void make_samr_r_delete_dom_group(SAMR_R_DELETE_DOM_GROUP *r_u,
1516 if (r_u == NULL) return;
1518 DEBUG(5,("make_samr_r_delete_dom_group\n"));
1520 r_u->status = status;
1523 /*******************************************************************
1524 reads or writes a structure.
1525 ********************************************************************/
1526 void samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_struct *ps, int depth)
1528 if (r_u == NULL) return;
1530 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
1535 prs_uint32("status", ps, depth, &(r_u->status));
1540 /*******************************************************************
1541 makes a SAMR_Q_DEL_GROUPMEM structure.
1542 ********************************************************************/
1543 void make_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_e,
1547 if (q_e == NULL || pol == NULL) return;
1549 DEBUG(5,("make_samr_q_del_groupmem\n"));
1551 memcpy(&(q_e->pol), pol, sizeof(*pol));
1557 /*******************************************************************
1558 reads or writes a structure.
1559 ********************************************************************/
1560 void samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *ps, int depth)
1562 if (q_e == NULL) return;
1564 prs_debug(ps, depth, desc, "samr_io_q_del_groupmem");
1569 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1572 prs_uint32("rid ", ps, depth, &(q_e->rid));
1576 /*******************************************************************
1577 makes a SAMR_R_DEL_GROUPMEM structure.
1578 ********************************************************************/
1579 void make_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM *r_u, POLICY_HND *pol,
1582 if (r_u == NULL) return;
1584 DEBUG(5,("make_samr_r_del_groupmem\n"));
1586 r_u->status = status;
1590 /*******************************************************************
1591 reads or writes a structure.
1592 ********************************************************************/
1593 void samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM *r_u, prs_struct *ps, int depth)
1595 if (r_u == NULL) return;
1597 prs_debug(ps, depth, desc, "samr_io_r_del_groupmem");
1602 prs_uint32("status", ps, depth, &(r_u->status));
1606 /*******************************************************************
1607 makes a SAMR_Q_ADD_GROUPMEM structure.
1608 ********************************************************************/
1609 void make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e,
1613 if (q_e == NULL || pol == NULL) return;
1615 DEBUG(5,("make_samr_q_add_groupmem\n"));
1617 memcpy(&(q_e->pol), pol, sizeof(*pol));
1620 q_e->unknown = 0x0005;
1624 /*******************************************************************
1625 reads or writes a structure.
1626 ********************************************************************/
1627 void samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth)
1629 if (q_e == NULL) return;
1631 prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
1636 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1639 prs_uint32("rid ", ps, depth, &(q_e->rid));
1640 prs_uint32("unknown", ps, depth, &(q_e->unknown));
1644 /*******************************************************************
1645 makes a SAMR_R_ADD_GROUPMEM structure.
1646 ********************************************************************/
1647 void make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol,
1650 if (r_u == NULL) return;
1652 DEBUG(5,("make_samr_r_add_groupmem\n"));
1654 r_u->status = status;
1658 /*******************************************************************
1659 reads or writes a structure.
1660 ********************************************************************/
1661 void samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth)
1663 if (r_u == NULL) return;
1665 prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
1670 prs_uint32("status", ps, depth, &(r_u->status));
1674 /*******************************************************************
1675 makes a SAMR_Q_SET_GROUPINFO structure.
1676 ********************************************************************/
1677 void make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e,
1678 POLICY_HND *pol, GROUP_INFO_CTR *ctr)
1680 if (q_e == NULL || pol == NULL) return;
1682 DEBUG(5,("make_samr_q_set_groupinfo\n"));
1684 memcpy(&(q_e->pol), pol, sizeof(*pol));
1689 /*******************************************************************
1690 reads or writes a structure.
1691 ********************************************************************/
1692 void samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth)
1694 if (q_e == NULL) return;
1696 prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
1701 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1704 samr_group_info_ctr("ctr", q_e->ctr, ps, depth);
1708 /*******************************************************************
1709 makes a SAMR_R_SET_GROUPINFO structure.
1710 ********************************************************************/
1711 void make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u,
1714 if (r_u == NULL) return;
1716 DEBUG(5,("make_samr_r_set_groupinfo\n"));
1718 r_u->status = status;
1722 /*******************************************************************
1723 reads or writes a structure.
1724 ********************************************************************/
1725 void samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth)
1727 if (r_u == NULL) return;
1729 prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
1734 prs_uint32("status", ps, depth, &(r_u->status));
1737 /*******************************************************************
1738 makes a SAMR_Q_QUERY_GROUPINFO structure.
1739 ********************************************************************/
1740 void make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e,
1742 uint16 switch_level)
1744 if (q_e == NULL || pol == NULL) return;
1746 DEBUG(5,("make_samr_q_query_groupinfo\n"));
1748 memcpy(&(q_e->pol), pol, sizeof(*pol));
1750 q_e->switch_level = switch_level;
1754 /*******************************************************************
1755 reads or writes a structure.
1756 ********************************************************************/
1757 void samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth)
1759 if (q_e == NULL) return;
1761 prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
1766 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1769 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
1773 /*******************************************************************
1774 makes a SAMR_R_QUERY_GROUPINFO structure.
1775 ********************************************************************/
1776 void make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr,
1779 if (r_u == NULL) return;
1781 DEBUG(5,("make_samr_r_query_groupinfo\n"));
1783 r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0;
1785 r_u->status = status;
1789 /*******************************************************************
1790 reads or writes a structure.
1791 ********************************************************************/
1792 void samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth)
1794 if (r_u == NULL) return;
1796 prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
1801 prs_uint32("ptr", ps, depth, &(r_u->ptr));
1805 samr_group_info_ctr("ctr", r_u->ctr, ps, depth);
1808 prs_uint32("status", ps, depth, &(r_u->status));
1812 /*******************************************************************
1813 makes a SAMR_Q_QUERY_GROUPMEM structure.
1814 ********************************************************************/
1815 void make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd)
1817 if (q_c == NULL || hnd == NULL) return;
1819 DEBUG(5,("make_samr_q_query_groupmem\n"));
1821 memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol));
1824 /*******************************************************************
1825 reads or writes a structure.
1826 ********************************************************************/
1827 void samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth)
1829 if (q_u == NULL) return;
1831 prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
1836 smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
1839 /*******************************************************************
1840 makes a SAMR_R_QUERY_GROUPMEM structure.
1841 ********************************************************************/
1842 void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u,
1843 uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status)
1845 if (r_u == NULL) return;
1847 DEBUG(5,("make_samr_r_query_groupmem\n"));
1851 r_u->ptr = (num_entries != 0) ? 1 : 0;
1852 r_u->num_entries = num_entries;
1854 r_u->ptr_attrs = attr != NULL ? 1 : 0;
1855 r_u->ptr_rids = rid != NULL ? 1 : 0;
1857 r_u->num_rids = num_entries;
1860 r_u->num_attrs = num_entries;
1866 r_u->num_entries = 0;
1869 r_u->status = status;
1872 /*******************************************************************
1873 reads or writes a structure.
1874 ********************************************************************/
1875 void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth)
1879 if (r_u == NULL) return;
1881 prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
1886 prs_uint32("ptr", ps, depth, &(r_u->ptr));
1887 prs_uint32("num_entries ", ps, depth, &(r_u->num_entries));
1891 prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids ));
1892 prs_uint32("ptr_attrs", ps, depth, &(r_u->ptr_attrs));
1894 if (r_u->ptr_rids != 0)
1896 prs_uint32("num_rids", ps, depth, &(r_u->num_rids));
1897 for (i = 0; i < r_u->num_rids; i++)
1900 prs_uint32("", ps, depth, &(r_u->rid[i]));
1904 if (r_u->ptr_attrs != 0)
1906 prs_uint32("num_attrs", ps, depth, &(r_u->num_attrs));
1907 for (i = 0; i < r_u->num_attrs; i++)
1910 prs_uint32("", ps, depth, &(r_u->attr[i]));
1915 prs_uint32("status", ps, depth, &(r_u->status));
1919 /*******************************************************************
1920 makes a SAMR_Q_ENUM_DOM_GROUPS structure.
1921 ********************************************************************/
1922 void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol,
1923 uint16 switch_level, uint32 start_idx, uint32 size)
1925 if (q_e == NULL || pol == NULL) return;
1927 DEBUG(5,("make_samr_q_enum_dom_groups\n"));
1929 memcpy(&(q_e->pol), pol, sizeof(*pol));
1931 q_e->switch_level = switch_level;
1934 q_e->start_idx = start_idx;
1935 q_e->unknown_1 = 0x000007d0;
1936 q_e->max_size = size;
1940 /*******************************************************************
1941 reads or writes a structure.
1942 ********************************************************************/
1943 void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth)
1945 if (q_e == NULL) return;
1947 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups");
1952 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1955 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
1956 prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 ));
1957 prs_uint32("start_idx ", ps, depth, &(q_e->start_idx ));
1958 prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 ));
1959 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
1965 /*******************************************************************
1966 makes a SAMR_R_ENUM_DOM_GROUPS structure.
1967 ********************************************************************/
1968 void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u,
1969 uint32 start_idx, uint32 num_sam_entries,
1976 if (r_u == NULL) return;
1978 DEBUG(5,("make_samr_r_enum_dom_groups\n"));
1980 if (num_sam_entries >= MAX_SAM_ENTRIES)
1982 num_sam_entries = MAX_SAM_ENTRIES;
1983 DEBUG(5,("limiting number of entries to %d\n",
1989 for (i = start_idx, entries_added = 0; i < num_sam_entries; i++)
1991 int acct_name_len = strlen(grp[i].name);
1992 int acct_desc_len = strlen(grp[i].comment);
1994 make_sam_entry3(&(r_u->sam[entries_added]),
1995 start_idx + entries_added + 1,
2000 make_unistr2(&(r_u->str[entries_added].uni_grp_name), grp[i].name , acct_name_len);
2001 make_unistr2(&(r_u->str[entries_added].uni_grp_desc), grp[i].comment, acct_desc_len);
2006 if (entries_added > 0)
2008 r_u->unknown_0 = 0x0000492;
2009 r_u->unknown_1 = 0x000049a;
2013 r_u->unknown_0 = 0x0;
2014 r_u->unknown_1 = 0x0;
2016 r_u->switch_level = 3;
2017 r_u->num_entries = entries_added;
2018 r_u->ptr_entries = 1;
2019 r_u->num_entries2 = entries_added;
2023 r_u->switch_level = 0;
2026 r_u->status = status;
2029 /*******************************************************************
2030 reads or writes a structure.
2031 ********************************************************************/
2032 void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth)
2036 if (r_u == NULL) return;
2038 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups");
2043 prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 ));
2044 prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 ));
2045 prs_uint32("switch_level ", ps, depth, &(r_u->switch_level ));
2047 if (r_u->switch_level != 0)
2049 prs_uint32("num_entries ", ps, depth, &(r_u->num_entries ));
2050 prs_uint32("ptr_entries ", ps, depth, &(r_u->ptr_entries ));
2052 prs_uint32("num_entries2 ", ps, depth, &(r_u->num_entries2 ));
2054 SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries);
2056 for (i = 0; i < r_u->num_entries; i++)
2059 sam_io_sam_entry3("", &(r_u->sam[i]), ps, depth);
2062 for (i = 0; i < r_u->num_entries; i++)
2065 sam_io_sam_str3 ("", &(r_u->str[i]),
2066 r_u->sam[i].hdr_grp_name.buffer,
2067 r_u->sam[i].hdr_grp_desc.buffer,
2072 prs_uint32("status", ps, depth, &(r_u->status));
2075 /*******************************************************************
2076 makes a SAMR_Q_QUERY_USERGROUPS structure.
2077 ********************************************************************/
2078 void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
2081 if (q_u == NULL || hnd == NULL) return;
2083 DEBUG(5,("make_samr_q_query_usergroups\n"));
2085 memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
2089 /*******************************************************************
2090 reads or writes a structure.
2091 ********************************************************************/
2092 void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth)
2094 if (q_u == NULL) return;
2096 prs_debug(ps, depth, desc, "samr_io_q_query_usergroups");
2101 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
2105 /*******************************************************************
2106 makes a SAMR_R_QUERY_USERGROUPS structure.
2107 ********************************************************************/
2108 void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u,
2109 uint32 num_gids, DOM_GID *gid, uint32 status)
2111 if (r_u == NULL) return;
2113 DEBUG(5,("make_samr_r_query_usergroups\n"));
2118 r_u->num_entries = num_gids;
2119 r_u->ptr_1 = (num_gids != 0) ? 1 : 0;
2120 r_u->num_entries2 = num_gids;
2127 r_u->num_entries = 0;
2131 r_u->status = status;
2134 /*******************************************************************
2135 reads or writes a structure.
2136 ********************************************************************/
2137 void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth)
2140 if (r_u == NULL) return;
2142 prs_debug(ps, depth, desc, "samr_io_r_query_usergroups");
2147 prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 ));
2149 if (r_u->ptr_0 != 0)
2151 prs_uint32("num_entries ", ps, depth, &(r_u->num_entries));
2152 prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 ));
2154 if (r_u->num_entries != 0)
2156 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
2158 for (i = 0; i < r_u->num_entries2; i++)
2161 smb_io_gid("", &(r_u->gid[i]), ps, depth);
2165 prs_uint32("status", ps, depth, &(r_u->status));
2169 /*******************************************************************
2170 makes a SAMR_Q_ENUM_DOM_ALIASES structure.
2171 ********************************************************************/
2172 void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size)
2174 if (q_e == NULL || pol == NULL) return;
2176 DEBUG(5,("make_samr_q_enum_dom_aliases\n"));
2178 memcpy(&(q_e->pol), pol, sizeof(*pol));
2181 q_e->max_size = size;
2185 /*******************************************************************
2186 reads or writes a structure.
2187 ********************************************************************/
2188 void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth)
2190 if (q_e == NULL) return;
2192 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases");
2197 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
2200 prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0));
2201 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
2207 /*******************************************************************
2208 makes a SAMR_R_ENUM_DOM_ALIASES structure.
2209 ********************************************************************/
2210 void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u,
2211 uint32 num_sam_entries, LOCAL_GRP *alss,
2216 if (r_u == NULL) return;
2218 DEBUG(5,("make_samr_r_enum_dom_aliases\n"));
2220 if (num_sam_entries >= MAX_SAM_ENTRIES)
2222 num_sam_entries = MAX_SAM_ENTRIES;
2223 DEBUG(5,("limiting number of entries to %d\n",
2227 r_u->num_entries = num_sam_entries;
2229 if (num_sam_entries > 0)
2231 r_u->ptr_entries = 1;
2232 r_u->num_entries2 = num_sam_entries;
2233 r_u->ptr_entries2 = 1;
2234 r_u->num_entries3 = num_sam_entries;
2236 SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries);
2238 for (i = 0; i < num_sam_entries; i++)
2240 int acct_name_len = strlen(alss[i].name);
2242 make_sam_entry(&(r_u->sam[i]),
2246 make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name , acct_name_len);
2249 r_u->num_entries4 = num_sam_entries;
2253 r_u->ptr_entries = 0;
2256 r_u->status = status;
2259 /*******************************************************************
2260 reads or writes a structure.
2261 ********************************************************************/
2262 void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth)
2266 if (r_u == NULL) return;
2268 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases");
2273 prs_uint32("num_entries", ps, depth, &(r_u->num_entries));
2274 prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries));
2276 if (r_u->num_entries != 0 && r_u->ptr_entries != 0)
2278 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
2279 prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
2280 prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
2282 SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries);
2284 for (i = 0; i < r_u->num_entries; i++)
2286 sam_io_sam_entry("", &(r_u->sam[i]), ps, depth);
2289 for (i = 0; i < r_u->num_entries; i++)
2291 smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
2296 prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4));
2299 prs_uint32("status", ps, depth, &(r_u->status));
2303 /*******************************************************************
2304 makes a ALIAS_INFO3 structure.
2305 ********************************************************************/
2306 void make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc)
2308 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
2309 if (al3 == NULL) return;
2311 DEBUG(5,("make_samr_alias_info3\n"));
2313 make_uni_hdr(&(al3->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
2314 make_unistr2(&(al3->uni_acct_desc), acct_desc, acct_len);
2318 /*******************************************************************
2319 reads or writes a structure.
2320 ********************************************************************/
2321 void samr_io_alias_info3(char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int depth)
2323 if (al3 == NULL) return;
2325 prs_debug(ps, depth, desc, "samr_io_alias_info3");
2330 smb_io_unihdr ("hdr_acct_desc", &(al3->hdr_acct_desc) , ps, depth);
2331 smb_io_unistr2("uni_acct_desc", &(al3->uni_acct_desc), al3->hdr_acct_desc.buffer, ps, depth);
2334 /*******************************************************************
2335 reads or writes a structure.
2336 ********************************************************************/
2337 void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int depth)
2339 if (ctr == NULL) return;
2341 prs_debug(ps, depth, desc, "samr_alias_info_ctr");
2344 prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1));
2345 prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2));
2347 switch (ctr->switch_value1)
2351 samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth);
2356 DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n"));
2365 /*******************************************************************
2366 makes a SAMR_Q_QUERY_ALIASINFO structure.
2367 ********************************************************************/
2368 void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e,
2370 uint16 switch_level)
2372 if (q_e == NULL || pol == NULL) return;
2374 DEBUG(5,("make_samr_q_query_aliasinfo\n"));
2376 memcpy(&(q_e->pol), pol, sizeof(*pol));
2378 q_e->switch_level = switch_level;
2382 /*******************************************************************
2383 reads or writes a structure.
2384 ********************************************************************/
2385 void samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth)
2387 if (q_e == NULL) return;
2389 prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo");
2394 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
2397 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
2401 /*******************************************************************
2402 makes a SAMR_R_QUERY_ALIASINFO structure.
2403 ********************************************************************/
2404 void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ctr,
2407 if (r_u == NULL) return;
2409 DEBUG(5,("make_samr_r_query_aliasinfo\n"));
2411 r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0;
2413 r_u->status = status;
2417 /*******************************************************************
2418 reads or writes a structure.
2419 ********************************************************************/
2420 void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth)
2422 if (r_u == NULL) return;
2424 prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo");
2429 prs_uint32("ptr", ps, depth, &(r_u->ptr));
2433 samr_alias_info_ctr("ctr", r_u->ctr, ps, depth);
2436 prs_uint32("status", ps, depth, &(r_u->status));
2440 /*******************************************************************
2441 makes a SAMR_Q_SET_ALIASINFO structure.
2442 ********************************************************************/
2443 void make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd,
2444 ALIAS_INFO_CTR *ctr)
2446 if (q_u == NULL) return;
2448 DEBUG(5,("make_samr_q_set_aliasinfo\n"));
2450 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
2455 /*******************************************************************
2456 reads or writes a structure.
2457 ********************************************************************/
2458 void samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO *q_u, prs_struct *ps, int depth)
2460 if (q_u == NULL) return;
2462 prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo");
2467 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
2468 samr_alias_info_ctr("ctr", q_u->ctr, ps, depth);
2471 /*******************************************************************
2472 reads or writes a structure.
2473 ********************************************************************/
2474 void samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct *ps, int depth)
2476 if (r_u == NULL) return;
2478 prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo");
2482 prs_uint32("status", ps, depth, &(r_u->status));
2487 /*******************************************************************
2488 makes a SAMR_Q_QUERY_USERALIASES structure.
2489 ********************************************************************/
2490 void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u,
2494 if (q_u == NULL || hnd == NULL) return;
2496 DEBUG(5,("make_samr_q_query_useraliases\n"));
2498 memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
2505 q_u->ptr_sid[0] = 1;
2506 make_dom_sid2(&q_u->sid[0], sid);
2510 /*******************************************************************
2511 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
2512 ********************************************************************/
2513 void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth)
2518 if (q_u == NULL) return;
2520 prs_debug(ps, depth, desc, "samr_io_q_query_useraliases");
2525 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
2528 prs_uint32("num_sids1", ps, depth, &(q_u->num_sids1));
2529 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
2530 prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2));
2532 SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2);
2534 for (i = 0; i < q_u->num_sids2; i++)
2536 slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i);
2537 prs_uint32(tmp, ps, depth, &(q_u->ptr_sid[i]));
2540 for (i = 0; i < q_u->num_sids2; i++)
2542 if (q_u->ptr_sid[i] != 0)
2545 slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i);
2546 smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth);
2554 /*******************************************************************
2555 makes a SAMR_R_QUERY_USERALIASES structure.
2556 ********************************************************************/
2557 void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u,
2558 uint32 num_rids, uint32 *rid, uint32 status)
2560 if (r_u == NULL) return;
2562 DEBUG(5,("make_samr_r_query_useraliases\n"));
2566 r_u->num_entries = num_rids;
2568 r_u->num_entries2 = num_rids;
2574 r_u->num_entries = 0;
2576 r_u->num_entries2 = 0;
2579 r_u->status = status;
2582 /*******************************************************************
2583 reads or writes a structure.
2584 ********************************************************************/
2585 void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth)
2589 if (r_u == NULL) return;
2591 prs_debug(ps, depth, desc, "samr_io_r_query_useraliases");
2596 prs_uint32("num_entries", ps, depth, &(r_u->num_entries));
2597 prs_uint32("ptr ", ps, depth, &(r_u->ptr ));
2598 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
2600 if (r_u->num_entries != 0)
2602 for (i = 0; i < r_u->num_entries2; i++)
2604 slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i);
2605 prs_uint32(tmp, ps, depth, &(r_u->rid[i]));
2609 prs_uint32("status", ps, depth, &(r_u->status));
2612 /*******************************************************************
2613 makes a SAMR_Q_OPEN_ALIAS structure.
2614 ********************************************************************/
2615 void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol,
2616 uint32 unknown_0, uint32 rid)
2618 if (q_u == NULL) return;
2620 DEBUG(5,("make_samr_q_open_alias\n"));
2622 memcpy(&(q_u->dom_pol), pol, sizeof(q_u->dom_pol));
2624 /* example values: 0x0000 0008 */
2625 q_u->unknown_0 = unknown_0;
2627 q_u->rid_alias = rid;
2630 /*******************************************************************
2631 reads or writes a structure.
2632 ********************************************************************/
2633 void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth)
2635 if (q_u == NULL) return;
2637 prs_debug(ps, depth, desc, "samr_io_q_open_alias");
2642 smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth);
2644 prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0));
2645 prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias));
2648 /*******************************************************************
2649 reads or writes a structure.
2650 ********************************************************************/
2651 void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth)
2653 if (r_u == NULL) return;
2655 prs_debug(ps, depth, desc, "samr_io_r_open_alias");
2660 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
2663 prs_uint32("status", ps, depth, &(r_u->status));
2666 /*******************************************************************
2667 makes a SAMR_Q_LOOKUP_RIDS structure.
2668 ********************************************************************/
2669 void make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u,
2670 POLICY_HND *pol, uint32 flags,
2671 uint32 num_rids, uint32 *rid)
2674 if (q_u == NULL) return;
2676 DEBUG(5,("make_samr_r_unknwon_12\n"));
2678 memcpy(&(q_u->pol), pol, sizeof(*pol));
2680 q_u->num_rids1 = num_rids;
2683 q_u->num_rids2 = num_rids;
2685 for (i = 0; i < num_rids; i++)
2687 q_u->rid[i] = rid[i];
2691 /*******************************************************************
2692 reads or writes a structure.
2693 ********************************************************************/
2694 void samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth)
2699 if (q_u == NULL) return;
2701 prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
2706 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
2709 prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1));
2710 prs_uint32("flags ", ps, depth, &(q_u->flags ));
2711 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
2712 prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2));
2714 SMB_ASSERT_ARRAY(q_u->rid, q_u->num_rids2);
2716 for (i = 0; i < q_u->num_rids2; i++)
2719 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
2720 prs_uint32(tmp, ps, depth, &(q_u->rid[i]));
2727 /*******************************************************************
2728 makes a SAMR_R_LOOKUP_RIDS structure.
2729 ********************************************************************/
2730 void make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u,
2731 uint32 num_names, fstring *name, uint8 *type,
2735 if (r_u == NULL || name == NULL || type == NULL) return;
2737 DEBUG(5,("make_samr_r_lookup_rids\n"));
2741 r_u->num_names1 = num_names;
2743 r_u->num_names2 = num_names;
2745 r_u->num_types1 = num_names;
2747 r_u->num_types2 = num_names;
2749 SMB_ASSERT_ARRAY(r_u->hdr_name, num_names);
2751 for (i = 0; i < num_names; i++)
2753 int len = name[i] != NULL ? strlen(name[i]) : 0;
2754 make_uni_hdr(&(r_u->hdr_name[i]), len , len, name[i] ? 1 : 0);
2755 make_unistr2(&(r_u->uni_name[i]), name[i], len);
2756 r_u->type[i] = type[i];
2761 r_u->num_names1 = num_names;
2763 r_u->num_names2 = num_names;
2765 r_u->num_types1 = num_names;
2767 r_u->num_types2 = num_names;
2770 r_u->status = status;
2773 /*******************************************************************
2774 reads or writes a structure.
2775 ********************************************************************/
2776 void samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth)
2780 if (r_u == NULL) return;
2782 prs_debug(ps, depth, desc, "samr_io_r_lookup_rids");
2787 prs_uint32("num_names1", ps, depth, &(r_u->num_names1));
2788 prs_uint32("ptr_names ", ps, depth, &(r_u->ptr_names ));
2789 prs_uint32("num_names2", ps, depth, &(r_u->num_names2));
2791 if (r_u->ptr_names != 0 && r_u->num_names1 != 0)
2793 SMB_ASSERT_ARRAY(r_u->hdr_name, r_u->num_names2);
2795 for (i = 0; i < r_u->num_names2; i++)
2798 slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
2799 smb_io_unihdr ("", &(r_u->hdr_name[i]), ps, depth);
2801 for (i = 0; i < r_u->num_names2; i++)
2804 slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
2805 smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth);
2811 prs_uint32("num_types1", ps, depth, &(r_u->num_types1));
2812 prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types ));
2813 prs_uint32("num_types2", ps, depth, &(r_u->num_types2));
2815 if (r_u->ptr_types != 0 && r_u->num_types1 != 0)
2817 for (i = 0; i < r_u->num_types2; i++)
2820 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
2821 prs_uint32(tmp, ps, depth, &(r_u->type[i]));
2825 prs_uint32("status", ps, depth, &(r_u->status));
2828 /*******************************************************************
2829 makes a SAMR_Q_OPEN_ALIAS structure.
2830 ********************************************************************/
2831 void make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd)
2833 if (q_u == NULL) return;
2835 DEBUG(5,("make_samr_q_delete_alias\n"));
2837 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
2841 /*******************************************************************
2842 reads or writes a structure.
2843 ********************************************************************/
2844 void samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth)
2846 if (q_u == NULL) return;
2848 prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
2853 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
2856 /*******************************************************************
2857 reads or writes a structure.
2858 ********************************************************************/
2859 void samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth)
2861 if (r_u == NULL) return;
2863 prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
2868 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
2869 prs_uint32("status", ps, depth, &(r_u->status));
2873 /*******************************************************************
2874 makes a SAMR_Q_CREATE_DOM_ALIAS structure.
2875 ********************************************************************/
2876 void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd,
2877 const char *acct_desc)
2879 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
2880 if (q_u == NULL) return;
2882 DEBUG(5,("make_samr_q_create_dom_alias\n"));
2884 memcpy(&(q_u->dom_pol), hnd, sizeof(q_u->dom_pol));
2886 make_uni_hdr(&(q_u->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
2887 make_unistr2(&(q_u->uni_acct_desc), acct_desc, acct_len);
2889 q_u->unknown_1 = 0x001f;
2890 q_u->unknown_2 = 0x000f;
2894 /*******************************************************************
2895 reads or writes a structure.
2896 ********************************************************************/
2897 void samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_struct *ps, int depth)
2899 if (q_u == NULL) return;
2901 prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
2906 smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth);
2908 smb_io_unihdr ("hdr_acct_desc", &(q_u->hdr_acct_desc) , ps, depth);
2909 smb_io_unistr2("uni_acct_desc", &(q_u->uni_acct_desc), q_u->hdr_acct_desc.buffer, ps, depth);
2911 prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1));
2912 prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2));
2915 /*******************************************************************
2916 reads or writes a structure.
2917 ********************************************************************/
2918 void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_struct *ps, int depth)
2920 if (r_u == NULL) return;
2922 prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
2927 smb_io_pol_hnd("alias_pol", &(r_u->alias_pol), ps, depth);
2928 prs_uint32("rid", ps, depth, &(r_u->rid));
2930 prs_uint32("status", ps, depth, &(r_u->status));
2935 /*******************************************************************
2936 makes a SAMR_Q_ADD_ALIASMEM structure.
2937 ********************************************************************/
2938 void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd,
2941 if (q_u == NULL) return;
2943 DEBUG(5,("make_samr_q_add_aliasmem\n"));
2945 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
2946 sid_copy(&q_u->sid, sid);
2950 /*******************************************************************
2951 reads or writes a structure.
2952 ********************************************************************/
2953 void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth)
2955 if (q_u == NULL) return;
2957 prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
2962 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
2963 smb_io_dom_sid("sid ", &(q_u->sid ), ps, depth);
2966 /*******************************************************************
2967 reads or writes a structure.
2968 ********************************************************************/
2969 void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth)
2971 if (r_u == NULL) return;
2973 prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
2978 prs_uint32("status", ps, depth, &(r_u->status));
2982 /*******************************************************************
2983 makes a SAMR_Q_DEL_ALIASMEM structure.
2984 ********************************************************************/
2985 void make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd,
2988 if (q_u == NULL) return;
2990 DEBUG(5,("make_samr_q_del_aliasmem\n"));
2992 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
2993 make_dom_sid2(&q_u->sid, sid);
2997 /*******************************************************************
2998 reads or writes a structure.
2999 ********************************************************************/
3000 void samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *ps, int depth)
3002 if (q_u == NULL) return;
3004 prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
3009 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
3010 smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth);
3013 /*******************************************************************
3014 reads or writes a structure.
3015 ********************************************************************/
3016 void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *ps, int depth)
3018 if (r_u == NULL) return;
3020 prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
3025 prs_uint32("status", ps, depth, &(r_u->status));
3028 /*******************************************************************
3029 makes a SAMR_Q_DELETE_DOM_ALIAS structure.
3030 ********************************************************************/
3031 void make_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_c, POLICY_HND *hnd)
3033 if (q_c == NULL || hnd == NULL) return;
3035 DEBUG(5,("make_samr_q_delete_dom_alias\n"));
3037 memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol));
3040 /*******************************************************************
3041 reads or writes a structure.
3042 ********************************************************************/
3043 void samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth)
3045 if (q_u == NULL) return;
3047 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
3052 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
3055 /*******************************************************************
3056 makes a SAMR_R_DELETE_DOM_ALIAS structure.
3057 ********************************************************************/
3058 void make_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS *r_u,
3061 if (r_u == NULL) return;
3063 DEBUG(5,("make_samr_r_delete_dom_alias\n"));
3065 r_u->status = status;
3068 /*******************************************************************
3069 reads or writes a structure.
3070 ********************************************************************/
3071 void samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth)
3073 if (r_u == NULL) return;
3075 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
3080 prs_uint32("status", ps, depth, &(r_u->status));
3084 /*******************************************************************
3085 makes a SAMR_Q_QUERY_ALIASMEM structure.
3086 ********************************************************************/
3087 void make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd)
3089 if (q_c == NULL || hnd == NULL) return;
3091 DEBUG(5,("make_samr_q_query_aliasmem\n"));
3093 memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol));
3096 /*******************************************************************
3097 reads or writes a structure.
3098 ********************************************************************/
3099 void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth)
3101 if (q_u == NULL) return;
3103 prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem");
3108 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
3111 /*******************************************************************
3112 makes a SAMR_R_QUERY_ALIASMEM structure.
3113 ********************************************************************/
3114 void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u,
3115 uint32 num_sids, DOM_SID2 *sid, uint32 status)
3117 if (r_u == NULL) return;
3119 DEBUG(5,("make_samr_r_query_aliasmem\n"));
3123 r_u->num_sids = num_sids;
3124 r_u->ptr = (num_sids != 0) ? 1 : 0;
3125 r_u->num_sids1 = num_sids;
3135 r_u->status = status;
3138 /*******************************************************************
3139 reads or writes a structure.
3140 ********************************************************************/
3141 void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth)
3144 uint32 ptr_sid[MAX_LOOKUP_SIDS];
3146 if (r_u == NULL) return;
3148 prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem");
3153 prs_uint32("num_sids ", ps, depth, &(r_u->num_sids));
3154 prs_uint32("ptr", ps, depth, &(r_u->ptr));
3158 SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids);
3160 if (r_u->num_sids != 0)
3162 prs_uint32("num_sids1", ps, depth, &(r_u->num_sids1));
3164 for (i = 0; i < r_u->num_sids1; i++)
3168 prs_uint32("", ps, depth, &(ptr_sid[i]));
3170 for (i = 0; i < r_u->num_sids1; i++)
3173 if (ptr_sid[i] != 0)
3175 smb_io_dom_sid2("", &(r_u->sid[i]), ps, depth);
3180 prs_uint32("status", ps, depth, &(r_u->status));
3184 /*******************************************************************
3185 reads or writes a structure.
3186 ********************************************************************/
3187 void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth)
3191 if (q_u == NULL) return;
3193 prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
3198 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
3201 prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1));
3202 prs_uint32("rid ", ps, depth, &(q_u->rid ));
3203 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
3204 prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2));
3206 SMB_ASSERT_ARRAY(q_u->hdr_user_name, q_u->num_rids2);
3208 for (i = 0; i < q_u->num_rids2; i++)
3211 smb_io_unihdr ("", &(q_u->hdr_user_name[i]), ps, depth);
3213 for (i = 0; i < q_u->num_rids2; i++)
3216 smb_io_unistr2("", &(q_u->uni_user_name[i]), q_u->hdr_user_name[i].buffer, ps, depth);
3223 /*******************************************************************
3224 makes a SAMR_R_LOOKUP_NAMES structure.
3225 ********************************************************************/
3226 void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u,
3227 uint32 num_rids, uint32 *rid, uint8 *type, uint32 status)
3230 if (r_u == NULL) return;
3232 DEBUG(5,("make_samr_r_lookup_names\n"));
3236 r_u->num_entries = num_rids;
3237 r_u->undoc_buffer = 1;
3238 r_u->num_entries2 = num_rids;
3240 SMB_ASSERT_ARRAY(r_u->dom_rid, num_rids);
3242 for (i = 0; i < num_rids; i++)
3244 make_dom_rid3(&(r_u->dom_rid[i]), rid[i], type[i]);
3249 r_u->num_entries = 0;
3250 r_u->undoc_buffer = 0;
3251 r_u->num_entries2 = 0;
3254 r_u->status = status;
3257 /*******************************************************************
3258 reads or writes a structure.
3259 ********************************************************************/
3260 void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth)
3263 if (r_u == NULL) return;
3265 prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
3270 prs_uint32("num_entries ", ps, depth, &(r_u->num_entries ));
3271 prs_uint32("undoc_buffer", ps, depth, &(r_u->undoc_buffer));
3272 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
3274 if (r_u->num_entries != 0)
3276 SMB_ASSERT_ARRAY(r_u->dom_rid, r_u->num_entries2);
3278 for (i = 0; i < r_u->num_entries2; i++)
3281 smb_io_dom_rid3("", &(r_u->dom_rid[i]), ps, depth);
3286 prs_uint32("status", ps, depth, &(r_u->status));
3290 /*******************************************************************
3291 reads or writes a structure.
3292 ********************************************************************/
3293 void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u,
3295 uint32 unk_0, uint32 rid)
3297 if (q_u == NULL) return;
3299 DEBUG(5,("samr_make_samr_q_open_user\n"));
3301 memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol));
3303 q_u->unknown_0 = unk_0;
3304 q_u->user_rid = rid;
3307 /*******************************************************************
3308 reads or writes a structure.
3309 ********************************************************************/
3310 void samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth)
3312 if (q_u == NULL) return;
3314 prs_debug(ps, depth, desc, "samr_io_q_open_user");
3319 smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
3322 prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0));
3323 prs_uint32("user_rid ", ps, depth, &(q_u->user_rid ));
3328 /*******************************************************************
3329 reads or writes a structure.
3330 ********************************************************************/
3331 void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth)
3333 if (r_u == NULL) return;
3335 prs_debug(ps, depth, desc, "samr_io_r_open_user");
3340 smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth);
3343 prs_uint32("status", ps, depth, &(r_u->status));
3346 /*******************************************************************
3347 makes a SAMR_Q_QUERY_USERINFO structure.
3348 ********************************************************************/
3349 void make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u,
3350 POLICY_HND *hnd, uint16 switch_value)
3352 if (q_u == NULL || hnd == NULL) return;
3354 DEBUG(5,("make_samr_q_query_userinfo\n"));
3356 memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
3357 q_u->switch_value = switch_value;
3361 /*******************************************************************
3362 reads or writes a structure.
3363 ********************************************************************/
3364 void samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struct *ps, int depth)
3366 if (q_u == NULL) return;
3368 prs_debug(ps, depth, desc, "samr_io_q_query_userinfo");
3373 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
3376 prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); /* 0x0015 or 0x0011 */
3381 /*******************************************************************
3382 reads or writes a LOGON_HRS structure.
3383 ********************************************************************/
3384 static void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth)
3386 if (hrs == NULL) return;
3388 prs_debug(ps, depth, desc, "sam_io_logon_hrs");
3393 prs_uint32 ( "len ", ps, depth, &(hrs->len ));
3397 DEBUG(5,("sam_io_logon_hrs: truncating length\n"));
3401 prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len);
3404 /*******************************************************************
3405 makes a SAM_USER_INFO_10 structure.
3406 ********************************************************************/
3407 void make_sam_user_info10(SAM_USER_INFO_10 *usr,
3410 if (usr == NULL) return;
3412 DEBUG(5,("make_sam_user_info10\n"));
3414 usr->acb_info = acb_info;
3417 /*******************************************************************
3418 reads or writes a structure.
3419 ********************************************************************/
3420 void sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth)
3422 if (usr == NULL) return;
3424 prs_debug(ps, depth, desc, "samr_io_r_user_info10");
3429 prs_uint32("acb_info", ps, depth, &(usr->acb_info));
3432 /*******************************************************************
3433 makes a SAM_USER_INFO_11 structure.
3434 ********************************************************************/
3435 void make_sam_user_info11(SAM_USER_INFO_11 *usr,
3444 if (usr == NULL || expiry == NULL || mach_acct == NULL) return;
3446 DEBUG(5,("make_sam_user_info11\n"));
3448 len_mach_acct = strlen(mach_acct);
3450 memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */
3451 bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */
3453 make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct, len_mach_acct, 4); /* unicode header for machine account */
3454 usr->padding_2 = 0; /* 0 - padding 4 bytes */
3456 usr->ptr_1 = 1; /* pointer */
3457 bzero(usr->padding_3, sizeof(usr->padding_3)); /* 0 - padding 32 bytes */
3458 usr->padding_4 = 0; /* 0 - padding 4 bytes */
3460 usr->ptr_2 = 1; /* pointer */
3461 usr->padding_5 = 0; /* 0 - padding 4 bytes */
3463 usr->ptr_3 = 1; /* pointer */
3464 bzero(usr->padding_6, sizeof(usr->padding_6)); /* 0 - padding 32 bytes */
3466 usr->rid_user = rid_user;
3467 usr->rid_group = rid_group;
3469 usr->acct_ctrl = acct_ctrl;
3470 usr->unknown_3 = 0x0000;
3472 usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */
3473 usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */
3475 bzero(usr->padding_7, sizeof(usr->padding_7)); /* 0 - padding 16 bytes */
3476 usr->padding_8 = 0; /* 0 - padding 4 bytes */
3478 make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */
3480 bzero(usr->padding_9, sizeof(usr->padding_9)); /* 0 - padding 48 bytes */
3483 /*******************************************************************
3484 reads or writes a structure.
3485 ********************************************************************/
3486 void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth)
3488 if (usr == NULL) return;
3490 prs_debug(ps, depth, desc, "samr_io_r_unknown_24");
3495 prs_uint8s (False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0));
3497 smb_io_time("time", &(usr->expiry), ps, depth);
3499 prs_uint8s (False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1));
3501 smb_io_unihdr ("unihdr", &(usr->hdr_mach_acct), ps, depth);
3502 prs_uint32( "padding_2", ps, depth, &(usr->padding_2));
3504 prs_uint32( "ptr_1 ", ps, depth, &(usr->ptr_1 ));
3505 prs_uint8s (False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3));
3506 prs_uint32( "padding_4", ps, depth, &(usr->padding_4));
3508 prs_uint32( "ptr_2 ", ps, depth, &(usr->ptr_2 ));
3509 prs_uint32( "padding_5", ps, depth, &(usr->padding_5));
3511 prs_uint32( "ptr_3 ", ps, depth, &(usr->ptr_3 ));
3512 prs_uint8s (False, "padding_6", ps, depth, usr->padding_6, sizeof(usr->padding_6));
3514 prs_uint32( "rid_user ", ps, depth, &(usr->rid_user ));
3515 prs_uint32( "rid_group", ps, depth, &(usr->rid_group));
3516 prs_uint16( "acct_ctrl", ps, depth, &(usr->acct_ctrl));
3517 prs_uint16( "unknown_3", ps, depth, &(usr->unknown_3));
3518 prs_uint16( "unknown_4", ps, depth, &(usr->unknown_4));
3519 prs_uint16( "unknown_5", ps, depth, &(usr->unknown_5));
3521 prs_uint8s (False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7));
3522 prs_uint32( "padding_8", ps, depth, &(usr->padding_8));
3524 smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth);
3527 prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9));
3529 /*************************************************************************
3530 make_sam_user_info21
3532 unknown_3 = 0x00ff ffff
3533 unknown_5 = 0x0002 0000
3534 unknown_6 = 0x0000 04ec
3536 *************************************************************************/
3537 void make_sam_user_info21(SAM_USER_INFO_21 *usr,
3540 NTTIME *logoff_time,
3541 NTTIME *kickoff_time,
3542 NTTIME *pass_last_set_time,
3543 NTTIME *pass_can_change_time,
3544 NTTIME *pass_must_change_time,
3567 int len_user_name = user_name != NULL ? strlen(user_name ) : 0;
3568 int len_full_name = full_name != NULL ? strlen(full_name ) : 0;
3569 int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0;
3570 int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0;
3571 int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0;
3572 int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0;
3573 int len_description = description != NULL ? strlen(description ) : 0;
3574 int len_workstations = workstations != NULL ? strlen(workstations) : 0;
3575 int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0;
3576 int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0;
3578 usr->logon_time = *logon_time;
3579 usr->logoff_time = *logoff_time;
3580 usr->kickoff_time = *kickoff_time;
3581 usr->pass_last_set_time = *pass_last_set_time;
3582 usr->pass_can_change_time = *pass_can_change_time;
3583 usr->pass_must_change_time = *pass_must_change_time;
3585 make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 1);
3586 make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 1);
3587 make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 1);
3588 make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 1);
3589 make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 1);
3590 make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 1);
3591 make_uni_hdr(&(usr->hdr_acct_desc ), len_description , len_description , 1);
3592 make_uni_hdr(&(usr->hdr_workstations), len_workstations, len_workstations, 1);
3593 make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str , len_unknown_str , 1);
3594 make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial , len_munged_dial , 1);
3596 bzero(usr->nt_pwd, sizeof(usr->nt_pwd));
3597 bzero(usr->lm_pwd, sizeof(usr->lm_pwd));
3599 usr->user_rid = user_rid;
3600 usr->group_rid = group_rid;
3601 usr->acb_info = acb_info;
3602 usr->unknown_3 = unknown_3; /* 0x00ff ffff */
3604 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
3605 usr->ptr_logon_hrs = hrs ? 1 : 0;
3606 usr->unknown_5 = unknown_5; /* 0x0002 0000 */
3608 bzero(usr->padding1, sizeof(usr->padding1));
3610 make_unistr2(&(usr->uni_user_name ), user_name , len_user_name );
3611 make_unistr2(&(usr->uni_full_name ), full_name , len_full_name );
3612 make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir );
3613 make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive );
3614 make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script);
3615 make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path);
3616 make_unistr2(&(usr->uni_acct_desc ), description , len_description );
3617 make_unistr2(&(usr->uni_workstations), workstations, len_workstations);
3618 make_unistr2(&(usr->uni_unknown_str ), unknown_str , len_unknown_str );
3619 make_unistr2(&(usr->uni_munged_dial ), munged_dial , len_munged_dial );
3621 usr->unknown_6 = unknown_6; /* 0x0000 04ec */
3626 memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs));
3630 memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs));
3635 /*******************************************************************
3636 reads or writes a structure.
3637 ********************************************************************/
3638 static void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth)
3640 if (usr == NULL) return;
3642 prs_debug(ps, depth, desc, "lsa_io_user_info");
3647 smb_io_time("logon_time ", &(usr->logon_time) , ps, depth);
3648 smb_io_time("logoff_time ", &(usr->logoff_time) , ps, depth);
3649 smb_io_time("kickoff_time ", &(usr->kickoff_time) , ps, depth);
3650 smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time) , ps, depth);
3651 smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time) , ps, depth);
3652 smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), ps, depth);
3654 smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */
3655 smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */
3656 smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */
3657 smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */
3658 smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */
3659 smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */
3660 smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account description */
3661 smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* workstations user can log on from */
3662 smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */
3663 smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* workstations user can log on from */
3665 prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd ));
3666 prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd ));
3668 prs_uint32("user_rid ", ps, depth, &(usr->user_rid )); /* User ID */
3669 prs_uint32("group_rid ", ps, depth, &(usr->group_rid )); /* Group ID */
3670 prs_uint16("acb_info ", ps, depth, &(usr->acb_info )); /* Group ID */
3673 prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3 ));
3674 prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs )); /* logon divisions per week */
3676 prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs));
3677 prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5 ));
3679 prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1));
3681 /* here begins pointed-to data */
3683 smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */
3684 smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */
3685 smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */
3686 smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */
3687 smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */
3688 smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */
3689 smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user description unicode string */
3690 smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */
3691 smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */
3692 smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */
3694 prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 ));
3695 prs_uint32("padding4 ", ps, depth, &(usr->padding4 ));
3697 if (usr->ptr_logon_hrs)
3699 sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth);
3705 /*******************************************************************
3706 makes a SAMR_R_QUERY_USERINFO structure.
3707 ********************************************************************/
3708 void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u,
3709 uint16 switch_value, void *info, uint32 status)
3712 if (r_u == NULL || info == NULL) return;
3714 DEBUG(5,("make_samr_r_query_userinfo\n"));
3717 r_u->switch_value = 0;
3721 r_u->switch_value = switch_value;
3723 switch (switch_value)
3728 r_u->info.id10 = (SAM_USER_INFO_10*)info;
3736 r_u->info.id11 = (SAM_USER_INFO_11*)info;
3744 r_u->info.id21 = (SAM_USER_INFO_21*)info;
3751 DEBUG(4,("make_samr_r_query_userinfo: unsupported switch level\n"));
3757 r_u->status = status; /* return status */
3760 /*******************************************************************
3761 reads or writes a structure.
3762 ********************************************************************/
3763 void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth)
3765 if (r_u == NULL) return;
3767 prs_debug(ps, depth, desc, "samr_io_r_query_userinfo");
3772 prs_uint32("ptr ", ps, depth, &(r_u->ptr ));
3773 prs_uint16("switch_value", ps, depth, &(r_u->switch_value));
3776 if (r_u->ptr != 0 && r_u->switch_value != 0)
3778 switch (r_u->switch_value)
3782 if (r_u->info.id10 != NULL)
3784 sam_io_user_info10("", r_u->info.id10, ps, depth);
3788 DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
3796 if (r_u->info.id11 != NULL)
3798 sam_io_user_info11("", r_u->info.id11, ps, depth);
3802 DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
3810 if (r_u->info.id21 != NULL)
3812 sam_io_user_info21("", r_u->info.id21, ps, depth);
3816 DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
3823 DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n"));
3830 prs_uint32("status", ps, depth, &(r_u->status));
3833 /*******************************************************************
3834 reads or writes a structure.
3835 ********************************************************************/
3836 void samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth)
3838 if (q_u == NULL) return;
3840 prs_debug(ps, depth, desc, "samr_io_q_unknown_32");
3845 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
3848 smb_io_unihdr ("", &(q_u->hdr_mach_acct), ps, depth);
3849 smb_io_unistr2("", &(q_u->uni_mach_acct), q_u->hdr_mach_acct.buffer, ps, depth);
3853 prs_uint32("acct_ctrl", ps, depth, &(q_u->acct_ctrl));
3854 prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1));
3855 prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2));
3858 /*******************************************************************
3859 reads or writes a structure.
3860 ********************************************************************/
3861 void samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth)
3863 if (r_u == NULL) return;
3865 prs_debug(ps, depth, desc, "samr_io_r_unknown_32");
3870 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
3873 prs_uint32("status", ps, depth, &(r_u->status));
3877 /*******************************************************************
3878 makes a SAMR_Q_CONNECT structure.
3879 ********************************************************************/
3880 void make_samr_q_connect(SAMR_Q_CONNECT *q_u,
3881 char *srv_name, uint32 unknown_0)
3883 int len_srv_name = strlen(srv_name);
3885 if (q_u == NULL) return;
3887 DEBUG(5,("make_samr_q_connect\n"));
3889 /* make PDC server name \\server */
3890 q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0;
3891 make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name+1);
3893 /* example values: 0x0000 0002 */
3894 q_u->unknown_0 = unknown_0;
3898 /*******************************************************************
3899 reads or writes a structure.
3900 ********************************************************************/
3901 void samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth)
3903 if (q_u == NULL) return;
3905 prs_debug(ps, depth, desc, "samr_io_q_connect");
3910 prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name));
3911 smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth);
3915 prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 ));
3918 /*******************************************************************
3919 reads or writes a structure.
3920 ********************************************************************/
3921 void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth)
3923 if (r_u == NULL) return;
3925 prs_debug(ps, depth, desc, "samr_io_r_connect");
3930 smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth);
3933 prs_uint32("status", ps, depth, &(r_u->status));
3936 /*******************************************************************
3937 makes a SAMR_Q_CONNECT_ANON structure.
3938 ********************************************************************/
3939 void make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u)
3941 if (q_u == NULL) return;
3943 DEBUG(5,("make_samr_q_connect_anon\n"));
3946 q_u->unknown_0 = 0x5c; /* server name (?!!) */
3947 q_u->unknown_1 = 0x01;
3948 q_u->unknown_2 = 0x20;
3952 /*******************************************************************
3953 reads or writes a structure.
3954 ********************************************************************/
3955 void samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth)
3957 if (q_u == NULL) return;
3959 prs_debug(ps, depth, desc, "samr_io_q_connect_anon");
3964 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
3965 prs_uint16("unknown_0", ps, depth, &(q_u->unknown_0));
3966 prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1));
3967 prs_uint32("unknown_2", ps, depth, &(q_u->unknown_2));
3970 /*******************************************************************
3971 reads or writes a structure.
3972 ********************************************************************/
3973 void samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth)
3975 if (r_u == NULL) return;
3977 prs_debug(ps, depth, desc, "samr_io_r_connect_anon");
3982 smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth);
3985 prs_uint32("status", ps, depth, &(r_u->status));
3988 /*******************************************************************
3989 makes a SAMR_Q_UNKNOWN_38 structure.
3990 ********************************************************************/
3991 void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name)
3993 int len_srv_name = strlen(srv_name);
3995 if (q_u == NULL) return;
3997 DEBUG(5,("make_samr_q_unknown_38\n"));
4000 make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0);
4001 make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name);
4005 /*******************************************************************
4006 reads or writes a structure.
4007 ********************************************************************/
4008 void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth)
4010 if (q_u == NULL) return;
4012 prs_debug(ps, depth, desc, "samr_io_q_unknown_38");
4017 prs_uint32("ptr", ps, depth, &(q_u->ptr));
4020 smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth);
4021 smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth);
4025 /*******************************************************************
4026 makes a SAMR_R_UNKNOWN_38 structure.
4027 ********************************************************************/
4028 void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u)
4030 if (r_u == NULL) return;
4032 DEBUG(5,("make_r_unknown_38\n"));
4040 /*******************************************************************
4041 reads or writes a structure.
4042 ********************************************************************/
4043 void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth)
4045 if (r_u == NULL) return;
4047 prs_debug(ps, depth, desc, "samr_io_r_unknown_38");
4052 prs_uint16("unk_0", ps, depth, &(r_u->unk_0));
4054 prs_uint16("unk_1", ps, depth, &(r_u->unk_1));
4056 prs_uint16("unk_2", ps, depth, &(r_u->unk_2));
4058 prs_uint16("unk_3", ps, depth, &(r_u->unk_3));
4062 /*******************************************************************
4063 make a SAMR_ENC_PASSWD structure.
4064 ********************************************************************/
4065 void make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512])
4067 if (pwd == NULL) return;
4070 memcpy(pwd->pass, pass, sizeof(pwd->pass));
4073 /*******************************************************************
4074 reads or writes a SAMR_ENC_PASSWD structure.
4075 ********************************************************************/
4076 void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth)
4078 if (pwd == NULL) return;
4080 prs_debug(ps, depth, desc, "samr_io_enc_passwd");
4085 prs_uint32("ptr", ps, depth, &(pwd->ptr));
4086 prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass));
4089 /*******************************************************************
4090 makes a SAMR_ENC_HASH structure.
4091 ********************************************************************/
4092 void make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16])
4094 if (hsh == NULL) return;
4097 memcpy(hsh->hash, hash, sizeof(hsh->hash));
4100 /*******************************************************************
4101 reads or writes a SAMR_ENC_HASH structure.
4102 ********************************************************************/
4103 void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth)
4105 if (hsh == NULL) return;
4107 prs_debug(ps, depth, desc, "samr_io_enc_hash");
4112 prs_uint32("ptr ", ps, depth, &(hsh->ptr));
4113 prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash));
4116 /*******************************************************************
4117 makes a SAMR_R_UNKNOWN_38 structure.
4118 ********************************************************************/
4119 void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u,
4120 char *dest_host, char *user_name,
4121 char nt_newpass[516], uchar nt_oldhash[16],
4122 char lm_newpass[516], uchar lm_oldhash[16])
4124 int len_dest_host = strlen(dest_host);
4125 int len_user_name = strlen(user_name);
4127 if (q_u == NULL) return;
4129 DEBUG(5,("make_samr_q_chgpasswd_user\n"));
4132 make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host, len_dest_host, len_dest_host != 0);
4133 make_unistr2(&(q_u->uni_dest_host), dest_host, len_dest_host);
4134 make_uni_hdr(&(q_u->hdr_user_name), len_user_name, len_user_name, len_user_name != 0);
4135 make_unistr2(&(q_u->uni_user_name), user_name, len_user_name);
4137 make_enc_passwd(&(q_u->nt_newpass), nt_newpass);
4138 make_enc_hash (&(q_u->nt_oldhash), nt_oldhash);
4140 q_u->unknown = 0x01;
4142 make_enc_passwd(&(q_u->lm_newpass), lm_newpass);
4143 make_enc_hash (&(q_u->lm_oldhash), lm_oldhash);
4146 /*******************************************************************
4147 reads or writes a structure.
4148 ********************************************************************/
4149 void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth)
4151 if (q_u == NULL) return;
4153 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user");
4158 prs_uint32("ptr_0", ps, depth, &(q_u->ptr_0));
4160 smb_io_unihdr ("", &(q_u->hdr_dest_host), ps, depth);
4161 smb_io_unistr2("", &(q_u->uni_dest_host), q_u->hdr_dest_host.buffer, ps, depth);
4162 smb_io_unihdr ("", &(q_u->hdr_user_name), ps, depth);
4163 smb_io_unistr2("", &(q_u->uni_user_name), q_u->hdr_user_name.buffer, ps, depth);
4165 samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth);
4167 samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth);
4169 prs_uint32("unknown", ps, depth, &(q_u->unknown));
4171 samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth);
4173 samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth);
4176 /*******************************************************************
4177 makes a SAMR_R_CHGPASSWD_USER structure.
4178 ********************************************************************/
4179 void make_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status)
4181 if (r_u == NULL) return;
4183 DEBUG(5,("make_r_chgpasswd_user\n"));
4185 r_u->status = status;
4188 /*******************************************************************
4189 reads or writes a structure.
4190 ********************************************************************/
4191 void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth)
4193 if (r_u == NULL) return;
4195 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user");
4200 prs_uint32("status", ps, depth, &(r_u->status));