Regenerate all asn2wrs generated dissectors.
[obnox/wireshark/wip.git] / epan / dissectors / packet-ldap.c
index de8315726f54ffba5b9bc5acd7c3a24633f50500..dfd791d6906e70922070715f32769f32d1c4ea68 100644 (file)
@@ -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 Lightweight-Directory-Access-Protocol-V3.asn */
+/* ../../tools/asn2wrs.py -b -p ldap -c ./ldap.cnf -s ./packet-ldap-template -D . Lightweight-Directory-Access-Protocol-V3.asn */
 
 /* Input file: packet-ldap-template.c */
 
@@ -393,12 +393,12 @@ static guint global_ldaps_tcp_port = TCP_PORT_LDAPS;
 static guint tcp_port = 0;
 static guint ssl_port = 0;
 
-static dissector_handle_t gssapi_handle = NULL;
-static dissector_handle_t gssapi_wrap_handle = NULL;
-static dissector_handle_t ntlmssp_handle = NULL;
-static dissector_handle_t spnego_handle = NULL;
-static dissector_handle_t ssl_handle = NULL;
-static dissector_handle_t ldap_handle = NULL;
+static dissector_handle_t gssapi_handle;
+static dissector_handle_t gssapi_wrap_handle;
+static dissector_handle_t ntlmssp_handle;
+static dissector_handle_t spnego_handle;
+static dissector_handle_t ssl_handle;
+static dissector_handle_t ldap_handle ;
 
 void prefs_register_ldap(void); /* forward declaration for use in preferences registration */
 
@@ -581,7 +581,7 @@ static int dissect_mscldap_ntver_flags(proto_tree *parent_tree, tvbuff_t *tvb, i
       else
        one_bit_set = TRUE;
 
-      proto_item_append_text(item, hfi->name);
+      proto_item_append_text(item, "%s", hfi->name);
 
     }
   }
