From 9be16e49c455f92f882aa765357899b2b9cce4a6 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Thu, 21 Apr 2011 19:51:05 +0000 Subject: From Stefan Metzmacher and Gregor Beck via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5850 : The smallest LDAP PDU is 7 bytes, not 4. svn path=/trunk/; revision=36777 --- asn1/ldap/packet-ldap-template.c | 31 ++++++++++++++++++++++++++++++- epan/dissectors/packet-ldap.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c index 74dffda805..681eda11ab 100644 --- a/asn1/ldap/packet-ldap-template.c +++ b/asn1/ldap/packet-ldap-template.c @@ -1705,7 +1705,36 @@ this_was_not_sasl: goto this_was_not_normal_ldap; } - tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu); + /* + * The minimun size of a LDAP pdu is 7 bytes + * + * dumpasn1 -hh ldap-unbind-min.dat + * + * <30 05 02 01 09 42 00> + * 0 5: SEQUENCE { + * <02 01 09> + * 2 1: INTEGER 9 + * <42 00> + * 5 0: [APPLICATION 2] + * : Error: Object has zero length. + * : } + * + * dumpasn1 -hh ldap-unbind-windows.dat + * + * <30 84 00 00 00 05 02 01 09 42 00> + * 0 5: SEQUENCE { + * <02 01 09> + * 6 1: INTEGER 9 + * <42 00> + * 9 0: [APPLICATION 2] + * : Error: Object has zero length. + * : } + * + * 6 bytes would also be ok to get the full length of + * the pdu, but as the smallest pdu can be 7 bytes + * we can use 7. + */ + tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 7, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu); goto end; diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index a660d5e4b0..011a641860 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-ldap.c */ -/* ../../tools/asn2wrs.py -b -p ldap -c ./ldap.cnf -s ./packet-ldap-template -D . Lightweight-Directory-Access-Protocol-V3.asn */ +/* ../../../tools/asn2wrs.py -b -p ldap -c ../../../asn1/ldap/ldap.cnf -s ../../../asn1/ldap/packet-ldap-template -D ../../../asn1/ldap Lightweight-Directory-Access-Protocol-V3.asn */ /* Input file: packet-ldap-template.c */ @@ -4669,7 +4669,36 @@ this_was_not_sasl: goto this_was_not_normal_ldap; } - tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu); + /* + * The minimun size of a LDAP pdu is 7 bytes + * + * dumpasn1 -hh ldap-unbind-min.dat + * + * <30 05 02 01 09 42 00> + * 0 5: SEQUENCE { + * <02 01 09> + * 2 1: INTEGER 9 + * <42 00> + * 5 0: [APPLICATION 2] + * : Error: Object has zero length. + * : } + * + * dumpasn1 -hh ldap-unbind-windows.dat + * + * <30 84 00 00 00 05 02 01 09 42 00> + * 0 5: SEQUENCE { + * <02 01 09> + * 6 1: INTEGER 9 + * <42 00> + * 9 0: [APPLICATION 2] + * : Error: Object has zero length. + * : } + * + * 6 bytes would also be ok to get the full length of + * the pdu, but as the smallest pdu can be 7 bytes + * we can use 7. + */ + tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 7, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu); goto end; @@ -5583,7 +5612,7 @@ void proto_register_ldap(void) { NULL, HFILL }}, /*--- End of included file: packet-ldap-hfarr.c ---*/ -#line 2042 "../../asn1/ldap/packet-ldap-template.c" +#line 2071 "../../asn1/ldap/packet-ldap-template.c" }; /* List of subtrees */ @@ -5658,7 +5687,7 @@ void proto_register_ldap(void) { &ett_ldap_T_warning, /*--- End of included file: packet-ldap-ettarr.c ---*/ -#line 2055 "../../asn1/ldap/packet-ldap-template.c" +#line 2084 "../../asn1/ldap/packet-ldap-template.c" }; module_t *ldap_module; @@ -5789,7 +5818,7 @@ proto_reg_handoff_ldap(void) /*--- End of included file: packet-ldap-dis-tab.c ---*/ -#line 2169 "../../asn1/ldap/packet-ldap-template.c" +#line 2198 "../../asn1/ldap/packet-ldap-template.c" } -- cgit v1.2.3