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)
453 smb_io_strhdr2("hdr_secret", &(value->hdr_secret), ps, depth);
454 smb_io_string2("secret" , &(value->enc_secret),
455 value->hdr_secret.buffer, ps, depth);
459 /*******************************************************************
460 reads or writes an LSA_SECRET_INFO structure.
461 ********************************************************************/
462 void lsa_io_secret_info(char *desc, LSA_SECRET_INFO *info, prs_struct *ps, int depth)
464 if (info == NULL) return;
466 prs_debug(ps, depth, desc, "lsa_io_secret_info");
470 prs_uint32("ptr_value ", ps, depth, &(info->ptr_value ));
472 if (info->ptr_value != 0)
474 lsa_io_secret_value("", &(info->value), ps, depth);
478 prs_uint32("ptr_update", ps, depth, &(info->ptr_update));
480 if (info->ptr_update != 0)
486 smb_io_time("last_update", &(info->last_update), ps, depth);
490 /*******************************************************************
491 makes an LSA_Q_QUERY_SECRET structure.
492 ********************************************************************/
493 void make_q_query_secret(LSA_Q_QUERY_SECRET *q_q, POLICY_HND *pol)
495 if (q_q == NULL) return;
497 DEBUG(5,("make_q_query_secret"));
499 memcpy(&(q_q->pol), pol, sizeof(q_q->pol));
502 q_q->info.ptr_value = 1;
503 q_q->info.value.ptr_secret = 0;
505 /* Want last change time */
506 q_q->info.ptr_update = 1;
508 /* Don't care about old info */
509 q_q->oldinfo.ptr_value = 0;
510 q_q->oldinfo.ptr_update = 0;
513 /*******************************************************************
514 reads or writes an LSA_Q_QUERY_SECRET structure.
515 ********************************************************************/
516 void lsa_io_q_query_secret(char *desc, LSA_Q_QUERY_SECRET *q_q, prs_struct *ps, int depth)
518 if (q_q == NULL) return;
520 prs_debug(ps, depth, desc, "lsa_io_q_query_secret");
523 smb_io_pol_hnd("", &(q_q->pol), ps, depth);
525 lsa_io_secret_info("", &(q_q->info ), ps, depth);
526 lsa_io_secret_info("", &(q_q->oldinfo), ps, depth);
529 /*******************************************************************
530 reads or writes an LSA_Q_QUERY_SECRET structure.
531 ********************************************************************/
532 void lsa_io_r_query_secret(char *desc, LSA_R_QUERY_SECRET *r_q, prs_struct *ps, int depth)
534 if (r_q == NULL) return;
536 prs_debug(ps, depth, desc, "lsa_io_r_query_secret");
539 lsa_io_secret_info("", &(r_q->info ), ps, depth);
540 lsa_io_secret_info("", &(r_q->oldinfo), ps, depth);
543 prs_uint32("status", ps, depth, &(r_q->status));
546 /*******************************************************************
547 reads or writes an LSA_Q_ENUM_TRUST_DOM structure.
548 ********************************************************************/
549 void lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth)
551 if (q_e == NULL) return;
553 prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom");
557 smb_io_pol_hnd("", &(q_e->pol), ps, depth);
559 prs_uint32("enum_context ", ps, depth, &(q_e->enum_context ));
560 prs_uint32("preferred_len", ps, depth, &(q_e->preferred_len));
563 /*******************************************************************
564 makes an LSA_R_ENUM_TRUST_DOM structure.
565 ********************************************************************/
566 void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e,
567 uint32 enum_context, char *domain_name, DOM_SID *domain_sid,
570 if (r_e == NULL) return;
572 DEBUG(5,("make_r_enum_trust_dom\n"));
574 r_e->enum_context = enum_context;
578 int len_domain_name = strlen(domain_name);
580 r_e->num_domains = 1;
581 r_e->ptr_enum_domains = 1;
582 r_e->num_domains2 = 1;
584 make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name, len_domain_name, 4);
585 make_unistr2 (&(r_e->uni_domain_name ), domain_name, len_domain_name);
586 make_dom_sid2(&(r_e->other_domain_sid), domain_sid);
590 r_e->num_domains = 0;
591 r_e->ptr_enum_domains = 0;
594 r_e->status = status;
597 /*******************************************************************
598 reads or writes an LSA_R_ENUM_TRUST_DOM structure.
599 ********************************************************************/
600 void lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth)
602 if (r_e == NULL) return;
604 prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
607 prs_uint32("enum_context ", ps, depth, &(r_e->enum_context ));
608 prs_uint32("num_domains ", ps, depth, &(r_e->num_domains ));
609 prs_uint32("ptr_enum_domains", ps, depth, &(r_e->ptr_enum_domains));
611 if (r_e->ptr_enum_domains != 0)
613 prs_uint32("num_domains2", ps, depth, &(r_e->num_domains2));
614 smb_io_unihdr2 ("", &(r_e->hdr_domain_name ), ps, depth);
615 smb_io_unistr2 ("", &(r_e->uni_domain_name ), r_e->hdr_domain_name.buffer, ps, depth);
616 smb_io_dom_sid2("", &(r_e->other_domain_sid), ps, depth);
619 prs_uint32("status", ps, depth, &(r_e->status));
622 /*******************************************************************
623 reads or writes an LSA_Q_QUERY_INFO structure.
624 ********************************************************************/
625 void lsa_io_r_query(char *desc, LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth)
627 if (r_q == NULL) return;
629 prs_debug(ps, depth, desc, "lsa_io_r_query");
632 prs_uint32("undoc_buffer", ps, depth, &(r_q->undoc_buffer));
634 if (r_q->undoc_buffer != 0)
636 prs_uint16("info_class", ps, depth, &(r_q->info_class));
638 switch (r_q->info_class)
642 smb_io_dom_query_3("", &(r_q->dom.id3), ps, depth);
647 smb_io_dom_query_5("", &(r_q->dom.id3), ps, depth);
658 prs_uint32("status", ps, depth, &(r_q->status));
661 /*******************************************************************
662 makes a LSA_SID_ENUM structure.
663 ********************************************************************/
664 void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids)
667 if (sen == NULL || sids == NULL) return;
669 DEBUG(5,("make_lsa_sid_enum\n"));
671 sen->num_entries = num_entries;
672 sen->ptr_sid_enum = num_entries != 0 ? 1 : 0;
673 sen->num_entries2 = num_entries;
675 SMB_ASSERT_ARRAY(sen->sid, sen->num_entries);
677 for (i = 0, i2 = 0; i < num_entries; i++)
682 make_dom_sid2(&(sen->sid[i2]), sids[i]);
692 /*******************************************************************
693 reads or writes a LSA_SID_ENUM structure.
694 ********************************************************************/
695 static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen,
696 prs_struct *ps, int depth)
700 if (sen == NULL) return;
702 prs_debug(ps, depth, desc, "lsa_io_sid_enum");
707 prs_uint32("num_entries ", ps, depth, &(sen->num_entries));
708 prs_uint32("ptr_sid_enum", ps, depth, &(sen->ptr_sid_enum));
709 prs_uint32("num_entries2", ps, depth, &(sen->num_entries2));
711 SMB_ASSERT_ARRAY(sen->ptr_sid, sen->num_entries);
713 for (i = 0; i < sen->num_entries; i++)
716 slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i);
717 prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */
720 SMB_ASSERT_ARRAY(sen->sid, sen->num_entries);
722 for (i = 0; i < sen->num_entries; i++)
725 slprintf(temp, sizeof(temp) - 1, "sid[%d]", i);
726 smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */
730 /*******************************************************************
731 reads or writes a structure.
732 ********************************************************************/
733 static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
734 prs_struct *ps, int depth)
738 if (trn == NULL) return;
740 prs_debug(ps, depth, desc, "lsa_io_trans_names");
745 prs_uint32("num_entries ", ps, depth, &(trn->num_entries));
746 prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names));
748 if (trn->ptr_trans_names != 0)
750 prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2));
751 SMB_ASSERT_ARRAY(trn->name, trn->num_entries);
753 for (i = 0; i < trn->num_entries2; i++)
756 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
758 lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */
761 for (i = 0; i < trn->num_entries2; i++)
764 slprintf(t, sizeof(t) - 1, "name[%d] ", i);
766 smb_io_unistr2(t, &(trn->uni_name[i]), trn->name[i].hdr_name.buffer, ps, depth);
772 /*******************************************************************
774 ********************************************************************/
775 void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
776 int num_sids, DOM_SID **sids,
779 if (q_l == NULL) return;
781 DEBUG(5,("make_q_lookup_sids\n"));
783 memcpy(&(q_l->pol), hnd, sizeof(q_l->pol));
784 make_lsa_sid_enum(&(q_l->sids), num_sids, sids);
786 q_l->names.ptr_trans_names = 0;
787 q_l->names.num_entries = 0;
789 q_l->level.value = level;
792 /*******************************************************************
793 reads or writes a LSA_Q_LOOKUP_SIDS structure.
794 ********************************************************************/
795 void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth)
797 if (q_s == NULL) return;
799 prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids");
804 smb_io_pol_hnd ("pol_hnd", &(q_s->pol), ps, depth); /* policy handle */
805 lsa_io_sid_enum ("sids ", &(q_s->sids ), ps, depth); /* sids to be looked up */
806 lsa_io_trans_names ("names ", &(q_s->names ), ps, depth); /* translated names */
807 smb_io_lookup_level("switch ", &(q_s->level ), ps, depth); /* lookup level */
809 prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count));
812 /*******************************************************************
813 reads or writes a structure.
814 ********************************************************************/
815 void lsa_io_r_lookup_sids(char *desc, LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth)
817 if (r_s == NULL) return;
819 prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids");
824 lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */
825 lsa_io_trans_names("names ", r_s->names , ps, depth); /* translated names */
829 prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count));
831 prs_uint32("status ", ps, depth, &(r_s->status));
834 /*******************************************************************
836 ********************************************************************/
837 void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
838 int num_names, const char **names)
841 if (q_l == NULL) return;
843 DEBUG(5,("make_q_lookup_names\n"));
845 memcpy(&(q_l->pol), hnd, sizeof(q_l->pol));
847 q_l->num_entries = num_names;
848 q_l->num_entries2 = num_names;
850 SMB_ASSERT_ARRAY(q_l->uni_name, q_l->num_entries);
852 for (i = 0; i < num_names; i++)
854 const char* name = names[i];
855 int len = strlen(name);
856 make_uni_hdr(&q_l->hdr_name[i], len, len, len != 0);
857 make_unistr2(&q_l->uni_name[i], name, len);
860 q_l->num_trans_entries = 0;
861 q_l->ptr_trans_sids = 0;
862 q_l->lookup_level = 1;
863 q_l->mapped_count = 0;
866 /*******************************************************************
867 reads or writes a structure.
868 ********************************************************************/
869 void lsa_io_q_lookup_names(char *desc, LSA_Q_LOOKUP_NAMES *q_r, prs_struct *ps, int depth)
873 if (q_r == NULL) return;
875 prs_debug(ps, depth, desc, "lsa_io_q_lookup_names");
880 smb_io_pol_hnd("", &(q_r->pol), ps, depth); /* policy handle */
882 prs_uint32("num_entries ", ps, depth, &(q_r->num_entries));
883 prs_uint32("num_entries2 ", ps, depth, &(q_r->num_entries2));
885 SMB_ASSERT_ARRAY(q_r->uni_name, q_r->num_entries);
887 for (i = 0; i < q_r->num_entries; i++)
889 smb_io_unihdr("hdr_name", &(q_r->hdr_name[i]), ps, depth); /* pointer names */
892 for (i = 0; i < q_r->num_entries; i++)
894 smb_io_unistr2("dom_name", &(q_r->uni_name[i]), q_r->hdr_name[i].buffer, ps, depth); /* names to be looked up */
898 prs_uint32("num_trans_entries ", ps, depth, &(q_r->num_trans_entries));
899 prs_uint32("ptr_trans_sids ", ps, depth, &(q_r->ptr_trans_sids));
900 prs_uint32("lookup_level ", ps, depth, &(q_r->lookup_level ));
901 prs_uint32("mapped_count ", ps, depth, &(q_r->mapped_count ));
904 /*******************************************************************
905 reads or writes a structure.
906 ********************************************************************/
907 void lsa_io_r_lookup_names(char *desc, LSA_R_LOOKUP_NAMES *r_r, prs_struct *ps, int depth)
911 if (r_r == NULL) return;
913 prs_debug(ps, depth, desc, "lsa_io_r_lookup_names");
918 lsa_io_dom_r_ref("", r_r->dom_ref, ps, depth); /* domain reference info */
920 prs_uint32("num_entries ", ps, depth, &(r_r->num_entries));
921 prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer));
922 prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2));
924 for (i = 0; i < r_r->num_entries2; i++)
926 smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */
929 prs_uint32("mapped_count", ps, depth, &(r_r->mapped_count));
931 prs_uint32("status ", ps, depth, &(r_r->status));
935 /*******************************************************************
936 makes an LSA_Q_CLOSE structure.
937 ********************************************************************/
938 void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd)
940 if (q_c == NULL || hnd == NULL) return;
942 DEBUG(5,("make_lsa_q_close\n"));
944 memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
947 /*******************************************************************
948 reads or writes an LSA_Q_CLOSE structure.
949 ********************************************************************/
950 void lsa_io_q_close(char *desc, LSA_Q_CLOSE *q_c, prs_struct *ps, int depth)
952 if (q_c == NULL) return;
954 prs_debug(ps, depth, desc, "lsa_io_q_close");
957 smb_io_pol_hnd("", &(q_c->pol), ps, depth);
960 /*******************************************************************
961 reads or writes an LSA_R_CLOSE structure.
962 ********************************************************************/
963 void lsa_io_r_close(char *desc, LSA_R_CLOSE *r_c, prs_struct *ps, int depth)
965 if (r_c == NULL) return;
967 prs_debug(ps, depth, desc, "lsa_io_r_close");
970 smb_io_pol_hnd("", &(r_c->pol), ps, depth);
972 prs_uint32("status", ps, depth, &(r_c->status));