2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1997,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
7 * Copyright (C) Paul Ashton 1997.
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;
29 /*******************************************************************
30 creates a LSA_TRANS_NAME structure.
31 ********************************************************************/
32 void make_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
33 uint32 sid_name_use, char *name, uint32 idx)
35 int len_name = strlen(name);
37 trn->sid_name_use = sid_name_use;
38 make_uni_hdr(&(trn->hdr_name), len_name, len_name, 1);
39 make_unistr2(uni_name, name, len_name);
40 trn->domain_idx = idx;
43 /*******************************************************************
44 reads or writes a LSA_TRANS_NAME structure.
45 ********************************************************************/
46 static void lsa_io_trans_name(char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, int depth)
48 if (trn == NULL) return;
50 prs_debug(ps, depth, desc, "lsa_io_trans_name");
55 prs_uint32("sid_name_use", ps, depth, &(trn->sid_name_use));
56 smb_io_unihdr ("hdr_name", &(trn->hdr_name), ps, depth);
57 prs_uint32("domain_idx ", ps, depth, &(trn->domain_idx ));
60 /*******************************************************************
61 reads or writes a DOM_R_REF structure.
62 ********************************************************************/
63 static void lsa_io_dom_r_ref(char *desc, DOM_R_REF *r_r, prs_struct *ps, int depth)
67 prs_debug(ps, depth, desc, "smb_io_dom_r_ref");
70 if (r_r == NULL) return;
74 prs_uint32("undoc_buffer ", ps, depth, &(r_r->undoc_buffer )); /* undocumented buffer pointer. */
75 prs_uint32("num_ref_doms_1", ps, depth, &(r_r->num_ref_doms_1)); /* num referenced domains? */
76 prs_uint32("ptr_ref_dom ", ps, depth, &(r_r->ptr_ref_dom )); /* undocumented buffer pointer. */
77 prs_uint32("max_entries ", ps, depth, &(r_r->max_entries )); /* 32 - max number of entries */
79 SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1);
81 if (r_r->ptr_ref_dom != 0)
83 prs_uint32("num_ref_doms_2", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */
84 SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2);
86 for (i = 0; i < r_r->num_ref_doms_1; i++)
90 slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i);
91 smb_io_unihdr(t, &(r_r->hdr_ref_dom[i].hdr_dom_name), ps, depth);
93 slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i);
94 prs_uint32(t, ps, depth, &(r_r->hdr_ref_dom[i].ptr_dom_sid));
97 for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++)
101 if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0)
103 slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i);
104 smb_io_unistr2(t, &(r_r->ref_dom[n].uni_dom_name), True, ps, depth); /* domain name unicode string */
108 if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0)
110 slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i);
111 smb_io_dom_sid2("", &(r_r->ref_dom[s].ref_dom), ps, depth); /* referenced domain SIDs */
119 /*******************************************************************
120 makes an LSA_SEC_QOS structure.
121 ********************************************************************/
122 void make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff,
125 if (qos == NULL) return;
127 DEBUG(5,("make_lsa_sec_qos\n"));
129 qos->len = 0x0c; /* length of quality of service block, in bytes */
130 qos->sec_imp_level = imp_lev;
131 qos->sec_ctxt_mode = ctxt;
132 qos->effective_only = eff;
133 qos->unknown = unknown;
136 /*******************************************************************
137 reads or writes an LSA_SEC_QOS structure.
138 ********************************************************************/
139 static void lsa_io_sec_qos(char *desc, LSA_SEC_QOS *qos, prs_struct *ps, int depth)
143 if (qos == NULL) return;
145 prs_debug(ps, depth, desc, "lsa_io_obj_qos");
152 /* these pointers had _better_ be zero, because we don't know
155 prs_uint32("len ", ps, depth, &(qos->len )); /* 0x18 - length (in bytes) inc. the length field. */
156 prs_uint16("sec_imp_level ", ps, depth, &(qos->sec_imp_level ));
157 prs_uint8 ("sec_ctxt_mode ", ps, depth, &(qos->sec_ctxt_mode ));
158 prs_uint8 ("effective_only", ps, depth, &(qos->effective_only));
159 prs_uint32("unknown ", ps, depth, &(qos->unknown ));
161 if (qos->len != ps->offset - start)
163 DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n",
164 qos->len, ps->offset - start));
169 /*******************************************************************
170 makes an LSA_OBJ_ATTR structure.
171 ********************************************************************/
172 void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos)
174 if (attr == NULL) return;
176 DEBUG(5,("make_lsa_obj_attr\n"));
178 attr->len = 0x18; /* length of object attribute block, in bytes */
179 attr->ptr_root_dir = 0;
180 attr->ptr_obj_name = 0;
181 attr->attributes = attributes;
182 attr->ptr_sec_desc = 0;
186 attr->ptr_sec_qos = 1;
191 attr->ptr_sec_qos = 0;
192 attr->sec_qos = NULL;
196 /*******************************************************************
197 reads or writes an LSA_OBJ_ATTR structure.
198 ********************************************************************/
199 static void lsa_io_obj_attr(char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps, int depth)
203 if (attr == NULL) return;
205 prs_debug(ps, depth, desc, "lsa_io_obj_attr");
212 /* these pointers had _better_ be zero, because we don't know
215 prs_uint32("len ", ps, depth, &(attr->len )); /* 0x18 - length (in bytes) inc. the length field. */
216 prs_uint32("ptr_root_dir", ps, depth, &(attr->ptr_root_dir)); /* 0 - root directory (pointer) */
217 prs_uint32("ptr_obj_name", ps, depth, &(attr->ptr_obj_name)); /* 0 - object name (pointer) */
218 prs_uint32("attributes ", ps, depth, &(attr->attributes )); /* 0 - attributes (undocumented) */
219 prs_uint32("ptr_sec_desc", ps, depth, &(attr->ptr_sec_desc)); /* 0 - security descriptior (pointer) */
220 prs_uint32("ptr_sec_qos ", ps, depth, &(attr->ptr_sec_qos )); /* security quality of service (pointer) */
222 if (attr->len != ps->offset - start)
224 DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n",
225 attr->len, ps->offset - start));
228 if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL)
230 lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth);
235 /*******************************************************************
236 makes an LSA_Q_OPEN_POL structure.
237 ********************************************************************/
238 void make_q_open_pol(LSA_Q_OPEN_POL *r_q, uint16 system_name,
240 uint32 desired_access,
243 if (r_q == NULL) return;
245 DEBUG(5,("make_open_pol: attr:%d da:%d\n", attributes, desired_access));
247 r_q->ptr = 1; /* undocumented pointer */
251 r_q->des_access = desired_access;
254 r_q->system_name = system_name;
255 make_lsa_obj_attr(&(r_q->attr ), attributes, qos);
258 /*******************************************************************
259 reads or writes an LSA_Q_OPEN_POL structure.
260 ********************************************************************/
261 void lsa_io_q_open_pol(char *desc, LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth)
263 if (r_q == NULL) return;
265 prs_debug(ps, depth, desc, "lsa_io_q_open_pol");
268 prs_uint32("ptr ", ps, depth, &(r_q->ptr ));
269 prs_uint16("system_name", ps, depth, &(r_q->system_name ));
272 lsa_io_obj_attr("", &(r_q->attr ), ps, depth);
274 if (r_q->attr.ptr_sec_qos == 0)
276 prs_uint32("des_access", ps, depth, &(r_q->des_access));
280 /*******************************************************************
281 reads or writes an LSA_R_OPEN_POL structure.
282 ********************************************************************/
283 void lsa_io_r_open_pol(char *desc, LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth)
285 if (r_p == NULL) return;
287 prs_debug(ps, depth, desc, "lsa_io_r_open_pol");
290 smb_io_pol_hnd("", &(r_p->pol), ps, depth);
292 prs_uint32("status", ps, depth, &(r_p->status));
295 /*******************************************************************
296 makes an LSA_Q_OPEN_POL2 structure.
297 ********************************************************************/
298 void make_q_open_pol2(LSA_Q_OPEN_POL2 *r_q, char *server_name,
300 uint32 desired_access,
303 if (r_q == NULL) return;
305 DEBUG(5,("make_open_pol2: attr:%d da:%d\n", attributes, desired_access));
307 r_q->ptr = 1; /* undocumented pointer */
311 r_q->des_access = desired_access;
314 make_unistr2 (&(r_q->uni_server_name), server_name, strlen(server_name));
315 make_lsa_obj_attr(&(r_q->attr ), attributes, qos);
318 /*******************************************************************
319 reads or writes an LSA_Q_OPEN_POL2 structure.
320 ********************************************************************/
321 void lsa_io_q_open_pol2(char *desc, LSA_Q_OPEN_POL2 *r_q, prs_struct *ps, int depth)
323 if (r_q == NULL) return;
325 prs_debug(ps, depth, desc, "lsa_io_q_open_pol2");
328 prs_uint32("ptr ", ps, depth, &(r_q->ptr ));
330 smb_io_unistr2 ("", &(r_q->uni_server_name), r_q->ptr, ps, depth);
331 lsa_io_obj_attr("", &(r_q->attr ), ps, depth);
333 if (r_q->attr.ptr_sec_qos == 0)
335 prs_uint32("des_access", ps, depth, &(r_q->des_access));
339 /*******************************************************************
340 reads or writes an LSA_R_OPEN_POL2 structure.
341 ********************************************************************/
342 void lsa_io_r_open_pol2(char *desc, LSA_R_OPEN_POL2 *r_p, prs_struct *ps, int depth)
344 if (r_p == NULL) return;
346 prs_debug(ps, depth, desc, "lsa_io_r_open_pol2");
349 smb_io_pol_hnd("", &(r_p->pol), ps, depth);
351 prs_uint32("status", ps, depth, &(r_p->status));
354 /*******************************************************************
355 makes an LSA_Q_QUERY_INFO structure.
356 ********************************************************************/
357 void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class)
359 if (q_q == NULL || hnd == NULL) return;
361 DEBUG(5,("make_q_query\n"));
363 memcpy(&(q_q->pol), hnd, sizeof(q_q->pol));
365 q_q->info_class = info_class;
368 /*******************************************************************
369 reads or writes an LSA_Q_QUERY_INFO structure.
370 ********************************************************************/
371 void lsa_io_q_query(char *desc, LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth)
373 if (q_q == NULL) return;
375 prs_debug(ps, depth, desc, "lsa_io_q_query");
378 smb_io_pol_hnd("", &(q_q->pol), ps, depth);
380 prs_uint16("info_class", ps, depth, &(q_q->info_class));
383 /*******************************************************************
384 makes an LSA_Q_OPEN_SECRET structure.
385 ********************************************************************/
386 void make_q_open_secret(LSA_Q_OPEN_SECRET *q_o, POLICY_HND *pol_hnd,
387 char *secret_name, uint32 desired_access)
389 int len = strlen(secret_name);
391 if (q_o == NULL) return;
393 DEBUG(5,("make_q_open_secret"));
395 memcpy(&(q_o->pol), pol_hnd, sizeof(q_o->pol));
397 make_uni_hdr(&(q_o->hdr_secret), len, len, 1);
398 make_unistr2(&(q_o->uni_secret), secret_name, len);
400 q_o->des_access = desired_access;
403 /*******************************************************************
404 reads or writes an LSA_Q_OPEN_SECRET structure.
405 ********************************************************************/
406 void lsa_io_q_open_secret(char *desc, LSA_Q_OPEN_SECRET *q_o, prs_struct *ps, int depth)
408 if (q_o == NULL) return;
410 prs_debug(ps, depth, desc, "lsa_io_q_open_secret");
413 smb_io_pol_hnd("", &(q_o->pol), ps, depth);
416 smb_io_unihdr ("", &(q_o->hdr_secret), ps, depth);
417 smb_io_unistr2("", &(q_o->uni_secret), 1, ps, depth);
420 prs_uint32("des_access", ps, depth, &(q_o->des_access));
423 /*******************************************************************
424 reads or writes an LSA_R_OPEN_SECRET structure.
425 ********************************************************************/
426 void lsa_io_r_open_secret(char *desc, LSA_R_OPEN_SECRET *r_o, prs_struct *ps, int depth)
428 if (r_o == NULL) return;
430 prs_debug(ps, depth, desc, "lsa_io_r_open_secret");
433 smb_io_pol_hnd("", &(r_o->pol), ps, depth);
435 prs_uint32("status", ps, depth, &(r_o->status));
438 /*******************************************************************
439 reads or writes an LSA_SECRET_VALUE structure.
440 ********************************************************************/
441 void lsa_io_secret_value(char *desc, LSA_SECRET_VALUE *value, prs_struct *ps, int depth)
443 if (value == NULL) return;
445 prs_debug(ps, depth, desc, "lsa_io_secret_value");
449 prs_uint32("ptr_secret", ps, depth, &(value->ptr_secret));
451 if (value->ptr_secret == 0)
456 smb_io_strhdr2("hdr_secret", &(value->hdr_secret), ps, depth);
457 smb_io_string2("secret" , &(value->secret ),
458 value->hdr_secret.buffer, ps, depth);
461 /*******************************************************************
462 reads or writes an LSA_SECRET_INFO structure.
463 ********************************************************************/
464 void lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth)
466 if (info == NULL) return;
468 prs_debug(ps, depth, desc, "lsa_io_secret_info");
472 prs_uint32("ptr_value ", ps, depth, &(info->ptr_value ));
474 if (info->ptr_value != 0)
476 lsa_io_secret_value("", &(info->value), ps, depth);
480 prs_uint32("ptr_update", ps, depth, &(info->ptr_update));
482 if (info->ptr_update != 0)
488 smb_io_time("last_update", &(info->last_update), ps, depth);
492 /*******************************************************************
493 makes an LSA_Q_QUERY_SECRET structure.
494 ********************************************************************/
495 void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol)
497 if (q_q == NULL) return;
499 DEBUG(5,("make_q_query_secret"));
501 memcpy(&(q_q->pol), pol, sizeof(q_q->pol));
504 q_q->info.ptr_value = 1;
505 q_q->info.value.ptr_secret = 0;
507 /* Want last change time */
508 q_q->info.ptr_update = 1;
510 /* Don't care about old info */
511 q_q->oldinfo.ptr_value = 0;
512 q_q->oldinfo.ptr_update = 0;
515 /*******************************************************************
516 reads or writes an LSA_Q_QUERY_SECRET structure.
517 ********************************************************************/
518 void lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth)
520 if (q_q == NULL) return;
522 prs_debug(ps, depth, desc, "lsa_io_q_query_secret");
525 smb_io_pol_hnd("", &(q_q->pol), ps, depth);
527 lsa_io_secret_info("", &(q_q->info ), ps, depth);
528 lsa_io_secret_info("", &(q_q->oldinfo), ps, depth);
531 /*******************************************************************
532 reads or writes an LSA_Q_QUERY_SECRET structure.
533 ********************************************************************/
534 void lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth)
536 if (r_q == NULL) return;
538 prs_debug(ps, depth, desc, "lsa_io_r_query_secret");
541 lsa_io_secret_info("", &(r_q->info ), ps, depth);
542 lsa_io_secret_info("", &(r_q->oldinfo), ps, depth);
545 prs_uint32("status", ps, depth, &(r_q->status));
548 /*******************************************************************
549 reads or writes an LSA_Q_ENUM_TRUST_DOM structure.
550 ********************************************************************/
551 void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth)
553 if (q_e == NULL) return;
555 prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom");
559 smb_io_pol_hnd("", &(q_e->pol), ps, depth);
561 prs_uint32("enum_context ", ps, depth, &(q_e->enum_context ));
562 prs_uint32("preferred_len", ps, depth, &(q_e->preferred_len));
565 /*******************************************************************
566 makes an LSA_R_ENUM_TRUST_DOM structure.
567 ********************************************************************/
568 void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e,
569 uint32 enum_context, char *domain_name, DOM_SID *domain_sid,
572 if (r_e == NULL) return;
574 DEBUG(5,("make_r_enum_trust_dom\n"));
576 r_e->enum_context = enum_context;
580 int len_domain_name = strlen(domain_name);
582 r_e->num_domains = 1;
583 r_e->ptr_enum_domains = 1;
584 r_e->num_domains2 = 1;
586 make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name, len_domain_name, 4);
587 make_unistr2 (&(r_e->uni_domain_name ), domain_name, len_domain_name);
588 make_dom_sid2(&(r_e->other_domain_sid), domain_sid);
592 r_e->num_domains = 0;
593 r_e->ptr_enum_domains = 0;
596 r_e->status = status;
599 /*******************************************************************
600 reads or writes an LSA_R_ENUM_TRUST_DOM structure.
601 ********************************************************************/
602 void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth)
604 if (r_e == NULL) return;
606 prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
609 prs_uint32("enum_context ", ps, depth, &(r_e->enum_context ));
610 prs_uint32("num_domains ", ps, depth, &(r_e->num_domains ));
611 prs_uint32("ptr_enum_domains", ps, depth, &(r_e->ptr_enum_domains));
613 if (r_e->ptr_enum_domains != 0)
615 prs_uint32("num_domains2", ps, depth, &(r_e->num_domains2));
616 smb_io_unihdr2 ("", &(r_e->hdr_domain_name ), ps, depth);
617 smb_io_unistr2 ("", &(r_e->uni_domain_name ), r_e->hdr_domain_name.buffer, ps, depth);
618 smb_io_dom_sid2("", &(r_e->other_domain_sid), ps, depth);
621 prs_uint32("status", ps, depth, &(r_e->status));
624 /*******************************************************************
625 reads or writes an LSA_Q_QUERY_INFO structure.
626 ********************************************************************/
627 void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth)
629 if (r_q == NULL) return;
631 prs_debug(ps, depth, desc, "lsa_io_r_query");
634 prs_uint32("undoc_buffer", ps, depth, &(r_q->undoc_buffer));
636 if (r_q->undoc_buffer != 0)
638 prs_uint16("info_class", ps, depth, &(r_q->info_class));
640 switch (r_q->info_class)
644 smb_io_dom_query_3("", &(r_q->dom.id3), ps, depth);
649 smb_io_dom_query_5("", &(r_q->dom.id3), ps, depth);
660 prs_uint32("status", ps, depth, &(r_q->status));
663 /*******************************************************************
664 makes a LSA_SID_ENUM structure.
665 ********************************************************************/
666 void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids)
669 if (sen == NULL || sids == NULL) return;
671 DEBUG(5,("make_lsa_sid_enum\n"));
673 sen->num_entries = num_entries;
674 sen->ptr_sid_enum = num_entries != 0 ? 1 : 0;
675 sen->num_entries2 = num_entries;
677 SMB_ASSERT_ARRAY(sen->sid, sen->num_entries);
679 for (i = 0, i2 = 0; i < num_entries; i++)
684 make_dom_sid2(&(sen->sid[i2]), sids[i]);
694 /*******************************************************************
695 reads or writes a LSA_SID_ENUM structure.
696 ********************************************************************/
697 static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen,
698 prs_struct *ps, int depth)
702 if (sen == NULL) return;
704 prs_debug(ps, depth, desc, "lsa_io_sid_enum");
709 prs_uint32("num_entries ", ps, depth, &(sen->num_entries));
710 prs_uint32("ptr_sid_enum", ps, depth, &(sen->ptr_sid_enum));
711 prs_uint32("num_entries2", ps, depth, &(sen->num_entries2));
713 SMB_ASSERT_ARRAY(sen->ptr_sid, sen->num_entries);
715 for (i = 0; i < sen->num_entries; i++)
718 slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i);
719 prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */
722 SMB_ASSERT_ARRAY(sen->sid, sen->num_entries);
724 for (i = 0; i < sen->num_entries; i++)
727 slprintf(temp, sizeof(temp) - 1, "sid[%d]", i);
728 smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */
732 /*******************************************************************
733 reads or writes a structure.
734 ********************************************************************/
735 static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
736 prs_struct *ps, int depth)
740 if (trn == NULL) return;
742 prs_debug(ps, depth, desc, "lsa_io_trans_names");
747 prs_uint32("num_entries ", ps, depth, &(trn->num_entries));
748 prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names));
750 if (trn->ptr_trans_names != 0)
752 prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2));
753 SMB_ASSERT_ARRAY(trn->name, trn->num_entries);
755 for (i = 0; i < trn->num_entries2; i++)
758 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
760 lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */
763 for (i = 0; i < trn->num_entries2; i++)
766 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
768 smb_io_unistr2(t, &(trn->uni_name[i]), trn->name[i].hdr_name.buffer, ps, depth);
774 /*******************************************************************
776 ********************************************************************/
777 void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
778 int num_sids, DOM_SID **sids,
781 if (q_l == NULL) return;
783 DEBUG(5,("make_q_lookup_sids\n"));
785 memcpy(&(q_l->pol), hnd, sizeof(q_l->pol));
786 make_lsa_sid_enum(&(q_l->sids), num_sids, sids);
788 q_l->names.ptr_trans_names = 0;
789 q_l->names.num_entries = 0;
791 q_l->level.value = level;
794 /*******************************************************************
795 reads or writes a LSA_Q_LOOKUP_SIDS structure.
796 ********************************************************************/
797 void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth)
799 if (q_s == NULL) return;
801 prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids");
806 smb_io_pol_hnd ("pol_hnd", &(q_s->pol), ps, depth); /* policy handle */
807 lsa_io_sid_enum ("sids ", &(q_s->sids ), ps, depth); /* sids to be looked up */
808 lsa_io_trans_names ("names ", &(q_s->names ), ps, depth); /* translated names */
809 smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */
811 prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count));
814 /*******************************************************************
815 reads or writes a structure.
816 ********************************************************************/
817 void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth)
819 if (r_s == NULL) return;
821 prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids");
826 lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */
827 lsa_io_trans_names("names ", r_s->names , ps, depth); /* translated names */
831 prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count));
833 prs_uint32("status ", ps, depth, &(r_s->status));
836 /*******************************************************************
838 ********************************************************************/
839 void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
840 int num_names, const char **names)
843 if (q_l == NULL) return;
845 DEBUG(5,("make_q_lookup_names\n"));
847 memcpy(&(q_l->pol), hnd, sizeof(q_l->pol));
849 q_l->num_entries = num_names;
850 q_l->num_entries2 = num_names;
852 SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries);
854 for (i = 0; i < num_names; i++)
856 const char* name = names[i];
857 int len = strlen(name);
858 make_uni_hdr(&q_l->hdr_name[i], len, len, len != 0);
859 make_unistr2(&q_l->uni_name[i], name, len);
862 q_l->num_trans_entries = 0;
863 q_l->ptr_trans_sids = 0;
864 q_l->lookup_level = 1;
865 q_l->mapped_count = 0;
868 /*******************************************************************
869 reads or writes a structure.
870 ********************************************************************/
871 void lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth)
875 if (q_r == NULL) return;
877 prs_debug(ps, depth, desc, "lsa_io_q_lookup_names");
882 smb_io_pol_hnd("", &(q_r->pol), ps, depth); /* policy handle */
884 prs_uint32("num_entries ", ps, depth, &(q_r->num_entries));
885 prs_uint32("num_entries2 ", ps, depth, &(q_r->num_entries2));
887 SMB_ASSERT_ARRAY(q_r->uni_name, q_r->num_entries);
889 for (i = 0; i < q_r->num_entries; i++)
891 smb_io_unihdr("hdr_name", &(q_r->hdr_name[i]), ps, depth); /* pointer names */
894 for (i = 0; i < q_r->num_entries; i++)
896 smb_io_unistr2("dom_name", &(q_r->uni_name[i]), q_r->hdr_name[i].buffer, ps, depth); /* names to be looked up */
900 prs_uint32("num_trans_entries ", ps, depth, &(q_r->num_trans_entries));
901 prs_uint32("ptr_trans_sids ", ps, depth, &(q_r->ptr_trans_sids));
902 prs_uint32("lookup_level ", ps, depth, &(q_r->lookup_level ));
903 prs_uint32("mapped_count ", ps, depth, &(q_r->mapped_count ));
906 /*******************************************************************
907 reads or writes a structure.
908 ********************************************************************/
909 void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth)
913 if (r_r == NULL) return;
915 prs_debug(ps, depth, desc, "lsa_io_r_lookup_names");
920 lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth); /* domain reference info */
922 prs_uint32("num_entries ", ps, depth, &(r_r->num_entries));
923 prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer));
924 prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2));
926 for (i = 0; i < r_r->num_entries2; i++)
928 smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */
931 prs_uint32("mapped_count", ps, depth, &(r_r->mapped_count));
933 prs_uint32("status ", ps, depth, &(r_r->status));
937 /*******************************************************************
938 makes an LSA_Q_CLOSE structure.
939 ********************************************************************/
940 void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd)
942 if (q_c == NULL || hnd == NULL) return;
944 DEBUG(5,("make_lsa_q_close\n"));
946 memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
949 /*******************************************************************
950 reads or writes an LSA_Q_CLOSE structure.
951 ********************************************************************/
952 void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth)
954 if (q_c == NULL) return;
956 prs_debug(ps, depth, desc, "lsa_io_q_close");
959 smb_io_pol_hnd("", &(q_c->pol), ps, depth);
962 /*******************************************************************
963 reads or writes an LSA_R_CLOSE structure.
964 ********************************************************************/
965 void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth)
967 if (r_c == NULL) return;
969 prs_debug(ps, depth, desc, "lsa_io_r_close");
972 smb_io_pol_hnd("", &(r_c->pol), ps, depth);
974 prs_uint32("status", ps, depth, &(r_c->status));