From b787f03df35e6ea3112014227b3078affa1768b3 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 1 May 2013 20:54:31 +0000 Subject: Remove some global variables in favor of private_data member of asn1_ctx_t. Bug 7060 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7060). This should (mostly) passify the bug, but it appears like this could be done with a lot more ASN.1 dissectors. svn path=/trunk/; revision=49117 --- epan/dissectors/packet-cmp.c | 16 ++++++---------- epan/dissectors/packet-crmf.c | 15 ++++++--------- epan/dissectors/packet-x509af.c | 21 +++++++++------------ 3 files changed, 21 insertions(+), 31 deletions(-) (limited to 'epan/dissectors') diff --git a/epan/dissectors/packet-cmp.c b/epan/dissectors/packet-cmp.c index 8b639df01c..2c234c592a 100644 --- a/epan/dissectors/packet-cmp.c +++ b/epan/dissectors/packet-cmp.c @@ -295,10 +295,6 @@ static gint ett_cmp_PollRepContent_item = -1; /*--- End of included file: packet-cmp-ett.c ---*/ #line 74 "../../asn1/cmp/packet-cmp-template.c" -static const char *object_identifier_id; - - - /*--- Included file: packet-cmp-fn.c ---*/ #line 1 "../../asn1/cmp/packet-cmp-fn.c" /*--- Cyclic dependencies ---*/ @@ -390,7 +386,7 @@ dissect_cmp_PKIFreeText(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_cmp_T_infoType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_cmp_type_oid, &object_identifier_id); + offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_cmp_type_oid, (const char**)&actx->private_data); return offset; } @@ -400,7 +396,7 @@ dissect_cmp_T_infoType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_cmp_T_infoValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 90 "../../asn1/cmp/cmp.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree); + offset=call_ber_oid_callback((const char*)actx->private_data, tvb, offset, actx->pinfo, tree); @@ -1457,7 +1453,7 @@ static void dissect_SuppLangTagsValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo /*--- End of included file: packet-cmp-fn.c ---*/ -#line 79 "../../asn1/cmp/packet-cmp-template.c" +#line 75 "../../asn1/cmp/packet-cmp-template.c" static int dissect_cmp_pdu(tvbuff_t *tvb, proto_tree *tree, asn1_ctx_t *actx) @@ -2347,7 +2343,7 @@ void proto_register_cmp(void) { NULL, HFILL }}, /*--- End of included file: packet-cmp-hfarr.c ---*/ -#line 336 "../../asn1/cmp/packet-cmp-template.c" +#line 332 "../../asn1/cmp/packet-cmp-template.c" }; /* List of subtrees */ @@ -2405,7 +2401,7 @@ void proto_register_cmp(void) { &ett_cmp_PollRepContent_item, /*--- End of included file: packet-cmp-ettarr.c ---*/ -#line 342 "../../asn1/cmp/packet-cmp-template.c" +#line 338 "../../asn1/cmp/packet-cmp-template.c" }; module_t *cmp_module; @@ -2499,7 +2495,7 @@ void proto_reg_handoff_cmp(void) { /*--- End of included file: packet-cmp-dis-tab.c ---*/ -#line 414 "../../asn1/cmp/packet-cmp-template.c" +#line 410 "../../asn1/cmp/packet-cmp-template.c" inited = TRUE; } diff --git a/epan/dissectors/packet-crmf.c b/epan/dissectors/packet-crmf.c index 3f35da3da9..cd70492258 100644 --- a/epan/dissectors/packet-crmf.c +++ b/epan/dissectors/packet-crmf.c @@ -172,9 +172,6 @@ static gint ett_crmf_Attributes = -1; /*--- End of included file: packet-crmf-ett.c ---*/ #line 50 "../../asn1/crmf/packet-crmf-template.c" -static const char *object_identifier_id; - - /*--- Included file: packet-crmf-fn.c ---*/ #line 1 "../../asn1/crmf/packet-crmf-fn.c" @@ -229,7 +226,7 @@ dissect_crmf_CertTemplate(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_crmf_T_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_crmf_type_oid, &object_identifier_id); + offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_crmf_type_oid, (const char**)&actx->private_data); return offset; } @@ -239,7 +236,7 @@ dissect_crmf_T_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ static int dissect_crmf_T_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 74 "../../asn1/crmf/crmf.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree); + offset=call_ber_oid_callback((const char*)actx->private_data, tvb, offset, actx->pinfo, tree); @@ -886,7 +883,7 @@ static void dissect_EncKeyWithID_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, /*--- End of included file: packet-crmf-fn.c ---*/ -#line 54 "../../asn1/crmf/packet-crmf-template.c" +#line 51 "../../asn1/crmf/packet-crmf-template.c" /*--- proto_register_crmf ----------------------------------------------*/ @@ -1223,7 +1220,7 @@ void proto_register_crmf(void) { NULL, HFILL }}, /*--- End of included file: packet-crmf-hfarr.c ---*/ -#line 66 "../../asn1/crmf/packet-crmf-template.c" +#line 63 "../../asn1/crmf/packet-crmf-template.c" }; /* List of subtrees */ @@ -1259,7 +1256,7 @@ void proto_register_crmf(void) { &ett_crmf_Attributes, /*--- End of included file: packet-crmf-ettarr.c ---*/ -#line 71 "../../asn1/crmf/packet-crmf-template.c" +#line 68 "../../asn1/crmf/packet-crmf-template.c" }; /* Register protocol */ @@ -1293,6 +1290,6 @@ void proto_reg_handoff_crmf(void) { /*--- End of included file: packet-crmf-dis-tab.c ---*/ -#line 89 "../../asn1/crmf/packet-crmf-template.c" +#line 86 "../../asn1/crmf/packet-crmf-template.c" } diff --git a/epan/dissectors/packet-x509af.c b/epan/dissectors/packet-x509af.c index ba10434c18..cf30ecca93 100644 --- a/epan/dissectors/packet-x509af.c +++ b/epan/dissectors/packet-x509af.c @@ -177,10 +177,7 @@ static gint ett_x509af_DSS_Params = -1; /*--- End of included file: packet-x509af-ett.c ---*/ #line 56 "../../asn1/x509af/packet-x509af-template.c" - static const char *algorithm_id; -static const char *extension_id; - /*--- Included file: packet-x509af-fn.c ---*/ #line 1 "../../asn1/x509af/packet-x509af-fn.c" @@ -376,13 +373,13 @@ dissect_x509af_T_extnId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset #line 88 "../../asn1/x509af/x509af.cnf" const char *name; - offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_x509af_extension_id, &extension_id); + offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_x509af_extension_id, (const char**)&actx->private_data); - if(extension_id) { - name = oid_resolved_from_string(extension_id); + if(actx->private_data) { + name = oid_resolved_from_string((const char*)actx->private_data); - proto_item_append_text(tree, " (%s)", name ? name : extension_id); + proto_item_append_text(tree, " (%s)", name ? name : actx->private_data); } @@ -411,7 +408,7 @@ dissect_x509af_T_extnValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off /* skip past the T and L */ offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &ber_class, &pc, &tag); offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind); - offset=call_ber_oid_callback(extension_id, tvb, offset, actx->pinfo, tree); + offset=call_ber_oid_callback((const char*)actx->private_data, tvb, offset, actx->pinfo, tree); @@ -890,7 +887,7 @@ static void dissect_DSS_Params_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pr /*--- End of included file: packet-x509af-fn.c ---*/ -#line 61 "../../asn1/x509af/packet-x509af-template.c" +#line 58 "../../asn1/x509af/packet-x509af-template.c" const char *x509af_get_last_algorithm_id(void) { return algorithm_id; @@ -1232,7 +1229,7 @@ void proto_register_x509af(void) { "INTEGER", HFILL }}, /*--- End of included file: packet-x509af-hfarr.c ---*/ -#line 102 "../../asn1/x509af/packet-x509af-template.c" +#line 99 "../../asn1/x509af/packet-x509af-template.c" }; /* List of subtrees */ @@ -1275,7 +1272,7 @@ void proto_register_x509af(void) { &ett_x509af_DSS_Params, /*--- End of included file: packet-x509af-ettarr.c ---*/ -#line 108 "../../asn1/x509af/packet-x509af-template.c" +#line 105 "../../asn1/x509af/packet-x509af-template.c" }; /* Register protocol */ @@ -1318,7 +1315,7 @@ void proto_reg_handoff_x509af(void) { /*--- End of included file: packet-x509af-dis-tab.c ---*/ -#line 136 "../../asn1/x509af/packet-x509af-template.c" +#line 133 "../../asn1/x509af/packet-x509af-template.c" /*XXX these should really go to a better place but since that I have not that ITU standard, ill put it here for the time -- cgit v1.2.3