diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-01-14 03:01:13 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-01-14 03:01:13 +0000 |
commit | d520b1675499a1faec60f92ecd172a413cdd5282 (patch) | |
tree | 5c7872dc19920d8f66ed2c5bb25535c11e02a87c /packet-ldap.c | |
parent | cbd0ae1706f8f4764191ff5da694e3de74d3e060 (diff) |
Give each LDAP packet its own top-level protocol tree item. (This also
means if there are no complete LDAP packets in a TCP segment, there is
no LDAP top-level protocol tree item, which is as it should be.)
svn path=/trunk/; revision=4539
Diffstat (limited to 'packet-ldap.c')
-rw-r--r-- | packet-ldap.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/packet-ldap.c b/packet-ldap.c index ad6063c983..4106bae3ff 100644 --- a/packet-ldap.c +++ b/packet-ldap.c @@ -1,7 +1,7 @@ /* packet-ldap.c * Routines for ldap packet dissection * - * $Id: packet-ldap.c,v 1.31 2002/01/14 02:50:28 guy Exp $ + * $Id: packet-ldap.c,v 1.32 2002/01/14 03:01:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -889,18 +889,6 @@ dissect_ldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gboolean first_time = TRUE; int ret; - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDAP"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_clear(pinfo->cinfo, COL_INFO); - - if (tree) - { - ti = proto_tree_add_item(tree, proto_ldap, tvb, 0, tvb_length(tvb), - FALSE); - ldap_tree = proto_item_add_subtree(ti, ett_ldap); - } - asn1_open(&a, tvb, 0); while (tvb_reported_length_remaining(tvb, a.offset) > 0) @@ -916,11 +904,21 @@ dissect_ldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_start = a.offset; if (read_sequence(&a, &messageLength)) { - if (first_time && check_col(pinfo->cinfo, COL_INFO)) - col_set_str(pinfo->cinfo, COL_INFO, "Invalid LDAP packet"); - if (ldap_tree) - proto_tree_add_text(ldap_tree, tvb, message_start, 1, + if (first_time) + { + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDAP"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "Invalid LDAP packet"); + } + if (tree) + { + ti = proto_tree_add_item(tree, proto_ldap, tvb, message_start, + tvb_length(tvb), FALSE); + ldap_tree = proto_item_add_subtree(ti, ett_ldap); + proto_tree_add_text(ldap_tree, tvb, message_start, tvb_length(tvb), "Invalid LDAP packet"); + } break; } @@ -946,6 +944,21 @@ dissect_ldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } next_offset = a.offset + messageLength; + if (first_time) + { + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDAP"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + } + + if (tree) + { + ti = proto_tree_add_item(tree, proto_ldap, tvb, message_start, + next_offset - message_start, FALSE); + ldap_tree = proto_item_add_subtree(ti, ett_ldap); + } + message_id_start = a.offset; if (read_integer(&a, 0, -1, 0, &messageId, ASN1_INT)) { |