summaryrefslogtreecommitdiff
path: root/asn1/spnego
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2007-05-13 20:58:29 +0000
committerAnders Broman <anders.broman@ericsson.com>2007-05-13 20:58:29 +0000
commitc01f3829742dacd6d94dc50be54537661bad0581 (patch)
treeeb3da0d69d5bc62ca587ebd999b6beacd693f168 /asn1/spnego
parentb80cb43018aa49bac3e24cabca009ca0471cd579 (diff)
downloadwireshark-c01f3829742dacd6d94dc50be54537661bad0581.tar.gz
Second step in introducing asn context to BER dissectors just like in PER.
svn path=/trunk/; revision=21753
Diffstat (limited to 'asn1/spnego')
-rw-r--r--asn1/spnego/packet-spnego-template.c13
-rw-r--r--asn1/spnego/spnego.cnf46
2 files changed, 32 insertions, 27 deletions
diff --git a/asn1/spnego/packet-spnego-template.c b/asn1/spnego/packet-spnego-template.c
index 8ef17d96ea..4e52960d75 100644
--- a/asn1/spnego/packet-spnego-template.c
+++ b/asn1/spnego/packet-spnego-template.c
@@ -44,6 +44,7 @@
#include <epan/crypt/crypt-rc4.h>
#include <epan/conversation.h>
#include <epan/emem.h>
+#include <epan/asn1.h>
#include <stdio.h>
#include <string.h>
@@ -94,7 +95,7 @@ static dissector_handle_t data_handle;
* definition.
*/
static int dissect_spnego_PrincipalSeq(gboolean implicit_tag, tvbuff_t *tvb,
- int offset, packet_info *pinfo,
+ int offset, asn1_ctx_t *actx _U_,
proto_tree *tree, int hf_index);
#include "packet-spnego-fn.c"
@@ -877,8 +878,10 @@ dissect_spnego_wrap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *item;
proto_tree *subtree;
-
int offset = 0;
+ asn1_ctx_t asn1_ctx;
+ asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+
/*
@@ -900,7 +903,7 @@ dissect_spnego_wrap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* ASN1 code addet to spnego.asn to handle this.
*/
- offset = dissect_spnego_InitialContextToken(FALSE, tvb, offset, pinfo , subtree, -1);
+ offset = dissect_spnego_InitialContextToken(FALSE, tvb, offset, &asn1_ctx , subtree, -1);
return offset;
}
@@ -913,6 +916,8 @@ dissect_spnego(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
proto_tree *subtree;
int offset = 0;
conversation_t *conversation;
+ asn1_ctx_t asn1_ctx;
+ asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/*
* We need this later, so lets get it now ...
@@ -971,7 +976,7 @@ dissect_spnego(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
* as well. Naughty, naughty.
*
*/
- offset = dissect_spnego_NegotiationToken(FALSE, tvb, offset, pinfo, subtree, -1);
+ offset = dissect_spnego_NegotiationToken(FALSE, tvb, offset, &asn1_ctx, subtree, -1);
}
diff --git a/asn1/spnego/spnego.cnf b/asn1/spnego/spnego.cnf
index 620a4bceb6..b6c0f9ab7a 100644
--- a/asn1/spnego/spnego.cnf
+++ b/asn1/spnego/spnego.cnf
@@ -78,7 +78,7 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
*/
token_tvb = tvb_new_subset(tvb, offset, -1, -1);
if (next_level_value && next_level_value->wrap_handle) {
- len = call_dissector(next_level_value->wrap_handle, token_tvb, pinfo,
+ len = call_dissector(next_level_value->wrap_handle, token_tvb, actx->pinfo,
subtree);
if (len == 0)
offset = tvb_length(tvb);
@@ -100,15 +100,15 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
* does not provide a supportedMech.
*/
if(saw_mechanism){
- conversation = find_conversation(pinfo->fd->num,
- &pinfo->src, &pinfo->dst,
- pinfo->ptype,
- pinfo->srcport, pinfo->destport, 0);
+ conversation = find_conversation(actx->pinfo->fd->num,
+ &actx->pinfo->src, &actx->pinfo->dst,
+ actx->pinfo->ptype,
+ actx->pinfo->srcport, actx->pinfo->destport, 0);
if(!conversation){
- conversation = conversation_new(pinfo->fd->num,
- &pinfo->src, &pinfo->dst,
- pinfo->ptype,
- pinfo->srcport, pinfo->destport, 0);
+ conversation = conversation_new(actx->pinfo->fd->num,
+ &actx->pinfo->src, &actx->pinfo->dst,
+ actx->pinfo->ptype,
+ actx->pinfo->srcport, actx->pinfo->destport, 0);
}
conversation_add_proto_data(conversation, proto_spnego, next_level_value);
}
@@ -128,7 +128,7 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
* the token and we have information on how to dissect its contents.
*/
if (mechToken_tvb && next_level_value)
- call_dissector(next_level_value->handle, mechToken_tvb, pinfo, tree);
+ call_dissector(next_level_value->handle, mechToken_tvb, actx->pinfo, tree);
#.FN_BODY NegTokenInit/mechListMIC
@@ -150,7 +150,7 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
/*
* It's a sequence.
*/
- return dissect_spnego_PrincipalSeq(FALSE, tvb, offset, pinfo, tree,
+ return dissect_spnego_PrincipalSeq(FALSE, tvb, offset, actx, tree,
hf_spnego_mechListMIC);
} else {
/*
@@ -158,14 +158,14 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
* which is what it's supposed to be; that'll cause the
* right error report if it's not an octet string, either.
*/
- offset = dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset,
+ offset = dissect_ber_octet_string(FALSE, actx->pinfo, tree, tvb, offset,
hf_spnego_mechListMIC, &mechListMIC_tvb);
/*
* Now, we should be able to dispatch with that tvbuff.
*/
if (mechListMIC_tvb && next_level_value)
- call_dissector(next_level_value->handle, mechListMIC_tvb, pinfo, tree);
+ call_dissector(next_level_value->handle, mechListMIC_tvb, actx->pinfo, tree);
return offset;
}
@@ -183,15 +183,15 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
* negTokenInit.
*/
if(saw_mechanism){
- conversation = find_conversation(pinfo->fd->num,
- &pinfo->src, &pinfo->dst,
- pinfo->ptype,
- pinfo->srcport, pinfo->destport, 0);
+ conversation = find_conversation(actx->pinfo->fd->num,
+ &actx->pinfo->src, &actx->pinfo->dst,
+ actx->pinfo->ptype,
+ actx->pinfo->srcport, actx->pinfo->destport, 0);
if(!conversation){
- conversation = conversation_new(pinfo->fd->num,
- &pinfo->src, &pinfo->dst,
- pinfo->ptype,
- pinfo->srcport, pinfo->destport, 0);
+ conversation = conversation_new(actx->pinfo->fd->num,
+ &actx->pinfo->src, &actx->pinfo->dst,
+ actx->pinfo->ptype,
+ actx->pinfo->srcport, actx->pinfo->destport, 0);
}
conversation_add_proto_data(conversation, proto_spnego, next_level_value);
}
@@ -219,7 +219,7 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
gssapi_oid_value *value=next_level_value;
if(value){
- call_dissector(value->handle, responseToken_tvb, pinfo, tree);
+ call_dissector(value->handle, responseToken_tvb, actx->pinfo, tree);
}
}
@@ -244,7 +244,7 @@ NegTokenInit/mechListMIC negTokenInit_mechListMIC
gssapi_oid_value *value=next_level_value;
if(value){
- call_dissector(value->handle, mechListMIC_tvb, pinfo, tree);
+ call_dissector(value->handle, mechListMIC_tvb, actx->pinfo, tree);
}
}