Fix for bug 5422:
[obnox/wireshark/wip.git] / epan / dissectors / packet-dcerpc-rs_pgo.c
1 /* packet-dcerpc-rs_pgo.c
2  *
3  * Routines for dcerpc Afs4Int dissection
4  * Copyright 2002, Jaime Fournier <Jaime.Fournier@hush.com>
5  * This information is based off the released idl files from opengroup.
6  * ftp://ftp.opengroup.org/pub/dce122/dce/src/security.tar.gz  security/idl/rs_pgo.idl
7  *
8  * $Id$
9  *
10  * Wireshark - Network traffic analyzer
11  * By Gerald Combs <gerald@wireshark.org>
12  * Copyright 1998 Gerald Combs
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
27  */
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32
33
34 #ifdef HAVE_SYS_TYPES_H
35 #include <sys/types.h>
36 #endif
37
38 #include <glib.h>
39 #include <epan/packet.h>
40 #include "packet-dcerpc.h"
41 #include "packet-dcerpc-dce122.h"
42 /*
43 delete
44 dissect_rgy_acct_user_flags_t
45 */
46
47 static int proto_rs_pgo = -1;
48 static int hf_rs_pgo_opnum = -1;
49 static int hf_rs_var1 = -1;
50 static int hf_rs_pgo_query_result_t = -1;
51 static int hf_rs_pgo_query_t = -1;
52 static int hf_rs_pgo_query_key_t = -1;
53 static int hf_error_status_t = -1;
54 static int hf_sec_rgy_pgo_flags_t = -1;
55 static int hf_rs_sec_rgy_pgo_item_t_quota = -1;
56 static int hf_rs_sec_rgy_pgo_item_t_unix_num = -1;
57 static int hf_rs_timeval = -1;
58 static int hf_rs_uuid1 = -1;
59 static int hf_sec_rgy_domain_t = -1;
60 static int hf_sec_rgy_name_t_principalName_string = -1;
61 static int hf_sec_rgy_name_t_size = -1;
62 static int hf_sec_rgy_pname_t_principalName_string = -1;
63 static int hf_sec_rgy_pname_t_size = -1;
64 static int hf_rs_pgo_unix_num_key_t = -1;
65
66 static gint ett_rs_cache_data_t = -1;
67 static gint ett_sec_rgy_domain_t = -1;
68 static gint ett_rgy_acct_user_flags_t = -1;
69 static gint ett_sec_attr_component_name_t = -1;
70 static gint ett_sec_passwd_type_t = -1;
71 static gint ett_sec_rgy_acct_admin_flags_t = -1;
72 static gint ett_sec_rgy_acct_admin_t = -1;
73 static gint ett_sec_rgy_acct_auth_flags_t = -1;
74 static gint ett_sec_rgy_acct_key_t = -1;
75 static gint ett_sec_rgy_acct_user_t = -1;
76 static gint ett_sec_rgy_cursor_t = -1;
77 static gint ett_sec_rgy_foreign_id_t = -1;
78 static gint ett_sec_rgy_login_name_t = -1;
79 static gint ett_sec_rgy_name_t = -1;
80 static gint ett_sec_rgy_pgo_item_t = -1;
81 static gint ett_sec_rgy_pname_t = -1;
82 static gint ett_sec_rgy_sid_t = -1;
83 static gint ett_sec_rgy_unix_passwd_buf_t = -1;
84 static gint ett_sec_rgy_unix_sid_t = -1;
85 static gint ett_sec_timeval_sec_t = -1;
86 static gint ett_sec_rgy_pgo_flags_t = -1;
87 static gint ett_error_status_t = -1;
88 static gint ett_rs_pgo_query_t = -1;
89 static gint ett_rs_pgo_query_key_t = -1;
90 static gint ett_rs_pgo_id_key_t = -1;
91 static gint ett_rs_pgo_unix_num_key_t = -1;
92 static gint ett_rs_pgo_query_result_t = -1;
93 static gint ett_rs_pgo_result_t = -1;
94
95
96 #define sec_rgy_acct_admin_valid  0x1
97 #define sec_rgy_acct_admin_audit   0x2
98 #define sec_rgy_acct_admin_server  0x4
99 #define sec_rgy_acct_admin_client  0x8
100 #define sec_rgy_acct_admin_flags_none  0
101 #define sec_rgy_acct_auth_post_dated        0x1
102 #define sec_rgy_acct_auth_forwardable       0x2
103 #define sec_rgy_acct_auth_tgt               0x4
104 #define sec_rgy_acct_auth_renewable         0x8
105 #define sec_rgy_acct_auth_proxiable        0x10
106 #define sec_rgy_acct_auth_dup_skey   0x20
107 #define sec_rgy_acct_auth_user_to_user  0x40
108 #define sec_rgy_acct_auth_flags_none  0
109 #define sec_rgy_acct_user_passwd_valid   0x1
110 #define sec_rgy_acct_user_flags_none  0
111 #define rs_acct_part_user        0x1
112 #define rs_acct_part_admin      0x2
113 #define rs_acct_part_passwd    0x4
114 #define rs_acct_part_unused     0x8
115 #define rs_acct_part_login_name  0x10
116 #define sec_rgy_pgo_is_an_alias   0x1
117 #define sec_rgy_pgo_is_required   0x2
118 #define sec_rgy_pgo_projlist_ok  0x4
119 #define sec_rgy_pgo_flags_none  0
120 #define sec_rgy_acct_user_passwd_valid  0x1
121 #define sec_rgy_acct_user_flags_none  0
122
123 static gint ett_rs_pgo = -1;
124
125 static e_uuid_t uuid_rs_pgo =
126   { 0x4c878280, 0x3000, 0x0000, {0x0d, 0x00, 0x02, 0x87, 0x14, 0x00, 0x00,
127                                  0x00}
128 };
129 static guint16 ver_rs_pgo = 1;
130
131
132 static int
133 dissect_error_status_t (tvbuff_t * tvb, int offset,
134                         packet_info * pinfo, proto_tree * parent_tree,
135                         guint8 * drep)
136 {
137   proto_item *item = NULL;
138   proto_tree *tree = NULL;
139   int old_offset = offset;
140   guint32 st;
141   dcerpc_info *di;
142   const char *st_str;
143
144   di = pinfo->private_data;
145   if (di->conformant_run)
146     {
147       return offset;
148     }
149
150   if (parent_tree)
151     {
152       item = proto_tree_add_text (parent_tree, tvb, offset, -1,
153                                   "error_status_t");
154       tree = proto_item_add_subtree (item, ett_error_status_t);
155     }
156
157   offset =
158     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_error_status_t,
159                         &st);
160   st_str = val_to_str_ext (st, &dce_error_vals_ext, "%u");
161
162   if (check_col (pinfo->cinfo, COL_INFO))
163     col_append_fstr (pinfo->cinfo, COL_INFO, " st:%s ", st_str);
164
165   proto_item_set_len (item, offset - old_offset);
166   return offset;
167 }
168
169
170 static int
171 dissect_sec_rgy_pname_t (tvbuff_t * tvb, int offset,
172                          packet_info * pinfo, proto_tree * parent_tree,
173                          guint8 * drep)
174 {
175
176
177   proto_item *item = NULL;
178   proto_tree *tree = NULL;
179   int old_offset = offset;
180 #define    sec_rgy_pname_t_size 257
181 /*
182 dissect    sec_rgy_pname const signed32        sec_rgy_pname_t_size  = 257; * Include final '\0' *
183           typedef [string] char sec_rgy_pname_t[sec_rgy_pname_t_size];
184 */
185   guint32 string_size;
186   const guint8 *namestring;
187   dcerpc_info *di;
188
189   di = pinfo->private_data;
190   if (di->conformant_run)
191     {
192       return offset;
193     }
194
195
196   if (parent_tree)
197     {
198       item =
199         proto_tree_add_text (parent_tree, tvb, offset, -1, "sec_rgy_pname_t");
200       tree = proto_item_add_subtree (item, ett_sec_rgy_pname_t);
201     }
202
203   offset =
204     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
205                         hf_sec_rgy_pname_t_size, &string_size);
206   if (check_col (pinfo->cinfo, COL_INFO))
207     col_append_fstr (pinfo->cinfo, COL_INFO, " String_size:%u", string_size);
208   if (string_size < sec_rgy_pname_t_size)
209     {
210 /* proto_tree_add_string(tree, id, tvb, start, length, value_ptr); */
211
212       proto_tree_add_string (tree, hf_sec_rgy_pname_t_principalName_string,
213                              tvb, offset, string_size, tvb_get_ptr (tvb,
214                                                                     offset,
215                                                                     string_size));
216       if (string_size > 1)
217         {
218           namestring = tvb_get_ptr (tvb, offset, string_size);
219           if (check_col (pinfo->cinfo, COL_INFO))
220             col_append_fstr (pinfo->cinfo, COL_INFO, " Principal:%s",
221                              namestring);
222         }
223       offset += string_size;
224     }
225   else
226     {
227       if (check_col (pinfo->cinfo, COL_INFO))
228         col_append_fstr (pinfo->cinfo, COL_INFO,
229                          " :FIXME!: Invalid string length of  %u",
230                          string_size);
231     }
232
233   proto_item_set_len (item, offset - old_offset);
234   return offset;
235 }
236
237 static int
238 dissect_sec_rgy_pgo_flags_t (tvbuff_t * tvb, int offset,
239                              packet_info * pinfo, proto_tree * parent_tree,
240                              guint8 * drep)
241 {
242
243 /*
244
245 */
246
247   proto_item *item = NULL;
248   proto_tree *tree = NULL;
249   int old_offset = offset;
250   dcerpc_info *di;
251   guint32 flags;
252
253 /*
254     typedef bitset  sec_rgy_pgo_flags_t;
255 */
256
257   di = pinfo->private_data;
258   if (di->conformant_run)
259     {
260       return offset;
261     }
262
263
264   if (parent_tree)
265     {
266       item =
267         proto_tree_add_text (parent_tree, tvb, offset, -1,
268                              "sec_rgy_pgo_flags_t ");
269       tree = proto_item_add_subtree (item, ett_sec_rgy_pgo_flags_t);
270     }
271
272   offset =
273     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
274                         hf_sec_rgy_pgo_flags_t, &flags);
275
276 /*
277      *
278      * s e c _ r g y _ p g o _ f l a g s _ t
279      *
280
281         * pgo item is an alias *
282         const unsigned32 sec_rgy_pgo_is_an_alias  = 0x1;
283
284         * pgo item is required - cannot be deleted *
285         const unsigned32 sec_rgy_pgo_is_required  = 0x2;
286
287         *
288          * projlist_ok: on person items indicates person can have a concurrent
289          * group set on group items indicates this group can appear on a
290          * concurrent group set.  On org items this flag is undefined.
291          *
292         const unsigned32 sec_rgy_pgo_projlist_ok = 0x4;
293
294         *
295         * bits 4-32 unused
296         *
297         const unsigned32 sec_rgy_pgo_flags_none = 0;
298 */
299 #define sec_rgy_pgo_is_an_alias   0x1
300 #define sec_rgy_pgo_is_required   0x2
301 #define sec_rgy_pgo_projlist_ok   0x4
302 #define sec_rgy_pgo_flags_none      0
303
304
305   col_append_str (pinfo->cinfo, COL_INFO, " PgoFlags=");
306   if ((flags & sec_rgy_pgo_is_an_alias) == sec_rgy_pgo_is_an_alias)
307     {
308       col_append_str (pinfo->cinfo, COL_INFO, ":IS_AN_ALIAS");
309     }
310   if ((flags & sec_rgy_pgo_is_required) == sec_rgy_pgo_is_required)
311     {
312       col_append_str (pinfo->cinfo, COL_INFO, ":IS_REQUIRED");
313     }
314   if ((flags & sec_rgy_pgo_projlist_ok) == sec_rgy_pgo_projlist_ok)
315     {
316       col_append_str (pinfo->cinfo, COL_INFO, ":PROJLIST_OK");
317     }
318   if ((flags & sec_rgy_acct_admin_client) == sec_rgy_acct_admin_client)
319     {
320       col_append_str (pinfo->cinfo, COL_INFO, ":NONE");
321     }
322   if ((flags & sec_rgy_pgo_flags_none) == sec_rgy_pgo_flags_none)
323     {
324       col_append_str (pinfo->cinfo, COL_INFO, ":NONE");
325     }
326
327   proto_item_set_len (item, offset - old_offset);
328   return offset;
329 }
330
331
332
333
334 static int
335 dissect_rs_cache_data_t (tvbuff_t * tvb, int offset,
336                          packet_info * pinfo, proto_tree * parent_tree,
337                          guint8 * drep)
338 {
339
340 /*
341     typedef struct {
342         uuid_t              site_id;
343         sec_timeval_sec_t   person_dtm;
344         sec_timeval_sec_t   group_dtm;
345         sec_timeval_sec_t   org_dtm;
346     } rs_cache_data_t;
347 */
348
349
350   proto_item *item = NULL;
351   proto_tree *tree = NULL;
352   int old_offset = offset;
353   dcerpc_info *di;
354   guint32 person_dtm, group_dtm, org_dtm;
355   e_uuid_t uuid1;
356
357
358   di = pinfo->private_data;
359   if (di->conformant_run)
360     {
361       return offset;
362     }
363
364
365   if (parent_tree)
366     {
367       item =
368         proto_tree_add_text (parent_tree, tvb, offset, -1, "rs_cache_data_t");
369       tree = proto_item_add_subtree (item, ett_rs_cache_data_t);
370     }
371
372
373   offset =
374     dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_rs_uuid1, &uuid1);
375   offset =
376     dissect_dcerpc_time_t (tvb, offset, pinfo, tree, drep, hf_rs_timeval,
377                            &person_dtm);
378   offset =
379     dissect_dcerpc_time_t (tvb, offset, pinfo, tree, drep, hf_rs_timeval,
380                            &group_dtm);
381   offset =
382     dissect_dcerpc_time_t (tvb, offset, pinfo, tree, drep, hf_rs_timeval,
383                            &org_dtm);
384
385   if (check_col (pinfo->cinfo, COL_INFO))
386     col_append_fstr (pinfo->cinfo, COL_INFO,
387                      " siteid %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x person_dtm:%u group_dtm:%u org_dtm:%u",
388                      uuid1.Data1, uuid1.Data2, uuid1.Data3, uuid1.Data4[0],
389                      uuid1.Data4[1], uuid1.Data4[2], uuid1.Data4[3],
390                      uuid1.Data4[4], uuid1.Data4[5], uuid1.Data4[6],
391                      uuid1.Data4[7], person_dtm, group_dtm, org_dtm);
392
393   proto_item_set_len (item, offset - old_offset);
394   return offset;
395 }
396
397
398
399 static int
400 dissect_sec_rgy_name_t (tvbuff_t * tvb, int offset,
401                         packet_info * pinfo, proto_tree * parent_tree,
402                         guint8 * drep)
403 {
404
405
406   proto_item *item = NULL;
407   proto_tree *tree = NULL;
408   int old_offset = offset;
409 #define    sec_rgy_name_t_size  1025
410 /*    typedef [string] char sec_rgy_name_t[sec_rgy_name_t_size]; */
411   guint32 string_size;
412   const guint8 *namestring;
413   dcerpc_info *di;
414
415   di = pinfo->private_data;
416   if (di->conformant_run)
417     {
418       return offset;
419     }
420
421
422   if (parent_tree)
423     {
424       item =
425         proto_tree_add_text (parent_tree, tvb, offset, -1, "sec_rgy_name_t");
426       tree = proto_item_add_subtree (item, ett_sec_rgy_name_t);
427     }
428
429   offset =
430     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
431                         hf_sec_rgy_name_t_size, &string_size);
432   if (check_col (pinfo->cinfo, COL_INFO))
433     col_append_fstr (pinfo->cinfo, COL_INFO, " String_size:%u", string_size);
434   if (string_size < sec_rgy_name_t_size)
435     {
436 /* proto_tree_add_string(tree, id, tvb, start, length, value_ptr); */
437
438       proto_tree_add_string (tree, hf_sec_rgy_name_t_principalName_string,
439                              tvb, offset, string_size, tvb_get_ptr (tvb,
440                                                                     offset,
441                                                                     string_size));
442       if (string_size > 1)
443         {
444           namestring = tvb_get_ptr (tvb, offset, string_size);
445           if (check_col (pinfo->cinfo, COL_INFO))
446             col_append_fstr (pinfo->cinfo, COL_INFO, " Principal:%s",
447                              namestring);
448         }
449       offset += string_size;
450     }
451   else
452     {
453       if (check_col (pinfo->cinfo, COL_INFO))
454         col_append_fstr (pinfo->cinfo, COL_INFO,
455                          " :FIXME!: Invalid string length of  %u",
456                          string_size);
457     }
458
459   proto_item_set_len (item, offset - old_offset);
460   return offset;
461 }
462
463
464 static int
465 dissect_sec_rgy_domain_t (tvbuff_t * tvb, int offset,
466                           packet_info * pinfo, proto_tree * parent_tree,
467                           guint8 * drep)
468 {
469
470 /*
471     typedef signed32    sec_rgy_domain_t;
472 */
473
474   proto_item *item = NULL;
475   proto_tree *tree = NULL;
476   int old_offset = offset;
477   dcerpc_info *di;
478   guint32 domain_t;
479
480   di = pinfo->private_data;
481   if (di->conformant_run)
482     {
483       return offset;
484     }
485
486
487   if (parent_tree)
488     {
489       item =
490         proto_tree_add_text (parent_tree, tvb, offset, -1, "sec_rgy_domain_t");
491       tree = proto_item_add_subtree (item, ett_sec_rgy_domain_t);
492     }
493
494
495   offset =
496     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_sec_rgy_domain_t,
497                         &domain_t);
498
499   if (check_col (pinfo->cinfo, COL_INFO))
500     col_append_fstr (pinfo->cinfo, COL_INFO, " sec_rgy_domain_t:%u",
501                      domain_t);
502
503
504   proto_item_set_len (item, offset - old_offset);
505   return offset;
506 }
507
508 static int
509 dissect_sec_rgy_pgo_item_t (tvbuff_t * tvb, int offset,
510                             packet_info * pinfo, proto_tree * parent_tree,
511                             guint8 * drep)
512 {
513
514 /*
515     typedef struct {
516         uuid_t              id;
517         signed32            unix_num;
518         signed32            quota;
519         sec_rgy_pgo_flags_t flags;
520         sec_rgy_pname_t     fullname;
521     }               sec_rgy_pgo_item_t;
522
523 */
524
525   proto_item *item = NULL;
526   proto_tree *tree = NULL;
527   int old_offset = offset;
528   dcerpc_info *di;
529   e_uuid_t id;
530   guint32 unix_num, quota;
531
532   di = pinfo->private_data;
533   if (di->conformant_run)
534     {
535       return offset;
536     }
537
538
539   if (parent_tree)
540     {
541       item =
542         proto_tree_add_text (parent_tree, tvb, offset, -1,
543                              " sec_rgy_pgo_item_t ");
544       tree = proto_item_add_subtree (item, ett_sec_rgy_pgo_item_t);
545     }
546
547   offset =
548     dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_rs_uuid1, &id);
549   offset =
550     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
551                         hf_rs_sec_rgy_pgo_item_t_unix_num, &unix_num);
552   offset =
553     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
554                         hf_rs_sec_rgy_pgo_item_t_quota, &quota);
555   offset = dissect_sec_rgy_pgo_flags_t (tvb, offset, pinfo, tree, drep);
556   offset += 4;                  /* XXX */
557   offset = dissect_sec_rgy_pname_t (tvb, offset, pinfo, tree, drep);
558
559   if (check_col (pinfo->cinfo, COL_INFO))
560     col_append_fstr (pinfo->cinfo, COL_INFO,
561                      " sec_rgy_pgo_item_t - id %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x unix_num:%u quota:%u",
562                      id.Data1, id.Data2, id.Data3, id.Data4[0],
563                      id.Data4[1], id.Data4[2], id.Data4[3],
564                      id.Data4[4], id.Data4[5], id.Data4[6],
565                      id.Data4[7], unix_num, quota);
566
567   proto_item_set_len (item, offset - old_offset);
568   return offset;
569 }
570
571
572 static int
573 dissect_sec_rgy_cursor_t (tvbuff_t * tvb, int offset,
574                           packet_info * pinfo, proto_tree * parent_tree,
575                           guint8 * drep)
576 {
577
578 /*
579      * Database cursor for iterative operations
580      *
581     typedef struct {
582         uuid_t          source;
583         signed32        handle;
584         boolean32       valid;
585     }               sec_rgy_cursor_t;
586
587
588 */
589
590   proto_item *item = NULL;
591   proto_tree *tree = NULL;
592   int old_offset = offset;
593   dcerpc_info *di;
594   e_uuid_t source;
595   guint32 handle, valid;
596
597   di = pinfo->private_data;
598   if (di->conformant_run)
599     {
600       return offset;
601     }
602
603
604   if (parent_tree)
605     {
606       item =
607         proto_tree_add_text (parent_tree, tvb, offset, -1,
608                              " sec_rgy_cursor_t ");
609       tree = proto_item_add_subtree (item, ett_sec_rgy_cursor_t);
610     }
611
612   offset =
613     dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_rs_uuid1, &source);
614   offset =
615     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
616                         hf_rs_sec_rgy_pgo_item_t_unix_num, &handle);
617   offset =
618     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
619                         hf_rs_sec_rgy_pgo_item_t_quota, &valid);
620
621   if (check_col (pinfo->cinfo, COL_INFO))
622     col_append_fstr (pinfo->cinfo, COL_INFO,
623                      " sec_rgy_cursor_t - source %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x handle:%u valid:%u",
624                      source.Data1, source.Data2, source.Data3,
625                      source.Data4[0], source.Data4[1], source.Data4[2],
626                      source.Data4[3], source.Data4[4], source.Data4[5],
627                      source.Data4[6], source.Data4[7], handle, valid);
628
629   proto_item_set_len (item, offset - old_offset);
630   return offset;
631 }
632
633 static int
634 dissect_rs_pgo_query_t (tvbuff_t * tvb, int offset,
635                         packet_info * pinfo, proto_tree * parent_tree,
636                         guint8 * drep)
637 {
638
639   typedef enum
640   {
641     rs_pgo_query_name,
642     rs_pgo_query_id,
643     rs_pgo_query_unix_num,
644     rs_pgo_query_next,
645     rs_pgo_query_none
646   } rs_pgo_query_t;
647
648
649   proto_item *item = NULL;
650   proto_tree *tree = NULL;
651   int old_offset = offset;
652   dcerpc_info *di;
653   guint8 query_t;
654
655   di = pinfo->private_data;
656   if (di->conformant_run)
657     {
658       return offset;
659     }
660
661
662   if (parent_tree)
663     {
664       item =
665         proto_tree_add_text (parent_tree, tvb, offset, -1, "rs_pgo_query_t ");
666       tree = proto_item_add_subtree (item, ett_rs_pgo_query_t);
667     }
668   offset =
669     dissect_ndr_uint8 (tvb, offset, pinfo, tree, drep, hf_rs_pgo_query_t,
670                        &query_t);
671   col_append_str (pinfo->cinfo, COL_INFO, " rs_pgo_query_t:");
672
673   switch (query_t)
674     {
675     case rs_pgo_query_name:
676       col_append_str (pinfo->cinfo, COL_INFO, "NAME");
677       break;
678     case rs_pgo_query_id:
679       col_append_str (pinfo->cinfo, COL_INFO, "ID");
680       break;
681     case rs_pgo_query_unix_num:
682       col_append_str (pinfo->cinfo, COL_INFO, "UNIX_NUM");
683       break;
684     case rs_pgo_query_next:
685       col_append_str (pinfo->cinfo, COL_INFO, "NEXT");
686       break;
687     case rs_pgo_query_none:
688       col_append_str (pinfo->cinfo, COL_INFO, "NONE");
689       break;
690     default:
691       if (check_col (pinfo->cinfo, COL_INFO))
692         col_append_fstr (pinfo->cinfo, COL_INFO, " unknown:%u", query_t);
693       break;
694       ;
695     }
696
697
698   proto_item_set_len (item, offset - old_offset);
699   return offset;
700 }
701 static int
702 dissect_rs_pgo_id_key_t (tvbuff_t * tvb, int offset,
703                          packet_info * pinfo, proto_tree * parent_tree,
704                          guint8 * drep)
705 {
706
707 /*
708     typedef struct {
709         uuid_t          id;
710         sec_rgy_name_t  scope;
711     } rs_pgo_id_key_t;
712
713 */
714
715   proto_item *item = NULL;
716   proto_tree *tree = NULL;
717   int old_offset = offset;
718   dcerpc_info *di;
719   e_uuid_t id;
720
721   di = pinfo->private_data;
722   if (di->conformant_run)
723     {
724       return offset;
725     }
726
727
728   if (parent_tree)
729     {
730       item =
731         proto_tree_add_text (parent_tree, tvb, offset, -1,
732                              "rs_pgo_id_key_t ");
733       tree = proto_item_add_subtree (item, ett_rs_pgo_id_key_t);
734     }
735
736   offset =
737     dissect_ndr_uuid_t (tvb, offset, pinfo, tree, drep, hf_rs_uuid1, &id);
738   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
739
740   if (check_col (pinfo->cinfo, COL_INFO))
741     col_append_fstr (pinfo->cinfo, COL_INFO,
742                      " rs_pgo_id_key_t - id %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
743                      id.Data1, id.Data2, id.Data3, id.Data4[0],
744                      id.Data4[1], id.Data4[2], id.Data4[3],
745                      id.Data4[4], id.Data4[5], id.Data4[6], id.Data4[7]);
746
747   proto_item_set_len (item, offset - old_offset);
748   return offset;
749 }
750
751
752 static int
753 dissect_rs_pgo_result_t (tvbuff_t * tvb, int offset,
754                          packet_info * pinfo, proto_tree * parent_tree,
755                          guint8 * drep)
756 {
757
758 /*
759     typedef struct {
760         sec_rgy_name_t      name;
761         sec_rgy_pgo_item_t  item;
762     } rs_pgo_result_t;
763
764
765 */
766
767   proto_item *item = NULL;
768   proto_tree *tree = NULL;
769   int old_offset = offset;
770   dcerpc_info *di;
771
772   di = pinfo->private_data;
773   if (di->conformant_run)
774     {
775       return offset;
776     }
777
778   if (parent_tree)
779     {
780       item =
781         proto_tree_add_text (parent_tree, tvb, offset, -1,
782                              "rs_pgo_result_t ");
783       tree = proto_item_add_subtree (item, ett_rs_pgo_result_t);
784     }
785
786   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
787   offset = dissect_sec_rgy_pgo_item_t (tvb, offset, pinfo, tree, drep);
788
789   proto_item_set_len (item, offset - old_offset);
790   return offset;
791 }
792
793
794
795 static int
796 dissect_rs_pgo_unix_num_key_t (tvbuff_t * tvb, int offset,
797                                packet_info * pinfo, proto_tree * parent_tree,
798                                guint8 * drep)
799 {
800
801 /*
802     typedef struct {
803         signed32        unix_num;
804         sec_rgy_name_t  scope;
805     } rs_pgo_unix_num_key_t;
806
807
808 r
809
810 */
811
812   proto_item *item = NULL;
813   proto_tree *tree = NULL;
814   int old_offset = offset;
815   dcerpc_info *di;
816   guint32 rs_pgo_unix_num_key_t;
817
818   di = pinfo->private_data;
819   if (di->conformant_run)
820     {
821       return offset;
822     }
823
824
825   if (parent_tree)
826     {
827       item =
828         proto_tree_add_text (parent_tree, tvb, offset, -1,
829                              " rs_pgo_unix_num_key_t ");
830       tree = proto_item_add_subtree (item, ett_rs_pgo_unix_num_key_t);
831     }
832
833   offset =
834     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
835                         hf_rs_pgo_unix_num_key_t, &rs_pgo_unix_num_key_t);
836   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
837
838   if (check_col (pinfo->cinfo, COL_INFO))
839     col_append_fstr (pinfo->cinfo, COL_INFO,
840                      " rs_pgo_unix_num_key_t:%u", rs_pgo_unix_num_key_t);
841
842   proto_item_set_len (item, offset - old_offset);
843   return offset;
844 }
845
846
847 static int
848 dissect_rs_pgo_query_key_t (tvbuff_t * tvb, int offset,
849                             packet_info * pinfo, proto_tree * parent_tree,
850                             guint8 * drep)
851 {
852
853   typedef enum
854   {
855     rs_pgo_query_name,
856     rs_pgo_query_id,
857     rs_pgo_query_unix_num,
858     rs_pgo_query_next,
859     rs_pgo_query_none
860   } rs_pgo_query_t;
861 /*
862     typedef union switch (rs_pgo_query_t query) tagged_union {
863         case rs_pgo_query_name:
864             sec_rgy_name_t              name;
865
866         case rs_pgo_query_id:
867             rs_pgo_id_key_t             id_key;
868
869         case rs_pgo_query_unix_num:
870             rs_pgo_unix_num_key_t       unix_num_key;
871
872         case rs_pgo_query_next:
873             sec_rgy_name_t              scope;
874
875         default:
876             ;                       * empty branch of union *
877
878     } rs_pgo_query_key_t;
879 */
880
881
882   proto_item *item = NULL;
883   proto_tree *tree = NULL;
884   int old_offset = offset;
885   dcerpc_info *di;
886   guint16 query_t;
887
888   di = pinfo->private_data;
889   if (di->conformant_run)
890     {
891       return offset;
892     }
893
894
895   if (parent_tree)
896     {
897       item =
898         proto_tree_add_text (parent_tree, tvb, offset, -1,
899                              "rs_pgo_query_key_t ");
900       tree = proto_item_add_subtree (item, ett_rs_pgo_query_key_t);
901     }
902   offset =
903     dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep, hf_rs_pgo_query_key_t,
904                         &query_t);
905   col_append_str (pinfo->cinfo, COL_INFO, " rs_pgo_query_key_t:");
906   offset += 4;
907   switch (query_t)
908     {
909     case rs_pgo_query_name:
910       col_append_str (pinfo->cinfo, COL_INFO, "NAME");
911       offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
912       break;
913     case rs_pgo_query_id:
914       col_append_str (pinfo->cinfo, COL_INFO, "ID");
915       offset = dissect_rs_pgo_id_key_t (tvb, offset, pinfo, tree, drep);
916       break;
917     case rs_pgo_query_unix_num:
918       col_append_str (pinfo->cinfo, COL_INFO, "UNIX_NUM");
919       offset = dissect_rs_pgo_unix_num_key_t (tvb, offset, pinfo, tree, drep);
920       break;
921     case rs_pgo_query_next:
922       col_append_str (pinfo->cinfo, COL_INFO, "NEXT");
923       offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
924       break;
925     case rs_pgo_query_none:
926       col_append_str (pinfo->cinfo, COL_INFO, "NONE");
927       break;
928
929     default:
930       if (check_col (pinfo->cinfo, COL_INFO))
931         col_append_fstr (pinfo->cinfo, COL_INFO, " unknown:%u", query_t);
932       ;
933     }
934
935   proto_item_set_len (item, offset - old_offset);
936   return offset;
937 }
938
939
940 static int
941 dissect_rs_pgo_query_result_t (tvbuff_t * tvb, int offset,
942                                packet_info * pinfo, proto_tree * parent_tree,
943                                guint8 * drep)
944 {
945   proto_item *item = NULL;
946   proto_tree *tree = NULL;
947   int old_offset = offset;
948   guint32 st;
949   dcerpc_info *di;
950   const char *status;
951 #define error_status_ok 0
952
953   /*
954      typedef union switch (signed32 status) tagged_union {
955      case error_status_ok:
956      rs_pgo_result_t     result;
957
958      default:
959      ;                      * empty branch of union *
960
961      } rs_pgo_query_result_t;
962    */
963
964   di = pinfo->private_data;
965   if (di->conformant_run)
966     {
967       return offset;
968     }
969
970   if (parent_tree)
971     {
972       item = proto_tree_add_text (parent_tree, tvb, offset, -1,
973                                   "rs_pgo_query_result_t");
974       tree = proto_item_add_subtree (item, ett_rs_pgo_query_result_t);
975     }
976
977   offset =
978     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
979                         hf_rs_pgo_query_result_t, &st);
980   status = val_to_str_ext (st, &dce_error_vals_ext, "%u");
981
982   if (check_col (pinfo->cinfo, COL_INFO))
983     col_append_fstr (pinfo->cinfo, COL_INFO, " status:%s ", status);
984
985   offset += 4;                  /* XXX */
986
987   switch (st)
988     {
989     case error_status_ok:
990       offset = dissect_rs_pgo_result_t (tvb, offset, pinfo, tree, drep);
991       break;
992     default:
993       ;
994
995     }
996
997   proto_item_set_len (item, offset - old_offset);
998   return offset;
999 }
1000
1001
1002
1003 static int
1004 rs_pgo_dissect_add_rqst (tvbuff_t * tvb, int offset,
1005                          packet_info * pinfo, proto_tree * tree,
1006                          guint8 * drep)
1007 {
1008   dcerpc_info *di;
1009
1010   di = pinfo->private_data;
1011   if (di->conformant_run)
1012     {
1013       return offset;
1014     }
1015
1016 /*
1017         [in]        sec_rgy_domain_t    name_domain,
1018         [in]        sec_rgy_name_t      pgo_name,
1019         [in]        sec_rgy_pgo_item_t  *pgo_item,
1020 */
1021
1022   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1023   offset += 4;
1024   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1025   offset =
1026     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1027                          dissect_sec_rgy_pgo_item_t, NDR_POINTER_REF,
1028                          "sec_rgy_pgo_item_t: ", -1);
1029
1030   return offset;
1031 }
1032 static int
1033 rs_pgo_dissect_add_resp (tvbuff_t * tvb, int offset,
1034                          packet_info * pinfo, proto_tree * tree,
1035                          guint8 * drep)
1036 {
1037   dcerpc_info *di;
1038   guint32 buff_remain;
1039
1040   di = pinfo->private_data;
1041   if (di->conformant_run)
1042     {
1043       return offset;
1044     }
1045
1046 /*
1047         [out]       rs_cache_data_t     *cache_info,
1048         [out]       error_status_t      *status
1049 */
1050
1051  buff_remain = tvb_length_remaining(tvb, offset);
1052
1053 /* found several add_member responses that had 8 bytes of data. first was 4 0's and last was 3 zeros and a 1 */
1054 if (buff_remain > 8) {
1055   offset =
1056     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1057                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1058                          "cache_info: ", -1);
1059 }
1060   offset =
1061     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1062                          dissect_error_status_t, NDR_POINTER_REF, "status: ",
1063                          -1);
1064   return offset;
1065 }
1066
1067 static int
1068 rs_pgo_dissect_delete_rqst (tvbuff_t * tvb, int offset,
1069                             packet_info * pinfo, proto_tree * tree,
1070                             guint8 * drep)
1071 {
1072   dcerpc_info *di;
1073
1074   di = pinfo->private_data;
1075   if (di->conformant_run)
1076     {
1077       return offset;
1078     }
1079
1080 /*
1081         [in]        sec_rgy_domain_t    name_domain,
1082         [in]        sec_rgy_name_t      pgo_name,
1083 */
1084   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1085   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1086
1087   return offset;
1088 }
1089
1090 static int
1091 rs_pgo_dissect_delete_resp (tvbuff_t * tvb, int offset,
1092                             packet_info * pinfo, proto_tree * tree,
1093                             guint8 * drep)
1094 {
1095   dcerpc_info *di;
1096   guint32 buff_remain;
1097
1098   di = pinfo->private_data;
1099   if (di->conformant_run)
1100     {
1101       return offset;
1102     }
1103
1104 /*
1105         [out]       rs_cache_data_t     *cache_info,
1106         [out]       error_status_t      *status
1107 */
1108  buff_remain = tvb_length_remaining(tvb, offset);
1109
1110 /* found several add_member responses that had 8 bytes of data. first was 4 0's and last was 3 zeros and a 1 */
1111
1112   if (buff_remain > 8) {
1113   offset =
1114     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1115                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1116                          "cache_info:", -1);
1117   }
1118
1119   offset =
1120     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1121                          dissect_error_status_t, NDR_POINTER_REF, "status:",
1122                          -1);
1123
1124   return offset;
1125 }
1126
1127 static int
1128 rs_pgo_dissect_replace_rqst (tvbuff_t * tvb, int offset,
1129                              packet_info * pinfo, proto_tree * tree,
1130                              guint8 * drep)
1131 {
1132   dcerpc_info *di;
1133
1134   di = pinfo->private_data;
1135   if (di->conformant_run)
1136     {
1137       return offset;
1138     }
1139
1140 /*
1141         [in]        sec_rgy_domain_t    name_domain,
1142         [in]        sec_rgy_name_t      pgo_name,
1143         [in]        sec_rgy_pgo_item_t  *pgo_item,
1144 */
1145   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1146   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1147   offset =
1148     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1149                          dissect_sec_rgy_pgo_item_t, NDR_POINTER_REF,
1150                          "pgo_item:", -1);
1151
1152   return offset;
1153 }
1154
1155 static int
1156 rs_pgo_dissect_replace_resp (tvbuff_t * tvb, int offset,
1157                              packet_info * pinfo, proto_tree * tree,
1158                              guint8 * drep)
1159 {
1160   dcerpc_info *di;
1161
1162   di = pinfo->private_data;
1163   if (di->conformant_run)
1164     {
1165       return offset;
1166     }
1167
1168 /*
1169         [out]       rs_cache_data_t     *cache_info,
1170         [out]       error_status_t      *status
1171
1172 */
1173
1174   offset =
1175     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1176                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1177                          "cache_info:", -1);
1178   offset =
1179     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1180                          dissect_error_status_t, NDR_POINTER_REF, "status:",
1181                          -1);
1182
1183   return offset;
1184 }
1185
1186
1187 static int
1188 rs_pgo_dissect_add_member_rqst (tvbuff_t * tvb, int offset,
1189                                 packet_info * pinfo, proto_tree * tree,
1190                                 guint8 * drep)
1191 {
1192
1193   dcerpc_info *di;
1194
1195   di = pinfo->private_data;
1196   if (di->conformant_run)
1197     {
1198       return offset;
1199     }
1200
1201
1202
1203 /*
1204         [in]        sec_rgy_domain_t    name_domain,
1205         [in]        sec_rgy_name_t      go_name,
1206         [in]        sec_rgy_name_t      person_name,
1207 */
1208
1209   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1210   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1211   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1212
1213
1214   return offset;
1215
1216 }
1217 static int
1218 rs_pgo_dissect_rename_rqst (tvbuff_t * tvb, int offset,
1219                             packet_info * pinfo, proto_tree * tree,
1220                             guint8 * drep)
1221 {
1222   dcerpc_info *di;
1223
1224   di = pinfo->private_data;
1225   if (di->conformant_run)
1226     {
1227       return offset;
1228     }
1229
1230 /*
1231         [in]        sec_rgy_domain_t    name_domain,
1232         [in]        sec_rgy_name_t      old_name,
1233         [in]        sec_rgy_name_t      new_name,
1234 */
1235   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1236   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1237   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1238
1239
1240   return offset;
1241 }
1242
1243 static int
1244 rs_pgo_dissect_rename_resp (tvbuff_t * tvb, int offset,
1245                             packet_info * pinfo, proto_tree * tree,
1246                             guint8 * drep)
1247 {
1248   dcerpc_info *di;
1249
1250   di = pinfo->private_data;
1251   if (di->conformant_run)
1252     {
1253       return offset;
1254     }
1255
1256 /*
1257         [out]       rs_cache_data_t     *cache_info,
1258         [out]       error_status_t      *status
1259 */
1260   offset =
1261     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1262                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1263                          "cache_info:", -1);
1264   offset =
1265     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1266                          dissect_error_status_t, NDR_POINTER_REF, "status:",
1267                          -1);
1268
1269   return offset;
1270 }
1271
1272
1273 static int
1274 rs_pgo_dissect_add_member_resp (tvbuff_t * tvb, int offset,
1275                                 packet_info * pinfo, proto_tree * tree,
1276                                 guint8 * drep)
1277 {
1278   dcerpc_info *di;
1279   guint32 buff_remain;
1280
1281   di = pinfo->private_data;
1282   if (di->conformant_run)
1283     {
1284       return offset;
1285     }
1286
1287 /*
1288         [out]       rs_cache_data_t     *cache_info,
1289         [out]       error_status_t      *status
1290 */
1291
1292  buff_remain = tvb_length_remaining(tvb, offset);
1293
1294 /* found several add responses that had 8 bytes of data. first was 4 0's and last was 3 zeros and a 1 */
1295 if (buff_remain > 8) {
1296
1297   offset =
1298     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1299                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1300                          "cache_info:", -1);
1301 }
1302   offset =
1303     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1304                          dissect_error_status_t, NDR_POINTER_REF, "status:",
1305                          -1);
1306
1307
1308   return offset;
1309 }
1310
1311 static int
1312 rs_pgo_dissect_delete_member_rqst (tvbuff_t * tvb, int offset,
1313                                    packet_info * pinfo, proto_tree * tree,
1314                                    guint8 * drep)
1315 {
1316   dcerpc_info *di;
1317
1318   di = pinfo->private_data;
1319   if (di->conformant_run)
1320     {
1321       return offset;
1322     }
1323
1324 /*
1325     void rs_pgo_delete_member (
1326         [in]        sec_rgy_domain_t    name_domain,
1327         [in]        sec_rgy_name_t      go_name,
1328         [in]        sec_rgy_name_t      person_name,
1329     );
1330 */
1331
1332   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1333   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1334   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1335
1336   return offset;
1337
1338 }
1339
1340
1341 static int
1342 rs_pgo_dissect_get_members_rqst (tvbuff_t * tvb, int offset,
1343                                  packet_info * pinfo, proto_tree * tree,
1344                                  guint8 * drep)
1345 {
1346
1347   guint32 max_members;
1348   dcerpc_info *di;
1349
1350   di = pinfo->private_data;
1351   if (di->conformant_run)
1352     {
1353       return offset;
1354     }
1355
1356 /*
1357         [in]        sec_rgy_domain_t        name_domain,
1358         [in]        sec_rgy_name_t          go_name,
1359         [in, out]   sec_rgy_cursor_t        *member_cursor,
1360         [in]        signed32                max_members,
1361 */
1362
1363   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1364   offset += 4;
1365   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1366   offset =
1367     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1368                          dissect_sec_rgy_cursor_t, NDR_POINTER_REF,
1369                          "member_cursor:", -1);
1370   offset =
1371     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_rs_var1,
1372                         &max_members);
1373
1374   if (check_col (pinfo->cinfo, COL_INFO))
1375     col_append_fstr (pinfo->cinfo, COL_INFO, " :max_members:%u", max_members);
1376
1377   return offset;
1378 }
1379
1380 static int
1381 rs_pgo_dissect_key_transfer_rqst (tvbuff_t * tvb, int offset,
1382                                   packet_info * pinfo, proto_tree * tree,
1383                                   guint8 * drep)
1384 {
1385   dcerpc_info *di;
1386
1387   di = pinfo->private_data;
1388   if (di->conformant_run)
1389     {
1390       return offset;
1391     }
1392
1393 /*
1394         [in]        sec_rgy_domain_t    name_domain,
1395         [in]        rs_pgo_query_t      requested_result_type,
1396         [in, out]   rs_pgo_query_key_t  *key,
1397 */
1398
1399   offset += 4;
1400   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1401   offset = dissect_rs_pgo_query_t (tvb, offset, pinfo, tree, drep);
1402   offset =
1403     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1404                          dissect_rs_pgo_query_key_t, NDR_POINTER_REF, "key:",
1405                          -1);
1406
1407   return offset;
1408 }
1409
1410 static int
1411 rs_pgo_dissect_key_transfer_resp (tvbuff_t * tvb, int offset,
1412                                   packet_info * pinfo, proto_tree * tree,
1413                                   guint8 * drep)
1414 {
1415   dcerpc_info *di;
1416
1417   di = pinfo->private_data;
1418   if (di->conformant_run)
1419     {
1420       return offset;
1421     }
1422
1423 /*
1424         [in, out]   rs_pgo_query_key_t  *key,
1425         [out]       rs_cache_data_t     *cache_info,
1426         [out]       error_status_t      *status
1427 */
1428
1429   offset =
1430     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1431                          dissect_rs_pgo_query_key_t, NDR_POINTER_REF, "key:",
1432                          -1);
1433   offset =
1434     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1435                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1436                          "cache_info:", -1);
1437   offset =
1438     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1439                          dissect_error_status_t, NDR_POINTER_REF, "status:",
1440                          -1);
1441
1442   return offset;
1443 }
1444
1445
1446 static int
1447 rs_pgo_dissect_is_member_resp (tvbuff_t * tvb, int offset,
1448                                packet_info * pinfo, proto_tree * tree,
1449                                guint8 * drep)
1450 {
1451   dcerpc_info *di;
1452
1453   di = pinfo->private_data;
1454   if (di->conformant_run)
1455     {
1456       return offset;
1457     }
1458
1459 /*
1460         [out]       rs_cache_data_t     *cache_info,
1461         [out]       error_status_t      *status
1462 */
1463   offset =
1464     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1465                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1466                          "cache_info:", -1);
1467   offset =
1468     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1469                          dissect_error_status_t, NDR_POINTER_REF, "status:",
1470                          -1);
1471
1472   return offset;
1473 }
1474
1475 static int
1476 rs_pgo_dissect_is_member_rqst (tvbuff_t * tvb, int offset,
1477                                packet_info * pinfo, proto_tree * tree,
1478                                guint8 * drep)
1479 {
1480   dcerpc_info *di;
1481 /*
1482         [in]        sec_rgy_domain_t    name_domain,
1483         [in]        sec_rgy_name_t      go_name,
1484         [in]        sec_rgy_name_t      person_name,
1485 */
1486
1487
1488   di = pinfo->private_data;
1489   if (di->conformant_run)
1490     {
1491       return offset;
1492     }
1493
1494   offset += 4;
1495   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1496   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1497   offset += 4;
1498   offset = dissect_sec_rgy_name_t (tvb, offset, pinfo, tree, drep);
1499
1500
1501   return offset;
1502
1503 }
1504
1505
1506 static int
1507 rs_pgo_dissect_get_rqst (tvbuff_t * tvb, int offset,
1508                          packet_info * pinfo, proto_tree * tree,
1509                          guint8 * drep)
1510 {
1511   dcerpc_info *di;
1512   guint32 allow_aliases;
1513
1514   di = pinfo->private_data;
1515   if (di->conformant_run)
1516     {
1517       return offset;
1518     }
1519
1520 /*
1521         [in]        sec_rgy_domain_t        name_domain,
1522         [in]        rs_pgo_query_key_t      *key,
1523         [in]        boolean32               allow_aliases,
1524         [in, out]   sec_rgy_cursor_t        *item_cursor,
1525 */
1526
1527   offset = dissect_sec_rgy_domain_t (tvb, offset, pinfo, tree, drep);
1528   offset =
1529     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1530                          dissect_rs_pgo_query_key_t, NDR_POINTER_REF, "key:",
1531                          -1);
1532   offset =
1533     dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, hf_rs_var1,
1534                         &allow_aliases);
1535
1536   if (check_col (pinfo->cinfo, COL_INFO))
1537     col_append_fstr (pinfo->cinfo, COL_INFO, " :allow_aliases:%u",
1538                      allow_aliases);
1539
1540
1541   offset += 4;                  /* XXX */
1542
1543   offset =
1544     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1545                          dissect_sec_rgy_cursor_t, NDR_POINTER_REF,
1546                          "item_cursor:", -1);
1547   return offset;
1548
1549 }
1550
1551 static int
1552 rs_pgo_dissect_get_resp (tvbuff_t * tvb, int offset,
1553                          packet_info * pinfo, proto_tree * tree,
1554                          guint8 * drep)
1555 {
1556
1557   dcerpc_info *di;
1558
1559   di = pinfo->private_data;
1560   if (di->conformant_run)
1561     {
1562       return offset;
1563     }
1564
1565 /*
1566         [in, out]   sec_rgy_cursor_t        *item_cursor,
1567         [out]       rs_cache_data_t         *cache_info,
1568         [out]       rs_pgo_query_result_t   *result
1569 */
1570
1571   offset =
1572     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1573                          dissect_sec_rgy_cursor_t, NDR_POINTER_REF,
1574                          "item_cursor:", -1);
1575   offset =
1576     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1577                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1578                          "cache_info:", -1);
1579   offset =
1580     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1581                          dissect_rs_pgo_query_result_t, NDR_POINTER_REF,
1582                          "result:", -1);
1583
1584   return offset;
1585
1586 }
1587
1588 static int
1589 rs_pgo_dissect_delete_member_resp (tvbuff_t * tvb, int offset,
1590                                    packet_info * pinfo, proto_tree * tree,
1591                                    guint8 * drep)
1592 {
1593
1594   dcerpc_info *di;
1595
1596   di = pinfo->private_data;
1597   if (di->conformant_run)
1598     {
1599       return offset;
1600     }
1601
1602 /*
1603         [out]       rs_cache_data_t     *cache_info,
1604         [out]       error_status_t      *status
1605
1606 */
1607
1608   offset =
1609     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1610                          dissect_rs_cache_data_t, NDR_POINTER_REF,
1611                          "cache_info:", -1);
1612   offset =
1613     dissect_ndr_pointer (tvb, offset, pinfo, tree, drep,
1614                          dissect_error_status_t, NDR_POINTER_REF, "status:",
1615                          -1);
1616
1617   return offset;
1618
1619 }
1620
1621
1622 static dcerpc_sub_dissector rs_pgo_dissectors[] = {
1623   {0, "add", rs_pgo_dissect_add_rqst, rs_pgo_dissect_add_resp},
1624   {1, "delete", rs_pgo_dissect_delete_rqst, rs_pgo_dissect_delete_resp},
1625   {2, "replace", rs_pgo_dissect_replace_rqst, rs_pgo_dissect_replace_resp},
1626   {3, "rename", rs_pgo_dissect_rename_rqst, rs_pgo_dissect_rename_resp},
1627   {4, "get", rs_pgo_dissect_get_rqst, rs_pgo_dissect_get_resp},
1628   {5, "key_transfer", rs_pgo_dissect_key_transfer_rqst,
1629    rs_pgo_dissect_key_transfer_resp},
1630   {6, "add_member", rs_pgo_dissect_add_member_rqst,
1631    rs_pgo_dissect_add_member_resp},
1632   {7, "delete_member", rs_pgo_dissect_delete_member_rqst,
1633    rs_pgo_dissect_delete_member_resp},
1634   {8, "is_member", rs_pgo_dissect_is_member_rqst,
1635    rs_pgo_dissect_is_member_resp},
1636   {9, "get_members", rs_pgo_dissect_get_members_rqst, NULL},
1637   {0, NULL, NULL, NULL},
1638 };
1639
1640
1641 void
1642 proto_register_rs_pgo (void)
1643 {
1644   static hf_register_info hf[] = {
1645     {&hf_rs_pgo_opnum,
1646      {"Operation", "rs_pgo.opnum", FT_UINT16, BASE_DEC, NULL, 0x0,
1647       NULL, HFILL}},
1648     {&hf_error_status_t,
1649      {"Error status", "rs_pgo.error_status", FT_UINT32, BASE_DEC, NULL,
1650       0x0, NULL, HFILL}},
1651     {&hf_rs_pgo_query_key_t,
1652      {"Query key", "rs_pgo.query_key", FT_UINT32, BASE_DEC,
1653       NULL, 0x0, NULL, HFILL}},
1654     {&hf_rs_pgo_query_result_t,
1655      {"Query result", "rs_pgo.query_result", FT_UINT32,
1656       BASE_DEC, NULL, 0x0, NULL, HFILL}},
1657     {&hf_rs_pgo_query_t,
1658      {"Query", "rs_pgo.query", FT_UINT32, BASE_DEC, NULL,
1659       0x0, NULL, HFILL}},
1660     {&hf_rs_sec_rgy_pgo_item_t_quota,
1661      {"Quota", "rs_pgo.quota",
1662       FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1663     {&hf_rs_sec_rgy_pgo_item_t_unix_num,
1664      {"Unix num",
1665       "rs_pgo.unix_num", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
1666       HFILL}},
1667     {&hf_rs_timeval,
1668      {"Timeval", "rs_pgo.timeval", FT_RELATIVE_TIME, BASE_NONE, NULL,
1669       0x0, NULL, HFILL}},
1670     {&hf_rs_uuid1,
1671      {"Uuid1", "rs_pgo.uuid1", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1672     {&hf_rs_var1,
1673      {"Var1", "rs_pgo.var1", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
1674       HFILL}},
1675     {&hf_sec_rgy_domain_t,
1676      {"Domain", "rs_pgo.domain", FT_UINT32, BASE_DEC,
1677       NULL, 0x0, NULL, HFILL}},
1678     {&hf_sec_rgy_name_t_principalName_string,
1679      {"Name principalName", "rs_pgo.name_principalName", FT_STRING, BASE_NONE, NULL,
1680       0x0, NULL, HFILL}},
1681     {&hf_sec_rgy_name_t_size,
1682      {"Name_t size", "rs_pgo.name_t_size", FT_UINT32,
1683       BASE_DEC, NULL, 0x0, NULL, HFILL}},
1684     {&hf_sec_rgy_pgo_flags_t,
1685      {"Flags", "rs_pgo.flags", FT_UINT32,
1686       BASE_HEX, NULL, 0x0, NULL, HFILL}},
1687     {&hf_sec_rgy_pname_t_size,
1688      {"Pname_t size", "rs_pgo.pname_t_size", FT_UINT32, BASE_DEC, NULL,
1689       0x0, NULL, HFILL}},
1690     {&hf_sec_rgy_pname_t_principalName_string,
1691      {"Pname principalName", "rs_pgo.pname_principalName", FT_STRING,
1692       BASE_NONE, NULL, 0x0, NULL, HFILL}},
1693     {&hf_rs_pgo_unix_num_key_t,
1694      {"Unix num key", "rs_pgo.unix_num_key_t", FT_UINT32,
1695       BASE_DEC,
1696       NULL, 0x0, NULL, HFILL}}
1697   };
1698
1699   static gint *ett[] = {
1700     &ett_error_status_t,
1701     &ett_rgy_acct_user_flags_t,
1702     &ett_rs_pgo,
1703     &ett_rs_pgo_id_key_t,
1704     &ett_rs_pgo_query_key_t,
1705     &ett_rs_pgo_query_result_t,
1706     &ett_rs_pgo_query_t,
1707     &ett_rs_pgo_result_t,
1708     &ett_rs_pgo_unix_num_key_t,
1709     &ett_sec_attr_component_name_t,
1710     &ett_sec_passwd_type_t,
1711     &ett_sec_rgy_acct_admin_flags_t,
1712     &ett_sec_rgy_acct_admin_t,
1713     &ett_sec_rgy_acct_auth_flags_t,
1714     &ett_sec_rgy_acct_key_t,
1715     &ett_sec_rgy_acct_user_t,
1716     &ett_sec_rgy_cursor_t,
1717     &ett_sec_rgy_foreign_id_t,
1718     &ett_sec_rgy_login_name_t,
1719     &ett_sec_rgy_name_t,
1720     &ett_sec_rgy_domain_t,
1721     &ett_sec_rgy_pgo_flags_t,
1722     &ett_sec_rgy_pgo_item_t,
1723     &ett_sec_rgy_pname_t,
1724     &ett_sec_rgy_sid_t,
1725     &ett_sec_rgy_unix_passwd_buf_t,
1726     &ett_sec_rgy_unix_sid_t,
1727     &ett_sec_timeval_sec_t,
1728     &ett_rs_cache_data_t,
1729   };
1730   proto_rs_pgo =
1731     proto_register_protocol ("DCE Name Service", "RS_PGO", "rs_pgo");
1732   proto_register_field_array (proto_rs_pgo, hf, array_length (hf));
1733   proto_register_subtree_array (ett, array_length (ett));
1734 }
1735
1736 void
1737 proto_reg_handoff_rs_pgo (void)
1738 {
1739   /* Register the protocol as dcerpc */
1740   dcerpc_init_uuid (proto_rs_pgo, ett_rs_pgo, &uuid_rs_pgo, ver_rs_pgo,
1741                     rs_pgo_dissectors, hf_rs_pgo_opnum);
1742 }