@@ -929,7 +929,7 @@ dissect_ldap_INTEGER_1_127(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
 
 static int
 dissect_ldap_LDAPString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 322 "ldap.cnf"
+#line 320 "ldap.cnf"
   tvbuff_t     *parameter_tvb = NULL;
   char          *ldapstring = NULL;
   gchar                *sc = NULL; /* semi-colon pointer */
@@ -1095,9 +1095,7 @@ char *mechanism = NULL;
         if (mechanism == NULL) {
             mechanism = ldap_info->auth_mech;
         } else {
-          if (ldap_info->auth_mech != NULL) {
-              g_free(ldap_info->auth_mech);
-          }
+          g_free(ldap_info->auth_mech);
           ldap_info->auth_mech = mechanism;
         }
        actx->pinfo->private_data = ldap_info;
@@ -1111,7 +1109,7 @@ char *mechanism = NULL;
 
 static int
 dissect_ldap_Credentials(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 212 "ldap.cnf"
+#line 210 "ldap.cnf"
 
 tvbuff_t       *parameter_tvb;
 ldap_conv_info_t *ldap_info;
@@ -1177,7 +1175,7 @@ dissect_ldap_SaslCredentials(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
 
 static int
 dissect_ldap_T_ntlmsspNegotiate(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 697 "ldap.cnf"
+#line 689 "ldap.cnf"
        /* make sure the protocol op comes first */
                ldap_do_protocolop(actx->pinfo);
 
@@ -1193,7 +1191,7 @@ dissect_ldap_T_ntlmsspNegotiate(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
 
 static int
 dissect_ldap_T_ntlmsspAuth(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 704 "ldap.cnf"
+#line 696 "ldap.cnf"
        /* make sure the protocol op comes first */
                ldap_do_protocolop(actx->pinfo);
 
@@ -1224,7 +1222,7 @@ static const ber_choice_t AuthenticationChoice_choice[] = {
 
 static int
 dissect_ldap_AuthenticationChoice(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 497 "ldap.cnf"
+#line 495 "ldap.cnf"
   gint branch = -1;
   gint auth = -1;
   const gchar *valstr;
@@ -1331,7 +1329,7 @@ static const value_string ldap_BindResponse_resultCode_vals[] = {
 
 static int
 dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 447 "ldap.cnf"
+#line 445 "ldap.cnf"
 
   const gchar *valstr;
 
@@ -1359,7 +1357,7 @@ dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U
 
 static int
 dissect_ldap_T_bindResponse_matchedDN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 711 "ldap.cnf"
+#line 703 "ldap.cnf"
        tvbuff_t *new_tvb=NULL;
 
        offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_ldap_matchedDN, &new_tvb);
@@ -1420,7 +1418,7 @@ dissect_ldap_Referral(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
 
 static int
 dissect_ldap_ServerSaslCreds(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 252 "ldap.cnf"
+#line 250 "ldap.cnf"
 
 tvbuff_t       *parameter_tvb;
 ldap_conv_info_t *ldap_info;
@@ -1538,7 +1536,7 @@ dissect_ldap_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_,
 
 static int
 dissect_ldap_UnbindRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 519 "ldap.cnf"
+#line 517 "ldap.cnf"
 
  implicit_tag = TRUE; /* correct problem with asn2wrs */
 
@@ -1568,7 +1566,7 @@ static const value_string ldap_T_scope_vals[] = {
 
 static int
 dissect_ldap_T_scope(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 413 "ldap.cnf"
+#line 411 "ldap.cnf"
 
   gint         scope;
   const gchar *valstr;
@@ -1635,7 +1633,7 @@ static int
 dissect_ldap_T_and_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 569 "ldap.cnf"
+#line 559 "ldap.cnf"
        if(and_filter_string){
                and_filter_string=ep_strdup_printf("(&%s%s)",and_filter_string,Filter_string);
        } else {
@@ -1653,7 +1651,7 @@ static const ber_sequence_t T_and_set_of[1] = {
 
 static int
 dissect_ldap_T_and(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 576 "ldap.cnf"
+#line 566 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
        char *old_and_filter_string=and_filter_string;
@@ -1686,7 +1684,7 @@ static int
 dissect_ldap_T_or_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 596 "ldap.cnf"
+#line 586 "ldap.cnf"
        if(or_filter_string){
                or_filter_string=ep_strdup_printf("(|%s%s)",or_filter_string,Filter_string);
        } else {
@@ -1705,7 +1703,7 @@ static const ber_sequence_t T_or_set_of[1] = {
 
 static int
 dissect_ldap_T_or(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 604 "ldap.cnf"
+#line 594 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
        char *old_or_filter_string=or_filter_string;
@@ -1736,8 +1734,8 @@ static int
 dissect_ldap_T_not(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 625 "ldap.cnf"
-       Filter_string=ep_strdup_printf("(!%s)",Filter_string);
+#line 615 "ldap.cnf"
+       Filter_string=ep_strdup_printf("(!%s)",string_or_null(Filter_string));
 
 
   return offset;
@@ -1774,12 +1772,10 @@ static int
 dissect_ldap_T_equalityMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 538 "ldap.cnf"
+#line 536 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s=%s)",
-                                      attributedesc_string ?
-                                      attributedesc_string : "(null)",
-                                      ldapvalue_string ?
-                                      ldapvalue_string : "(null)");
+                                      string_or_null(attributedesc_string),
+                                      string_or_null(ldapvalue_string));
 
 
 
@@ -1807,7 +1803,7 @@ dissect_ldap_T_substringFilter_substrings_item(gboolean implicit_tag _U_, tvbuff
                                  T_substringFilter_substrings_item_choice, hf_index, ett_ldap_T_substringFilter_substrings_item,
                                  NULL);
 
-#line 651 "ldap.cnf"
+#line 641 "ldap.cnf"
        if (substring_item_final) {
                substring_value=ep_strdup_printf("%s%s",
                                                 (substring_value?substring_value:"*"),
@@ -1847,7 +1843,7 @@ static const ber_sequence_t SubstringFilter_sequence[] = {
 
 static int
 dissect_ldap_SubstringFilter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 665 "ldap.cnf"
+#line 655 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
        char *old_substring_value=substring_value;
@@ -1864,7 +1860,9 @@ dissect_ldap_SubstringFilter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    SubstringFilter_sequence, hf_index, ett_ldap_SubstringFilter);
 
-       Filter_string=ep_strdup_printf("(%s=%s)",attr_type,substring_value);
+       Filter_string=ep_strdup_printf("(%s=%s)",
+               string_or_null(attr_type),
+               string_or_null(substring_value));
        proto_item_append_text(it, "%s", Filter_string);
        substring_value=old_substring_value;
 
@@ -1879,12 +1877,10 @@ static int
 dissect_ldap_T_greaterOrEqual(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 546 "ldap.cnf"
+#line 542 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s>=%s)",
-                                      attributedesc_string ?
-                                      attributedesc_string : "(null)",
-                                      ldapvalue_string ?
-                                      ldapvalue_string : "(null)");
+                                      string_or_null(attributedesc_string),
+                                      string_or_null(ldapvalue_string));
 
 
 
@@ -1897,12 +1893,10 @@ static int
 dissect_ldap_T_lessOrEqual(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 554 "ldap.cnf"
+#line 548 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s<=%s)",
-                                      attributedesc_string ?
-                                      attributedesc_string : "(null)",
-                                      ldapvalue_string ?
-                                      ldapvalue_string : "(null)");
+                                      string_or_null(attributedesc_string),
+                                      string_or_null(ldapvalue_string));
 
 
 
@@ -1915,8 +1909,8 @@ static int
 dissect_ldap_T_present(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_AttributeDescription(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 622 "ldap.cnf"
-       Filter_string=ep_strdup_printf("(%s=*)",Filter_string);
+#line 612 "ldap.cnf"
+       Filter_string=ep_strdup_printf("(%s=*)",string_or_null(Filter_string));
 
 
   return offset;
@@ -1928,12 +1922,10 @@ static int
 dissect_ldap_T_approxMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
   offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 562 "ldap.cnf"
+#line 554 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s~=%s)",
-                                      attributedesc_string ?
-                                      attributedesc_string : "(null)",
-                                      ldapvalue_string ?
-                                      ldapvalue_string : "(null)");
+                                      string_or_null(attributedesc_string),
+                                      string_or_null(ldapvalue_string));
 
 
   return offset;
@@ -1952,7 +1944,7 @@ dissect_ldap_MatchingRuleId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
 
 static int
 dissect_ldap_T_dnAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 628 "ldap.cnf"
+#line 618 "ldap.cnf"
        gboolean val;
 
 offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &val);
@@ -1987,7 +1979,7 @@ dissect_ldap_MatchingRuleAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
 
 static int
 dissect_ldap_T_extensibleMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 637 "ldap.cnf"
+#line 627 "ldap.cnf"
        attr_type=NULL;
        matching_rule_string=NULL;
        ldapvalue_string=NULL;
@@ -1996,13 +1988,13 @@ dissect_ldap_T_extensibleMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
 
   offset = dissect_ldap_MatchingRuleAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 643 "ldap.cnf"
+#line 633 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s:%s%s%s=%s)",
                                        (attr_type?attr_type:""),
                                        (matching_rule_dnattr?"dn:":""),
                                        (matching_rule_string?matching_rule_string:""),
                                        (matching_rule_string?":":""),
-                                       ldapvalue_string);
+                                       string_or_null(ldapvalue_string));
 
 
   return offset;
@@ -2039,7 +2031,7 @@ static const ber_choice_t Filter_choice[] = {
 
 static int
 dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 684 "ldap.cnf"
+#line 676 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
 
@@ -2053,7 +2045,7 @@ dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_
                                  NULL);
 
        if(Filter_string)
-               proto_item_append_text(it, "%s", Filter_string);
+               proto_item_append_text(it, "%s", string_or_null(Filter_string));
 
 
 
@@ -2064,13 +2056,13 @@ dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_
 
 static int
 dissect_ldap_T_filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 531 "ldap.cnf"
+#line 529 "ldap.cnf"
        Filter_string=NULL;
 
 
   offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 534 "ldap.cnf"
+#line 532 "ldap.cnf"
        Filter_string=NULL;
        and_filter_string=NULL;
 
@@ -2126,7 +2118,7 @@ dissect_ldap_SearchRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
 
 static int
 dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 464 "ldap.cnf"
+#line 462 "ldap.cnf"
 
   tvbuff_t     *next_tvb;
   gchar                *string;
@@ -2283,7 +2275,7 @@ static const value_string ldap_T_resultCode_vals[] = {
 
 static int
 dissect_ldap_T_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 430 "ldap.cnf"
+#line 428 "ldap.cnf"
 
   const gchar *valstr;
 
@@ -2351,7 +2343,7 @@ dissect_ldap_SEQUENCE_OF_LDAPURL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i
 
 static int
 dissect_ldap_SearchResultReference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 754 "ldap.cnf"
+#line 746 "ldap.cnf"
 
    offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
                                       hf_index, BER_CLASS_APP, 19, TRUE, dissect_ldap_SEQUENCE_OF_LDAPURL);
@@ -2628,7 +2620,7 @@ dissect_ldap_CompareResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
 
 static int
 dissect_ldap_AbandonRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 761 "ldap.cnf"
+#line 753 "ldap.cnf"
 
    offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
                                       hf_index, BER_CLASS_APP, 16, TRUE, dissect_ldap_MessageID);
@@ -2702,7 +2694,7 @@ dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
 
 static int
 dissect_ldap_T_requestValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 746 "ldap.cnf"
+#line 738 "ldap.cnf"
 
        if((object_identifier_id != NULL) && oid_has_dissector(object_identifier_id)) {
                offset = call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
@@ -2983,7 +2975,7 @@ dissect_ldap_ControlType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 
 static int
 dissect_ldap_T_controlValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 727 "ldap.cnf"
+#line 719 "ldap.cnf"
        gint8 class;
        gboolean pc, ind;
        gint32 tag;
@@ -3813,7 +3805,7 @@ static int dissect_mscldap_netlogon_flags(proto_tree *parent_tree, tvbuff_t *tvb
       else
        one_bit_set = TRUE;
 
-      proto_item_append_text(item, hfi->name);
+      proto_item_append_text(item, "%s", hfi->name);
 
     }
   }
@@ -4340,14 +4332,9 @@ ldap_reinit(void)
   for (ldap_info = ldap_info_items; ldap_info != NULL; ) {
     ldap_conv_info_t *next;
 
-    if (ldap_info->auth_mech != NULL) {
-      g_free(ldap_info->auth_mech);
-      ldap_info->auth_mech=NULL;
-    }
+    g_free(ldap_info->auth_mech);
     g_hash_table_destroy(ldap_info->matched);
-    ldap_info->matched=NULL;
     g_hash_table_destroy(ldap_info->unmatched);
-    ldap_info->unmatched=NULL;
 
     next = ldap_info->next;
     g_free(ldap_info);
@@ -4754,7 +4741,7 @@ void proto_register_ldap(void) {
         FT_NONE, BASE_NONE, NULL, 0,
         "ldap.ExtendedResponse", HFILL }},
     { &hf_ldap_AttributeDescriptionList_item,
-      { "AttributeDescriptionList", "ldap.AttributeDescriptionList_item",
+      { "AttributeDescription", "ldap.AttributeDescription",
         FT_STRING, BASE_NONE, NULL, 0,
         "ldap.AttributeDescription", HFILL }},
     { &hf_ldap_attributeDesc,
@@ -4774,7 +4761,7 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.SET_OF_AttributeValue", HFILL }},
     { &hf_ldap_vals_item,
-      { "vals", "ldap.vals_item",
+      { "AttributeValue", "ldap.AttributeValue",
         FT_BYTES, BASE_HEX, NULL, 0,
         "ldap.AttributeValue", HFILL }},
     { &hf_ldap_resultCode,
@@ -4794,11 +4781,11 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.Referral", HFILL }},
     { &hf_ldap_Referral_item,
-      { "Referral", "ldap.Referral_item",
+      { "LDAPURL", "ldap.LDAPURL",
         FT_STRING, BASE_NONE, NULL, 0,
         "ldap.LDAPURL", HFILL }},
     { &hf_ldap_Controls_item,
-      { "Controls", "ldap.Controls_item",
+      { "Control", "ldap.Control",
         FT_NONE, BASE_NONE, NULL, 0,
         "ldap.Control", HFILL }},
     { &hf_ldap_controlType,
@@ -4898,7 +4885,7 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.T_and", HFILL }},
     { &hf_ldap_and_item,
-      { "and", "ldap.and_item",
+      { "and item", "ldap.and_item",
         FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
         "ldap.T_and_item", HFILL }},
     { &hf_ldap_or,
@@ -4906,7 +4893,7 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.T_or", HFILL }},
     { &hf_ldap_or_item,
-      { "or", "ldap.or_item",
+      { "or item", "ldap.or_item",
         FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
         "ldap.T_or_item", HFILL }},
     { &hf_ldap_not,
@@ -4946,7 +4933,7 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.T_substringFilter_substrings", HFILL }},
     { &hf_ldap_substringFilter_substrings_item,
-      { "substrings", "ldap.substrings_item",
+      { "substrings item", "ldap.substrings_item",
         FT_UINT32, BASE_DEC, VALS(ldap_T_substringFilter_substrings_item_vals), 0,
         "ldap.T_substringFilter_substrings_item", HFILL }},
     { &hf_ldap_initial,
@@ -4982,11 +4969,11 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.PartialAttributeList", HFILL }},
     { &hf_ldap_PartialAttributeList_item,
-      { "PartialAttributeList", "ldap.PartialAttributeList_item",
+      { "PartialAttributeList item", "ldap.PartialAttributeList_item",
         FT_NONE, BASE_NONE, NULL, 0,
         "ldap.PartialAttributeList_item", HFILL }},
     { &hf_ldap__untag_item,
-      { "_untag", "ldap._untag_item",
+      { "LDAPURL", "ldap.LDAPURL",
         FT_STRING, BASE_NONE, NULL, 0,
         "ldap.LDAPURL", HFILL }},
     { &hf_ldap_object,
@@ -4998,7 +4985,7 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.ModifyRequest_modification", HFILL }},
     { &hf_ldap_modifyRequest_modification_item,
-      { "modification", "ldap.modification_item",
+      { "modification item", "ldap.modification_item",
         FT_NONE, BASE_NONE, NULL, 0,
         "ldap.T_modifyRequest_modification_item", HFILL }},
     { &hf_ldap_operation,
@@ -5018,7 +5005,7 @@ void proto_register_ldap(void) {
         FT_UINT32, BASE_DEC, NULL, 0,
         "ldap.AttributeList", HFILL }},
     { &hf_ldap_AttributeList_item,
-      { "AttributeList", "ldap.AttributeList_item",
+      { "AttributeList item", "ldap.AttributeList_item",
         FT_NONE, BASE_NONE, NULL, 0,
         "ldap.AttributeList_item", HFILL }},
     { &hf_ldap_newrdn,
@@ -5066,7 +5053,7 @@ void proto_register_ldap(void) {
         FT_BYTES, BASE_HEX, NULL, 0,
         "ldap.OCTET_STRING", HFILL }},
     { &hf_ldap_SortKeyList_item,
-      { "SortKeyList", "ldap.SortKeyList_item",
+      { "SortKeyList item", "ldap.SortKeyList_item",
         FT_NONE, BASE_NONE, NULL, 0,
         "ldap.SortKeyList_item", HFILL }},
     { &hf_ldap_attributeType,
@@ -5115,7 +5102,7 @@ void proto_register_ldap(void) {
         "ldap.MessageID", HFILL }},
 
 /*--- End of included file: packet-ldap-hfarr.c ---*/
-#line 2088 "packet-ldap-template.c"
+#line 2083 "packet-ldap-template.c"
   };
 
   /* List of subtrees */
@@ -5178,7 +5165,7 @@ void proto_register_ldap(void) {
     &ett_ldap_CancelRequestValue,
 
 /*--- End of included file: packet-ldap-ettarr.c ---*/
-#line 2101 "packet-ldap-template.c"
+#line 2096 "packet-ldap-template.c"
   };
 
     module_t *ldap_module;
@@ -5196,7 +5183,7 @@ void proto_register_ldap(void) {
   prefs_register_bool_preference(ldap_module, "desegment_ldap_messages",
     "Reassemble LDAP messages spanning multiple TCP segments",
     "Whether the LDAP dissector should reassemble messages spanning multiple TCP segments."
-    "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
+    " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
     &ldap_desegment);
 
   prefs_register_uint_preference(ldap_module, "tcp.port", "LDAP TCP Port",
@@ -5226,13 +5213,10 @@ void
 proto_reg_handoff_ldap(void)
 {
        dissector_handle_t cldap_handle;
-       ldap_handle = create_dissector_handle(dissect_ldap_tcp, proto_ldap);
+       ldap_handle = find_dissector("ldap");
 
-       dissector_add("tcp.port", global_ldap_tcp_port, ldap_handle);
        dissector_add("tcp.port", TCP_PORT_GLOBALCAT_LDAP, ldap_handle);
 
-       ssl_dissector_add(global_ldaps_tcp_port, "ldap", TRUE);
-
        cldap_handle = create_dissector_handle(dissect_mscldap, proto_cldap);
        dissector_add("udp.port", UDP_PORT_CLDAP, cldap_handle);
 
@@ -5244,6 +5228,8 @@ proto_reg_handoff_ldap(void)
 
        ssl_handle = find_dissector("ssl");
 
+       prefs_register_ldap();
+
 /*  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dsml/dsml/ldap_controls_and_session_support.asp */
        oid_add_from_string("LDAP_PAGED_RESULT_OID_STRING","1.2.840.113556.1.4.319");
        oid_add_from_string("LDAP_SERVER_SHOW_DELETED_OID","1.2.840.113556.1.4.417");
@@ -5301,7 +5287,7 @@ proto_reg_handoff_ldap(void)
 
 
 /*--- End of included file: packet-ldap-dis-tab.c ---*/
-#line 2212 "packet-ldap-template.c"
+#line 2206 "packet-ldap-template.c"
        
 
 }