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_info6(SAM_UNK_INFO_6 *u_6)
266 if (u_6 == NULL) return;
268 u_6->unknown_0 = 0x00000000;
270 memset(u_6->padding, 0, sizeof(u_6->padding)); /* 12 bytes zeros */
273 /*******************************************************************
274 reads or writes a structure.
275 ********************************************************************/
276 void sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 *u_6, prs_struct *ps, int depth)
278 if (u_6 == NULL) return;
280 prs_debug(ps, depth, desc, "sam_io_unk_info6");
283 prs_uint32("unknown_0", ps, depth, &u_6->unknown_0); /* 0x0000 0000 */
284 prs_uint32("ptr_0", ps, depth, &u_6->ptr_0); /* pointer to unknown structure */
285 prs_uint8s(False, "padding", ps, depth, u_6->padding, sizeof(u_6->padding)); /* 12 bytes zeros */
291 /*******************************************************************
293 ********************************************************************/
294 void make_unk_info7(SAM_UNK_INFO_7 *u_7)
296 if (u_7 == NULL) return;
298 u_7->unknown_0 = 0x0003;
301 /*******************************************************************
302 reads or writes a structure.
303 ********************************************************************/
304 void sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 *u_7, prs_struct *ps, int depth)
306 if (u_7 == NULL) return;
308 prs_debug(ps, depth, desc, "sam_io_unk_info7");
311 prs_uint16("unknown_0", ps, depth, &u_7->unknown_0); /* 0x0003 */
316 /*******************************************************************
318 ********************************************************************/
319 void make_unk_info2(SAM_UNK_INFO_2 *u_2, char *domain, char *server)
321 int len_domain = strlen(domain);
322 int len_server = strlen(server);
324 if (u_2 == NULL) return;
326 u_2->unknown_0 = 0x00000000;
327 u_2->unknown_1 = 0x80000000;
328 u_2->unknown_2 = 0x00000000;
331 make_uni_hdr(&(u_2->hdr_domain), len_domain, len_domain, 1);
332 make_uni_hdr(&(u_2->hdr_server), len_server, len_server, 1);
334 u_2->seq_num = 0x10000000;
335 u_2->unknown_3 = 0x00000000;
337 u_2->unknown_4 = 0x00000001;
338 u_2->unknown_5 = 0x00000003;
339 u_2->unknown_6 = 0x00000001;
340 u_2->num_domain_usrs = 0x00000008;
341 u_2->num_domain_grps = 0x00000003;
342 u_2->num_local_grps = 0x00000003;
344 memset(u_2->padding, 0, sizeof(u_2->padding)); /* 12 bytes zeros */
346 make_unistr2(&u_2->uni_domain, domain, len_domain);
347 make_unistr2(&u_2->uni_server, server, len_server);
350 /*******************************************************************
351 reads or writes a structure.
352 ********************************************************************/
353 void sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 *u_2, prs_struct *ps, int depth)
355 if (u_2 == NULL) return;
357 prs_debug(ps, depth, desc, "sam_io_unk_info2");
360 prs_uint32("unknown_0", ps, depth, &u_2->unknown_0); /* 0x0000 0000 */
361 prs_uint32("unknown_1", ps, depth, &u_2->unknown_1); /* 0x8000 0000 */
362 prs_uint32("unknown_2", ps, depth, &u_2->unknown_2); /* 0x0000 0000 */
364 prs_uint32("ptr_0", ps, depth, &u_2->ptr_0); /* pointer to unknown structure */
365 smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth); /* domain name unicode header */
366 smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth); /* server name unicode header */
368 /* put all the data in here, at the moment, including what the above
369 pointer is referring to
372 prs_uint32("seq_num ", ps, depth, &u_2->seq_num ); /* 0x0000 0099 or 0x1000 0000 */
373 prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3 ); /* 0x0000 0000 */
375 prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4 ); /* 0x0000 0001 */
376 prs_uint32("unknown_5 ", ps, depth, &u_2->unknown_5 ); /* 0x0000 0003 */
377 prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6 ); /* 0x0000 0001 */
378 prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs ); /* 0x0000 0008 */
379 prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps); /* 0x0000 0003 */
380 prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps); /* 0x0000 0003 */
382 prs_uint8s(False, "padding", ps, depth, u_2->padding, sizeof(u_2->padding)); /* 12 bytes zeros */
384 smb_io_unistr2( "uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth); /* domain name unicode string */
385 smb_io_unistr2( "uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth); /* server name unicode string */
391 /*******************************************************************
392 makes a SAMR_R_QUERY_DOMAIN_INFO structure.
393 ********************************************************************/
394 void make_samr_r_query_dom_info(SAMR_R_QUERY_DOMAIN_INFO *r_u,
395 uint16 switch_value, SAM_UNK_CTR *ctr,
398 if (r_u == NULL || ctr == NULL) return;
400 DEBUG(5,("make_samr_r_query_dom_info\n"));
403 r_u->switch_value = 0;
404 r_u->status = status; /* return status */
408 r_u->switch_value = switch_value;
414 /*******************************************************************
415 reads or writes a structure.
416 ********************************************************************/
417 void samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO *r_u, prs_struct *ps, int depth)
419 if (r_u == NULL) return;
421 prs_debug(ps, depth, desc, "samr_io_r_query_dom_info");
426 prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0));
427 prs_uint16("switch_value", ps, depth, &(r_u->switch_value));
430 if (r_u->ptr_0 != 0 && r_u->ctr != NULL)
432 switch (r_u->switch_value)
436 sam_io_unk_info6("unk_inf6", &r_u->ctr->info.inf6, ps, depth);
441 sam_io_unk_info7("unk_inf7", &r_u->ctr->info.inf7, ps, depth);
446 sam_io_unk_info2("unk_inf2", &r_u->ctr->info.inf2, ps, depth);
451 DEBUG(3,("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
460 /*******************************************************************
461 makes a DOM_SID3 structure.
463 calculate length by adding up the size of the components.
464 ********************************************************************/
465 void make_dom_sid3(DOM_SID3 *sid3, uint16 unk_0, uint16 unk_1, DOM_SID *sid)
467 if (sid3 == NULL) return;
470 sid3->len = 2 + 8 + sid3->sid.num_auths * 4;
473 /*******************************************************************
474 reads or writes a SAM_SID3 structure.
476 this one's odd, because the length (in bytes) is specified at the beginning.
477 the length _includes_ the length of the length, too :-)
479 ********************************************************************/
480 static void sam_io_dom_sid3(char *desc, DOM_SID3 *sid3, prs_struct *ps, int depth)
482 if (sid3 == NULL) return;
484 prs_debug(ps, depth, desc, "sam_io_dom_sid3");
487 prs_uint16("len", ps, depth, &(sid3->len));
489 smb_io_dom_sid("", &(sid3->sid), ps, depth);
492 /*******************************************************************
493 makes a SAMR_R_UNKNOWN3 structure.
498 unknown_4,5 : 0x0000 0014
501 unknown_7 : 0x5800 or 0x0070
503 ********************************************************************/
504 static void make_sam_sid_stuff(SAM_SID_STUFF *stf,
505 uint16 unknown_2, uint16 unknown_3,
506 uint32 unknown_4, uint16 unknown_6, uint16 unknown_7,
507 int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS])
509 stf->unknown_2 = unknown_2;
510 stf->unknown_3 = unknown_3;
512 bzero(stf->padding1, sizeof(stf->padding1));
514 stf->unknown_4 = unknown_4;
515 stf->unknown_5 = unknown_4;
517 stf->unknown_6 = unknown_6;
518 stf->unknown_7 = unknown_7;
520 stf->num_sids = num_sid3s;
522 stf->padding2 = 0x0000;
524 memcpy(stf->sid, sid3, sizeof(DOM_SID3) * num_sid3s);
527 /*******************************************************************
528 reads or writes a SAM_SID_STUFF structure.
529 ********************************************************************/
530 static void sam_io_sid_stuff(char *desc, SAM_SID_STUFF *stf, prs_struct *ps, int depth)
534 if (stf == NULL) return;
536 DEBUG(5,("make_sam_sid_stuff\n"));
538 prs_uint16("unknown_2", ps, depth, &(stf->unknown_2));
539 prs_uint16("unknown_3", ps, depth, &(stf->unknown_3));
541 prs_uint8s(False, "padding1", ps, depth, stf->padding1, sizeof(stf->padding1));
543 prs_uint32("unknown_4", ps, depth, &(stf->unknown_4));
544 prs_uint32("unknown_5", ps, depth, &(stf->unknown_5));
545 prs_uint16("unknown_6", ps, depth, &(stf->unknown_6));
546 prs_uint16("unknown_7", ps, depth, &(stf->unknown_7));
548 prs_uint32("num_sids ", ps, depth, &(stf->num_sids ));
549 prs_uint16("padding2 ", ps, depth, &(stf->padding2 ));
551 SMB_ASSERT_ARRAY(stf->sid, stf->num_sids);
553 for (i = 0; i < stf->num_sids; i++)
555 sam_io_dom_sid3("", &(stf->sid[i]), ps, depth);
559 /*******************************************************************
560 reads or writes a SAMR_R_UNKNOWN3 structure.
561 ********************************************************************/
562 void make_samr_r_unknown_3(SAMR_R_UNKNOWN_3 *r_u,
563 uint16 unknown_2, uint16 unknown_3,
564 uint32 unknown_4, uint16 unknown_6, uint16 unknown_7,
565 int num_sid3s, DOM_SID3 sid3[MAX_SAM_SIDS],
568 if (r_u == NULL) return;
570 DEBUG(5,("samr_make_r_unknown_3\n"));
579 make_sam_sid_stuff(&(r_u->sid_stuff), unknown_2, unknown_3,
580 unknown_4, unknown_6, unknown_7,
584 r_u->status = status;
588 /*******************************************************************
589 reads or writes a SAMR_R_UNKNOWN_3 structure.
591 this one's odd, because the daft buggers use a different mechanism
592 for writing out the array of sids. they put the number of sids in
593 only one place: they've calculated the length of each sid and jumped
594 by that amount. then, retrospectively, the length of the whole buffer
595 is put at the beginning of the data stream.
599 ********************************************************************/
600 void samr_io_r_unknown_3(char *desc, SAMR_R_UNKNOWN_3 *r_u, prs_struct *ps, int depth)
604 int ptr_sid_stuff = 0;
606 if (r_u == NULL) return;
608 prs_debug(ps, depth, desc, "samr_io_r_unknown_3");
613 prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 ));
617 /* reading. do the length later */
618 prs_uint32("sid_stuff_len0", ps, depth, &(r_u->sid_stuff_len0));
623 ptr_len0 = ps->offset; ps->offset += 4;
628 prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 ));
631 /* reading. do the length later */
632 prs_uint32("sid_stuff_len1", ps, depth, &(r_u->sid_stuff_len1));
637 ptr_len1 = ps->offset; ps->offset += 4;
642 ptr_sid_stuff = ps->offset;
643 sam_io_sid_stuff("", &(r_u->sid_stuff), ps, depth);
647 if (!(ps->io)) /* storing not reading. do the length, now. */
649 if (ptr_sid_stuff != 0)
651 uint32 sid_stuff_len = ps->offset - ptr_sid_stuff;
652 int old_len = ps->offset;
654 ps->offset = ptr_len0;
655 prs_uint32("sid_stuff_len0", ps, depth, &sid_stuff_len);
657 ps->offset = ptr_len1;
658 prs_uint32("sid_stuff_len1", ps, depth, &sid_stuff_len);
660 ps->offset = old_len;
664 prs_uint32("status", ps, depth, &(r_u->status));
667 /*******************************************************************
668 reads or writes a SAM_STR1 structure.
669 ********************************************************************/
670 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)
672 if (sam == NULL) return;
674 prs_debug(ps, depth, desc, "sam_io_sam_str1");
679 smb_io_unistr2("unistr2", &(sam->uni_acct_name), acct_buf, ps, depth); /* account name unicode string */
680 smb_io_unistr2("unistr2", &(sam->uni_full_name), name_buf, ps, depth); /* full name unicode string */
681 smb_io_unistr2("unistr2", &(sam->uni_acct_desc), desc_buf, ps, depth); /* account description unicode string */
684 /*******************************************************************
685 makes a SAM_ENTRY1 structure.
686 ********************************************************************/
687 static void make_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
688 uint32 len_sam_name, uint32 len_sam_full, uint32 len_sam_desc,
689 uint32 rid_user, uint16 acb_info)
691 if (sam == NULL) return;
693 DEBUG(5,("make_sam_entry1\n"));
695 sam->user_idx = user_idx;
696 sam->rid_user = rid_user;
697 sam->acb_info = acb_info;
700 make_uni_hdr(&(sam->hdr_acct_name), len_sam_name, len_sam_name, len_sam_name != 0);
701 make_uni_hdr(&(sam->hdr_user_name), len_sam_full, len_sam_full, len_sam_full != 0);
702 make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0);
705 /*******************************************************************
706 reads or writes a SAM_ENTRY1 structure.
707 ********************************************************************/
708 static void sam_io_sam_entry1(char *desc, SAM_ENTRY1 *sam, prs_struct *ps, int depth)
710 if (sam == NULL) return;
712 prs_debug(ps, depth, desc, "sam_io_sam_entry1");
717 prs_uint32("user_idx ", ps, depth, &(sam->user_idx ));
719 prs_uint32("rid_user ", ps, depth, &(sam->rid_user ));
720 prs_uint16("acb_info ", ps, depth, &(sam->acb_info ));
721 prs_uint16("pad ", ps, depth, &(sam->pad ));
723 smb_io_unihdr("unihdr", &(sam->hdr_acct_name), ps, depth); /* account name unicode string header */
724 smb_io_unihdr("unihdr", &(sam->hdr_user_name), ps, depth); /* account name unicode string header */
725 smb_io_unihdr("unihdr", &(sam->hdr_user_desc), ps, depth); /* account name unicode string header */
728 /*******************************************************************
729 reads or writes a SAM_STR2 structure.
730 ********************************************************************/
731 static void sam_io_sam_str2(char *desc, SAM_STR2 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth)
733 if (sam == NULL) return;
735 prs_debug(ps, depth, desc, "sam_io_sam_str2");
740 smb_io_unistr2("unistr2", &(sam->uni_srv_name), acct_buf, ps, depth); /* account name unicode string */
741 smb_io_unistr2("unistr2", &(sam->uni_srv_desc), desc_buf, ps, depth); /* account description unicode string */
744 /*******************************************************************
745 makes a SAM_ENTRY2 structure.
746 ********************************************************************/
747 static void make_sam_entry2(SAM_ENTRY2 *sam, uint32 user_idx,
748 uint32 len_sam_name, uint32 len_sam_desc,
749 uint32 rid_user, uint16 acb_info)
751 if (sam == NULL) return;
753 DEBUG(5,("make_sam_entry2\n"));
755 sam->user_idx = user_idx;
756 sam->rid_user = rid_user;
757 sam->acb_info = acb_info;
760 make_uni_hdr(&(sam->hdr_srv_name), len_sam_name, len_sam_name, len_sam_name != 0);
761 make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0);
764 /*******************************************************************
765 reads or writes a SAM_ENTRY2 structure.
766 ********************************************************************/
767 static void sam_io_sam_entry2(char *desc, SAM_ENTRY2 *sam, prs_struct *ps, int depth)
769 if (sam == NULL) return;
771 prs_debug(ps, depth, desc, "sam_io_sam_entry2");
776 prs_uint32("user_idx ", ps, depth, &(sam->user_idx ));
778 prs_uint32("rid_user ", ps, depth, &(sam->rid_user ));
779 prs_uint16("acb_info ", ps, depth, &(sam->acb_info ));
780 prs_uint16("pad ", ps, depth, &(sam->pad ));
782 smb_io_unihdr("unihdr", &(sam->hdr_srv_name), ps, depth); /* account name unicode string header */
783 smb_io_unihdr("unihdr", &(sam->hdr_srv_desc), ps, depth); /* account name unicode string header */
786 /*******************************************************************
787 reads or writes a SAM_STR3 structure.
788 ********************************************************************/
789 static void sam_io_sam_str3(char *desc, SAM_STR3 *sam, uint32 acct_buf, uint32 desc_buf, prs_struct *ps, int depth)
791 if (sam == NULL) return;
793 prs_debug(ps, depth, desc, "sam_io_sam_str3");
798 smb_io_unistr2("unistr2", &(sam->uni_grp_name), acct_buf, ps, depth); /* account name unicode string */
799 smb_io_unistr2("unistr2", &(sam->uni_grp_desc), desc_buf, ps, depth); /* account description unicode string */
802 /*******************************************************************
803 makes a SAM_ENTRY3 structure.
804 ********************************************************************/
805 static void make_sam_entry3(SAM_ENTRY3 *sam, uint32 grp_idx,
806 uint32 len_grp_name, uint32 len_grp_desc, uint32 rid_grp)
808 if (sam == NULL) return;
810 DEBUG(5,("make_sam_entry3\n"));
812 sam->grp_idx = grp_idx;
813 sam->rid_grp = rid_grp;
814 sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */
816 make_uni_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, len_grp_name != 0);
817 make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc, len_grp_desc, len_grp_desc != 0);
820 /*******************************************************************
821 reads or writes a SAM_ENTRY3 structure.
822 ********************************************************************/
823 static void sam_io_sam_entry3(char *desc, SAM_ENTRY3 *sam, prs_struct *ps, int depth)
825 if (sam == NULL) return;
827 prs_debug(ps, depth, desc, "sam_io_sam_entry3");
832 prs_uint32("grp_idx", ps, depth, &(sam->grp_idx));
834 prs_uint32("rid_grp", ps, depth, &(sam->rid_grp));
835 prs_uint32("attr ", ps, depth, &(sam->attr ));
837 smb_io_unihdr("unihdr", &(sam->hdr_grp_name), ps, depth); /* account name unicode string header */
838 smb_io_unihdr("unihdr", &(sam->hdr_grp_desc), ps, depth); /* account name unicode string header */
841 /*******************************************************************
842 makes a SAM_ENTRY structure.
843 ********************************************************************/
844 static void make_sam_entry(SAM_ENTRY *sam, uint32 len_sam_name, uint32 rid)
846 if (sam == NULL) return;
848 DEBUG(5,("make_sam_entry\n"));
851 make_uni_hdr(&(sam->hdr_name), len_sam_name, len_sam_name, len_sam_name != 0);
854 /*******************************************************************
855 reads or writes a SAM_ENTRY structure.
856 ********************************************************************/
857 static void sam_io_sam_entry(char *desc, SAM_ENTRY *sam, prs_struct *ps, int depth)
859 if (sam == NULL) return;
861 prs_debug(ps, depth, desc, "sam_io_sam_entry");
865 prs_uint32("rid", ps, depth, &(sam->rid ));
866 smb_io_unihdr("unihdr", &(sam->hdr_name), ps, depth); /* account name unicode string header */
870 /*******************************************************************
871 makes a SAMR_Q_ENUM_DOM_USERS structure.
872 ********************************************************************/
873 void make_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_e, POLICY_HND *pol,
875 uint16 acb_mask, uint16 unk_1, uint32 size)
877 if (q_e == NULL || pol == NULL) return;
879 DEBUG(5,("make_samr_q_enum_dom_users\n"));
881 memcpy(&(q_e->pol), pol, sizeof(*pol));
883 q_e->start_idx = start_idx; /* zero indicates lots */
884 q_e->acb_mask = acb_mask;
885 q_e->unknown_1 = unk_1;
886 q_e->max_size = size;
889 /*******************************************************************
890 reads or writes a structure.
891 ********************************************************************/
892 void samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS *q_e, prs_struct *ps, int depth)
894 if (q_e == NULL) return;
896 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
901 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
904 prs_uint32("start_idx", ps, depth, &(q_e->start_idx));
905 prs_uint16("acb_mask ", ps, depth, &(q_e->acb_mask ));
906 prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1));
908 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
914 /*******************************************************************
915 makes a SAMR_R_ENUM_DOM_USERS structure.
916 ********************************************************************/
917 void make_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS *r_u,
919 uint32 num_sam_entries, SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES], uint32 status)
923 if (r_u == NULL) return;
925 DEBUG(5,("make_samr_r_enum_dom_users\n"));
927 if (num_sam_entries >= MAX_SAM_ENTRIES)
929 num_sam_entries = MAX_SAM_ENTRIES;
930 DEBUG(5,("limiting number of entries to %d\n",
934 r_u->next_idx = next_idx;
936 if (num_sam_entries != 0)
938 r_u->ptr_entries1 = 1;
939 r_u->ptr_entries2 = 1;
940 r_u->num_entries2 = num_sam_entries;
941 r_u->num_entries3 = num_sam_entries;
943 SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries);
944 SMB_ASSERT_ARRAY(r_u->uni_acct_name, num_sam_entries);
946 for (i = 0; i < num_sam_entries; i++)
948 make_sam_entry(&(r_u->sam[i]),
949 pass[i].uni_user_name.uni_str_len,
952 copy_unistr2(&(r_u->uni_acct_name[i]), &(pass[i].uni_user_name));
955 r_u->num_entries4 = num_sam_entries;
959 r_u->ptr_entries1 = 0;
960 r_u->num_entries2 = num_sam_entries;
961 r_u->ptr_entries2 = 1;
964 r_u->status = status;
967 /*******************************************************************
968 reads or writes a structure.
969 ********************************************************************/
970 void samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS *r_u, prs_struct *ps, int depth)
974 if (r_u == NULL) return;
976 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
981 prs_uint32("next_idx ", ps, depth, &(r_u->next_idx ));
982 prs_uint32("ptr_entries1", ps, depth, &(r_u->ptr_entries1));
984 if (r_u->ptr_entries1 != 0)
986 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
987 prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
988 prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
990 SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries2);
992 for (i = 0; i < r_u->num_entries2; i++)
995 sam_io_sam_entry("", &(r_u->sam[i]), ps, depth);
998 SMB_ASSERT_ARRAY(r_u->uni_acct_name, r_u->num_entries2);
1000 for (i = 0; i < r_u->num_entries2; i++)
1003 smb_io_unistr2("", &(r_u->uni_acct_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
1008 prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4));
1011 prs_uint32("status", ps, depth, &(r_u->status));
1014 /*******************************************************************
1015 makes a SAMR_Q_QUERY_DISPINFO structure.
1016 ********************************************************************/
1017 void make_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_e, POLICY_HND *pol,
1018 uint16 switch_level, uint32 start_idx, uint32 size)
1020 if (q_e == NULL || pol == NULL) return;
1022 DEBUG(5,("make_samr_q_query_dispinfo\n"));
1024 memcpy(&(q_e->pol), pol, sizeof(*pol));
1026 q_e->switch_level = switch_level;
1029 q_e->start_idx = start_idx;
1030 q_e->unknown_1 = 0x000007d0;
1031 q_e->max_size = size;
1034 /*******************************************************************
1035 reads or writes a structure.
1036 ********************************************************************/
1037 void samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO *q_e, prs_struct *ps, int depth)
1039 if (q_e == NULL) return;
1041 prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo");
1046 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1049 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
1050 prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 ));
1051 prs_uint32("start_idx ", ps, depth, &(q_e->start_idx ));
1052 prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 ));
1053 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
1059 /*******************************************************************
1060 makes a SAM_INFO_2 structure.
1061 ********************************************************************/
1062 void make_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask,
1063 uint32 start_idx, uint32 num_sam_entries,
1064 SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES])
1069 if (sam == NULL) return;
1071 DEBUG(5,("make_sam_info_2\n"));
1073 if (num_sam_entries >= MAX_SAM_ENTRIES)
1075 num_sam_entries = MAX_SAM_ENTRIES;
1076 DEBUG(5,("limiting number of entries to %d\n",
1080 for (i = start_idx, entries_added = 0; i < num_sam_entries; i++)
1082 if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask))
1084 make_sam_entry2(&(sam->sam[entries_added]),
1085 start_idx + entries_added + 1,
1086 pass[i].uni_user_name.uni_str_len,
1087 pass[i].uni_acct_desc.uni_str_len,
1091 copy_unistr2(&(sam->str[entries_added].uni_srv_name), &(pass[i].uni_user_name));
1092 copy_unistr2(&(sam->str[entries_added].uni_srv_desc), &(pass[i].uni_acct_desc));
1097 sam->num_entries = entries_added;
1098 sam->ptr_entries = 1;
1099 sam->num_entries2 = entries_added;
1103 /*******************************************************************
1104 reads or writes a structure.
1105 ********************************************************************/
1106 static void sam_io_sam_info_2(char *desc, SAM_INFO_2 *sam, prs_struct *ps, int depth)
1110 if (sam == NULL) return;
1112 prs_debug(ps, depth, desc, "sam_io_sam_info_2");
1117 prs_uint32("num_entries ", ps, depth, &(sam->num_entries ));
1118 prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries ));
1120 prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 ));
1122 SMB_ASSERT_ARRAY(sam->sam, sam->num_entries);
1124 for (i = 0; i < sam->num_entries; i++)
1127 sam_io_sam_entry2("", &(sam->sam[i]), ps, depth);
1130 for (i = 0; i < sam->num_entries; i++)
1133 sam_io_sam_str2 ("", &(sam->str[i]),
1134 sam->sam[i].hdr_srv_name.buffer,
1135 sam->sam[i].hdr_srv_desc.buffer,
1141 /*******************************************************************
1142 makes a SAM_INFO_1 structure.
1143 ********************************************************************/
1144 void make_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask,
1145 uint32 start_idx, uint32 num_sam_entries,
1146 SAM_USER_INFO_21 pass[MAX_SAM_ENTRIES])
1151 if (sam == NULL) return;
1153 DEBUG(5,("make_sam_info_1\n"));
1155 if (num_sam_entries >= MAX_SAM_ENTRIES)
1157 num_sam_entries = MAX_SAM_ENTRIES;
1158 DEBUG(5,("limiting number of entries to %d\n",
1162 for (i = start_idx, entries_added = 0; i < num_sam_entries; i++)
1164 if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask))
1166 make_sam_entry1(&(sam->sam[entries_added]),
1167 start_idx + entries_added + 1,
1168 pass[i].uni_user_name.uni_str_len,
1169 pass[i].uni_full_name.uni_str_len,
1170 pass[i].uni_acct_desc.uni_str_len,
1174 copy_unistr2(&(sam->str[entries_added].uni_acct_name), &(pass[i].uni_user_name));
1175 copy_unistr2(&(sam->str[entries_added].uni_full_name), &(pass[i].uni_full_name));
1176 copy_unistr2(&(sam->str[entries_added].uni_acct_desc), &(pass[i].uni_acct_desc));
1182 sam->num_entries = entries_added;
1183 sam->ptr_entries = 1;
1184 sam->num_entries2 = entries_added;
1188 /*******************************************************************
1189 reads or writes a structure.
1190 ********************************************************************/
1191 static void sam_io_sam_info_1(char *desc, SAM_INFO_1 *sam, prs_struct *ps, int depth)
1195 if (sam == NULL) return;
1197 prs_debug(ps, depth, desc, "sam_io_sam_info_1");
1202 prs_uint32("num_entries ", ps, depth, &(sam->num_entries ));
1203 prs_uint32("ptr_entries ", ps, depth, &(sam->ptr_entries ));
1205 prs_uint32("num_entries2 ", ps, depth, &(sam->num_entries2 ));
1207 SMB_ASSERT_ARRAY(sam->sam, sam->num_entries);
1209 for (i = 0; i < sam->num_entries; i++)
1212 sam_io_sam_entry1("", &(sam->sam[i]), ps, depth);
1215 for (i = 0; i < sam->num_entries; i++)
1218 sam_io_sam_str1 ("", &(sam->str[i]),
1219 sam->sam[i].hdr_acct_name.buffer,
1220 sam->sam[i].hdr_user_name.buffer,
1221 sam->sam[i].hdr_user_desc.buffer,
1227 /*******************************************************************
1228 makes a SAMR_R_QUERY_DISPINFO structure.
1229 ********************************************************************/
1230 void make_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO *r_u,
1231 uint16 switch_level, SAM_INFO_CTR *ctr, uint32 status)
1233 if (r_u == NULL) return;
1235 DEBUG(5,("make_samr_r_query_dispinfo: level %d\n", switch_level));
1239 r_u->unknown_0 = 0x0000001;
1240 r_u->unknown_1 = 0x0000001;
1244 r_u->unknown_0 = 0x0;
1245 r_u->unknown_1 = 0x0;
1248 r_u->switch_level = switch_level;
1250 r_u->status = status;
1254 /*******************************************************************
1255 reads or writes a structure.
1256 ********************************************************************/
1257 void samr_io_r_query_dispinfo(char *desc, SAMR_R_QUERY_DISPINFO *r_u, prs_struct *ps, int depth)
1259 if (r_u == NULL) return;
1261 prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo");
1266 prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 ));
1267 prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 ));
1268 prs_uint16("switch_level ", ps, depth, &(r_u->switch_level ));
1272 switch (r_u->switch_level)
1276 sam_io_sam_info_1("users", r_u->ctr->sam.info1, ps, depth);
1281 sam_io_sam_info_2("servers", r_u->ctr->sam.info2, ps, depth);
1286 DEBUG(5,("samr_io_r_query_dispinfo: unknown switch value\n"));
1291 prs_uint32("status", ps, depth, &(r_u->status));
1295 /*******************************************************************
1296 makes a SAMR_Q_OPEN_GROUP structure.
1297 ********************************************************************/
1298 void make_samr_q_open_group(SAMR_Q_OPEN_GROUP *q_c,
1299 POLICY_HND *hnd, uint32 unk, uint32 rid)
1301 if (q_c == NULL || hnd == NULL) return;
1303 DEBUG(5,("make_samr_q_open_group\n"));
1305 memcpy(&(q_c->domain_pol), hnd, sizeof(q_c->domain_pol));
1307 q_c->rid_group = rid;
1310 /*******************************************************************
1311 reads or writes a structure.
1312 ********************************************************************/
1313 void samr_io_q_open_group(char *desc, SAMR_Q_OPEN_GROUP *q_u, prs_struct *ps, int depth)
1315 if (q_u == NULL) return;
1317 prs_debug(ps, depth, desc, "samr_io_q_open_group");
1322 smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
1324 prs_uint32("unknown ", ps, depth, &(q_u->unknown ));
1325 prs_uint32("rid_group", ps, depth, &(q_u->rid_group));
1328 /*******************************************************************
1329 reads or writes a structure.
1330 ********************************************************************/
1331 void samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP *r_u, prs_struct *ps, int depth)
1333 if (r_u == NULL) return;
1335 prs_debug(ps, depth, desc, "samr_io_r_open_group");
1340 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
1343 prs_uint32("status", ps, depth, &(r_u->status));
1347 /*******************************************************************
1348 makes a GROUP_INFO1 structure.
1349 ********************************************************************/
1350 void make_samr_group_info1(GROUP_INFO1 *gr1,
1351 char *acct_name, char *acct_desc)
1353 int desc_len = acct_desc != NULL ? strlen(acct_desc) : 0;
1354 int acct_len = acct_name != NULL ? strlen(acct_name) : 0;
1355 if (gr1 == NULL) return;
1357 DEBUG(5,("make_samr_group_info1\n"));
1359 make_uni_hdr(&(gr1->hdr_acct_name), acct_len , acct_len, acct_name ? 1 : 0);
1361 gr1->unknown_1 = 0x3;
1362 gr1->unknown_2 = 0x3;
1364 make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0);
1366 make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len);
1367 make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len);
1371 /*******************************************************************
1372 reads or writes a structure.
1373 ********************************************************************/
1374 void samr_io_group_info1(char *desc, GROUP_INFO1 *gr1, prs_struct *ps, int depth)
1376 if (gr1 == NULL) return;
1378 prs_debug(ps, depth, desc, "samr_io_group_info1");
1383 smb_io_unihdr ("hdr_acct_name", &(gr1->hdr_acct_name) , ps, depth);
1385 prs_uint32("unknown_1", ps, depth, &(gr1->unknown_1));
1386 prs_uint32("unknown_2", ps, depth, &(gr1->unknown_2));
1388 smb_io_unihdr ("hdr_acct_desc", &(gr1->hdr_acct_desc) , ps, depth);
1390 smb_io_unistr2("uni_acct_name", &(gr1->uni_acct_name), gr1->hdr_acct_name.buffer, ps, depth);
1393 smb_io_unistr2("uni_acct_desc", &(gr1->uni_acct_desc), gr1->hdr_acct_desc.buffer, ps, depth);
1396 /*******************************************************************
1397 makes a GROUP_INFO4 structure.
1398 ********************************************************************/
1399 void make_samr_group_info4(GROUP_INFO4 *gr4, const char *acct_desc)
1401 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
1402 if (gr4 == NULL) return;
1404 DEBUG(5,("make_samr_group_info4\n"));
1406 make_uni_hdr(&(gr4->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
1407 make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len);
1411 /*******************************************************************
1412 reads or writes a structure.
1413 ********************************************************************/
1414 void samr_io_group_info4(char *desc, GROUP_INFO4 *gr4, prs_struct *ps, int depth)
1416 if (gr4 == NULL) return;
1418 prs_debug(ps, depth, desc, "samr_io_group_info4");
1423 smb_io_unihdr ("hdr_acct_desc", &(gr4->hdr_acct_desc) , ps, depth);
1424 smb_io_unistr2("uni_acct_desc", &(gr4->uni_acct_desc), gr4->hdr_acct_desc.buffer, ps, depth);
1427 /*******************************************************************
1428 reads or writes a structure.
1429 ********************************************************************/
1430 void samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr, prs_struct *ps, int depth)
1432 if (ctr == NULL) return;
1434 prs_debug(ps, depth, desc, "samr_group_info_ctr");
1437 prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1));
1438 prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2));
1440 switch (ctr->switch_value1)
1444 samr_io_group_info1("group_info1", &(ctr->group.info1), ps, depth);
1449 samr_io_group_info4("group_info4", &(ctr->group.info4), ps, depth);
1454 DEBUG(4,("samr_group_info_ctr: unsupported switch level\n"));
1463 /*******************************************************************
1464 makes a SAMR_Q_CREATE_DOM_GROUP structure.
1465 ********************************************************************/
1466 void make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_e,
1468 const char *acct_desc)
1470 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
1471 if (q_e == NULL || pol == NULL) return;
1473 DEBUG(5,("make_samr_q_create_dom_group\n"));
1475 memcpy(&(q_e->pol), pol, sizeof(*pol));
1477 make_uni_hdr(&(q_e->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
1478 make_unistr2(&(q_e->uni_acct_desc), acct_desc, acct_len);
1480 q_e->unknown_1 = 0x0002;
1481 q_e->unknown_2 = 0x0001;
1485 /*******************************************************************
1486 reads or writes a structure.
1487 ********************************************************************/
1488 void samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP *q_e, prs_struct *ps, int depth)
1490 if (q_e == NULL) return;
1492 prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
1497 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1500 smb_io_unihdr ("hdr_acct_desc", &(q_e->hdr_acct_desc), ps, depth);
1501 smb_io_unistr2("uni_acct_desc", &(q_e->uni_acct_desc), q_e->hdr_acct_desc.buffer, ps, depth);
1504 prs_uint16("unknown_1", ps, depth, &(q_e->unknown_1));
1505 prs_uint16("unknown_2", ps, depth, &(q_e->unknown_2));
1509 /*******************************************************************
1510 makes a SAMR_R_CREATE_DOM_GROUP structure.
1511 ********************************************************************/
1512 void make_samr_r_create_dom_group(SAMR_R_CREATE_DOM_GROUP *r_u, POLICY_HND *pol,
1513 uint32 rid, uint32 status)
1515 if (r_u == NULL) return;
1517 DEBUG(5,("make_samr_r_create_dom_group\n"));
1519 memcpy(&(r_u->pol), pol, sizeof(*pol));
1522 r_u->status = status;
1526 /*******************************************************************
1527 reads or writes a structure.
1528 ********************************************************************/
1529 void samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP *r_u, prs_struct *ps, int depth)
1531 if (r_u == NULL) return;
1533 prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
1538 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
1541 prs_uint32("rid ", ps, depth, &(r_u->rid ));
1542 prs_uint32("status", ps, depth, &(r_u->status));
1545 /*******************************************************************
1546 makes a SAMR_Q_DELETE_DOM_GROUP structure.
1547 ********************************************************************/
1548 void make_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_c, POLICY_HND *hnd)
1550 if (q_c == NULL || hnd == NULL) return;
1552 DEBUG(5,("make_samr_q_delete_dom_group\n"));
1554 memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol));
1557 /*******************************************************************
1558 reads or writes a structure.
1559 ********************************************************************/
1560 void samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP *q_u, prs_struct *ps, int depth)
1562 if (q_u == NULL) return;
1564 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
1569 smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
1572 /*******************************************************************
1573 makes a SAMR_R_DELETE_DOM_GROUP structure.
1574 ********************************************************************/
1575 void make_samr_r_delete_dom_group(SAMR_R_DELETE_DOM_GROUP *r_u,
1578 if (r_u == NULL) return;
1580 DEBUG(5,("make_samr_r_delete_dom_group\n"));
1582 r_u->status = status;
1585 /*******************************************************************
1586 reads or writes a structure.
1587 ********************************************************************/
1588 void samr_io_r_delete_dom_group(char *desc, SAMR_R_DELETE_DOM_GROUP *r_u, prs_struct *ps, int depth)
1590 if (r_u == NULL) return;
1592 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
1597 prs_uint32("status", ps, depth, &(r_u->status));
1602 /*******************************************************************
1603 makes a SAMR_Q_DEL_GROUPMEM structure.
1604 ********************************************************************/
1605 void make_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_e,
1609 if (q_e == NULL || pol == NULL) return;
1611 DEBUG(5,("make_samr_q_del_groupmem\n"));
1613 memcpy(&(q_e->pol), pol, sizeof(*pol));
1619 /*******************************************************************
1620 reads or writes a structure.
1621 ********************************************************************/
1622 void samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM *q_e, prs_struct *ps, int depth)
1624 if (q_e == NULL) return;
1626 prs_debug(ps, depth, desc, "samr_io_q_del_groupmem");
1631 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1634 prs_uint32("rid ", ps, depth, &(q_e->rid));
1638 /*******************************************************************
1639 makes a SAMR_R_DEL_GROUPMEM structure.
1640 ********************************************************************/
1641 void make_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM *r_u, POLICY_HND *pol,
1644 if (r_u == NULL) return;
1646 DEBUG(5,("make_samr_r_del_groupmem\n"));
1648 r_u->status = status;
1652 /*******************************************************************
1653 reads or writes a structure.
1654 ********************************************************************/
1655 void samr_io_r_del_groupmem(char *desc, SAMR_R_DEL_GROUPMEM *r_u, prs_struct *ps, int depth)
1657 if (r_u == NULL) return;
1659 prs_debug(ps, depth, desc, "samr_io_r_del_groupmem");
1664 prs_uint32("status", ps, depth, &(r_u->status));
1668 /*******************************************************************
1669 makes a SAMR_Q_ADD_GROUPMEM structure.
1670 ********************************************************************/
1671 void make_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_e,
1675 if (q_e == NULL || pol == NULL) return;
1677 DEBUG(5,("make_samr_q_add_groupmem\n"));
1679 memcpy(&(q_e->pol), pol, sizeof(*pol));
1682 q_e->unknown = 0x0005;
1686 /*******************************************************************
1687 reads or writes a structure.
1688 ********************************************************************/
1689 void samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM *q_e, prs_struct *ps, int depth)
1691 if (q_e == NULL) return;
1693 prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
1698 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1701 prs_uint32("rid ", ps, depth, &(q_e->rid));
1702 prs_uint32("unknown", ps, depth, &(q_e->unknown));
1706 /*******************************************************************
1707 makes a SAMR_R_ADD_GROUPMEM structure.
1708 ********************************************************************/
1709 void make_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM *r_u, POLICY_HND *pol,
1712 if (r_u == NULL) return;
1714 DEBUG(5,("make_samr_r_add_groupmem\n"));
1716 r_u->status = status;
1720 /*******************************************************************
1721 reads or writes a structure.
1722 ********************************************************************/
1723 void samr_io_r_add_groupmem(char *desc, SAMR_R_ADD_GROUPMEM *r_u, prs_struct *ps, int depth)
1725 if (r_u == NULL) return;
1727 prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
1732 prs_uint32("status", ps, depth, &(r_u->status));
1736 /*******************************************************************
1737 makes a SAMR_Q_SET_GROUPINFO structure.
1738 ********************************************************************/
1739 void make_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO *q_e,
1740 POLICY_HND *pol, GROUP_INFO_CTR *ctr)
1742 if (q_e == NULL || pol == NULL) return;
1744 DEBUG(5,("make_samr_q_set_groupinfo\n"));
1746 memcpy(&(q_e->pol), pol, sizeof(*pol));
1751 /*******************************************************************
1752 reads or writes a structure.
1753 ********************************************************************/
1754 void samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO *q_e, prs_struct *ps, int depth)
1756 if (q_e == NULL) return;
1758 prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
1763 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1766 samr_group_info_ctr("ctr", q_e->ctr, ps, depth);
1770 /*******************************************************************
1771 makes a SAMR_R_SET_GROUPINFO structure.
1772 ********************************************************************/
1773 void make_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO *r_u,
1776 if (r_u == NULL) return;
1778 DEBUG(5,("make_samr_r_set_groupinfo\n"));
1780 r_u->status = status;
1784 /*******************************************************************
1785 reads or writes a structure.
1786 ********************************************************************/
1787 void samr_io_r_set_groupinfo(char *desc, SAMR_R_SET_GROUPINFO *r_u, prs_struct *ps, int depth)
1789 if (r_u == NULL) return;
1791 prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
1796 prs_uint32("status", ps, depth, &(r_u->status));
1799 /*******************************************************************
1800 makes a SAMR_Q_QUERY_GROUPINFO structure.
1801 ********************************************************************/
1802 void make_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_e,
1804 uint16 switch_level)
1806 if (q_e == NULL || pol == NULL) return;
1808 DEBUG(5,("make_samr_q_query_groupinfo\n"));
1810 memcpy(&(q_e->pol), pol, sizeof(*pol));
1812 q_e->switch_level = switch_level;
1816 /*******************************************************************
1817 reads or writes a structure.
1818 ********************************************************************/
1819 void samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO *q_e, prs_struct *ps, int depth)
1821 if (q_e == NULL) return;
1823 prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
1828 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
1831 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
1835 /*******************************************************************
1836 makes a SAMR_R_QUERY_GROUPINFO structure.
1837 ********************************************************************/
1838 void make_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO *r_u, GROUP_INFO_CTR *ctr,
1841 if (r_u == NULL) return;
1843 DEBUG(5,("make_samr_r_query_groupinfo\n"));
1845 r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0;
1847 r_u->status = status;
1851 /*******************************************************************
1852 reads or writes a structure.
1853 ********************************************************************/
1854 void samr_io_r_query_groupinfo(char *desc, SAMR_R_QUERY_GROUPINFO *r_u, prs_struct *ps, int depth)
1856 if (r_u == NULL) return;
1858 prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
1863 prs_uint32("ptr", ps, depth, &(r_u->ptr));
1867 samr_group_info_ctr("ctr", r_u->ctr, ps, depth);
1870 prs_uint32("status", ps, depth, &(r_u->status));
1874 /*******************************************************************
1875 makes a SAMR_Q_QUERY_GROUPMEM structure.
1876 ********************************************************************/
1877 void make_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_c, POLICY_HND *hnd)
1879 if (q_c == NULL || hnd == NULL) return;
1881 DEBUG(5,("make_samr_q_query_groupmem\n"));
1883 memcpy(&(q_c->group_pol), hnd, sizeof(q_c->group_pol));
1886 /*******************************************************************
1887 reads or writes a structure.
1888 ********************************************************************/
1889 void samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM *q_u, prs_struct *ps, int depth)
1891 if (q_u == NULL) return;
1893 prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
1898 smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
1901 /*******************************************************************
1902 makes a SAMR_R_QUERY_GROUPMEM structure.
1903 ********************************************************************/
1904 void make_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM *r_u,
1905 uint32 num_entries, uint32 *rid, uint32 *attr, uint32 status)
1907 if (r_u == NULL) return;
1909 DEBUG(5,("make_samr_r_query_groupmem\n"));
1914 r_u->num_entries = num_entries;
1916 r_u->ptr_attrs = attr != NULL ? 1 : 0;
1917 r_u->ptr_rids = rid != NULL ? 1 : 0;
1919 r_u->num_rids = num_entries;
1922 r_u->num_attrs = num_entries;
1928 r_u->num_entries = 0;
1931 r_u->status = status;
1934 /*******************************************************************
1935 reads or writes a structure.
1936 ********************************************************************/
1937 void samr_io_r_query_groupmem(char *desc, SAMR_R_QUERY_GROUPMEM *r_u, prs_struct *ps, int depth)
1941 if (r_u == NULL) return;
1943 prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
1948 prs_uint32("ptr", ps, depth, &(r_u->ptr));
1949 prs_uint32("num_entries ", ps, depth, &(r_u->num_entries));
1953 prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids ));
1954 prs_uint32("ptr_attrs", ps, depth, &(r_u->ptr_attrs));
1956 if (r_u->ptr_rids != 0)
1958 prs_uint32("num_rids", ps, depth, &(r_u->num_rids));
1959 for (i = 0; i < r_u->num_rids; i++)
1962 prs_uint32("", ps, depth, &(r_u->rid[i]));
1966 if (r_u->ptr_attrs != 0)
1968 prs_uint32("num_attrs", ps, depth, &(r_u->num_attrs));
1969 for (i = 0; i < r_u->num_attrs; i++)
1972 prs_uint32("", ps, depth, &(r_u->attr[i]));
1977 prs_uint32("status", ps, depth, &(r_u->status));
1981 /*******************************************************************
1982 makes a SAMR_Q_ENUM_DOM_GROUPS structure.
1983 ********************************************************************/
1984 void make_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_e, POLICY_HND *pol,
1985 uint16 switch_level, uint32 start_idx, uint32 size)
1987 if (q_e == NULL || pol == NULL) return;
1989 DEBUG(5,("make_samr_q_enum_dom_groups\n"));
1991 memcpy(&(q_e->pol), pol, sizeof(*pol));
1993 q_e->switch_level = switch_level;
1996 q_e->start_idx = start_idx;
1997 q_e->unknown_1 = 0x000007d0;
1998 q_e->max_size = size;
2002 /*******************************************************************
2003 reads or writes a structure.
2004 ********************************************************************/
2005 void samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS *q_e, prs_struct *ps, int depth)
2007 if (q_e == NULL) return;
2009 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups");
2014 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
2017 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
2018 prs_uint16("unknown_0 ", ps, depth, &(q_e->unknown_0 ));
2019 prs_uint32("start_idx ", ps, depth, &(q_e->start_idx ));
2020 prs_uint32("unknown_1 ", ps, depth, &(q_e->unknown_1 ));
2021 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
2027 /*******************************************************************
2028 makes a SAMR_R_ENUM_DOM_GROUPS structure.
2029 ********************************************************************/
2030 void make_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS *r_u,
2031 uint32 start_idx, uint32 num_sam_entries,
2038 if (r_u == NULL) return;
2040 DEBUG(5,("make_samr_r_enum_dom_groups\n"));
2042 if (num_sam_entries >= MAX_SAM_ENTRIES)
2044 num_sam_entries = MAX_SAM_ENTRIES;
2045 DEBUG(5,("limiting number of entries to %d\n",
2051 for (i = start_idx, entries_added = 0; i < num_sam_entries; i++)
2053 int acct_name_len = strlen(grp[i].name);
2054 int acct_desc_len = strlen(grp[i].comment);
2056 make_sam_entry3(&(r_u->sam[entries_added]),
2057 start_idx + entries_added + 1,
2062 make_unistr2(&(r_u->str[entries_added].uni_grp_name), grp[i].name , acct_name_len);
2063 make_unistr2(&(r_u->str[entries_added].uni_grp_desc), grp[i].comment, acct_desc_len);
2068 if (entries_added > 0)
2070 r_u->unknown_0 = 0x0000492;
2071 r_u->unknown_1 = 0x000049a;
2075 r_u->unknown_0 = 0x0;
2076 r_u->unknown_1 = 0x0;
2078 r_u->switch_level = 3;
2079 r_u->num_entries = entries_added;
2080 r_u->ptr_entries = 1;
2081 r_u->num_entries2 = entries_added;
2085 r_u->switch_level = 0;
2088 r_u->status = status;
2091 /*******************************************************************
2092 reads or writes a structure.
2093 ********************************************************************/
2094 void samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS *r_u, prs_struct *ps, int depth)
2098 if (r_u == NULL) return;
2100 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups");
2105 prs_uint32("unknown_0 ", ps, depth, &(r_u->unknown_0 ));
2106 prs_uint32("unknown_1 ", ps, depth, &(r_u->unknown_1 ));
2107 prs_uint32("switch_level ", ps, depth, &(r_u->switch_level ));
2109 if (r_u->switch_level != 0)
2111 prs_uint32("num_entries ", ps, depth, &(r_u->num_entries ));
2112 prs_uint32("ptr_entries ", ps, depth, &(r_u->ptr_entries ));
2114 prs_uint32("num_entries2 ", ps, depth, &(r_u->num_entries2 ));
2116 SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries);
2118 for (i = 0; i < r_u->num_entries; i++)
2121 sam_io_sam_entry3("", &(r_u->sam[i]), ps, depth);
2124 for (i = 0; i < r_u->num_entries; i++)
2127 sam_io_sam_str3 ("", &(r_u->str[i]),
2128 r_u->sam[i].hdr_grp_name.buffer,
2129 r_u->sam[i].hdr_grp_desc.buffer,
2134 prs_uint32("status", ps, depth, &(r_u->status));
2137 /*******************************************************************
2138 makes a SAMR_Q_QUERY_USERGROUPS structure.
2139 ********************************************************************/
2140 void make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u,
2143 if (q_u == NULL || hnd == NULL) return;
2145 DEBUG(5,("make_samr_q_query_usergroups\n"));
2147 memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
2151 /*******************************************************************
2152 reads or writes a structure.
2153 ********************************************************************/
2154 void samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS *q_u, prs_struct *ps, int depth)
2156 if (q_u == NULL) return;
2158 prs_debug(ps, depth, desc, "samr_io_q_query_usergroups");
2163 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
2167 /*******************************************************************
2168 makes a SAMR_R_QUERY_USERGROUPS structure.
2169 ********************************************************************/
2170 void make_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS *r_u,
2171 uint32 num_gids, DOM_GID *gid, uint32 status)
2173 if (r_u == NULL) return;
2175 DEBUG(5,("make_samr_r_query_usergroups\n"));
2180 r_u->num_entries = num_gids;
2181 r_u->ptr_1 = (num_gids != 0) ? 1 : 0;
2182 r_u->num_entries2 = num_gids;
2189 r_u->num_entries = 0;
2193 r_u->status = status;
2196 /*******************************************************************
2197 reads or writes a structure.
2198 ********************************************************************/
2199 void samr_io_r_query_usergroups(char *desc, SAMR_R_QUERY_USERGROUPS *r_u, prs_struct *ps, int depth)
2202 if (r_u == NULL) return;
2204 prs_debug(ps, depth, desc, "samr_io_r_query_usergroups");
2209 prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0 ));
2211 if (r_u->ptr_0 != 0)
2213 prs_uint32("num_entries ", ps, depth, &(r_u->num_entries));
2214 prs_uint32("ptr_1 ", ps, depth, &(r_u->ptr_1 ));
2216 if (r_u->num_entries != 0)
2218 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
2220 for (i = 0; i < r_u->num_entries2; i++)
2223 smb_io_gid("", &(r_u->gid[i]), ps, depth);
2227 prs_uint32("status", ps, depth, &(r_u->status));
2231 /*******************************************************************
2232 makes a SAMR_Q_ENUM_DOM_ALIASES structure.
2233 ********************************************************************/
2234 void make_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_e, POLICY_HND *pol, uint32 size)
2236 if (q_e == NULL || pol == NULL) return;
2238 DEBUG(5,("make_samr_q_enum_dom_aliases\n"));
2240 memcpy(&(q_e->pol), pol, sizeof(*pol));
2243 q_e->max_size = size;
2247 /*******************************************************************
2248 reads or writes a structure.
2249 ********************************************************************/
2250 void samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES *q_e, prs_struct *ps, int depth)
2252 if (q_e == NULL) return;
2254 prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases");
2259 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
2262 prs_uint32("unknown_0", ps, depth, &(q_e->unknown_0));
2263 prs_uint32("max_size ", ps, depth, &(q_e->max_size ));
2269 /*******************************************************************
2270 makes a SAMR_R_ENUM_DOM_ALIASES structure.
2271 ********************************************************************/
2272 void make_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u,
2273 uint32 num_sam_entries, LOCAL_GRP *alss,
2278 if (r_u == NULL) return;
2280 DEBUG(5,("make_samr_r_enum_dom_aliases\n"));
2282 if (num_sam_entries >= MAX_SAM_ENTRIES)
2284 num_sam_entries = MAX_SAM_ENTRIES;
2285 DEBUG(5,("limiting number of entries to %d\n",
2289 r_u->num_entries = num_sam_entries;
2291 if (num_sam_entries > 0)
2293 r_u->ptr_entries = 1;
2294 r_u->num_entries2 = num_sam_entries;
2295 r_u->ptr_entries2 = 1;
2296 r_u->num_entries3 = num_sam_entries;
2298 SMB_ASSERT_ARRAY(r_u->sam, num_sam_entries);
2300 for (i = 0; i < num_sam_entries; i++)
2302 int acct_name_len = strlen(alss[i].name);
2304 make_sam_entry(&(r_u->sam[i]),
2308 make_unistr2(&(r_u->uni_grp_name[i]), alss[i].name , acct_name_len);
2311 r_u->num_entries4 = num_sam_entries;
2315 r_u->ptr_entries = 0;
2318 r_u->status = status;
2321 /*******************************************************************
2322 reads or writes a structure.
2323 ********************************************************************/
2324 void samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES *r_u, prs_struct *ps, int depth)
2328 if (r_u == NULL) return;
2330 prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases");
2335 prs_uint32("num_entries", ps, depth, &(r_u->num_entries));
2336 prs_uint32("ptr_entries", ps, depth, &(r_u->ptr_entries));
2338 if (r_u->num_entries != 0 && r_u->ptr_entries != 0)
2340 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
2341 prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
2342 prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
2344 SMB_ASSERT_ARRAY(r_u->sam, r_u->num_entries);
2346 for (i = 0; i < r_u->num_entries; i++)
2348 sam_io_sam_entry("", &(r_u->sam[i]), ps, depth);
2351 for (i = 0; i < r_u->num_entries; i++)
2353 smb_io_unistr2("", &(r_u->uni_grp_name[i]), r_u->sam[i].hdr_name.buffer, ps, depth);
2358 prs_uint32("num_entries4", ps, depth, &(r_u->num_entries4));
2361 prs_uint32("status", ps, depth, &(r_u->status));
2365 /*******************************************************************
2366 makes a ALIAS_INFO3 structure.
2367 ********************************************************************/
2368 void make_samr_alias_info3(ALIAS_INFO3 *al3, const char *acct_desc)
2370 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
2371 if (al3 == NULL) return;
2373 DEBUG(5,("make_samr_alias_info3\n"));
2375 make_uni_hdr(&(al3->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
2376 make_unistr2(&(al3->uni_acct_desc), acct_desc, acct_len);
2380 /*******************************************************************
2381 reads or writes a structure.
2382 ********************************************************************/
2383 void samr_io_alias_info3(char *desc, ALIAS_INFO3 *al3, prs_struct *ps, int depth)
2385 if (al3 == NULL) return;
2387 prs_debug(ps, depth, desc, "samr_io_alias_info3");
2392 smb_io_unihdr ("hdr_acct_desc", &(al3->hdr_acct_desc) , ps, depth);
2393 smb_io_unistr2("uni_acct_desc", &(al3->uni_acct_desc), al3->hdr_acct_desc.buffer, ps, depth);
2396 /*******************************************************************
2397 reads or writes a structure.
2398 ********************************************************************/
2399 void samr_alias_info_ctr(char *desc, ALIAS_INFO_CTR *ctr, prs_struct *ps, int depth)
2401 if (ctr == NULL) return;
2403 prs_debug(ps, depth, desc, "samr_alias_info_ctr");
2406 prs_uint16("switch_value1", ps, depth, &(ctr->switch_value1));
2407 prs_uint16("switch_value2", ps, depth, &(ctr->switch_value2));
2409 switch (ctr->switch_value1)
2413 samr_io_alias_info3("alias_info3", &(ctr->alias.info3), ps, depth);
2418 DEBUG(4,("samr_alias_info_ctr: unsupported switch level\n"));
2427 /*******************************************************************
2428 makes a SAMR_Q_QUERY_ALIASINFO structure.
2429 ********************************************************************/
2430 void make_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_e,
2432 uint16 switch_level)
2434 if (q_e == NULL || pol == NULL) return;
2436 DEBUG(5,("make_samr_q_query_aliasinfo\n"));
2438 memcpy(&(q_e->pol), pol, sizeof(*pol));
2440 q_e->switch_level = switch_level;
2444 /*******************************************************************
2445 reads or writes a structure.
2446 ********************************************************************/
2447 void samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO *q_e, prs_struct *ps, int depth)
2449 if (q_e == NULL) return;
2451 prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo");
2456 smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
2459 prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
2463 /*******************************************************************
2464 makes a SAMR_R_QUERY_ALIASINFO structure.
2465 ********************************************************************/
2466 void make_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *r_u, ALIAS_INFO_CTR *ctr,
2469 if (r_u == NULL) return;
2471 DEBUG(5,("make_samr_r_query_aliasinfo\n"));
2473 r_u->ptr = (status == 0x0 && ctr != NULL) ? 1 : 0;
2475 r_u->status = status;
2479 /*******************************************************************
2480 reads or writes a structure.
2481 ********************************************************************/
2482 void samr_io_r_query_aliasinfo(char *desc, SAMR_R_QUERY_ALIASINFO *r_u, prs_struct *ps, int depth)
2484 if (r_u == NULL) return;
2486 prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo");
2491 prs_uint32("ptr", ps, depth, &(r_u->ptr));
2495 samr_alias_info_ctr("ctr", r_u->ctr, ps, depth);
2498 prs_uint32("status", ps, depth, &(r_u->status));
2502 /*******************************************************************
2503 makes a SAMR_Q_SET_ALIASINFO structure.
2504 ********************************************************************/
2505 void make_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO *q_u, POLICY_HND *hnd,
2506 ALIAS_INFO_CTR *ctr)
2508 if (q_u == NULL) return;
2510 DEBUG(5,("make_samr_q_set_aliasinfo\n"));
2512 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
2517 /*******************************************************************
2518 reads or writes a structure.
2519 ********************************************************************/
2520 void samr_io_q_set_aliasinfo(char *desc, SAMR_Q_SET_ALIASINFO *q_u, prs_struct *ps, int depth)
2522 if (q_u == NULL) return;
2524 prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo");
2529 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
2530 samr_alias_info_ctr("ctr", q_u->ctr, ps, depth);
2533 /*******************************************************************
2534 reads or writes a structure.
2535 ********************************************************************/
2536 void samr_io_r_set_aliasinfo(char *desc, SAMR_R_SET_ALIASINFO *r_u, prs_struct *ps, int depth)
2538 if (r_u == NULL) return;
2540 prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo");
2544 prs_uint32("status", ps, depth, &(r_u->status));
2549 /*******************************************************************
2550 makes a SAMR_Q_QUERY_USERALIASES structure.
2551 ********************************************************************/
2552 void make_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u,
2556 if (q_u == NULL || hnd == NULL) return;
2558 DEBUG(5,("make_samr_q_query_useraliases\n"));
2560 memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
2567 q_u->ptr_sid[0] = 1;
2568 make_dom_sid2(&q_u->sid[0], sid);
2572 /*******************************************************************
2573 reads or writes a SAMR_Q_QUERY_USERALIASES structure.
2574 ********************************************************************/
2575 void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs_struct *ps, int depth)
2580 if (q_u == NULL) return;
2582 prs_debug(ps, depth, desc, "samr_io_q_query_useraliases");
2587 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
2590 prs_uint32("num_sids1", ps, depth, &(q_u->num_sids1));
2591 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
2592 prs_uint32("num_sids2", ps, depth, &(q_u->num_sids2));
2594 SMB_ASSERT_ARRAY(q_u->ptr_sid, q_u->num_sids2);
2596 for (i = 0; i < q_u->num_sids2; i++)
2598 slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i);
2599 prs_uint32(tmp, ps, depth, &(q_u->ptr_sid[i]));
2602 for (i = 0; i < q_u->num_sids2; i++)
2604 if (q_u->ptr_sid[i] != 0)
2607 slprintf(tmp, sizeof(tmp)-1, "sid[%02d]", i);
2608 smb_io_dom_sid2(tmp, &(q_u->sid[i]), ps, depth);
2616 /*******************************************************************
2617 makes a SAMR_R_QUERY_USERALIASES structure.
2618 ********************************************************************/
2619 void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u,
2620 uint32 num_rids, uint32 *rid, uint32 status)
2622 if (r_u == NULL) return;
2624 DEBUG(5,("make_samr_r_query_useraliases\n"));
2628 r_u->num_entries = num_rids;
2630 r_u->num_entries2 = num_rids;
2636 r_u->num_entries = 0;
2638 r_u->num_entries2 = 0;
2641 r_u->status = status;
2644 /*******************************************************************
2645 reads or writes a structure.
2646 ********************************************************************/
2647 void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth)
2651 if (r_u == NULL) return;
2653 prs_debug(ps, depth, desc, "samr_io_r_query_useraliases");
2658 prs_uint32("num_entries", ps, depth, &(r_u->num_entries));
2659 prs_uint32("ptr ", ps, depth, &(r_u->ptr ));
2660 prs_uint32("num_entries2", ps, depth, &(r_u->num_entries2));
2662 if (r_u->num_entries != 0)
2664 for (i = 0; i < r_u->num_entries2; i++)
2666 slprintf(tmp, sizeof(tmp)-1, "rid[%02d]", i);
2667 prs_uint32(tmp, ps, depth, &(r_u->rid[i]));
2671 prs_uint32("status", ps, depth, &(r_u->status));
2674 /*******************************************************************
2675 makes a SAMR_Q_OPEN_ALIAS structure.
2676 ********************************************************************/
2677 void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol,
2678 uint32 unknown_0, uint32 rid)
2680 if (q_u == NULL) return;
2682 DEBUG(5,("make_samr_q_open_alias\n"));
2684 memcpy(&(q_u->dom_pol), pol, sizeof(q_u->dom_pol));
2686 /* example values: 0x0000 0008 */
2687 q_u->unknown_0 = unknown_0;
2689 q_u->rid_alias = rid;
2692 /*******************************************************************
2693 reads or writes a structure.
2694 ********************************************************************/
2695 void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth)
2697 if (q_u == NULL) return;
2699 prs_debug(ps, depth, desc, "samr_io_q_open_alias");
2704 smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth);
2706 prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0));
2707 prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias));
2710 /*******************************************************************
2711 reads or writes a structure.
2712 ********************************************************************/
2713 void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth)
2715 if (r_u == NULL) return;
2717 prs_debug(ps, depth, desc, "samr_io_r_open_alias");
2722 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
2725 prs_uint32("status", ps, depth, &(r_u->status));
2728 /*******************************************************************
2729 makes a SAMR_Q_LOOKUP_RIDS structure.
2730 ********************************************************************/
2731 void make_samr_q_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u,
2732 POLICY_HND *pol, uint32 flags,
2733 uint32 num_rids, uint32 *rid)
2736 if (q_u == NULL) return;
2738 DEBUG(5,("make_samr_r_unknwon_12\n"));
2740 memcpy(&(q_u->pol), pol, sizeof(*pol));
2742 q_u->num_rids1 = num_rids;
2745 q_u->num_rids2 = num_rids;
2747 for (i = 0; i < num_rids; i++)
2749 q_u->rid[i] = rid[i];
2753 /*******************************************************************
2754 reads or writes a structure.
2755 ********************************************************************/
2756 void samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS *q_u, prs_struct *ps, int depth)
2761 if (q_u == NULL) return;
2763 prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
2768 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
2771 prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1));
2772 prs_uint32("flags ", ps, depth, &(q_u->flags ));
2773 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
2774 prs_uint32("num_rids2", ps, depth, &(q_u->num_rids2));
2776 SMB_ASSERT_ARRAY(q_u->rid, q_u->num_rids2);
2778 for (i = 0; i < q_u->num_rids2; i++)
2781 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
2782 prs_uint32(tmp, ps, depth, &(q_u->rid[i]));
2789 /*******************************************************************
2790 makes a SAMR_R_LOOKUP_RIDS structure.
2791 ********************************************************************/
2792 void make_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS *r_u,
2793 uint32 num_names, fstring *name, uint8 *type,
2797 if (r_u == NULL || name == NULL || type == NULL) return;
2799 DEBUG(5,("make_samr_r_lookup_rids\n"));
2803 r_u->num_names1 = num_names;
2805 r_u->num_names2 = num_names;
2807 r_u->num_types1 = num_names;
2809 r_u->num_types2 = num_names;
2811 SMB_ASSERT_ARRAY(r_u->hdr_name, num_names);
2813 for (i = 0; i < num_names; i++)
2815 int len = name[i] != NULL ? strlen(name[i]) : 0;
2816 make_uni_hdr(&(r_u->hdr_name[i]), len , len, name[i] ? 1 : 0);
2817 make_unistr2(&(r_u->uni_name[i]), name[i], len);
2818 r_u->type[i] = type[i];
2823 r_u->num_names1 = num_names;
2825 r_u->num_names2 = num_names;
2827 r_u->num_types1 = num_names;
2829 r_u->num_types2 = num_names;
2832 r_u->status = status;
2835 /*******************************************************************
2836 reads or writes a structure.
2837 ********************************************************************/
2838 void samr_io_r_lookup_rids(char *desc, SAMR_R_LOOKUP_RIDS *r_u, prs_struct *ps, int depth)
2842 if (r_u == NULL) return;
2844 prs_debug(ps, depth, desc, "samr_io_r_lookup_rids");
2849 prs_uint32("num_names1", ps, depth, &(r_u->num_names1));
2850 prs_uint32("ptr_names ", ps, depth, &(r_u->ptr_names ));
2851 prs_uint32("num_names2", ps, depth, &(r_u->num_names2));
2853 if (r_u->ptr_names != 0 && r_u->num_names1 != 0)
2855 SMB_ASSERT_ARRAY(r_u->hdr_name, r_u->num_names2);
2857 for (i = 0; i < r_u->num_names2; i++)
2860 slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
2861 smb_io_unihdr ("", &(r_u->hdr_name[i]), ps, depth);
2863 for (i = 0; i < r_u->num_names2; i++)
2866 slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
2867 smb_io_unistr2("", &(r_u->uni_name[i]), r_u->hdr_name[i].buffer, ps, depth);
2873 prs_uint32("num_types1", ps, depth, &(r_u->num_types1));
2874 prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types ));
2875 prs_uint32("num_types2", ps, depth, &(r_u->num_types2));
2877 if (r_u->ptr_types != 0 && r_u->num_types1 != 0)
2879 for (i = 0; i < r_u->num_types2; i++)
2882 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
2883 prs_uint32(tmp, ps, depth, &(r_u->type[i]));
2887 prs_uint32("status", ps, depth, &(r_u->status));
2890 /*******************************************************************
2891 makes a SAMR_Q_OPEN_ALIAS structure.
2892 ********************************************************************/
2893 void make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, POLICY_HND *hnd)
2895 if (q_u == NULL) return;
2897 DEBUG(5,("make_samr_q_delete_alias\n"));
2899 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
2903 /*******************************************************************
2904 reads or writes a structure.
2905 ********************************************************************/
2906 void samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth)
2908 if (q_u == NULL) return;
2910 prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
2915 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
2918 /*******************************************************************
2919 reads or writes a structure.
2920 ********************************************************************/
2921 void samr_io_r_delete_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth)
2923 if (r_u == NULL) return;
2925 prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
2930 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
2931 prs_uint32("status", ps, depth, &(r_u->status));
2935 /*******************************************************************
2936 makes a SAMR_Q_CREATE_DOM_ALIAS structure.
2937 ********************************************************************/
2938 void make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, POLICY_HND *hnd,
2939 const char *acct_desc)
2941 int acct_len = acct_desc != NULL ? strlen(acct_desc) : 0;
2942 if (q_u == NULL) return;
2944 DEBUG(5,("make_samr_q_create_dom_alias\n"));
2946 memcpy(&(q_u->dom_pol), hnd, sizeof(q_u->dom_pol));
2948 make_uni_hdr(&(q_u->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
2949 make_unistr2(&(q_u->uni_acct_desc), acct_desc, acct_len);
2951 q_u->unknown_1 = 0x001f;
2952 q_u->unknown_2 = 0x000f;
2956 /*******************************************************************
2957 reads or writes a structure.
2958 ********************************************************************/
2959 void samr_io_q_create_dom_alias(char *desc, SAMR_Q_CREATE_DOM_ALIAS *q_u, prs_struct *ps, int depth)
2961 if (q_u == NULL) return;
2963 prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
2968 smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth);
2970 smb_io_unihdr ("hdr_acct_desc", &(q_u->hdr_acct_desc) , ps, depth);
2971 smb_io_unistr2("uni_acct_desc", &(q_u->uni_acct_desc), q_u->hdr_acct_desc.buffer, ps, depth);
2973 prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1));
2974 prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2));
2977 /*******************************************************************
2978 makes a SAMR_R_CREATE_DOM_ALIAS structure.
2979 ********************************************************************/
2980 void make_samr_r_create_dom_alias(SAMR_R_CREATE_DOM_ALIAS *r_u, POLICY_HND *pol,
2981 uint32 rid, uint32 status)
2983 if (r_u == NULL) return;
2985 DEBUG(5,("make_samr_r_create_dom_alias\n"));
2987 memcpy(&(r_u->alias_pol), pol, sizeof(*pol));
2989 r_u->status = status;
2993 /*******************************************************************
2994 reads or writes a structure.
2995 ********************************************************************/
2996 void samr_io_r_create_dom_alias(char *desc, SAMR_R_CREATE_DOM_ALIAS *r_u, prs_struct *ps, int depth)
2998 if (r_u == NULL) return;
3000 prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
3005 smb_io_pol_hnd("alias_pol", &(r_u->alias_pol), ps, depth);
3006 prs_uint32("rid", ps, depth, &(r_u->rid));
3008 prs_uint32("status", ps, depth, &(r_u->status));
3013 /*******************************************************************
3014 makes a SAMR_Q_ADD_ALIASMEM structure.
3015 ********************************************************************/
3016 void make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, POLICY_HND *hnd,
3019 if (q_u == NULL) return;
3021 DEBUG(5,("make_samr_q_add_aliasmem\n"));
3023 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
3024 make_dom_sid2(&q_u->sid, sid);
3028 /*******************************************************************
3029 reads or writes a structure.
3030 ********************************************************************/
3031 void samr_io_q_add_aliasmem(char *desc, SAMR_Q_ADD_ALIASMEM *q_u, prs_struct *ps, int depth)
3033 if (q_u == NULL) return;
3035 prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
3040 smb_io_pol_hnd ("alias_pol", &(q_u->alias_pol), ps, depth);
3041 smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth);
3044 /*******************************************************************
3045 reads or writes a structure.
3046 ********************************************************************/
3047 void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *ps, int depth)
3049 if (r_u == NULL) return;
3051 prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
3056 prs_uint32("status", ps, depth, &(r_u->status));
3060 /*******************************************************************
3061 makes a SAMR_Q_DEL_ALIASMEM structure.
3062 ********************************************************************/
3063 void make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, POLICY_HND *hnd,
3066 if (q_u == NULL) return;
3068 DEBUG(5,("make_samr_q_del_aliasmem\n"));
3070 memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
3071 make_dom_sid2(&q_u->sid, sid);
3075 /*******************************************************************
3076 reads or writes a structure.
3077 ********************************************************************/
3078 void samr_io_q_del_aliasmem(char *desc, SAMR_Q_DEL_ALIASMEM *q_u, prs_struct *ps, int depth)
3080 if (q_u == NULL) return;
3082 prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
3087 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
3088 smb_io_dom_sid2("sid ", &(q_u->sid ), ps, depth);
3091 /*******************************************************************
3092 reads or writes a structure.
3093 ********************************************************************/
3094 void samr_io_r_del_aliasmem(char *desc, SAMR_R_DEL_ALIASMEM *r_u, prs_struct *ps, int depth)
3096 if (r_u == NULL) return;
3098 prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
3103 prs_uint32("status", ps, depth, &(r_u->status));
3106 /*******************************************************************
3107 makes a SAMR_Q_DELETE_DOM_ALIAS structure.
3108 ********************************************************************/
3109 void make_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_c, POLICY_HND *hnd)
3111 if (q_c == NULL || hnd == NULL) return;
3113 DEBUG(5,("make_samr_q_delete_dom_alias\n"));
3115 memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol));
3118 /*******************************************************************
3119 reads or writes a structure.
3120 ********************************************************************/
3121 void samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS *q_u, prs_struct *ps, int depth)
3123 if (q_u == NULL) return;
3125 prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
3130 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
3133 /*******************************************************************
3134 makes a SAMR_R_DELETE_DOM_ALIAS structure.
3135 ********************************************************************/
3136 void make_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS *r_u,
3139 if (r_u == NULL) return;
3141 DEBUG(5,("make_samr_r_delete_dom_alias\n"));
3143 r_u->status = status;
3146 /*******************************************************************
3147 reads or writes a structure.
3148 ********************************************************************/
3149 void samr_io_r_delete_dom_alias(char *desc, SAMR_R_DELETE_DOM_ALIAS *r_u, prs_struct *ps, int depth)
3151 if (r_u == NULL) return;
3153 prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
3158 prs_uint32("status", ps, depth, &(r_u->status));
3162 /*******************************************************************
3163 makes a SAMR_Q_QUERY_ALIASMEM structure.
3164 ********************************************************************/
3165 void make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd)
3167 if (q_c == NULL || hnd == NULL) return;
3169 DEBUG(5,("make_samr_q_query_aliasmem\n"));
3171 memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol));
3174 /*******************************************************************
3175 reads or writes a structure.
3176 ********************************************************************/
3177 void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth)
3179 if (q_u == NULL) return;
3181 prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem");
3186 smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
3189 /*******************************************************************
3190 makes a SAMR_R_QUERY_ALIASMEM structure.
3191 ********************************************************************/
3192 void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u,
3193 uint32 num_sids, DOM_SID2 *sid, uint32 status)
3195 if (r_u == NULL) return;
3197 DEBUG(5,("make_samr_r_query_aliasmem\n"));
3201 r_u->num_sids = num_sids;
3202 r_u->ptr = (num_sids != 0) ? 1 : 0;
3203 r_u->num_sids1 = num_sids;
3213 r_u->status = status;
3216 /*******************************************************************
3217 reads or writes a structure.
3218 ********************************************************************/
3219 void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth)
3222 uint32 ptr_sid[MAX_LOOKUP_SIDS];
3224 if (r_u == NULL) return;
3226 prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem");
3231 prs_uint32("num_sids ", ps, depth, &(r_u->num_sids));
3232 prs_uint32("ptr", ps, depth, &(r_u->ptr));
3236 SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids);
3238 if (r_u->num_sids != 0)
3240 prs_uint32("num_sids1", ps, depth, &(r_u->num_sids1));
3242 for (i = 0; i < r_u->num_sids1; i++)
3246 prs_uint32("", ps, depth, &(ptr_sid[i]));
3248 for (i = 0; i < r_u->num_sids1; i++)
3251 if (ptr_sid[i] != 0)
3253 smb_io_dom_sid2("", &(r_u->sid[i]), ps, depth);
3258 prs_uint32("status", ps, depth, &(r_u->status));
3261 /*******************************************************************
3262 makes a SAMR_Q_LOOKUP_NAMES structure.
3263 ********************************************************************/
3264 void make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u,
3265 POLICY_HND *pol, uint32 flags,
3266 uint32 num_names, const char **name)
3269 if (q_u == NULL) return;
3271 DEBUG(5,("make_samr_q_lookup_names\n"));
3273 memcpy(&(q_u->pol), pol, sizeof(*pol));
3275 q_u->num_names1 = num_names;
3278 q_u->num_names2 = num_names;
3280 for (i = 0; i < num_names; i++)
3282 int len_name = name[i] != NULL ? strlen(name[i]) : 0;
3283 make_uni_hdr(&(q_u->hdr_name[i]), len_name, len_name, name[i] != NULL); /* unicode header for user_name */
3284 make_unistr2(&(q_u->uni_name[i]), name[i], len_name); /* unicode string for machine account */
3289 /*******************************************************************
3290 reads or writes a structure.
3291 ********************************************************************/
3292 void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth)
3296 if (q_u == NULL) return;
3298 prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
3303 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
3306 prs_uint32("num_names1", ps, depth, &(q_u->num_names1));
3307 prs_uint32("flags ", ps, depth, &(q_u->flags ));
3308 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
3309 prs_uint32("num_names2", ps, depth, &(q_u->num_names2));
3311 SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2);
3313 for (i = 0; i < q_u->num_names2; i++)
3316 smb_io_unihdr ("", &(q_u->hdr_name[i]), ps, depth);
3318 for (i = 0; i < q_u->num_names2; i++)
3321 smb_io_unistr2("", &(q_u->uni_name[i]), q_u->hdr_name[i].buffer, ps, depth);
3328 /*******************************************************************
3329 makes a SAMR_R_LOOKUP_NAMES structure.
3330 ********************************************************************/
3331 void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u,
3332 uint32 num_rids, uint32 *rid, uint8 *type, uint32 status)
3335 if (r_u == NULL) return;
3337 DEBUG(5,("make_samr_r_lookup_names\n"));
3341 r_u->num_types1 = num_rids;
3343 r_u->num_types2 = num_rids;
3345 r_u->num_rids1 = num_rids;
3347 r_u->num_rids2 = num_rids;
3349 SMB_ASSERT_ARRAY(r_u->rid, num_rids);
3351 for (i = 0; i < num_rids; i++)
3353 r_u->rid [i] = rid [i];
3354 r_u->type[i] = type[i];
3359 r_u->num_types1 = 0;
3361 r_u->num_types2 = 0;
3368 r_u->status = status;
3371 /*******************************************************************
3372 reads or writes a structure.
3373 ********************************************************************/
3374 void samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES *r_u, prs_struct *ps, int depth)
3379 if (r_u == NULL) return;
3381 prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
3386 prs_uint32("num_rids1", ps, depth, &(r_u->num_rids1));
3387 prs_uint32("ptr_rids ", ps, depth, &(r_u->ptr_rids ));
3388 prs_uint32("num_rids2", ps, depth, &(r_u->num_rids2));
3390 if (r_u->ptr_rids != 0 && r_u->num_rids1 != 0)
3392 for (i = 0; i < r_u->num_rids2; i++)
3395 slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
3396 prs_uint32(tmp, ps, depth, &(r_u->rid[i]));
3400 prs_uint32("num_types1", ps, depth, &(r_u->num_types1));
3401 prs_uint32("ptr_types ", ps, depth, &(r_u->ptr_types ));
3402 prs_uint32("num_types2", ps, depth, &(r_u->num_types2));
3404 if (r_u->ptr_types != 0 && r_u->num_types1 != 0)
3406 for (i = 0; i < r_u->num_types2; i++)
3409 slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
3410 prs_uint32(tmp, ps, depth, &(r_u->type[i]));
3414 prs_uint32("status", ps, depth, &(r_u->status));
3418 /*******************************************************************
3419 reads or writes a structure.
3420 ********************************************************************/
3421 void make_samr_q_open_user(SAMR_Q_OPEN_USER *q_u,
3423 uint32 unk_0, uint32 rid)
3425 if (q_u == NULL) return;
3427 DEBUG(5,("samr_make_samr_q_open_user\n"));
3429 memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol));
3431 q_u->unknown_0 = unk_0;
3432 q_u->user_rid = rid;
3435 /*******************************************************************
3436 reads or writes a structure.
3437 ********************************************************************/
3438 void samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER *q_u, prs_struct *ps, int depth)
3440 if (q_u == NULL) return;
3442 prs_debug(ps, depth, desc, "samr_io_q_open_user");
3447 smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
3450 prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0));
3451 prs_uint32("user_rid ", ps, depth, &(q_u->user_rid ));
3456 /*******************************************************************
3457 reads or writes a structure.
3458 ********************************************************************/
3459 void samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER *r_u, prs_struct *ps, int depth)
3461 if (r_u == NULL) return;
3463 prs_debug(ps, depth, desc, "samr_io_r_open_user");
3468 smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth);
3471 prs_uint32("status", ps, depth, &(r_u->status));
3474 /*******************************************************************
3475 makes a SAMR_Q_QUERY_USERINFO structure.
3476 ********************************************************************/
3477 void make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO *q_u,
3478 POLICY_HND *hnd, uint16 switch_value)
3480 if (q_u == NULL || hnd == NULL) return;
3482 DEBUG(5,("make_samr_q_query_userinfo\n"));
3484 memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
3485 q_u->switch_value = switch_value;
3489 /*******************************************************************
3490 reads or writes a structure.
3491 ********************************************************************/
3492 void samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO *q_u, prs_struct *ps, int depth)
3494 if (q_u == NULL) return;
3496 prs_debug(ps, depth, desc, "samr_io_q_query_userinfo");
3501 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
3504 prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); /* 0x0015 or 0x0011 */
3509 /*******************************************************************
3510 reads or writes a LOGON_HRS structure.
3511 ********************************************************************/
3512 static void sam_io_logon_hrs(char *desc, LOGON_HRS *hrs, prs_struct *ps, int depth)
3514 if (hrs == NULL) return;
3516 prs_debug(ps, depth, desc, "sam_io_logon_hrs");
3521 prs_uint32 ( "len ", ps, depth, &(hrs->len ));
3525 DEBUG(5,("sam_io_logon_hrs: truncating length\n"));
3529 prs_uint8s (False, "hours", ps, depth, hrs->hours, hrs->len);
3532 /*******************************************************************
3533 makes a SAM_USER_INFO_10 structure.
3534 ********************************************************************/
3535 void make_sam_user_info10(SAM_USER_INFO_10 *usr,
3538 if (usr == NULL) return;
3540 DEBUG(5,("make_sam_user_info10\n"));
3542 usr->acb_info = acb_info;
3545 /*******************************************************************
3546 reads or writes a structure.
3547 ********************************************************************/
3548 void sam_io_user_info10(char *desc, SAM_USER_INFO_10 *usr, prs_struct *ps, int depth)
3550 if (usr == NULL) return;
3552 prs_debug(ps, depth, desc, "samr_io_r_user_info10");
3557 prs_uint32("acb_info", ps, depth, &(usr->acb_info));
3560 /*******************************************************************
3561 makes a SAM_USER_INFO_11 structure.
3562 ********************************************************************/
3563 void make_sam_user_info11(SAM_USER_INFO_11 *usr,
3572 if (usr == NULL || expiry == NULL || mach_acct == NULL) return;
3574 DEBUG(5,("make_sam_user_info11\n"));
3576 len_mach_acct = strlen(mach_acct);
3578 memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */
3579 bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */
3581 make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct, len_mach_acct, 4); /* unicode header for machine account */
3582 usr->padding_2 = 0; /* 0 - padding 4 bytes */
3584 usr->ptr_1 = 1; /* pointer */
3585 bzero(usr->padding_3, sizeof(usr->padding_3)); /* 0 - padding 32 bytes */
3586 usr->padding_4 = 0; /* 0 - padding 4 bytes */
3588 usr->ptr_2 = 1; /* pointer */
3589 usr->padding_5 = 0; /* 0 - padding 4 bytes */
3591 usr->ptr_3 = 1; /* pointer */
3592 bzero(usr->padding_6, sizeof(usr->padding_6)); /* 0 - padding 32 bytes */
3594 usr->rid_user = rid_user;
3595 usr->rid_group = rid_group;
3597 usr->acct_ctrl = acct_ctrl;
3598 usr->unknown_3 = 0x0000;
3600 usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */
3601 usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */
3603 bzero(usr->padding_7, sizeof(usr->padding_7)); /* 0 - padding 16 bytes */
3604 usr->padding_8 = 0; /* 0 - padding 4 bytes */
3606 make_unistr2(&(usr->uni_mach_acct), mach_acct, len_mach_acct); /* unicode string for machine account */
3609 /*******************************************************************
3610 reads or writes a structure.
3611 ********************************************************************/
3612 void sam_io_user_info11(char *desc, SAM_USER_INFO_11 *usr, prs_struct *ps, int depth)
3614 if (usr == NULL) return;
3616 prs_debug(ps, depth, desc, "samr_io_r_unknown_24");
3621 prs_uint8s (False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0));
3623 smb_io_time("time", &(usr->expiry), ps, depth);
3625 prs_uint8s (False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1));
3627 smb_io_unihdr ("unihdr", &(usr->hdr_mach_acct), ps, depth);
3628 prs_uint32( "padding_2", ps, depth, &(usr->padding_2));
3630 prs_uint32( "ptr_1 ", ps, depth, &(usr->ptr_1 ));
3631 prs_uint8s (False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3));
3632 prs_uint32( "padding_4", ps, depth, &(usr->padding_4));
3634 prs_uint32( "ptr_2 ", ps, depth, &(usr->ptr_2 ));
3635 prs_uint32( "padding_5", ps, depth, &(usr->padding_5));
3637 prs_uint32( "ptr_3 ", ps, depth, &(usr->ptr_3 ));
3638 prs_uint8s (False, "padding_6", ps, depth, usr->padding_6, sizeof(usr->padding_6));
3640 prs_uint32( "rid_user ", ps, depth, &(usr->rid_user ));
3641 prs_uint32( "rid_group", ps, depth, &(usr->rid_group));
3642 prs_uint16( "acct_ctrl", ps, depth, &(usr->acct_ctrl));
3643 prs_uint16( "unknown_3", ps, depth, &(usr->unknown_3));
3644 prs_uint16( "unknown_4", ps, depth, &(usr->unknown_4));
3645 prs_uint16( "unknown_5", ps, depth, &(usr->unknown_5));
3647 prs_uint8s (False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7));
3648 prs_uint32( "padding_8", ps, depth, &(usr->padding_8));
3650 smb_io_unistr2("unistr2", &(usr->uni_mach_acct), True, ps, depth);
3653 prs_uint8s (False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9));
3656 /*************************************************************************
3657 make_sam_user_info21
3659 unknown_3 = 0x00ff ffff
3660 unknown_5 = 0x0002 0000
3661 unknown_6 = 0x0000 04ec
3663 *************************************************************************/
3664 void make_sam_user_info21(SAM_USER_INFO_21 *usr,
3667 NTTIME *logoff_time,
3668 NTTIME *kickoff_time,
3669 NTTIME *pass_last_set_time,
3670 NTTIME *pass_can_change_time,
3671 NTTIME *pass_must_change_time,
3694 int len_user_name = user_name != NULL ? strlen(user_name ) : 0;
3695 int len_full_name = full_name != NULL ? strlen(full_name ) : 0;
3696 int len_home_dir = home_dir != NULL ? strlen(home_dir ) : 0;
3697 int len_dir_drive = dir_drive != NULL ? strlen(dir_drive ) : 0;
3698 int len_logon_script = logon_script != NULL ? strlen(logon_script) : 0;
3699 int len_profile_path = profile_path != NULL ? strlen(profile_path) : 0;
3700 int len_description = description != NULL ? strlen(description ) : 0;
3701 int len_workstations = workstations != NULL ? strlen(workstations) : 0;
3702 int len_unknown_str = unknown_str != NULL ? strlen(unknown_str ) : 0;
3703 int len_munged_dial = munged_dial != NULL ? strlen(munged_dial ) : 0;
3705 usr->logon_time = *logon_time;
3706 usr->logoff_time = *logoff_time;
3707 usr->kickoff_time = *kickoff_time;
3708 usr->pass_last_set_time = *pass_last_set_time;
3709 usr->pass_can_change_time = *pass_can_change_time;
3710 usr->pass_must_change_time = *pass_must_change_time;
3712 make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 1);
3713 make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 1);
3714 make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 1);
3715 make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 1);
3716 make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 1);
3717 make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 1);
3718 make_uni_hdr(&(usr->hdr_acct_desc ), len_description , len_description , 1);
3719 make_uni_hdr(&(usr->hdr_workstations), len_workstations, len_workstations, 1);
3720 make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str , len_unknown_str , 1);
3721 make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial , len_munged_dial , 1);
3723 bzero(usr->nt_pwd, sizeof(usr->nt_pwd));
3724 bzero(usr->lm_pwd, sizeof(usr->lm_pwd));
3726 usr->user_rid = user_rid;
3727 usr->group_rid = group_rid;
3728 usr->acb_info = acb_info;
3729 usr->unknown_3 = unknown_3; /* 0x00ff ffff */
3731 usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
3732 usr->ptr_logon_hrs = hrs ? 1 : 0;
3733 usr->unknown_5 = unknown_5; /* 0x0002 0000 */
3735 bzero(usr->padding1, sizeof(usr->padding1));
3737 make_unistr2(&(usr->uni_user_name ), user_name , len_user_name );
3738 make_unistr2(&(usr->uni_full_name ), full_name , len_full_name );
3739 make_unistr2(&(usr->uni_home_dir ), home_dir , len_home_dir );
3740 make_unistr2(&(usr->uni_dir_drive ), dir_drive , len_dir_drive );
3741 make_unistr2(&(usr->uni_logon_script), logon_script, len_logon_script);
3742 make_unistr2(&(usr->uni_profile_path), profile_path, len_profile_path);
3743 make_unistr2(&(usr->uni_acct_desc ), description , len_description );
3744 make_unistr2(&(usr->uni_workstations), workstations, len_workstations);
3745 make_unistr2(&(usr->uni_unknown_str ), unknown_str , len_unknown_str );
3746 make_unistr2(&(usr->uni_munged_dial ), munged_dial , len_munged_dial );
3748 usr->unknown_6 = unknown_6; /* 0x0000 04ec */
3753 memcpy(&(usr->logon_hrs), hrs, sizeof(usr->logon_hrs));
3757 memset(&(usr->logon_hrs), 0xff, sizeof(usr->logon_hrs));
3762 /*******************************************************************
3763 reads or writes a structure.
3764 ********************************************************************/
3765 static void sam_io_user_info21(char *desc, SAM_USER_INFO_21 *usr, prs_struct *ps, int depth)
3767 if (usr == NULL) return;
3769 prs_debug(ps, depth, desc, "lsa_io_user_info");
3774 smb_io_time("logon_time ", &(usr->logon_time) , ps, depth);
3775 smb_io_time("logoff_time ", &(usr->logoff_time) , ps, depth);
3776 smb_io_time("kickoff_time ", &(usr->kickoff_time) , ps, depth);
3777 smb_io_time("pass_last_set_time ", &(usr->pass_last_set_time) , ps, depth);
3778 smb_io_time("pass_can_change_time ", &(usr->pass_can_change_time) , ps, depth);
3779 smb_io_time("pass_must_change_time", &(usr->pass_must_change_time), ps, depth);
3781 smb_io_unihdr("hdr_user_name ", &(usr->hdr_user_name) , ps, depth); /* username unicode string header */
3782 smb_io_unihdr("hdr_full_name ", &(usr->hdr_full_name) , ps, depth); /* user's full name unicode string header */
3783 smb_io_unihdr("hdr_home_dir ", &(usr->hdr_home_dir) , ps, depth); /* home directory unicode string header */
3784 smb_io_unihdr("hdr_dir_drive ", &(usr->hdr_dir_drive) , ps, depth); /* home directory drive */
3785 smb_io_unihdr("hdr_logon_script", &(usr->hdr_logon_script), ps, depth); /* logon script unicode string header */
3786 smb_io_unihdr("hdr_profile_path", &(usr->hdr_profile_path), ps, depth); /* profile path unicode string header */
3787 smb_io_unihdr("hdr_acct_desc ", &(usr->hdr_acct_desc ) , ps, depth); /* account description */
3788 smb_io_unihdr("hdr_workstations", &(usr->hdr_workstations), ps, depth); /* workstations user can log on from */
3789 smb_io_unihdr("hdr_unknown_str ", &(usr->hdr_unknown_str ), ps, depth); /* unknown string */
3790 smb_io_unihdr("hdr_munged_dial ", &(usr->hdr_munged_dial ), ps, depth); /* workstations user can log on from */
3792 prs_uint8s (False, "lm_pwd ", ps, depth, usr->lm_pwd , sizeof(usr->lm_pwd ));
3793 prs_uint8s (False, "nt_pwd ", ps, depth, usr->nt_pwd , sizeof(usr->nt_pwd ));
3795 prs_uint32("user_rid ", ps, depth, &(usr->user_rid )); /* User ID */
3796 prs_uint32("group_rid ", ps, depth, &(usr->group_rid )); /* Group ID */
3797 prs_uint16("acb_info ", ps, depth, &(usr->acb_info )); /* Group ID */
3800 prs_uint32("unknown_3 ", ps, depth, &(usr->unknown_3 ));
3801 prs_uint16("logon_divs ", ps, depth, &(usr->logon_divs )); /* logon divisions per week */
3803 prs_uint32("ptr_logon_hrs ", ps, depth, &(usr->ptr_logon_hrs));
3804 prs_uint32("unknown_5 ", ps, depth, &(usr->unknown_5 ));
3806 prs_uint8s (False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1));
3808 /* here begins pointed-to data */
3810 smb_io_unistr2("uni_user_name ", &(usr->uni_user_name) , usr->hdr_user_name .buffer, ps, depth); /* username unicode string */
3811 smb_io_unistr2("uni_full_name ", &(usr->uni_full_name) , usr->hdr_full_name .buffer, ps, depth); /* user's full name unicode string */
3812 smb_io_unistr2("uni_home_dir ", &(usr->uni_home_dir) , usr->hdr_home_dir .buffer, ps, depth); /* home directory unicode string */
3813 smb_io_unistr2("uni_dir_drive ", &(usr->uni_dir_drive) , usr->hdr_dir_drive .buffer, ps, depth); /* home directory drive unicode string */
3814 smb_io_unistr2("uni_logon_script", &(usr->uni_logon_script), usr->hdr_logon_script.buffer, ps, depth); /* logon script unicode string */
3815 smb_io_unistr2("uni_profile_path", &(usr->uni_profile_path), usr->hdr_profile_path.buffer, ps, depth); /* profile path unicode string */
3816 smb_io_unistr2("uni_acct_desc ", &(usr->uni_acct_desc ), usr->hdr_acct_desc .buffer, ps, depth); /* user description unicode string */
3817 smb_io_unistr2("uni_workstations", &(usr->uni_workstations), usr->hdr_workstations.buffer, ps, depth); /* worksations user can log on from */
3818 smb_io_unistr2("uni_unknown_str ", &(usr->uni_unknown_str ), usr->hdr_unknown_str .buffer, ps, depth); /* unknown string */
3819 smb_io_unistr2("uni_munged_dial ", &(usr->uni_munged_dial ), usr->hdr_munged_dial .buffer, ps, depth); /* worksations user can log on from */
3821 prs_uint32("unknown_6 ", ps, depth, &(usr->unknown_6 ));
3822 prs_uint32("padding4 ", ps, depth, &(usr->padding4 ));
3824 if (usr->ptr_logon_hrs)
3826 sam_io_logon_hrs("logon_hrs", &(usr->logon_hrs) , ps, depth);
3832 /*******************************************************************
3833 makes a SAMR_R_QUERY_USERINFO structure.
3834 ********************************************************************/
3835 void make_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO *r_u,
3836 uint16 switch_value, void *info, uint32 status)
3839 if (r_u == NULL || info == NULL) return;
3841 DEBUG(5,("make_samr_r_query_userinfo\n"));
3844 r_u->switch_value = 0;
3848 r_u->switch_value = switch_value;
3850 switch (switch_value)
3855 r_u->info.id10 = (SAM_USER_INFO_10*)info;
3863 r_u->info.id11 = (SAM_USER_INFO_11*)info;
3871 r_u->info.id21 = (SAM_USER_INFO_21*)info;
3878 DEBUG(4,("make_samr_r_query_userinfo: unsupported switch level\n"));
3884 r_u->status = status; /* return status */
3887 /*******************************************************************
3888 reads or writes a structure.
3889 ********************************************************************/
3890 void samr_io_r_query_userinfo(char *desc, SAMR_R_QUERY_USERINFO *r_u, prs_struct *ps, int depth)
3892 if (r_u == NULL) return;
3894 prs_debug(ps, depth, desc, "samr_io_r_query_userinfo");
3899 prs_uint32("ptr ", ps, depth, &(r_u->ptr ));
3900 prs_uint16("switch_value", ps, depth, &(r_u->switch_value));
3903 if (r_u->ptr != 0 && r_u->switch_value != 0)
3905 switch (r_u->switch_value)
3909 if (r_u->info.id10 != NULL)
3911 sam_io_user_info10("", r_u->info.id10, ps, depth);
3915 DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
3923 if (r_u->info.id11 != NULL)
3925 sam_io_user_info11("", r_u->info.id11, ps, depth);
3929 DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
3937 if (r_u->info.id21 != NULL)
3939 sam_io_user_info21("", r_u->info.id21, ps, depth);
3943 DEBUG(2,("samr_io_r_query_userinfo: info pointer not initialised\n"));
3950 DEBUG(2,("samr_io_r_query_userinfo: unknown switch level\n"));
3957 prs_uint32("status", ps, depth, &(r_u->status));
3960 /*******************************************************************
3961 reads or writes a structure.
3962 ********************************************************************/
3963 void samr_io_q_unknown_32(char *desc, SAMR_Q_UNKNOWN_32 *q_u, prs_struct *ps, int depth)
3965 if (q_u == NULL) return;
3967 prs_debug(ps, depth, desc, "samr_io_q_unknown_32");
3972 smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
3975 smb_io_unihdr ("", &(q_u->hdr_mach_acct), ps, depth);
3976 smb_io_unistr2("", &(q_u->uni_mach_acct), q_u->hdr_mach_acct.buffer, ps, depth);
3980 prs_uint32("acct_ctrl", ps, depth, &(q_u->acct_ctrl));
3981 prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1));
3982 prs_uint16("unknown_2", ps, depth, &(q_u->unknown_2));
3985 /*******************************************************************
3986 reads or writes a structure.
3987 ********************************************************************/
3988 void samr_io_r_unknown_32(char *desc, SAMR_R_UNKNOWN_32 *r_u, prs_struct *ps, int depth)
3990 if (r_u == NULL) return;
3992 prs_debug(ps, depth, desc, "samr_io_r_unknown_32");
3997 smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
4000 prs_uint32("status", ps, depth, &(r_u->status));
4004 /*******************************************************************
4005 makes a SAMR_Q_CONNECT structure.
4006 ********************************************************************/
4007 void make_samr_q_connect(SAMR_Q_CONNECT *q_u,
4008 char *srv_name, uint32 unknown_0)
4010 int len_srv_name = strlen(srv_name);
4012 if (q_u == NULL) return;
4014 DEBUG(5,("make_samr_q_connect\n"));
4016 /* make PDC server name \\server */
4017 q_u->ptr_srv_name = len_srv_name > 0 ? 1 : 0;
4018 make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name+1);
4020 /* example values: 0x0000 0002 */
4021 q_u->unknown_0 = unknown_0;
4025 /*******************************************************************
4026 reads or writes a structure.
4027 ********************************************************************/
4028 void samr_io_q_connect(char *desc, SAMR_Q_CONNECT *q_u, prs_struct *ps, int depth)
4030 if (q_u == NULL) return;
4032 prs_debug(ps, depth, desc, "samr_io_q_connect");
4037 prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name));
4038 smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps, depth);
4042 prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 ));
4045 /*******************************************************************
4046 reads or writes a structure.
4047 ********************************************************************/
4048 void samr_io_r_connect(char *desc, SAMR_R_CONNECT *r_u, prs_struct *ps, int depth)
4050 if (r_u == NULL) return;
4052 prs_debug(ps, depth, desc, "samr_io_r_connect");
4057 smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth);
4060 prs_uint32("status", ps, depth, &(r_u->status));
4063 /*******************************************************************
4064 makes a SAMR_Q_CONNECT_ANON structure.
4065 ********************************************************************/
4066 void make_samr_q_connect_anon(SAMR_Q_CONNECT_ANON *q_u)
4068 if (q_u == NULL) return;
4070 DEBUG(5,("make_samr_q_connect_anon\n"));
4073 q_u->unknown_0 = 0x5c; /* server name (?!!) */
4074 q_u->unknown_1 = 0x01;
4075 q_u->unknown_2 = 0x20;
4079 /*******************************************************************
4080 reads or writes a structure.
4081 ********************************************************************/
4082 void samr_io_q_connect_anon(char *desc, SAMR_Q_CONNECT_ANON *q_u, prs_struct *ps, int depth)
4084 if (q_u == NULL) return;
4086 prs_debug(ps, depth, desc, "samr_io_q_connect_anon");
4091 prs_uint32("ptr ", ps, depth, &(q_u->ptr ));
4092 prs_uint16("unknown_0", ps, depth, &(q_u->unknown_0));
4093 prs_uint16("unknown_1", ps, depth, &(q_u->unknown_1));
4094 prs_uint32("unknown_2", ps, depth, &(q_u->unknown_2));
4097 /*******************************************************************
4098 reads or writes a structure.
4099 ********************************************************************/
4100 void samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON *r_u, prs_struct *ps, int depth)
4102 if (r_u == NULL) return;
4104 prs_debug(ps, depth, desc, "samr_io_r_connect_anon");
4109 smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth);
4112 prs_uint32("status", ps, depth, &(r_u->status));
4115 /*******************************************************************
4116 makes a SAMR_Q_UNKNOWN_38 structure.
4117 ********************************************************************/
4118 void make_samr_q_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, char *srv_name)
4120 int len_srv_name = strlen(srv_name);
4122 if (q_u == NULL) return;
4124 DEBUG(5,("make_samr_q_unknown_38\n"));
4127 make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0);
4128 make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name);
4132 /*******************************************************************
4133 reads or writes a structure.
4134 ********************************************************************/
4135 void samr_io_q_unknown_38(char *desc, SAMR_Q_UNKNOWN_38 *q_u, prs_struct *ps, int depth)
4137 if (q_u == NULL) return;
4139 prs_debug(ps, depth, desc, "samr_io_q_unknown_38");
4144 prs_uint32("ptr", ps, depth, &(q_u->ptr));
4147 smb_io_unihdr ("", &(q_u->hdr_srv_name), ps, depth);
4148 smb_io_unistr2("", &(q_u->uni_srv_name), q_u->hdr_srv_name.buffer, ps, depth);
4152 /*******************************************************************
4153 makes a SAMR_R_UNKNOWN_38 structure.
4154 ********************************************************************/
4155 void make_samr_r_unknown_38(SAMR_R_UNKNOWN_38 *r_u)
4157 if (r_u == NULL) return;
4159 DEBUG(5,("make_r_unknown_38\n"));
4167 /*******************************************************************
4168 reads or writes a structure.
4169 ********************************************************************/
4170 void samr_io_r_unknown_38(char *desc, SAMR_R_UNKNOWN_38 *r_u, prs_struct *ps, int depth)
4172 if (r_u == NULL) return;
4174 prs_debug(ps, depth, desc, "samr_io_r_unknown_38");
4179 prs_uint16("unk_0", ps, depth, &(r_u->unk_0));
4181 prs_uint16("unk_1", ps, depth, &(r_u->unk_1));
4183 prs_uint16("unk_2", ps, depth, &(r_u->unk_2));
4185 prs_uint16("unk_3", ps, depth, &(r_u->unk_3));
4189 /*******************************************************************
4190 make a SAMR_ENC_PASSWD structure.
4191 ********************************************************************/
4192 void make_enc_passwd(SAMR_ENC_PASSWD *pwd, char pass[512])
4194 if (pwd == NULL) return;
4197 memcpy(pwd->pass, pass, sizeof(pwd->pass));
4200 /*******************************************************************
4201 reads or writes a SAMR_ENC_PASSWD structure.
4202 ********************************************************************/
4203 void samr_io_enc_passwd(char *desc, SAMR_ENC_PASSWD *pwd, prs_struct *ps, int depth)
4205 if (pwd == NULL) return;
4207 prs_debug(ps, depth, desc, "samr_io_enc_passwd");
4212 prs_uint32("ptr", ps, depth, &(pwd->ptr));
4213 prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass));
4216 /*******************************************************************
4217 makes a SAMR_ENC_HASH structure.
4218 ********************************************************************/
4219 void make_enc_hash(SAMR_ENC_HASH *hsh, uchar hash[16])
4221 if (hsh == NULL) return;
4224 memcpy(hsh->hash, hash, sizeof(hsh->hash));
4227 /*******************************************************************
4228 reads or writes a SAMR_ENC_HASH structure.
4229 ********************************************************************/
4230 void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth)
4232 if (hsh == NULL) return;
4234 prs_debug(ps, depth, desc, "samr_io_enc_hash");
4239 prs_uint32("ptr ", ps, depth, &(hsh->ptr));
4240 prs_uint8s(False, "hash", ps, depth, hsh->hash, sizeof(hsh->hash));
4243 /*******************************************************************
4244 makes a SAMR_R_UNKNOWN_38 structure.
4245 ********************************************************************/
4246 void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u,
4247 char *dest_host, char *user_name,
4248 char nt_newpass[516], uchar nt_oldhash[16],
4249 char lm_newpass[516], uchar lm_oldhash[16])
4251 int len_dest_host = strlen(dest_host);
4252 int len_user_name = strlen(user_name);
4254 if (q_u == NULL) return;
4256 DEBUG(5,("make_samr_q_chgpasswd_user\n"));
4259 make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host, len_dest_host, len_dest_host != 0);
4260 make_unistr2(&(q_u->uni_dest_host), dest_host, len_dest_host);
4261 make_uni_hdr(&(q_u->hdr_user_name), len_user_name, len_user_name, len_user_name != 0);
4262 make_unistr2(&(q_u->uni_user_name), user_name, len_user_name);
4264 make_enc_passwd(&(q_u->nt_newpass), nt_newpass);
4265 make_enc_hash (&(q_u->nt_oldhash), nt_oldhash);
4267 q_u->unknown = 0x01;
4269 make_enc_passwd(&(q_u->lm_newpass), lm_newpass);
4270 make_enc_hash (&(q_u->lm_oldhash), lm_oldhash);
4273 /*******************************************************************
4274 reads or writes a structure.
4275 ********************************************************************/
4276 void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth)
4278 if (q_u == NULL) return;
4280 prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user");
4285 prs_uint32("ptr_0", ps, depth, &(q_u->ptr_0));
4287 smb_io_unihdr ("", &(q_u->hdr_dest_host), ps, depth);
4288 smb_io_unistr2("", &(q_u->uni_dest_host), q_u->hdr_dest_host.buffer, ps, depth);
4289 smb_io_unihdr ("", &(q_u->hdr_user_name), ps, depth);
4290 smb_io_unistr2("", &(q_u->uni_user_name), q_u->hdr_user_name.buffer, ps, depth);
4292 samr_io_enc_passwd("nt_newpass", &(q_u->nt_newpass), ps, depth);
4294 samr_io_enc_hash ("nt_oldhash", &(q_u->nt_oldhash), ps, depth);
4296 prs_uint32("unknown", ps, depth, &(q_u->unknown));
4298 samr_io_enc_passwd("lm_newpass", &(q_u->lm_newpass), ps, depth);
4300 samr_io_enc_hash ("lm_oldhash", &(q_u->lm_oldhash), ps, depth);
4303 /*******************************************************************
4304 makes a SAMR_R_CHGPASSWD_USER structure.
4305 ********************************************************************/
4306 void make_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER *r_u, uint32 status)
4308 if (r_u == NULL) return;
4310 DEBUG(5,("make_r_chgpasswd_user\n"));
4312 r_u->status = status;
4315 /*******************************************************************
4316 reads or writes a structure.
4317 ********************************************************************/
4318 void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth)
4320 if (r_u == NULL) return;
4322 prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user");
4327 prs_uint32("status", ps, depth, &(r_u->status));