aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/pkcs12/packet-pkcs12-template.c
diff options
context:
space:
mode:
Diffstat (limited to 'asn1/pkcs12/packet-pkcs12-template.c')
-rw-r--r--asn1/pkcs12/packet-pkcs12-template.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/asn1/pkcs12/packet-pkcs12-template.c b/asn1/pkcs12/packet-pkcs12-template.c
index 113b4fb046..bdfe126978 100644
--- a/asn1/pkcs12/packet-pkcs12-template.c
+++ b/asn1/pkcs12/packet-pkcs12-template.c
@@ -29,6 +29,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/expert.h>
#include <epan/oids.h>
#include <epan/asn1.h>
#include <epan/prefs.h>
@@ -65,6 +66,9 @@ static int proto_pkcs12 = -1;
static int hf_pkcs12_X509Certificate_PDU = -1;
static gint ett_decrypted_pbe = -1;
+static expert_field ei_pkcs12_octet_string_expected = EI_INIT;
+
+
static const char *object_identifier_id = NULL;
static int iteration_count = 0;
static tvbuff_t *salt = NULL;
@@ -418,7 +422,7 @@ static void dissect_AuthenticatedSafe_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info
if((offset = strip_octet_string(tvb)) > 0)
dissect_pkcs12_AuthenticatedSafe(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_AuthenticatedSafe_PDU);
else
- proto_tree_add_text(tree, tvb, 0, 1, "BER Error: OCTET STRING expected");
+ proto_tree_add_expert(tree, pinfo, &ei_pkcs12_octet_string_expected, tvb, 0, 1);
}
static void dissect_SafeContents_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -441,7 +445,7 @@ static void dissect_X509Certificate_OCTETSTRING_PDU(tvbuff_t *tvb, packet_info *
if((offset = strip_octet_string(tvb)) > 0)
dissect_x509af_Certificate(FALSE, tvb, offset, &asn1_ctx, tree, hf_pkcs12_X509Certificate_PDU);
else
- proto_tree_add_text(tree, tvb, 0, 1, "BER Error: OCTET STRING expected");
+ proto_tree_add_expert(tree, pinfo, &ei_pkcs12_octet_string_expected, tvb, 0, 1);
}
/*--- proto_register_pkcs12 ----------------------------------------------*/
@@ -461,7 +465,12 @@ void proto_register_pkcs12(void) {
&ett_decrypted_pbe,
#include "packet-pkcs12-ettarr.c"
};
+ static ei_register_info ei[] = {
+ { &ei_pkcs12_octet_string_expected, { "pkcs12.octet_string_expected", PI_PROTOCOL, PI_WARN, "BER Error: OCTET STRING expected", EXPFILL }},
+ };
+
module_t *pkcs12_module;
+ expert_module_t* expert_pkcs12;
/* Register protocol */
proto_pkcs12 = proto_register_protocol(PNAME, PSNAME, PFNAME);
@@ -469,6 +478,8 @@ void proto_register_pkcs12(void) {
/* Register fields and subtrees */
proto_register_field_array(proto_pkcs12, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ expert_pkcs12 = expert_register_protocol(proto_pkcs12);
+ expert_register_field_array(expert_pkcs12, ei, array_length(ei));
/* Register preferences */
pkcs12_module = prefs_register_protocol(proto_pkcs12, NULL);