summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-09-06 12:21:24 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-09-06 13:27:14 +0000
commitc12624840ac422ed968fe5df600cd8fdb14683d1 (patch)
treee41ad58c2ad8a3a5461f967065d5944e096a65b4
parent3d2bcf5e96a1e63a71ffa01dcd34fa187ef502d0 (diff)
downloadwireshark-c12624840ac422ed968fe5df600cd8fdb14683d1.tar.gz
OCSP: get rid of an evil global variable
Bug: 11505 Change-Id: I87cc676426dceed05a9a95bb515c4fb2535ac9c5 Reviewed-on: https://code.wireshark.org/review/10400 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> (cherry picked from commit 09e92f004abc040584dbb0bec4598b34ee7a900f) Conflicts: epan/dissectors/packet-ocsp.c Reviewed-on: https://code.wireshark.org/review/10402
-rw-r--r--asn1/ocsp/ocsp.cnf9
-rw-r--r--asn1/ocsp/packet-ocsp-template.c5
-rw-r--r--epan/dissectors/packet-ocsp.c26
3 files changed, 22 insertions, 18 deletions
diff --git a/asn1/ocsp/ocsp.cnf b/asn1/ocsp/ocsp.cnf
index 5b6831a298..551b4583cc 100644
--- a/asn1/ocsp/ocsp.cnf
+++ b/asn1/ocsp/ocsp.cnf
@@ -36,8 +36,9 @@ Version
#.FIELD_RENAME
-#.FN_PARS ResponseBytes/responseType
- FN_VARIANT = _str HF_INDEX = hf_ocsp_responseType_id VAL_PTR = &responseType_id
+#.FN_BODY ResponseBytes/responseType FN_VARIANT = _str HF_INDEX = hf_ocsp_responseType_id VAL_PTR = &actx->external.direct_reference
+%(DEFAULT_BODY)s
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
#.FN_BODY ResponseBytes/response
gint8 appclass;
@@ -47,6 +48,8 @@ Version
/* skip past the T and L */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &appclass, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
- offset=call_ber_oid_callback(responseType_id, tvb, offset, actx->pinfo, tree, NULL);
+ if (actx->external.direct_ref_present) {
+ offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);
+ }
#.END
diff --git a/asn1/ocsp/packet-ocsp-template.c b/asn1/ocsp/packet-ocsp-template.c
index 843cacdf5f..be438b0139 100644
--- a/asn1/ocsp/packet-ocsp-template.c
+++ b/asn1/ocsp/packet-ocsp-template.c
@@ -51,9 +51,6 @@ static int hf_ocsp_responseType_id = -1;
static gint ett_ocsp = -1;
#include "packet-ocsp-ett.c"
-static const char *responseType_id;
-
-
#include "packet-ocsp-fn.c"
@@ -106,7 +103,7 @@ void proto_register_ocsp(void) {
/* List of fields */
static hf_register_info hf[] = {
{ &hf_ocsp_responseType_id,
- { "ResponseType Id", "x509af.responseType.id",
+ { "ResponseType Id", "ocsp.responseType.id",
FT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL }},
#include "packet-ocsp-hfarr.c"
diff --git a/epan/dissectors/packet-ocsp.c b/epan/dissectors/packet-ocsp.c
index fab2ae29e8..2a0b952ee1 100644
--- a/epan/dissectors/packet-ocsp.c
+++ b/epan/dissectors/packet-ocsp.c
@@ -140,9 +140,6 @@ static gint ett_ocsp_CrlID = -1;
/*--- End of included file: packet-ocsp-ett.c ---*/
#line 53 "../../asn1/ocsp/packet-ocsp-template.c"
-static const char *responseType_id;
-
-
/*--- Included file: packet-ocsp-fn.c ---*/
#line 1 "../../asn1/ocsp/packet-ocsp-fn.c"
@@ -307,7 +304,12 @@ dissect_ocsp_OCSPResponseStatus(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_ocsp_T_responseType(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_ocsp_responseType_id, &responseType_id);
+#line 40 "../../asn1/ocsp/ocsp.cnf"
+ offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_ocsp_responseType_id, &actx->external.direct_reference);
+
+ actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
+
+
return offset;
}
@@ -316,7 +318,7 @@ dissect_ocsp_T_responseType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_ocsp_T_response(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 43 "../../asn1/ocsp/ocsp.cnf"
+#line 44 "../../asn1/ocsp/ocsp.cnf"
gint8 appclass;
gboolean pc, ind;
gint32 tag;
@@ -324,7 +326,9 @@ dissect_ocsp_T_response(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
/* skip past the T and L */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &appclass, &pc, &tag);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
- offset=call_ber_oid_callback(responseType_id, tvb, offset, actx->pinfo, tree, NULL);
+ if (actx->external.direct_ref_present) {
+ offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);
+ }
@@ -658,7 +662,7 @@ static void dissect_NULL_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tr
/*--- End of included file: packet-ocsp-fn.c ---*/
-#line 58 "../../asn1/ocsp/packet-ocsp-template.c"
+#line 55 "../../asn1/ocsp/packet-ocsp-template.c"
static int
@@ -710,7 +714,7 @@ void proto_register_ocsp(void) {
/* List of fields */
static hf_register_info hf[] = {
{ &hf_ocsp_responseType_id,
- { "ResponseType Id", "x509af.responseType.id",
+ { "ResponseType Id", "ocsp.responseType.id",
FT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL }},
@@ -926,7 +930,7 @@ void proto_register_ocsp(void) {
"GeneralizedTime", HFILL }},
/*--- End of included file: packet-ocsp-hfarr.c ---*/
-#line 113 "../../asn1/ocsp/packet-ocsp-template.c"
+#line 110 "../../asn1/ocsp/packet-ocsp-template.c"
};
/* List of subtrees */
@@ -956,7 +960,7 @@ void proto_register_ocsp(void) {
&ett_ocsp_CrlID,
/*--- End of included file: packet-ocsp-ettarr.c ---*/
-#line 119 "../../asn1/ocsp/packet-ocsp-template.c"
+#line 116 "../../asn1/ocsp/packet-ocsp-template.c"
};
/* Register protocol */
@@ -992,6 +996,6 @@ void proto_reg_handoff_ocsp(void) {
/*--- End of included file: packet-ocsp-dis-tab.c ---*/
-#line 142 "../../asn1/ocsp/packet-ocsp-template.c"
+#line 139 "../../asn1/ocsp/packet-ocsp-template.c"
}