lsa_lookup_sids command added. severe debugging needed on lookup_sids
[samba.git] / source3 / rpc_parse / parse_lsa.c
1 /* 
2  *  Unix SMB/Netbios implementation.
3  *  Version 1.9.
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.
8  *  
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.
13  *  
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.
18  *  
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.
22  */
23
24 #include "includes.h"
25 #include "nterr.h"
26
27 extern int DEBUGLEVEL;
28
29 static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth);
30
31 /*******************************************************************
32 creates a LSA_TRANS_NAME structure.
33 ********************************************************************/
34 void make_lsa_trans_name(LSA_TRANS_NAME *trn, uint32 sid_name_use, char *name, uint32 idx)
35 {
36         int len_name = strlen(name);
37
38         trn->sid_name_use = sid_name_use;
39         make_uni_hdr(&(trn->hdr_name), len_name, len_name, len_name != 0);
40         trn->domain_idx = idx;
41 }
42
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)
47 {
48         if (trn == NULL) return;
49
50         prs_debug(ps, depth, desc, "lsa_io_trans_name");
51         depth++;
52
53         prs_align(ps);
54         
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  ));
58 }
59
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)
64 {
65         int i, s, n;
66
67         prs_debug(ps, depth, desc, "smb_io_dom_r_ref");
68         depth++;
69
70         if (r_r == NULL) return;
71
72         prs_align(ps);
73         
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("undoc_buffer2 ", ps, depth, &(r_r->undoc_buffer2 )); /* undocumented buffer pointer. */
77         prs_uint32("max_entries   ", ps, depth, &(r_r->max_entries   )); /* 32 - max number of entries */
78         prs_uint32("num_ref_doms_2", ps, depth, &(r_r->num_ref_doms_2)); /* 4 - num referenced domains? */
79
80         SMB_ASSERT_ARRAY(r_r->hdr_ref_dom, r_r->num_ref_doms_1-1);
81         SMB_ASSERT_ARRAY(r_r->ref_dom, r_r->num_ref_doms_2);
82
83         for (i = 0; i < r_r->num_ref_doms_1; i++)
84         {
85                 fstring t;
86
87                 slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i);
88                 smb_io_unihdr(t, &(r_r->hdr_ref_dom[i].hdr_dom_name), ps, depth);
89
90                 slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i);
91                 prs_uint32(t, ps, depth, &(r_r->hdr_ref_dom[i].ptr_dom_sid));
92         }
93
94         for (i = 0, n = 0, s = 0; i < r_r->num_ref_doms_2; i++)
95         {
96                 fstring t;
97
98                 if (r_r->hdr_ref_dom[i].hdr_dom_name.buffer != 0)
99                 {
100                         slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i);
101                         smb_io_unistr2(t, &(r_r->ref_dom[n].uni_dom_name), True, ps, depth); /* domain name unicode string */
102                         n++;
103                 }
104
105                 if (r_r->hdr_ref_dom[i].ptr_dom_sid != 0)
106                 {
107                         slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i);
108                         smb_io_dom_sid2("", &(r_r->ref_dom[s].ref_dom), ps, depth); /* referenced domain SIDs */
109                         s++;
110                 }
111         }
112 }
113
114
115 /*******************************************************************
116 makes an LSA_SEC_QOS structure.
117 ********************************************************************/
118 void make_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff,
119                                 uint32 unknown)
120 {
121         if (qos == NULL) return;
122
123         DEBUG(5,("make_lsa_sec_qos\n"));
124
125         qos->len = 0x0c; /* length of quality of service block, in bytes */
126         qos->sec_imp_level = imp_lev;
127         qos->sec_ctxt_mode = ctxt;
128         qos->effective_only = eff;
129         qos->unknown = unknown;
130 }
131
132 /*******************************************************************
133 reads or writes an LSA_SEC_QOS structure.
134 ********************************************************************/
135 static void lsa_io_sec_qos(char *desc,  LSA_SEC_QOS *qos, prs_struct *ps, int depth)
136 {
137         int start;
138
139         if (qos == NULL) return;
140
141         prs_debug(ps, depth, desc, "lsa_io_obj_qos");
142         depth++;
143
144         prs_align(ps);
145         
146         start = ps->offset;
147
148         /* these pointers had _better_ be zero, because we don't know
149            what they point to!
150          */
151         prs_uint32("len           ", ps, depth, &(qos->len           )); /* 0x18 - length (in bytes) inc. the length field. */
152         prs_uint16("sec_imp_level ", ps, depth, &(qos->sec_imp_level )); 
153         prs_uint8 ("sec_ctxt_mode ", ps, depth, &(qos->sec_ctxt_mode )); 
154         prs_uint8 ("effective_only", ps, depth, &(qos->effective_only)); 
155         prs_uint32("unknown       ", ps, depth, &(qos->unknown       )); 
156
157         if (qos->len != ps->offset - start)
158         {
159                 DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n",
160                          qos->len, ps->offset - start));
161         }
162 }
163
164
165 /*******************************************************************
166 makes an LSA_OBJ_ATTR structure.
167 ********************************************************************/
168 void make_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos)
169 {
170         if (attr == NULL) return;
171
172         DEBUG(5,("make_lsa_obj_attr\n"));
173
174         attr->len = 0x18; /* length of object attribute block, in bytes */
175         attr->ptr_root_dir = 0;
176         attr->ptr_obj_name = 0;
177         attr->attributes = attributes;
178         attr->ptr_sec_desc = 0;
179         
180         if (qos != NULL)
181         {
182                 attr->ptr_sec_qos = 1;
183                 attr->sec_qos = qos;
184         }
185         else
186         {
187                 attr->ptr_sec_qos = 0;
188                 attr->sec_qos = NULL;
189         }
190 }
191
192 /*******************************************************************
193 reads or writes an LSA_OBJ_ATTR structure.
194 ********************************************************************/
195 static void lsa_io_obj_attr(char *desc,  LSA_OBJ_ATTR *attr, prs_struct *ps, int depth)
196 {
197         int start;
198
199         if (attr == NULL) return;
200
201         prs_debug(ps, depth, desc, "lsa_io_obj_attr");
202         depth++;
203
204         prs_align(ps);
205         
206         start = ps->offset;
207
208         /* these pointers had _better_ be zero, because we don't know
209            what they point to!
210          */
211         prs_uint32("len         ", ps, depth, &(attr->len         )); /* 0x18 - length (in bytes) inc. the length field. */
212         prs_uint32("ptr_root_dir", ps, depth, &(attr->ptr_root_dir)); /* 0 - root directory (pointer) */
213         prs_uint32("ptr_obj_name", ps, depth, &(attr->ptr_obj_name)); /* 0 - object name (pointer) */
214         prs_uint32("attributes  ", ps, depth, &(attr->attributes  )); /* 0 - attributes (undocumented) */
215         prs_uint32("ptr_sec_desc", ps, depth, &(attr->ptr_sec_desc)); /* 0 - security descriptior (pointer) */
216         prs_uint32("ptr_sec_qos ", ps, depth, &(attr->ptr_sec_qos )); /* security quality of service (pointer) */
217
218         if (attr->len != ps->offset - start)
219         {
220                 DEBUG(3,("lsa_io_obj_attr: length %x does not match size %x\n",
221                          attr->len, ps->offset - start));
222         }
223
224         if (attr->ptr_sec_qos != 0 && attr->sec_qos != NULL)
225         {
226                 lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth);
227         }
228 }
229
230 /*******************************************************************
231 makes an LSA_Q_OPEN_POL structure.
232 ********************************************************************/
233 void make_q_open_pol(LSA_Q_OPEN_POL *r_q, char *server_name,
234                         uint32 attributes,
235                         uint32 desired_access,
236                         LSA_SEC_QOS *qos)
237 {
238         if (r_q == NULL) return;
239
240         DEBUG(5,("make_open_pol: attr:%d da:%d\n", attributes, desired_access));
241
242         r_q->ptr = 1; /* undocumented pointer */
243
244         if (qos == NULL)
245         {
246                 r_q->des_access = desired_access;
247         }
248
249         make_unistr2     (&(r_q->uni_server_name), server_name, strlen(server_name));
250         make_lsa_obj_attr(&(r_q->attr           ), attributes, qos);
251 }
252
253 /*******************************************************************
254 reads or writes an LSA_Q_OPEN_POL structure.
255 ********************************************************************/
256 void lsa_io_q_open_pol(char *desc,  LSA_Q_OPEN_POL *r_q, prs_struct *ps, int depth)
257 {
258         if (r_q == NULL) return;
259
260         prs_debug(ps, depth, desc, "lsa_io_q_open_pol");
261         depth++;
262
263         prs_uint32("ptr       ", ps, depth, &(r_q->ptr       ));
264
265         smb_io_unistr2 ("", &(r_q->uni_server_name), r_q->ptr, ps, depth);
266         lsa_io_obj_attr("", &(r_q->attr           ), ps, depth);
267
268         if (r_q->attr.ptr_sec_qos == 0)
269         {
270                 prs_uint32("des_access", ps, depth, &(r_q->des_access));
271         }
272 }
273
274 /*******************************************************************
275 reads or writes an LSA_R_OPEN_POL structure.
276 ********************************************************************/
277 void lsa_io_r_open_pol(char *desc,  LSA_R_OPEN_POL *r_p, prs_struct *ps, int depth)
278 {
279         if (r_p == NULL) return;
280
281         prs_debug(ps, depth, desc, "lsa_io_r_open_pol");
282         depth++;
283
284         smb_io_pol_hnd("", &(r_p->pol), ps, depth);
285
286         prs_uint32("status", ps, depth, &(r_p->status));
287 }
288
289 /*******************************************************************
290 makes an LSA_Q_QUERY_INFO structure.
291 ********************************************************************/
292 void make_q_query(LSA_Q_QUERY_INFO *q_q, POLICY_HND *hnd, uint16 info_class)
293 {
294         if (q_q == NULL || hnd == NULL) return;
295
296         DEBUG(5,("make_q_query\n"));
297
298         memcpy(&(q_q->pol), hnd, sizeof(q_q->pol));
299
300         q_q->info_class = info_class;
301 }
302
303 /*******************************************************************
304 reads or writes an LSA_Q_QUERY_INFO structure.
305 ********************************************************************/
306 void lsa_io_q_query(char *desc,  LSA_Q_QUERY_INFO *q_q, prs_struct *ps, int depth)
307 {
308         if (q_q == NULL) return;
309
310         prs_debug(ps, depth, desc, "lsa_io_q_query");
311         depth++;
312
313         smb_io_pol_hnd("", &(q_q->pol), ps, depth);
314
315         prs_uint16("info_class", ps, depth, &(q_q->info_class));
316 }
317
318 /*******************************************************************
319 reads or writes an LSA_Q_ENUM_TRUST_DOM structure.
320 ********************************************************************/
321 void lsa_io_q_enum_trust_dom(char *desc,  LSA_Q_ENUM_TRUST_DOM *q_e, prs_struct *ps, int depth)
322 {
323         if (q_e == NULL) return;
324
325         prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom");
326         depth++;
327
328
329         smb_io_pol_hnd("", &(q_e->pol), ps, depth);
330
331         prs_uint32("enum_context ", ps, depth, &(q_e->enum_context ));
332         prs_uint32("preferred_len", ps, depth, &(q_e->preferred_len));
333 }
334
335 /*******************************************************************
336 makes an LSA_R_ENUM_TRUST_DOM structure.
337 ********************************************************************/
338 void make_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e,
339                            uint32 enum_context, char *domain_name, DOM_SID *domain_sid,
340                            uint32 status)
341 {
342         if (r_e == NULL) return;
343
344         DEBUG(5,("make_r_enum_trust_dom\n"));
345
346         r_e->enum_context = enum_context;
347
348         if (status == 0)
349         {
350                 int len_domain_name = strlen(domain_name);
351
352                 r_e->num_domains  = 1;
353                 r_e->ptr_enum_domains = 1;
354                 r_e->num_domains2 = 1;
355
356                 make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name, len_domain_name, 4);
357                 make_unistr2 (&(r_e->uni_domain_name ), domain_name, len_domain_name);
358                 make_dom_sid2(&(r_e->other_domain_sid), domain_sid);
359         }
360         else
361         {
362                 r_e->num_domains = 0;
363                 r_e->ptr_enum_domains = 0;
364         }
365
366         r_e->status = status;
367 }
368
369 /*******************************************************************
370 reads or writes an LSA_R_ENUM_TRUST_DOM structure.
371 ********************************************************************/
372 void lsa_io_r_enum_trust_dom(char *desc,  LSA_R_ENUM_TRUST_DOM *r_e, prs_struct *ps, int depth)
373 {
374         if (r_e == NULL) return;
375
376         prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
377         depth++;
378
379         prs_uint32("enum_context    ", ps, depth, &(r_e->enum_context    ));
380         prs_uint32("num_domains     ", ps, depth, &(r_e->num_domains     ));
381         prs_uint32("ptr_enum_domains", ps, depth, &(r_e->ptr_enum_domains));
382
383         if (r_e->ptr_enum_domains != 0)
384         {
385                 prs_uint32("num_domains2", ps, depth, &(r_e->num_domains2));
386                 smb_io_unihdr2 ("", &(r_e->hdr_domain_name ), ps, depth);
387                 smb_io_unistr2 ("", &(r_e->uni_domain_name ), r_e->hdr_domain_name.buffer, ps, depth);
388                 smb_io_dom_sid2("", &(r_e->other_domain_sid), ps, depth);
389         }
390
391         prs_uint32("status", ps, depth, &(r_e->status));
392 }
393
394 /*******************************************************************
395 reads or writes an LSA_Q_QUERY_INFO structure.
396 ********************************************************************/
397 void lsa_io_r_query(char *desc,  LSA_R_QUERY_INFO *r_q, prs_struct *ps, int depth)
398 {
399         if (r_q == NULL) return;
400
401         prs_debug(ps, depth, desc, "lsa_io_r_query");
402         depth++;
403
404         prs_uint32("undoc_buffer", ps, depth, &(r_q->undoc_buffer));
405
406         if (r_q->undoc_buffer != 0)
407         {
408                 prs_uint16("info_class", ps, depth, &(r_q->info_class));
409
410                 switch (r_q->info_class)
411                 {
412                         case 3:
413                         {
414                                 smb_io_dom_query_3("", &(r_q->dom.id3), ps, depth);
415                                 break;
416                         }
417                         case 5:
418                         {
419                                 smb_io_dom_query_5("", &(r_q->dom.id3), ps, depth);
420                                 break;
421                         }
422                         default:
423                         {
424                                 /* PANIC! */
425                                 break;
426                         }
427                 }
428         }
429
430         prs_uint32("status", ps, depth, &(r_q->status));
431 }
432
433 /*******************************************************************
434 makes a LSA_SID_ENUM structure.
435 ********************************************************************/
436 void make_lsa_sid_enum(LSA_SID_ENUM *sen, int num_entries, DOM_SID **sids)
437 {
438         int i, i2;
439         if (sen == NULL || sids == NULL) return;
440
441         DEBUG(5,("make_lsa_sid_enum\n"));
442
443         sen->num_entries  = num_entries;
444         sen->ptr_sid_enum = num_entries != 0 ? 1 : 0;
445         sen->num_entries2 = num_entries;
446
447         SMB_ASSERT_ARRAY(sen->sid, sen->num_entries);
448
449         for (i = 0, i2 = 0; i < num_entries; i++)
450         {
451                 if (sids[i] != NULL)
452                 {
453                         sen->ptr_sid[i] = 1;
454                         make_dom_sid2(&(sen->sid[i2]), sids[i]);
455                         i2++;
456                 }
457                 else
458                 {
459                         sen->ptr_sid[i] = 0;
460                 }
461         }
462 }
463
464 /*******************************************************************
465 reads or writes a LSA_SID_ENUM structure.
466 ********************************************************************/
467 static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen,
468                                 prs_struct *ps, int depth)
469 {
470         int i;
471
472         if (sen == NULL) return;
473
474         prs_debug(ps, depth, desc, "lsa_io_sid_enum");
475         depth++;
476
477         prs_align(ps);
478         
479         prs_uint32("num_entries ", ps, depth, &(sen->num_entries));
480         prs_uint32("ptr_sid_enum", ps, depth, &(sen->ptr_sid_enum)); 
481         prs_uint32("num_entries2", ps, depth, &(sen->num_entries2)); 
482
483         SMB_ASSERT_ARRAY(sen->ptr_sid, sen->num_entries);
484
485         for (i = 0; i < sen->num_entries; i++)
486         {       
487                 fstring temp;
488                 slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i);
489                 prs_uint32(temp, ps, depth, &(sen->ptr_sid[i])); /* domain SID pointers to be looked up. */
490         }
491
492         SMB_ASSERT_ARRAY(sen->sid, sen->num_entries);
493
494         for (i = 0; i < sen->num_entries; i++)
495         {
496                 fstring temp;
497                 slprintf(temp, sizeof(temp) - 1, "sid[%d]", i);
498                 smb_io_dom_sid2(temp, &(sen->sid[i]), ps, depth); /* domain SIDs to be looked up. */
499         }
500 }
501
502 /*******************************************************************
503 makes an LSA_R_ENUM_TRUST_DOM structure.
504 ********************************************************************/
505 void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
506                                 int num_sids, DOM_SID **sids,
507                                 uint16 level)
508 {
509         if (q_l == NULL) return;
510
511         DEBUG(5,("make_r_enum_trust_dom\n"));
512
513         memcpy(&(q_l->pol), hnd, sizeof(q_l->pol));
514         make_lsa_sid_enum(&(q_l->sids), num_sids, sids);
515
516         q_l->names.num_entries     = 0;
517         q_l->names.ptr_trans_names = 0;
518         q_l->names.num_entries2    = 0;
519
520         q_l->level.value = level;
521 }
522
523 /*******************************************************************
524 reads or writes a LSA_Q_LOOKUP_SIDS structure.
525 ********************************************************************/
526 void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, int depth)
527 {
528         if (q_s == NULL) return;
529
530         prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids");
531         depth++;
532
533         prs_align(ps);
534         
535         smb_io_pol_hnd     ("pol_hnd", &(q_s->pol), ps, depth); /* policy handle */
536         lsa_io_sid_enum    ("sids   ", &(q_s->sids   ), ps, depth); /* sids to be looked up */
537         lsa_io_trans_names ("names  ", &(q_s->names  ), ps, depth); /* translated names */
538         smb_io_lookup_level("switch ", &(q_s->level  ), ps, depth); /* lookup level */
539
540         prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count));
541 }
542
543 /*******************************************************************
544 reads or writes a structure.
545 ********************************************************************/
546 static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
547                                 prs_struct *ps, int depth)
548 {
549         int i;
550         int i2;
551
552         if (trn == NULL) return;
553
554         prs_debug(ps, depth, desc, "lsa_io_trans_names");
555         depth++;
556
557         prs_align(ps);
558         
559         prs_uint32("num_entries    ", ps, depth, &(trn->num_entries));
560         prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names));
561
562         if (trn->ptr_trans_names != 0)
563         {
564                 prs_uint32("num_entries2   ", ps, depth, &(trn->num_entries2));
565
566                 SMB_ASSERT_ARRAY(trn->name, trn->num_entries);
567
568                 for (i = 0, i2 = 0; i < trn->num_entries2; i++)
569                 {
570                         fstring t;
571                         slprintf(t, sizeof(t) - 1, "name[%d] ", i);
572
573                         lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */
574
575                         if (trn->name[i].hdr_name.buffer != 0)
576                         {
577                                 smb_io_unistr2(t, &(trn->uni_name[i2]), 1, ps, depth);
578                                 prs_align(ps);
579                                 i2++;
580                         }
581                 }
582         }
583 }
584
585 /*******************************************************************
586 reads or writes a structure.
587 ********************************************************************/
588 void lsa_io_r_lookup_sids(char *desc,  LSA_R_LOOKUP_SIDS *r_s, prs_struct *ps, int depth)
589 {
590         if (r_s == NULL) return;
591
592         prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids");
593         depth++;
594
595         prs_align(ps);
596         
597         lsa_io_dom_r_ref  ("dom_ref", r_s->dom_ref, ps, depth); /* domain reference info */
598         lsa_io_trans_names("names  ", r_s->names  , ps, depth); /* translated names */
599
600         prs_align(ps);
601
602         prs_uint32("mapped_count", ps, depth, &(r_s->mapped_count));
603
604         prs_uint32("status      ", ps, depth, &(r_s->status));
605 }
606
607 /*******************************************************************
608 reads or writes a structure.
609 ********************************************************************/
610 void lsa_io_q_lookup_rids(char *desc,  LSA_Q_LOOKUP_RIDS *q_r, prs_struct *ps, int depth)
611 {
612         int i;
613
614         if (q_r == NULL) return;
615
616         prs_debug(ps, depth, desc, "lsa_io_q_lookup_rids");
617         depth++;
618
619         prs_align(ps);
620         
621         smb_io_pol_hnd("", &(q_r->pol), ps, depth); /* policy handle */
622
623         prs_uint32("num_entries    ", ps, depth, &(q_r->num_entries));
624         prs_uint32("num_entries2   ", ps, depth, &(q_r->num_entries2));
625         prs_uint32("buffer_dom_sid ", ps, depth, &(q_r->buffer_dom_sid)); /* undocumented domain SID buffer pointer */
626         prs_uint32("buffer_dom_name", ps, depth, &(q_r->buffer_dom_name)); /* undocumented domain name buffer pointer */
627
628         SMB_ASSERT_ARRAY(q_r->lookup_name, q_r->num_entries);
629
630         for (i = 0; i < q_r->num_entries; i++)
631         {
632                 smb_io_dom_name("", &(q_r->lookup_name[i]), ps, depth); /* names to be looked up */
633         }
634
635         prs_uint8s (False, "undoc          ", ps, depth, q_r->undoc, UNKNOWN_LEN);
636 }
637
638 /*******************************************************************
639 reads or writes a structure.
640 ********************************************************************/
641 void lsa_io_r_lookup_rids(char *desc,  LSA_R_LOOKUP_RIDS *r_r, prs_struct *ps, int depth)
642 {
643         int i;
644
645         if (r_r == NULL) return;
646
647         prs_debug(ps, depth, desc, "lsa_io_r_lookup_rids");
648         depth++;
649
650         prs_align(ps);
651         
652         lsa_io_dom_r_ref("", &(r_r->dom_ref), ps, depth); /* domain reference info */
653
654         prs_uint32("num_entries ", ps, depth, &(r_r->num_entries));
655         prs_uint32("undoc_buffer", ps, depth, &(r_r->undoc_buffer));
656         prs_uint32("num_entries2", ps, depth, &(r_r->num_entries2));
657
658         SMB_ASSERT_ARRAY(r_r->dom_rid, r_r->num_entries2);
659
660         for (i = 0; i < r_r->num_entries2; i++)
661         {
662                 smb_io_dom_rid2("", &(r_r->dom_rid[i]), ps, depth); /* domain RIDs being looked up */
663         }
664
665         prs_uint32("num_entries3", ps, depth, &(r_r->num_entries3));
666
667         prs_uint32("status      ", ps, depth, &(r_r->status));
668 }
669
670
671 /*******************************************************************
672 makes an LSA_Q_CLOSE structure.
673 ********************************************************************/
674 void make_lsa_q_close(LSA_Q_CLOSE *q_c, POLICY_HND *hnd)
675 {
676         if (q_c == NULL || hnd == NULL) return;
677
678         DEBUG(5,("make_lsa_q_close\n"));
679
680         memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
681 }
682
683 /*******************************************************************
684 reads or writes an LSA_Q_CLOSE structure.
685 ********************************************************************/
686 void lsa_io_q_close(char *desc,  LSA_Q_CLOSE *q_c, prs_struct *ps, int depth)
687 {
688         if (q_c == NULL) return;
689
690         prs_debug(ps, depth, desc, "lsa_io_q_close");
691         depth++;
692
693         smb_io_pol_hnd("", &(q_c->pol), ps, depth);
694 }
695
696 /*******************************************************************
697 reads or writes an LSA_R_CLOSE structure.
698 ********************************************************************/
699 void lsa_io_r_close(char *desc,  LSA_R_CLOSE *r_c, prs_struct *ps, int depth)
700 {
701         if (r_c == NULL) return;
702
703         prs_debug(ps, depth, desc, "lsa_io_r_close");
704         depth++;
705
706         smb_io_pol_hnd("", &(r_c->pol), ps, depth);
707
708         prs_uint32("status", ps, depth, &(r_c->status));
709 }
710