diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2011-02-22 10:23:44 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2011-02-22 10:23:44 +0000 |
commit | d9ef8f9ad1ff59faf245c93814fcfa7fd69339a6 (patch) | |
tree | 2149f3f37cce72dcb6e375ce741b83c0eaac8e18 /asn1/p1 | |
parent | 4dd920a9aa5a46e6bb69d467c8afa39687621ed9 (diff) |
Ensure we always have a valid top_tree for p1.content. This fixes a problem
with other dissectors using p1.content, such as p7.
Reset global content_type_id so this will be correct in more cases.
This is still not a good solution, because ContentType and Content are
generic objects which may occur individual in P7.
Indicate when to report invalid content-type.
svn path=/trunk/; revision=36025
Diffstat (limited to 'asn1/p1')
-rw-r--r-- | asn1/p1/p1.cnf | 19 | ||||
-rw-r--r-- | asn1/p1/packet-p1-template.c | 13 | ||||
-rw-r--r-- | asn1/p1/packet-p1-template.h | 1 |
3 files changed, 30 insertions, 3 deletions
diff --git a/asn1/p1/p1.cnf b/asn1/p1/p1.cnf index 9d5502f500..91410fa1a6 100644 --- a/asn1/p1/p1.cnf +++ b/asn1/p1/p1.cnf @@ -659,7 +659,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" if (next_tvb) { if (content_type_id) { (void) call_ber_oid_callback(content_type_id, next_tvb, 0, actx->pinfo, top_tree ? top_tree : tree); - } else { + } else if (report_unknown_content_type) { proto_item *item = NULL; proto_tree *next_tree = NULL; @@ -669,6 +669,8 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" next_tree=proto_item_add_subtree(item, ett_p1_content_unknown); } dissect_unknown_ber(actx->pinfo, next_tvb, 0, next_tree); + } else { + proto_item_append_text (actx->created_item, " (unknown content-type)"); } } @@ -1290,5 +1292,20 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" } } +#.FN_BODY MessageSubmissionArgument + p1_initialize_content_globals(tree, TRUE); + %(DEFAULT_BODY)s + p1_initialize_content_globals(NULL, FALSE); + +#.FN_BODY MessageDeliveryArgument + p1_initialize_content_globals(tree, TRUE); + %(DEFAULT_BODY)s + p1_initialize_content_globals(NULL, FALSE); + +#.FN_BODY ReportDeliveryArgument + p1_initialize_content_globals(tree, TRUE); + %(DEFAULT_BODY)s + p1_initialize_content_globals(NULL, FALSE); + #.END diff --git a/asn1/p1/packet-p1-template.c b/asn1/p1/packet-p1-template.c index 3f52787d5c..ef567186a6 100644 --- a/asn1/p1/packet-p1-template.c +++ b/asn1/p1/packet-p1-template.c @@ -63,6 +63,7 @@ static struct SESSION_DATA_STRUCTURE* session = NULL; static int extension_id = -1; /* integer extension id */ static const char *object_identifier_id = NULL; /* extensions identifier */ static const char *content_type_id = NULL; /* content type identifier */ +static gboolean report_unknown_content_type = FALSE; #define MAX_ORA_STR_LEN 256 static char *oraddress = NULL; @@ -113,6 +114,12 @@ static const ros_info_t p3_ros_info = { p3_err_tab }; +void p1_initialize_content_globals (proto_tree *tree, gboolean report_unknown_cont_type) +{ + top_tree = tree; + content_type_id = NULL; + report_unknown_content_type = report_unknown_cont_type; +} char* p1_get_last_oraddress() { return oraddress; } @@ -128,7 +135,7 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* save parent_tree so subdissectors can create new top nodes */ - top_tree=parent_tree; + p1_initialize_content_globals (parent_tree, TRUE); if(parent_tree){ item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, FALSE); @@ -139,6 +146,7 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) col_set_str(pinfo->cinfo, COL_INFO, "Transfer"); dissect_p1_MTS_APDU (FALSE, tvb, 0, &asn1_ctx, tree, hf_p1_MTS_APDU_PDU); + p1_initialize_content_globals (NULL, FALSE); } /* @@ -158,7 +166,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* save parent_tree so subdissectors can create new top nodes */ - top_tree=parent_tree; + p1_initialize_content_globals (parent_tree, TRUE); /* do we have operation information from the ROS dissector? */ if( !pinfo->private_data ){ @@ -216,6 +224,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; } } + p1_initialize_content_globals (NULL, FALSE); } diff --git a/asn1/p1/packet-p1-template.h b/asn1/p1/packet-p1-template.h index d83bd5dc8e..c3a60ddf3a 100644 --- a/asn1/p1/packet-p1-template.h +++ b/asn1/p1/packet-p1-template.h @@ -28,6 +28,7 @@ #include "packet-p1-val.h" +void p1_initialize_content_globals (proto_tree *tree, gboolean report_unknown_cont_type); char* p1_get_last_oraddress(void); void dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree); #include "packet-p1-exp.h" |