aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ldap.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2009-06-30 10:38:00 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2009-06-30 10:38:00 +0000
commit4721f295589c62d8125ea2f05d9f0c4f1d708a5d (patch)
tree15241c12de0c18cd3d951adfa333571f212e12d5 /epan/dissectors/packet-ldap.c
parent942b03f06ece054d04acabf8d286b39b8a0b4478 (diff)
Changed check for having multiple ldap PDU's in one frame.
The previous check is incorrect when the first ldap frame in the capture is selected and the filter is changed, or selecting "Follow TCP Stream". Also removed check_col(). svn path=/trunk/; revision=28889
Diffstat (limited to 'epan/dissectors/packet-ldap.c')
-rw-r--r--epan/dissectors/packet-ldap.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 22b817cf39..515443fe64 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -100,6 +100,7 @@
#include <epan/emem.h>
#include <epan/oids.h>
#include <epan/strutil.h>
+#include <epan/dissectors/packet-frame.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/dissectors/packet-windows-common.h>
#include <epan/dissectors/packet-dcerpc.h>
@@ -315,7 +316,7 @@ static int hf_ldap_graceAuthNsRemaining = -1; /* INTEGER_0_maxInt */
static int hf_ldap_error = -1; /* T_error */
/*--- End of included file: packet-ldap-hf.c ---*/
-#line 181 "packet-ldap-template.c"
+#line 182 "packet-ldap-template.c"
/* Initialize the subtree pointers */
static gint ett_ldap = -1;
@@ -378,7 +379,7 @@ static gint ett_ldap_PasswordPolicyResponseValue = -1;
static gint ett_ldap_T_warning = -1;
/*--- End of included file: packet-ldap-ett.c ---*/
-#line 192 "packet-ldap-template.c"
+#line 193 "packet-ldap-template.c"
static dissector_table_t ldap_name_dissector_table=NULL;
static const char *object_identifier_id = NULL; /* LDAP OID */
@@ -386,7 +387,7 @@ static const char *object_identifier_id = NULL; /* LDAP OID */
static gboolean do_protocolop = FALSE;
static gchar *attr_type = NULL;
static gboolean is_binary_attr_type = FALSE;
-static guint32 last_frame_seen = 0;
+static gboolean ldap_found_in_frame = FALSE;
#define TCP_PORT_LDAP 389
#define TCP_PORT_LDAPS 636
@@ -752,8 +753,7 @@ static void ldap_do_protocolop(packet_info *pinfo)
valstr = val_to_str(ProtocolOp, ldap_ProtocolOp_choice_vals, "Unknown (%%u)");
- if(check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", valstr, MessageID);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", valstr, MessageID);
if(ldm_tree)
proto_item_append_text(ldm_tree, " %s(%d)", valstr, MessageID);
@@ -3416,6 +3416,12 @@ one_more_pdu:
}
static void
+ldap_frame_end(void)
+{
+ ldap_found_in_frame = FALSE;
+}
+
+static void
dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_mscldap)
{
int offset = 0;
@@ -3498,18 +3504,17 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
* This is the first PDU, set the Protocol column and clear the
* Info column.
*/
- if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, pinfo->current_proto);
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, pinfo->current_proto);
- if(last_frame_seen == pinfo->fd->num) {
+ if(ldap_found_in_frame) {
/* we have already dissected an ldap PDU in this frame - add a separator and set a fence */
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_str(pinfo->cinfo, COL_INFO, "| ");
- col_set_fence(pinfo->cinfo, COL_INFO);
- }
- } else
- if (check_col(pinfo->cinfo, COL_INFO)) col_clear(pinfo->cinfo, COL_INFO);
-
- last_frame_seen = pinfo->fd->num;
+ col_append_str(pinfo->cinfo, COL_INFO, " | ");
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ } else {
+ col_clear(pinfo->cinfo, COL_INFO);
+ register_frame_end_routine (ldap_frame_end);
+ ldap_found_in_frame = TRUE;
+ }
ldap_item = proto_tree_add_item(tree, is_mscldap?proto_cldap:proto_ldap, tvb, 0, -1, FALSE);
ldap_tree = proto_item_add_subtree(ldap_item, ett_ldap);
@@ -3651,9 +3656,7 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
* The LDAP message was encrypted in the packet, and has
* been decrypted; dissect the decrypted LDAP message.
*/
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy (decrypted): ");
- }
+ col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy (decrypted): ");
if (sasl_tree) {
enc_item = proto_tree_add_text(sasl_tree, gssapi_tvb, ver_len, -1,
@@ -3671,9 +3674,7 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
* The LDAP message wasn't encrypted in the packet;
* dissect the plain LDAP message.
*/
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Integrity: ");
- }
+ col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Integrity: ");
if (sasl_tree) {
plain_item = proto_tree_add_text(sasl_tree, gssapi_tvb, ver_len, -1,
@@ -3689,11 +3690,10 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
* The LDAP message was encrypted in the packet, and was
* not decrypted; just show it as encrypted data.
*/
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_add_fstr(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy: payload (%d byte%s)",
- sasl_len - ver_len,
- plurality(sasl_len - ver_len, "", "s"));
- }
+ col_add_fstr(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy: payload (%d byte%s)",
+ sasl_len - ver_len,
+ plurality(sasl_len - ver_len, "", "s"));
+
if (sasl_tree) {
proto_tree_add_text(sasl_tree, gssapi_tvb, ver_len, -1,
"GSS-API Encrypted payload (%d byte%s)",
@@ -4414,8 +4414,6 @@ ldap_reinit(void)
}
ldap_info_items = NULL;
- last_frame_seen = 0;
-
}
void
@@ -5194,7 +5192,7 @@ void proto_register_ldap(void) {
"ldap.T_error", HFILL }},
/*--- End of included file: packet-ldap-hfarr.c ---*/
-#line 2083 "packet-ldap-template.c"
+#line 2081 "packet-ldap-template.c"
};
/* List of subtrees */
@@ -5259,7 +5257,7 @@ void proto_register_ldap(void) {
&ett_ldap_T_warning,
/*--- End of included file: packet-ldap-ettarr.c ---*/
-#line 2096 "packet-ldap-template.c"
+#line 2094 "packet-ldap-template.c"
};
module_t *ldap_module;
@@ -5382,7 +5380,7 @@ proto_reg_handoff_ldap(void)
/*--- End of included file: packet-ldap-dis-tab.c ---*/
-#line 2206 "packet-ldap-template.c"
+#line 2204 "packet-ldap-template.c"
}