aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-05-01 20:54:31 +0000
committerMichael Mann <mmann78@netscape.net>2013-05-01 20:54:31 +0000
commitb787f03df35e6ea3112014227b3078affa1768b3 (patch)
treee4bbc68759a801777337eb9bb2399f03cf274073
parentbf579224ae30b015206d602d976998c8bbab06f3 (diff)
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
-rw-r--r--asn1/cmp/cmp.cnf4
-rw-r--r--asn1/cmp/packet-cmp-template.c4
-rw-r--r--asn1/crmf/crmf.cnf4
-rw-r--r--asn1/crmf/packet-crmf-template.c3
-rw-r--r--asn1/x509af/packet-x509af-template.c3
-rw-r--r--asn1/x509af/x509af.cnf10
-rw-r--r--epan/dissectors/packet-cmp.c16
-rw-r--r--epan/dissectors/packet-crmf.c15
-rw-r--r--epan/dissectors/packet-x509af.c21
9 files changed, 30 insertions, 50 deletions
diff --git a/asn1/cmp/cmp.cnf b/asn1/cmp/cmp.cnf
index 4f6c709cd8..5547867297 100644
--- a/asn1/cmp/cmp.cnf
+++ b/asn1/cmp/cmp.cnf
@@ -84,10 +84,10 @@ RevAnnContent/status pkistatus
#.FN_PARS InfoTypeAndValue/infoType
- FN_VARIANT = _str HF_INDEX = hf_cmp_type_oid VAL_PTR = &object_identifier_id
+ FN_VARIANT = _str HF_INDEX = hf_cmp_type_oid VAL_PTR = (const char**)&actx->private_data
#.FN_BODY InfoTypeAndValue/infoValue
- 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);
#.FN_PARS PKIBody
VAL_PTR = &branch_taken
diff --git a/asn1/cmp/packet-cmp-template.c b/asn1/cmp/packet-cmp-template.c
index be42981d41..857290b7d8 100644
--- a/asn1/cmp/packet-cmp-template.c
+++ b/asn1/cmp/packet-cmp-template.c
@@ -71,10 +71,6 @@ static int hf_cmp_tcptrans10_flags = -1;
/* Initialize the subtree pointers */
static gint ett_cmp = -1;
#include "packet-cmp-ett.c"
-
-static const char *object_identifier_id;
-
-
#include "packet-cmp-fn.c"
static int
diff --git a/asn1/crmf/crmf.cnf b/asn1/crmf/crmf.cnf
index f5abc415dc..9bf6bfc9a5 100644
--- a/asn1/crmf/crmf.cnf
+++ b/asn1/crmf/crmf.cnf
@@ -68,10 +68,10 @@ PrivateKeyInfo/version privkey_version
EncKeyWithID/privateKey enckeywid_privkey
#.FN_PARS AttributeTypeAndValue/type
- FN_VARIANT = _str HF_INDEX = hf_crmf_type_oid VAL_PTR = &object_identifier_id
+ FN_VARIANT = _str HF_INDEX = hf_crmf_type_oid VAL_PTR = (const char**)&actx->private_data
#.FN_BODY AttributeTypeAndValue/value
- 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);
#.END
diff --git a/asn1/crmf/packet-crmf-template.c b/asn1/crmf/packet-crmf-template.c
index 70c0f8d10b..ed1d31181e 100644
--- a/asn1/crmf/packet-crmf-template.c
+++ b/asn1/crmf/packet-crmf-template.c
@@ -47,9 +47,6 @@ static int hf_crmf_type_oid = -1;
/* Initialize the subtree pointers */
#include "packet-crmf-ett.c"
-
-static const char *object_identifier_id;
-
#include "packet-crmf-fn.c"
diff --git a/asn1/x509af/packet-x509af-template.c b/asn1/x509af/packet-x509af-template.c
index a91d606798..9641aa9bcc 100644
--- a/asn1/x509af/packet-x509af-template.c
+++ b/asn1/x509af/packet-x509af-template.c
@@ -53,10 +53,7 @@ static int hf_x509af_extension_id = -1;
/* Initialize the subtree pointers */
static gint ett_pkix_crl = -1;
#include "packet-x509af-ett.c"
-
static const char *algorithm_id;
-static const char *extension_id;
-
#include "packet-x509af-fn.c"
const char *x509af_get_last_algorithm_id(void) {
diff --git a/asn1/x509af/x509af.cnf b/asn1/x509af/x509af.cnf
index 48acb47a2a..346f1745d4 100644
--- a/asn1/x509af/x509af.cnf
+++ b/asn1/x509af/x509af.cnf
@@ -82,17 +82,17 @@ CertificateList/signedCertificateList/revokedCertificates/_item/userCertificate
offset=call_ber_oid_callback(algorithm_id, tvb, offset, actx->pinfo, tree);
#.FN_PARS Extension/extnId
- FN_VARIANT = _str HF_INDEX = hf_x509af_extension_id VAL_PTR = &extension_id
+ FN_VARIANT = _str HF_INDEX = hf_x509af_extension_id VAL_PTR = (const char**)&actx->private_data
#.FN_BODY Extension/extnId
const char *name;
%(DEFAULT_BODY)s
- 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);
}
#.FN_BODY Extension/extnValue
@@ -103,7 +103,7 @@ CertificateList/signedCertificateList/revokedCertificates/_item/userCertificate
/* 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);
#.FN_BODY SubjectName
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