aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-spnego.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-30 20:41:45 -0400
committerAnders Broman <a.broman58@gmail.com>2016-07-01 14:26:20 +0000
commita062c802364fd83d43f934560149f2ddd1fee6a3 (patch)
treee5c9240b24a5b86c12b4a9481a2bd93e18b828f5 /epan/dissectors/packet-spnego.c
parentd4add25cb77773d9564dfc8f340ab5ce491a7d20 (diff)
ASN.1 dissectors - don't try to find yourself.
If an ASN.1 dissector is calling register_dissector for itself in its proto_register_xxx function and then calling find_dissector for itself in its proto_reg_handoff_xxx function then just create a static handle for that dissector and use the return value of register_dissector, so the find isn't necessary. Change-Id: I911bdadc2fb4259601c141b955e741a2369cc447 Reviewed-on: https://code.wireshark.org/review/16233 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-spnego.c')
-rw-r--r--epan/dissectors/packet-spnego.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c
index cc597443ac..e988bb7ee8 100644
--- a/epan/dissectors/packet-spnego.c
+++ b/epan/dissectors/packet-spnego.c
@@ -141,6 +141,10 @@ static gint ett_spnego_InitialContextToken_U = -1;
static expert_field ei_spnego_decrypted_keytype = EI_INIT;
static expert_field ei_spnego_unknown_header = EI_INIT;
+static dissector_handle_t spnego_handle;
+static dissector_handle_t spnego_krb5_handle;
+static dissector_handle_t spnego_krb5_wrap_handle;
+
/*
* Unfortunately, we have to have forward declarations of thess,
* as the code generated by asn2wrs includes a call before the
@@ -555,7 +559,7 @@ dissect_spnego_InitialContextToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
/*--- End of included file: packet-spnego-fn.c ---*/
-#line 107 "./asn1/spnego/packet-spnego-template.c"
+#line 111 "./asn1/spnego/packet-spnego-template.c"
/*
* This is the SPNEGO KRB5 dissector. It is not true KRB5, but some ASN.1
* wrapped blob with an OID, USHORT token ID, and a Ticket, that is also
@@ -1962,7 +1966,7 @@ void proto_register_spnego(void) {
NULL, HFILL }},
/*--- End of included file: packet-spnego-hfarr.c ---*/
-#line 1417 "./asn1/spnego/packet-spnego-template.c"
+#line 1421 "./asn1/spnego/packet-spnego-template.c"
};
/* List of subtrees */
@@ -1985,7 +1989,7 @@ void proto_register_spnego(void) {
&ett_spnego_InitialContextToken_U,
/*--- End of included file: packet-spnego-ettarr.c ---*/
-#line 1427 "./asn1/spnego/packet-spnego-template.c"
+#line 1431 "./asn1/spnego/packet-spnego-template.c"
};
static ei_register_info ei[] = {
@@ -1998,14 +2002,14 @@ void proto_register_spnego(void) {
/* Register protocol */
proto_spnego = proto_register_protocol(PNAME, PSNAME, PFNAME);
- register_dissector("spnego", dissect_spnego, proto_spnego);
+ spnego_handle = register_dissector("spnego", dissect_spnego, proto_spnego);
proto_spnego_krb5 = proto_register_protocol("SPNEGO-KRB5",
"SPNEGO-KRB5",
"spnego-krb5");
- register_dissector("spnego-krb5", dissect_spnego_krb5, proto_spnego_krb5);
- register_dissector("spnego-krb5-wrap", dissect_spnego_krb5_wrap, proto_spnego_krb5);
+ spnego_krb5_handle = register_dissector("spnego-krb5", dissect_spnego_krb5, proto_spnego_krb5);
+ spnego_krb5_wrap_handle = register_dissector("spnego-krb5-wrap", dissect_spnego_krb5_wrap, proto_spnego_krb5);
/* Register fields and subtrees */
proto_register_field_array(proto_spnego, hf, array_length(hf));
@@ -2018,12 +2022,10 @@ void proto_register_spnego(void) {
/*--- proto_reg_handoff_spnego ---------------------------------------*/
void proto_reg_handoff_spnego(void) {
- dissector_handle_t spnego_handle, spnego_wrap_handle;
- dissector_handle_t spnego_krb5_handle, spnego_krb5_wrap_handle;
+ dissector_handle_t spnego_wrap_handle;
/* Register protocol with GSS-API module */
- spnego_handle = find_dissector("spnego");
spnego_wrap_handle = create_dissector_handle(dissect_spnego_wrap, proto_spnego);
gssapi_init_oid("1.3.6.1.5.5.2", proto_spnego, ett_spnego,
spnego_handle, spnego_wrap_handle,
@@ -2038,8 +2040,6 @@ void proto_reg_handoff_spnego(void) {
* See the archive of <ietf-krb-wg@anl.gov> for the thread topic
* SPNEGO implementation issues. 3-Dec-2002.
*/
- spnego_krb5_handle = find_dissector("spnego-krb5");
- spnego_krb5_wrap_handle = find_dissector("spnego-krb5-wrap");
gssapi_init_oid("1.2.840.48018.1.2.2", proto_spnego_krb5, ett_spnego_krb5,
spnego_krb5_handle, spnego_krb5_wrap_handle,
"MS KRB5 - Microsoft Kerberos 5");