aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2021-08-23 17:41:43 -0400
committerAndersBroman <a.broman58@gmail.com>2021-08-24 12:16:15 +0000
commite8f967f162038fe4a72595f0b2191cdca2f10149 (patch)
tree4865f187679ffdcb3a86194044cababc4c92606a /epan/dissectors/asn1
parent28ab4bed8ee0f55dc618588fe36a32f24d7b1b63 (diff)
asn1: convert more dissectors to pinfo->pool
Just h248 left of the asn1 templates, and it's gonna be tricky.
Diffstat (limited to 'epan/dissectors/asn1')
-rw-r--r--epan/dissectors/asn1/h245/h245.cnf4
-rw-r--r--epan/dissectors/asn1/h245/packet-h245-template.c10
-rw-r--r--epan/dissectors/asn1/snmp/packet-snmp-template.c26
-rw-r--r--epan/dissectors/asn1/snmp/snmp.cnf4
4 files changed, 22 insertions, 22 deletions
diff --git a/epan/dissectors/asn1/h245/h245.cnf b/epan/dissectors/asn1/h245/h245.cnf
index e6bd071271..13ff4ca836 100644
--- a/epan/dissectors/asn1/h245/h245.cnf
+++ b/epan/dissectors/asn1/h245/h245.cnf
@@ -149,7 +149,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
h245_setup_channels(actx->pinfo, &upcoming_olc->rev_lc);
} else {
wmem_map_insert(h245_pending_olc_reqs,
- wmem_strdup(wmem_file_scope(), gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->dst, &%(ACTX)s->pinfo->src)),
+ wmem_strdup(wmem_file_scope(), gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->dst, &%(ACTX)s->pinfo->src, actx->pinfo->pool)),
upcoming_olc);
}
}
@@ -250,7 +250,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
%(ACTX)s->pinfo->p2p_dir = p2p_dir;
if (upcoming_olc) {
- olc_key = gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->src, &%(ACTX)s->pinfo->dst);
+ olc_key = gen_olc_key(upcoming_olc->fwd_lc_num, &%(ACTX)s->pinfo->src, &%(ACTX)s->pinfo->dst, actx->pinfo->pool);
olc_req = (olc_info_t *)wmem_map_lookup(h245_pending_olc_reqs, olc_key);
if (olc_req) {
update_unicast_addr(&olc_req->fwd_lc.media_addr, &upcoming_olc->fwd_lc.media_addr);
diff --git a/epan/dissectors/asn1/h245/packet-h245-template.c b/epan/dissectors/asn1/h245/packet-h245-template.c
index d8687fb5e6..b71edc7288 100644
--- a/epan/dissectors/asn1/h245/packet-h245-template.c
+++ b/epan/dissectors/asn1/h245/packet-h245-template.c
@@ -291,11 +291,11 @@ void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle )
h223_add_lc_handle = handle;
}
-static const gchar *gen_olc_key(guint16 lc_num, address *dst_addr, address *src_addr)
+static const gchar *gen_olc_key(guint16 lc_num, address *dst_addr, address *src_addr, wmem_allocator_t *scope)
{
- return wmem_strdup_printf(wmem_packet_scope(), "%s/%s/%u",
- address_to_str(wmem_packet_scope(), dst_addr),
- address_to_str(wmem_packet_scope(), src_addr),
+ return wmem_strdup_printf(scope, "%s/%s/%u",
+ address_to_str(scope, dst_addr),
+ address_to_str(scope, src_addr),
lc_num);
}
@@ -382,7 +382,7 @@ static int ett_h245_returnedFunction = -1;
static int dissect_h245_MultimediaSystemControlMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
static void reset_h245_pi(void *dummy _U_)
{
- h245_pi = NULL; /* Make sure we don't leave wmem_packet_scoped() memory lying around */
+ h245_pi = NULL; /* Make sure we don't leave pinfo->pool memory lying around */
}
#include "packet-h245-fn.c"
diff --git a/epan/dissectors/asn1/snmp/packet-snmp-template.c b/epan/dissectors/asn1/snmp/packet-snmp-template.c
index bbc5edb942..d0df6b3c0a 100644
--- a/epan/dissectors/asn1/snmp/packet-snmp-template.c
+++ b/epan/dissectors/asn1/snmp/packet-snmp-template.c
@@ -89,7 +89,7 @@ static tvbuff_t* snmp_usm_priv_aes128(snmp_usm_params_t*, tvbuff_t*, packet_info
static tvbuff_t* snmp_usm_priv_aes192(snmp_usm_params_t*, tvbuff_t*, packet_info *pinfo, gchar const**);
static tvbuff_t* snmp_usm_priv_aes256(snmp_usm_params_t*, tvbuff_t*, packet_info *pinfo, gchar const**);
-static gboolean snmp_usm_auth(const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8**, guint*, gchar const**);
+static gboolean snmp_usm_auth(const packet_info *pinfo, const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8**, guint*, gchar const**);
static const value_string auth_types[] = {
{SNMP_USM_AUTH_MD5,"MD5"},
@@ -516,7 +516,7 @@ DateAndTime ::= TEXTUAL-CONVENTION
SYNTAX OCTET STRING (SIZE (8 | 11))
*/
static proto_item *
-dissect_snmp_variable_date_and_time(proto_tree *tree,int hfid, tvbuff_t *tvb, int offset, int length)
+dissect_snmp_variable_date_and_time(proto_tree *tree, packet_info *pinfo, int hfid, tvbuff_t *tvb, int offset, int length)
{
guint16 year;
guint8 month;
@@ -540,7 +540,7 @@ dissect_snmp_variable_date_and_time(proto_tree *tree,int hfid, tvbuff_t *tvb, in
hour_from_utc = tvb_get_guint8(tvb,offset+9);
min_from_utc = tvb_get_guint8(tvb,offset+10);
- str = wmem_strdup_printf(wmem_packet_scope(),
+ str = wmem_strdup_printf(pinfo->pool,
"%u-%u-%u, %u:%u:%u.%u UTC %s%u:%u",
year,
month,
@@ -549,11 +549,11 @@ dissect_snmp_variable_date_and_time(proto_tree *tree,int hfid, tvbuff_t *tvb, in
minutes,
seconds,
deci_seconds,
- tvb_get_string_enc(wmem_packet_scope(),tvb,offset+8,1,ENC_ASCII|ENC_NA),
+ tvb_get_string_enc(pinfo->pool,tvb,offset+8,1,ENC_ASCII|ENC_NA),
hour_from_utc,
min_from_utc);
}else{
- str = wmem_strdup_printf(wmem_packet_scope(),
+ str = wmem_strdup_printf(pinfo->pool,
"%u-%u-%u, %u:%u:%u.%u",
year,
month,
@@ -1119,7 +1119,7 @@ indexing_done:
}
/* Special case DATE AND TIME */
if((oid_info->value_type)&&(oid_info->value_type->keytype == OID_KEY_TYPE_DATE_AND_TIME)&&(value_len > 7)){
- pi_value = dissect_snmp_variable_date_and_time(pt_varbind, hfid, tvb, value_offset, value_len);
+ pi_value = dissect_snmp_variable_date_and_time(pt_varbind, actx->pinfo, hfid, tvb, value_offset, value_len);
}else{
pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN);
}
@@ -1631,7 +1631,7 @@ localize_ue( snmp_ue_assoc_t* o, const guint8* engine, guint engine_len )
( a->user.userName.len == l && memcmp( a->user.userName.data, u, l) == 0 )
static snmp_ue_assoc_t*
-get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb)
+get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb, packet_info *pinfo)
{
static snmp_ue_assoc_t* a;
guint given_username_len;
@@ -1646,8 +1646,8 @@ get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb)
given_username_len = tvb_captured_length(user_tvb);
given_engine_len = tvb_captured_length(engine_tvb);
if (! ( given_engine_len && given_username_len ) ) return NULL;
- given_username = (guint8*)tvb_memdup(wmem_packet_scope(),user_tvb,0,-1);
- given_engine = (guint8*)tvb_memdup(wmem_packet_scope(),engine_tvb,0,-1);
+ given_username = (guint8*)tvb_memdup(pinfo->pool,user_tvb,0,-1);
+ given_engine = (guint8*)tvb_memdup(pinfo->pool,engine_tvb,0,-1);
for (a = localized_ues; a; a = a->next) {
if ( localized_match(a, given_username, given_username_len, given_engine, given_engine_len) ) {
@@ -1667,7 +1667,7 @@ get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb)
}
static gboolean
-snmp_usm_auth(const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8** calc_auth_p,
+snmp_usm_auth(const packet_info *pinfo, const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8** calc_auth_p,
guint* calc_auth_len_p, gchar const** error)
{
gint msg_len;
@@ -1706,9 +1706,9 @@ snmp_usm_auth(const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8**
*error = "Not enough data remaining";
return FALSE;
}
- msg = (guint8*)tvb_memdup(wmem_packet_scope(),p->msg_tvb,0,msg_len);
+ msg = (guint8*)tvb_memdup(pinfo->pool,p->msg_tvb,0,msg_len);
- auth = (guint8*)tvb_memdup(wmem_packet_scope(),p->auth_tvb,0,auth_len);
+ auth = (guint8*)tvb_memdup(pinfo->pool,p->auth_tvb,0,auth_len);
start = p->auth_offset - p->start_offset;
end = start + auth_len;
@@ -1718,7 +1718,7 @@ snmp_usm_auth(const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8**
msg[i] = '\0';
}
- calc_auth = (guint8*)wmem_alloc(wmem_packet_scope(), auth_hash_len[model]);
+ calc_auth = (guint8*)wmem_alloc(pinfo->pool, auth_hash_len[model]);
if (ws_hmac_buffer(auth_hash_algo[model], calc_auth, msg, msg_len, key, key_len)) {
return FALSE;
diff --git a/epan/dissectors/asn1/snmp/snmp.cnf b/epan/dissectors/asn1/snmp/snmp.cnf
index fe7947a32e..faac625d0a 100644
--- a/epan/dissectors/asn1/snmp/snmp.cnf
+++ b/epan/dissectors/asn1/snmp/snmp.cnf
@@ -188,7 +188,7 @@ BulkPDU/request-id bulkPDU_request-id
offset = get_ber_identifier(tvb, offset, NULL, NULL, NULL);
offset = get_ber_length(tvb, offset, NULL, NULL);
offset = dissect_snmp_UsmSecurityParameters(FALSE, tvb, offset, actx, tree, -1);
- usm_p.user_assoc = get_user_assoc(usm_p.engine_tvb, usm_p.user_tvb);
+ usm_p.user_assoc = get_user_assoc(usm_p.engine_tvb, usm_p.user_tvb, actx->pinfo);
break;
case SNMP_SEC_ANY: /* 0 */
case SNMP_SEC_V1: /* 1 */
@@ -208,7 +208,7 @@ BulkPDU/request-id bulkPDU_request-id
guint8* calc_auth = NULL;
guint calc_auth_len = 0;
- usm_p.authOK = snmp_usm_auth(usm_p.user_assoc->user.authModel, &usm_p, &calc_auth, &calc_auth_len, &error );
+ usm_p.authOK = snmp_usm_auth(actx->pinfo, usm_p.user_assoc->user.authModel, &usm_p, &calc_auth, &calc_auth_len, &error );
if (error) {
expert_add_info_format( actx->pinfo, usm_p.auth_item, &ei_snmp_verify_authentication_error, "Error while verifying Message authenticity: %s", error );