Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-dcerpc-krb5rpc.c
blobd208874dba6bbe1abed7dc68ebb237e01c0602ca
1 /* packet-dcerpc-krb5rpc.c
3 * Routines for dcerpc DCE/KRB5 interface
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/krb5rpc.idl
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include "config.h"
18 #include <epan/packet.h>
19 #include <epan/asn1.h>
20 #include "packet-dcerpc.h"
21 #include "packet-kerberos.h"
23 void proto_register_krb5rpc (void);
24 void proto_reg_handoff_krb5rpc (void);
26 static int proto_krb5rpc;
28 static int ett_krb5rpc;
31 static e_guid_t uuid_krb5rpc =
32 { 0x8f73de50, 0x768c, 0x11ca, {0xbf, 0xfc, 0x08, 0x00, 0x1e, 0x03, 0x94,
33 0x31}
35 static uint16_t ver_krb5rpc = 1;
36 static int hf_krb5rpc_opnum;
37 static int hf_krb5rpc_sendto_kdc_rqst_keysize;
38 static int hf_krb5rpc_sendto_kdc_rqst_spare1;
39 static int hf_krb5rpc_sendto_kdc_resp_len;
40 static int hf_krb5rpc_sendto_kdc_resp_max;
41 static int hf_krb5rpc_sendto_kdc_resp_spare1;
42 static int hf_krb5rpc_sendto_kdc_resp_keysize;
43 /* static int hf_krb5rpc_sendto_kdc_resp_st; */
44 static int hf_krb5rpc_krb5;
45 static int ett_krb5rpc_krb5;
47 static int
48 krb5rpc_dissect_sendto_kdc_rqst (tvbuff_t * tvb, int offset,
49 packet_info * pinfo, proto_tree * tree,
50 dcerpc_info *di, uint8_t *drep)
52 uint32_t keysize, spare1, remain;
53 proto_item *item;
54 tvbuff_t *krb5_tvb;
55 proto_tree *subtree;
59 * [in] handle_t h,
60 * [in] unsigned32 len,
61 * [in, size_is(len)]
62 * byte message[],
63 * [in] unsigned32 out_buf_len,
66 offset =
67 dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
68 hf_krb5rpc_sendto_kdc_rqst_keysize, &keysize);
69 offset =
70 dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
71 hf_krb5rpc_sendto_kdc_rqst_spare1, &spare1);
72 item = proto_tree_add_item (tree, hf_krb5rpc_krb5, tvb, offset, -1, ENC_NA);
73 subtree = proto_item_add_subtree (item, ett_krb5rpc_krb5);
75 remain = tvb_captured_length_remaining(tvb, offset);
76 krb5_tvb = tvb_new_subset_length(tvb, offset, remain);
77 offset = dissect_kerberos_main (krb5_tvb, pinfo, subtree, true, NULL);
80 return offset;
84 static int
85 krb5rpc_dissect_sendto_kdc_resp (tvbuff_t * tvb, int offset,
86 packet_info * pinfo, proto_tree * tree,
87 dcerpc_info *di, uint8_t *drep)
89 uint32_t resp_len, maxsize, spare1, keysize, remain;
90 proto_item *item;
91 tvbuff_t *krb5_tvb;
92 proto_tree *subtree;
97 * [out] unsigned32 *resp_len,
98 * [out, length_is(*resp_len), size_is(out_buf_len)]
99 * byte out_buf[],
100 * [out] error_status_t *st unsigned long
104 offset =
105 dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
106 hf_krb5rpc_sendto_kdc_resp_len, &resp_len);
107 offset =
108 dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
109 hf_krb5rpc_sendto_kdc_resp_max, &maxsize);
110 offset =
111 dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
112 hf_krb5rpc_sendto_kdc_resp_spare1, &spare1);
113 offset =
114 dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
115 hf_krb5rpc_sendto_kdc_resp_keysize, &keysize);
118 item = proto_tree_add_item (tree, hf_krb5rpc_krb5, tvb, offset, -1, ENC_NA);
119 subtree = proto_item_add_subtree (item, ett_krb5rpc_krb5);
120 remain = tvb_captured_length_remaining(tvb, offset);
121 krb5_tvb = tvb_new_subset_length(tvb, offset, remain);
123 offset = dissect_kerberos_main (krb5_tvb, pinfo, subtree, true, NULL);
124 offset += 16; /* no idea what this is, probably just extended encrypted text. */
126 return offset;
130 static const dcerpc_sub_dissector krb5rpc_dissectors[] = {
131 {0, "rsec_krb5rpc_sendto_kdc", krb5rpc_dissect_sendto_kdc_rqst,
132 krb5rpc_dissect_sendto_kdc_resp},
133 {0, NULL, NULL, NULL},
137 void
138 proto_register_krb5rpc (void)
140 static hf_register_info hf[] = {
141 {&hf_krb5rpc_opnum,
142 {"Opnum", "krb5rpc.opnum", FT_UINT16, BASE_DEC, NULL, 0x0,
143 NULL, HFILL }},
144 {&hf_krb5rpc_sendto_kdc_rqst_keysize,
145 {"Request keysize",
146 "krb5rpc.sendto_kdc_rqst_keysize", FT_UINT32, BASE_DEC, NULL, 0x0,
147 NULL, HFILL}},
148 {&hf_krb5rpc_sendto_kdc_rqst_spare1,
149 {"Request spare1",
150 "krb5rpc.sendto_kdc_rqst_spare1", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
151 HFILL}},
152 {&hf_krb5rpc_sendto_kdc_resp_len,
153 {"Response length", "krb5rpc.sendto_kdc_resp_len",
154 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
155 {&hf_krb5rpc_sendto_kdc_resp_max,
156 {"Response max", "krb5rpc.sendto_kdc_resp_max",
157 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
158 {&hf_krb5rpc_sendto_kdc_resp_spare1,
159 {"Response spare1",
160 "krb5rpc.sendto_kdc_resp_spare1", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
161 HFILL}},
162 {&hf_krb5rpc_sendto_kdc_resp_keysize,
163 {"Response key size",
164 "krb5rpc.sendto_kdc_resp_keysize", FT_UINT32, BASE_DEC, NULL, 0x0,
165 NULL, HFILL}},
166 #if 0
167 {&hf_krb5rpc_sendto_kdc_resp_st,
168 {"Response st", "krb5rpc.sendto_kdc_resp_st",
169 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
170 #endif
171 {&hf_krb5rpc_krb5,
172 {"krb5", "krb5rpc.krb5", FT_BYTES, BASE_NONE, NULL, 0x0,
173 "krb5 blob", HFILL}},
177 static int *ett[] = {
178 &ett_krb5rpc,
179 &ett_krb5rpc_krb5,
181 proto_krb5rpc =
182 proto_register_protocol ("DCE/RPC Kerberos V", "KRB5RPC", "krb5rpc");
183 proto_register_field_array (proto_krb5rpc, hf, array_length (hf));
184 proto_register_subtree_array (ett, array_length (ett));
187 void
188 proto_reg_handoff_krb5rpc (void)
190 /* Register the protocol as dcerpc */
191 dcerpc_init_uuid (proto_krb5rpc, ett_krb5rpc, &uuid_krb5rpc, ver_krb5rpc,
192 krb5rpc_dissectors, hf_krb5rpc_opnum);
196 * Editor modelines - https://www.wireshark.org/tools/modelines.html
198 * Local Variables:
199 * c-basic-offset: 2
200 * tab-width: 8
201 * indent-tabs-mode: nil
202 * End:
204 * ex: set shiftwidth=2 tabstop=8 expandtab:
205 * :indentSize=2:tabSize=8:noTabs=true: