aboutsummaryrefslogtreecommitdiffstats
path: root/packet-spnego.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-09-08 01:43:44 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-09-08 01:43:44 +0000
commit535f0b810626b0276a47da9181a2e6bf55e6f9b3 (patch)
treed88c5d528a9ec42984949f74e4641a87b37eb268 /packet-spnego.c
parent0f65571f4e43ba5a99c6caa71252742ebcce07cc (diff)
Add a "gssapi_lookup_oid()" that takes a binary OID (pointer and length)
as an argument, and looks up that OID in the GSSAPI OID hash table. Always use that routine to look up OIDs, so that we never use the result of "format_oid()" as the key (as that doesn't necessarily work). Make "gssapi_oids" static, as one should only look up GSSAPI authentication mechanism OIDs with "gssapi_lookup_oid()". In the SPNEGO dissector, free up the OID strings when we're done with them, and don't advance the offset past the OID until after we put the OID into the protocol tree. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6228 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-spnego.c')
-rw-r--r--packet-spnego.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/packet-spnego.c b/packet-spnego.c
index 6ac3cad2ff..143a0aab75 100644
--- a/packet-spnego.c
+++ b/packet-spnego.c
@@ -4,7 +4,7 @@
* Copyright 2002, Tim Potter <tpot@samba.org>
* Copyright 2002, Richard Sharpe <rsharpe@ns.aus.com>
*
- * $Id: packet-spnego.c,v 1.31 2002/09/07 03:32:49 sharpe Exp $
+ * $Id: packet-spnego.c,v 1.32 2002/09/08 01:43:44 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -187,7 +187,7 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
oid_string = format_oid(oid, oid_len);
- value = g_hash_table_lookup(gssapi_oids, oid_string);
+ value = gssapi_lookup_oid(oid, oid_len);
if (value)
proto_tree_add_text(subtree, tvb, offset, nbytes,
@@ -197,6 +197,8 @@ dissect_spnego_krb5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
proto_tree_add_text(subtree, tvb, offset, oid_len, "OID: %s",
oid_string);
+ g_free(oid_string);
+
offset += nbytes;
/* Next, the token ID ... */
@@ -239,7 +241,6 @@ dissect_spnego_mechTypes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
gchar *oid_string;
int ret;
-
/*
* MechTypeList ::= SEQUENCE OF MechType
*/
@@ -282,7 +283,7 @@ dissect_spnego_mechTypes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
}
oid_string = format_oid(oid, len);
- value = g_hash_table_lookup(gssapi_oids, oid_string);
+ value = gssapi_lookup_oid(oid, len);
if (value)
proto_tree_add_text(subtree, tvb, offset, nbytes, "OID: %s (%s)",
oid_string, value->comment);
@@ -290,6 +291,8 @@ dissect_spnego_mechTypes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
proto_tree_add_text(subtree, tvb, offset, nbytes, "OID: %s",
oid_string);
+ g_free(oid_string);
+
offset += nbytes;
len1 -= nbytes;
@@ -627,10 +630,9 @@ dissect_spnego_supportedMech(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
proto_tree *tree, ASN1_SCK *hnd)
{
int ret;
- guint oid_len, len, nbytes;
+ guint oid_len, nbytes;
subid_t *oid;
- gchar *p, *oid_string;
- unsigned int i;
+ gchar *oid_string;
gssapi_oid_value *value;
conversation_t *conversation;
@@ -649,21 +651,7 @@ dissect_spnego_supportedMech(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
}
oid_string = format_oid(oid, oid_len);
-
- offset += nbytes;
-
- g_free(oid_string);
-
- oid_string = g_malloc(oid_len * 22 + 1);
- p = oid_string;
- len = sprintf(p, "%lu", (unsigned long)oid[0]);
- p += len;
- for (i = 1; i < oid_len;i++) {
- len = sprintf(p, ".%lu", (unsigned long)oid[i]);
- p += len;
- }
-
- value = g_hash_table_lookup(gssapi_oids, oid_string);
+ value = gssapi_lookup_oid(oid, oid_len);
if (value)
proto_tree_add_text(tree, tvb, offset, nbytes,
@@ -673,6 +661,10 @@ dissect_spnego_supportedMech(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
proto_tree_add_text(tree, tvb, offset, nbytes, "supportedMech: %s",
oid_string);
+ g_free(oid_string);
+
+ offset += nbytes;
+
/* Should check for an unrecognized OID ... */
next_level_dissector = NULL; /* FIXME: Is this right? */