2 # spnego conformation file
11 #.FN_BODY NegotiationToken/negTokenInit
12 bool is_response = actx->pinfo->ptype == PT_TCP &&
13 actx->pinfo->srcport < 1024;
16 * We decode as negTokenInit2 or negTokenInit depending on whether or not
17 * we are in a response or a request. That is essentially what MS-SPNG
21 return dissect_spnego_NegTokenInit2(%(IMPLICIT_TAG)s, %(TVB)s, %(OFFSET)s,
22 %(ACTX)s, %(TREE)s, %(HF_INDEX)s);
24 return dissect_spnego_NegTokenInit(%(IMPLICIT_TAG)s, %(TVB)s, %(OFFSET)s,
25 %(ACTX)s, %(TREE)s, %(HF_INDEX)s);
30 FN_VARIANT = _str VAL_PTR = &MechType_oid
34 gssapi_oid_value *value;
38 value = gssapi_lookup_oid_str(MechType_oid);
41 * Tell our caller the first mechanism we see, so that if
42 * this is a negTokenInit with a mechToken, it can interpret
43 * the mechToken according to the first mechType. (There
44 * might not have been any indication of the mechType
45 * in prior frames, so we can't necessarily use the
46 * mechanism from the conversation; i.e., a negTokenInit
47 * can contain the initial security token for the desired
48 * mechanism of the initiator - that's the first mechanism
53 next_level_value = value;
57 #.FN_BODY InnerContextToken
59 gssapi_oid_value *next_level_value_lcl;
66 * XXX - what should we do if this OID doesn't match the value
67 * attached to the frame or conversation? (That would be
68 * bogus, but that's not impossible - some broken implementation
69 * might negotiate some security mechanism but put the OID
70 * for some other security mechanism in GSS_Wrap tokens.)
73 next_level_value_lcl = gssapi_lookup_oid_str(MechType_oid);
76 * Now dissect the GSS_Wrap token; it's assumed to be in the
79 item = proto_tree_add_item(tree, hf_spnego_wraptoken, tvb, offset, -1, ENC_NA);
81 subtree = proto_item_add_subtree(item, ett_spnego_wraptoken);
84 * Now, we should be able to dispatch after creating a new TVB.
85 * The subdissector must return the length of the part of the
86 * token it dissected, so we can return the length of the part
87 * we (and it) dissected.
89 token_tvb = tvb_new_subset_remaining(tvb, offset);
90 if (next_level_value_lcl && next_level_value_lcl->wrap_handle) {
91 len = call_dissector(next_level_value_lcl->wrap_handle, token_tvb, actx->pinfo,
94 offset = tvb_reported_length(tvb);
96 offset = offset + len;
98 offset = tvb_reported_length(tvb);
100 #.FN_BODY MechTypeList
102 conversation_t *conversation;
104 saw_mechanism = false;
109 * If we saw a mechType we need to store it in case the negTokenTarg
110 * does not provide a supportedMech.
113 conversation = find_or_create_conversation(actx->pinfo);
114 conversation_add_proto_data(conversation, proto_spnego, next_level_value);
117 #.FN_PARS NegTokenInit/mechToken
119 VAL_PTR = &mechToken_tvb
121 #.FN_BODY NegTokenInit/mechToken
123 tvbuff_t *mechToken_tvb = NULL;
128 * Now, we should be able to dispatch, if we've gotten a tvbuff for
129 * the token and we have information on how to dissect its contents.
131 if (mechToken_tvb && next_level_value)
132 call_dissector(next_level_value->handle, mechToken_tvb, actx->pinfo, tree);
134 #.FN_BODY NegTokenTarg/supportedMech
136 conversation_t *conversation;
138 saw_mechanism = false;
143 * If we saw an explicit mechType we store this in the conversation so that
144 * it will override any mechType we might have picked up from the
148 conversation = find_or_create_conversation(actx->pinfo);
149 conversation_add_proto_data(conversation, proto_spnego, next_level_value);
153 #.FN_PARS NegTokenTarg/responseToken
155 VAL_PTR = &responseToken_tvb
157 #.FN_BODY NegTokenTarg/responseToken
159 tvbuff_t *responseToken_tvb;
166 * Now, we should be able to dispatch, if we've gotten a tvbuff for
167 * the token and we have information on how to dissect its contents.
168 * However, we should make sure that there is something in the
171 if (responseToken_tvb && (tvb_reported_length(responseToken_tvb) > 0) ){
172 gssapi_oid_value *value=next_level_value;
175 call_dissector(value->handle, responseToken_tvb, actx->pinfo, tree);
180 #.FN_BODY NegTokenTarg/mechListMIC VAL_PTR = &mechListMIC_tvb
182 tvbuff_t *mechListMIC_tvb;
189 * Now, we should be able to dispatch, if we've gotten a tvbuff for
190 * the token and we have information on how to dissect its contents.
191 * However, we should make sure that there is something in the
194 if (mechListMIC_tvb && (tvb_reported_length(mechListMIC_tvb) > 0) ){
195 gssapi_oid_value *value=next_level_value;
198 call_dissector(value->handle, mechListMIC_tvb, actx->pinfo, tree);
203 #.FN_BODY IAKERB-HEADER/target-realm
210 * MIT Kerberos sends an IAKERB-HEADER like this:
212 * <30 2B A1 29 04 27 53 32 2D 57 32 30 31 32 2D 4C 34 2E 53 31 2D 57 32 30>
214 * <A1 29 04 27 53 32 2D 57 32 30 31 32 2D 4C 34 2E 53 31 2D 57 32 30 31 32>
216 * <04 27 53 32 2D 57 32 30 31 32 2D 4C 34 2E 53 31 2D 57 32 30 31 32 2D 4C>
217 * 4 39: OCTET STRING 'S2-W2012-L4.S1-W2012-L4.W2012R2-L4.BASE'
222 get_ber_identifier(tvb, offset, &ber_class, &pc, &tag);
223 if (ber_class == BER_CLASS_UNI && pc == false && tag == BER_UNI_TAG_OCTETSTRING) {
224 proto_tree_add_text_internal(tree, tvb, offset, 1,
225 "target-realm encoded as OCTET STRING: MIT Kerberos?");
226 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_OCTETSTRING,
227 actx, tree, tvb, offset, hf_index,
230 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
231 actx, tree, tvb, offset, hf_index,
238 # Editor modelines - https://www.wireshark.org/tools/modelines.html
243 # indent-tabs-mode: nil
246 # vi: set shiftwidth=2 tabstop=8 expandtab:
247 # :indentSize=2:tabSize=8:noTabs=true: