* Wes Hardaker (c) 2000
* wjhardaker@ucdavis.edu
*
- * $Id: packet-kerberos.c,v 1.16 2001/04/15 08:50:37 guy Exp $
+ * $Id: packet-kerberos.c,v 1.20 2002/01/21 07:36:36 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Didier Jorand
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include <glib.h>
-#include "packet.h"
+#include <epan/packet.h>
-#include "strutil.h"
+#include <epan/strutil.h>
#include "asn1.h"
start = asn1p->offset; \
ret = asn1_header_decode (asn1p, &cls, &con, &tag, &def, &item_len); \
if (ret != ASN1_ERR_NOERROR) {\
- if (check_col(pinfo->fd, COL_INFO)) \
- col_add_fstr(pinfo->fd, COL_INFO, "ERROR: Problem at %s: %s", \
+ if (check_col(pinfo->cinfo, COL_INFO)) \
+ col_add_fstr(pinfo->cinfo, COL_INFO, "ERROR: Problem at %s: %s", \
token, to_error_str(ret)); \
return -1; \
} \
if (!def) {\
- if (check_col(pinfo->fd, COL_INFO)) \
- col_add_fstr(pinfo->fd, COL_INFO, "not definite: %s", token); \
+ if (check_col(pinfo->cinfo, COL_INFO)) \
+ col_add_fstr(pinfo->cinfo, COL_INFO, "not definite: %s", token); \
fprintf(stderr,"not definite: %s\n", token); \
return -1; \
} \
#define DIE_WITH_BAD_TYPE(token, expected_tag) \
{ \
- if (check_col(pinfo->fd, COL_INFO)) \
- col_add_fstr(pinfo->fd, COL_INFO, "ERROR: Problem at %s: %s (tag=%d exp=%d)", \
+ if (check_col(pinfo->cinfo, COL_INFO)) \
+ col_add_fstr(pinfo->cinfo, COL_INFO, "ERROR: Problem at %s: %s (tag=%d exp=%d)", \
token, to_error_str(ASN1_ERR_WRONG_TYPE), tag, expected_tag); \
return -1; \
}
#define KRB_SEQ_HEAD_DECODE_OR_DIE(token) \
ret = asn1_sequence_decode (asn1p, &item_len, &header_len); \
if (ret != ASN1_ERR_NOERROR) {\
- if (check_col(pinfo->fd, COL_INFO)) \
- col_add_fstr(pinfo->fd, COL_INFO, "ERROR: Problem at %s: %s", \
+ if (check_col(pinfo->cinfo, COL_INFO)) \
+ col_add_fstr(pinfo->cinfo, COL_INFO, "ERROR: Problem at %s: %s", \
token, to_error_str(ret)); \
return -1; \
} \
#define KRB_DECODE_OR_DIE(token, fn, val) \
ret = fn (asn1p, &val, &length); \
if (ret != ASN1_ERR_NOERROR) { \
- if (check_col(pinfo->fd, COL_INFO)) \
- col_add_fstr(pinfo->fd, COL_INFO, "ERROR: Problem at %s: %s", \
+ if (check_col(pinfo->cinfo, COL_INFO)) \
+ col_add_fstr(pinfo->cinfo, COL_INFO, "ERROR: Problem at %s: %s", \
token, to_error_str(ret)); \
return -1; \
} \
#define KRB_DECODE_STRING_OR_DIE(token, expected_tag, val, val_len, item_len) \
ret = asn1_string_decode (asn1p, &val, &val_len, &item_len, expected_tag); \
if (ret != ASN1_ERR_NOERROR) { \
- if (check_col(pinfo->fd, COL_INFO)) \
- col_add_fstr(pinfo->fd, COL_INFO, "ERROR: Problem at %s: %s", \
+ if (check_col(pinfo->cinfo, COL_INFO)) \
+ col_add_fstr(pinfo->cinfo, COL_INFO, "ERROR: Problem at %s: %s", \
token, to_error_str(ret)); \
return -1; \
}
ASN1_SCK asn1, *asn1p = &asn1;
proto_item *item = NULL;
- guint length;
+ gint length;
guint cls, con, tag;
gboolean def;
- guint item_len, total_len;
+ gint item_len;
+ guint total_len;
int start, end, message_end, sequence_end;
int ret;
}
offset += length;
- if (check_col(pinfo->fd, COL_INFO))
- col_add_str(pinfo->fd, COL_INFO, val_to_str(msg_type, krb5_msg_types,
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_add_str(pinfo->cinfo, COL_INFO, val_to_str(msg_type, krb5_msg_types,
"Unknown msg type %#x"));
/* is preauthentication present? */
static void
dissect_kerberos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "KRB5");
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "KRB5");
dissect_kerberos_main(tvb, pinfo, tree);
}
int start;
guint cls, con, tag;
- guint header_len, item_len, total_len;
+ guint header_len, total_len;
+ gint item_len;
int ret;
proto_item *item = NULL;
- guint length;
+ gint length;
gboolean def;
guint32 val;
void
proto_reg_handoff_kerberos(void)
{
- dissector_add("udp.port", UDP_PORT_KERBEROS, dissect_kerberos,
- proto_kerberos);
- dissector_add("tcp.port", TCP_PORT_KERBEROS, dissect_kerberos,
- proto_kerberos);
+ dissector_handle_t kerberos_handle;
+
+ kerberos_handle = create_dissector_handle(dissect_kerberos, proto_kerberos);
+ dissector_add("udp.port", UDP_PORT_KERBEROS, kerberos_handle);
+ dissector_add("tcp.port", TCP_PORT_KERBEROS, kerberos_handle);
}
/*