HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-dcerpc-rpriv.c
blob9ad1b170aeeb119ae7f8c84efdc79ee3cf2f0e07
1 /* packet-dcerpc-rpriv.c
3 * Routines for DCERPC Privilege Server operations
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/rpriv.idl
8 * $Id$
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "config.h"
32 #include <glib.h>
33 #include <epan/packet.h>
34 #include "packet-dcerpc.h"
37 static int proto_rpriv = -1;
38 static int hf_rpriv_opnum = -1;
39 static int hf_rpriv_get_eptgt_rqst_authn_svc = -1;
40 static int hf_rpriv_get_eptgt_rqst_authz_svc = -1;
41 static int hf_rpriv_get_eptgt_rqst_var1 = -1;
42 /* static int hf_rpriv_get_eptgt_rqst_key_size = -1; */
43 static int hf_rpriv_get_eptgt_rqst_key_size2 = -1;
44 static int hf_rpriv_get_eptgt_rqst_key_t = -1;
45 static int hf_rpriv_get_eptgt_rqst_key_t2 = -1;
47 static gint ett_rpriv = -1;
50 static e_uuid_t uuid_rpriv = { 0xb1e338f8, 0x9533, 0x11c9, { 0xa3, 0x4a, 0x08, 0x00, 0x1e, 0x01, 0x9c, 0x1e } };
51 static guint16 ver_rpriv = 1;
54 static int
55 rpriv_dissect_get_eptgt_rqst (tvbuff_t *tvb, int offset,
56 packet_info *pinfo, proto_tree *tree,
57 dcerpc_info *di, guint8 *drep)
59 /* [in] handle_t handle,
60 * [in] unsigned32 authn_svc,
61 * [in] unsigned32 authz_svc,
62 * [in] rpriv_pickle_t *ptgt_req,
63 * unsigned32 num_bytes;
64 * [size_is(num_bytes)]
65 * byte bytes[];
68 guint32 authn_svc, authz_svc, key_size, key_size2, var1;
69 const char *key_t1 = NULL;
70 const char *key_t2 = NULL;
72 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_rpriv_get_eptgt_rqst_authn_svc, &authn_svc);
73 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_rpriv_get_eptgt_rqst_authz_svc, &authz_svc);
74 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_rpriv_get_eptgt_rqst_var1, &var1);
75 offset += 276;
76 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_rpriv_get_eptgt_rqst_key_size2, &key_size);
77 /* advance to get size of cell, and princ */
79 proto_tree_add_item (tree, hf_rpriv_get_eptgt_rqst_key_t, tvb, offset, key_size, ENC_ASCII|ENC_NA);
80 key_t1 = tvb_get_string(wmem_packet_scope(), tvb, offset, key_size);
81 offset += key_size;
83 offset += 8;
84 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_rpriv_get_eptgt_rqst_key_size2, &key_size2);
85 proto_tree_add_item (tree, hf_rpriv_get_eptgt_rqst_key_t2, tvb, offset, key_size2, ENC_ASCII|ENC_NA);
86 key_t2 = tvb_get_string(wmem_packet_scope(), tvb, offset, key_size2);
87 offset += key_size2;
90 col_append_fstr(pinfo->cinfo, COL_INFO,
91 " Request for: %s in %s ", key_t2, key_t1);
93 return offset;
98 static dcerpc_sub_dissector rpriv_dissectors[] = {
99 { 0, "get_ptgt", NULL,NULL},
100 { 1, "become_delegate", NULL, NULL},
101 { 2, "become_impersonator", NULL, NULL},
102 { 3, "get_eptgt", rpriv_dissect_get_eptgt_rqst , NULL},
103 { 0, NULL, NULL, NULL }
106 void
107 proto_register_rpriv (void)
109 static hf_register_info hf[] = {
110 { &hf_rpriv_opnum,
111 { "Operation", "rpriv.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
112 { &hf_rpriv_get_eptgt_rqst_authn_svc,
113 { "Authn_Svc", "rpriv.get_eptgt_rqst_authn_svc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
114 { &hf_rpriv_get_eptgt_rqst_authz_svc,
115 { "Authz_Svc", "rpriv.get_eptgt_rqst_authz_svc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
116 #if 0
117 { &hf_rpriv_get_eptgt_rqst_key_size,
118 { "Key_Size", "rpriv.get_eptgt_rqst_key_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
119 #endif
120 { &hf_rpriv_get_eptgt_rqst_var1,
121 { "Var1", "rpriv.get_eptgt_rqst_var1", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
122 { &hf_rpriv_get_eptgt_rqst_key_size2,
123 { "Key_Size", "rpriv.get_eptgt_rqst_key_size2", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
124 { &hf_rpriv_get_eptgt_rqst_key_t,
125 { "Key_t", "rpriv.get_eptgt_rqst_key_t", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
126 { &hf_rpriv_get_eptgt_rqst_key_t2,
127 { "Key_t2", "rpriv.get_eptgt_rqst_key_t2", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
131 static gint *ett[] = {
132 &ett_rpriv,
134 proto_rpriv = proto_register_protocol ("Privilege Server operations", "rpriv", "rpriv");
135 proto_register_field_array (proto_rpriv, hf, array_length (hf));
136 proto_register_subtree_array (ett, array_length (ett));
139 void
140 proto_reg_handoff_rpriv (void)
142 /* Register the protocol as dcerpc */
143 dcerpc_init_uuid (proto_rpriv, ett_rpriv, &uuid_rpriv, ver_rpriv, rpriv_dissectors, hf_rpriv_opnum);