remove some compiler warning due to unused pinfo parameter
[obnox/wireshark/wip.git] / epan / dissectors / packet-ldap.c
index 8ada2b1be600794149d3af7a94d7a5ef46a3685a..79d24fd1f824dbf62cd5a5d0d5f14e8b43ce912c 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 -e -p ldap -c ldap.cnf -s packet-ldap-template Lightweight-Directory-Access-Protocol-V3.asn */
+/* ../../tools/asn2wrs.py -b -X -e -p ldap -c ldap.cnf -s packet-ldap-template Lightweight-Directory-Access-Protocol-V3.asn */
 
 /* Input file: packet-ldap-template.c */
 
 #include <epan/dissectors/packet-tcp.h>
 #include <epan/dissectors/packet-windows-common.h>
 #include <epan/dissectors/packet-dcerpc.h>
+#include <epan/asn1.h>
 
 #include "packet-frame.h"
 #include "packet-ldap.h"
+#include "packet-ntlmssp.h"
 
 #include "packet-ber.h"
 #include "packet-per.h"
@@ -142,11 +144,24 @@ static int hf_mscldap_netlogon_version = -1;
 static int hf_mscldap_netlogon_lm_token = -1;
 static int hf_mscldap_netlogon_nt_token = -1;
 static int hf_ldap_sid = -1;
+static int hf_ldap_AccessMask_ADS_CREATE_CHILD = -1;
+static int hf_ldap_AccessMask_ADS_DELETE_CHILD = -1;
+static int hf_ldap_AccessMask_ADS_LIST = -1;
+static int hf_ldap_AccessMask_ADS_SELF_WRITE = -1;
+static int hf_ldap_AccessMask_ADS_READ_PROP = -1;
+static int hf_ldap_AccessMask_ADS_WRITE_PROP = -1;
+static int hf_ldap_AccessMask_ADS_DELETE_TREE = -1;
+static int hf_ldap_AccessMask_ADS_LIST_OBJECT = -1;
+static int hf_ldap_AccessMask_ADS_CONTROL_ACCESS = -1;
 
 
 /*--- Included file: packet-ldap-hf.c ---*/
 #line 1 "packet-ldap-hf.c"
 static int hf_ldap_LDAPMessage_PDU = -1;          /* LDAPMessage */
+static int hf_ldap_SearchControlValue_PDU = -1;   /* SearchControlValue */
+static int hf_ldap_SortKeyList_PDU = -1;          /* SortKeyList */
+static int hf_ldap_SortResult_PDU = -1;           /* SortResult */
+static int hf_ldap_ReplControlValue_PDU = -1;     /* ReplControlValue */
 static int hf_ldap_messageID = -1;                /* MessageID */
 static int hf_ldap_protocolOp = -1;               /* ProtocolOp */
 static int hf_ldap_controls = -1;                 /* Controls */
@@ -184,15 +199,18 @@ static int hf_ldap_Referral_item = -1;            /* LDAPURL */
 static int hf_ldap_Controls_item = -1;            /* Control */
 static int hf_ldap_controlType = -1;              /* ControlType */
 static int hf_ldap_criticality = -1;              /* BOOLEAN */
-static int hf_ldap_controlValue = -1;             /* OCTET_STRING */
+static int hf_ldap_controlValue = -1;             /* T_controlValue */
 static int hf_ldap_version = -1;                  /* INTEGER_1_127 */
 static int hf_ldap_name = -1;                     /* LDAPDN */
 static int hf_ldap_authentication = -1;           /* AuthenticationChoice */
 static int hf_ldap_simple = -1;                   /* Simple */
 static int hf_ldap_sasl = -1;                     /* SaslCredentials */
+static int hf_ldap_ntlmsspNegotiate = -1;         /* T_ntlmsspNegotiate */
+static int hf_ldap_ntlmsspAuth = -1;              /* T_ntlmsspAuth */
 static int hf_ldap_mechanism = -1;                /* Mechanism */
 static int hf_ldap_credentials = -1;              /* Credentials */
 static int hf_ldap_bindResponse_resultCode = -1;  /* BindResponse_resultCode */
+static int hf_ldap_matchedDN_01 = -1;             /* T_matchedDN */
 static int hf_ldap_serverSaslCreds = -1;          /* ServerSaslCreds */
 static int hf_ldap_baseObject = -1;               /* LDAPDN */
 static int hf_ldap_scope = -1;                    /* T_scope */
@@ -221,7 +239,7 @@ static int hf_ldap_any = -1;                      /* LDAPString */
 static int hf_ldap_final = -1;                    /* LDAPString */
 static int hf_ldap_matchingRule = -1;             /* MatchingRuleId */
 static int hf_ldap_matchValue = -1;               /* AssertionValue */
-static int hf_ldap_dnAttributes = -1;             /* BOOLEAN */
+static int hf_ldap_dnAttributes = -1;             /* T_dnAttributes */
 static int hf_ldap_objectName = -1;               /* LDAPDN */
 static int hf_ldap_searchResultEntry_attributes = -1;  /* PartialAttributeList */
 static int hf_ldap_PartialAttributeList_item = -1;  /* PartialAttributeList_item */
@@ -243,9 +261,18 @@ static int hf_ldap_requestValue = -1;             /* OCTET_STRING */
 static int hf_ldap_extendedResponse_resultCode = -1;  /* ExtendedResponse_resultCode */
 static int hf_ldap_responseName = -1;             /* ResponseName */
 static int hf_ldap_response = -1;                 /* OCTET_STRING */
+static int hf_ldap_size = -1;                     /* INTEGER */
+static int hf_ldap_cookie = -1;                   /* OCTET_STRING */
+static int hf_ldap_SortKeyList_item = -1;         /* SortKeyList_item */
+static int hf_ldap_attributeType = -1;            /* AttributeDescription */
+static int hf_ldap_orderingRule = -1;             /* MatchingRuleId */
+static int hf_ldap_reverseOrder = -1;             /* BOOLEAN */
+static int hf_ldap_sortResult = -1;               /* T_sortResult */
+static int hf_ldap_parentsFirst = -1;             /* INTEGER */
+static int hf_ldap_maxReturnLength = -1;          /* INTEGER */
 
 /*--- End of included file: packet-ldap-hf.c ---*/
-#line 139 "packet-ldap-template.c"
+#line 150 "packet-ldap-template.c"
 
 /* Initialize the subtree pointers */
 static gint ett_ldap = -1;
@@ -294,15 +321,22 @@ static gint ett_ldap_ModifyDNRequest = -1;
 static gint ett_ldap_CompareRequest = -1;
 static gint ett_ldap_ExtendedRequest = -1;
 static gint ett_ldap_ExtendedResponse = -1;
+static gint ett_ldap_SearchControlValue = -1;
+static gint ett_ldap_SortKeyList = -1;
+static gint ett_ldap_SortKeyList_item = -1;
+static gint ett_ldap_SortResult = -1;
+static gint ett_ldap_ReplControlValue = -1;
 
 /*--- End of included file: packet-ldap-ett.c ---*/
-#line 148 "packet-ldap-template.c"
+#line 159 "packet-ldap-template.c"
 
 static dissector_table_t ldap_name_dissector_table=NULL;
+static const char *object_identifier_id = NULL; /* LDAP OID */
 
 /* desegmentation of LDAP */
 static gboolean ldap_desegment = TRUE;
 static guint    ldap_tcp_port = 389;
+
 static gboolean do_protocolop = FALSE;
 static gchar    *attr_type = NULL;
 static gboolean is_binary_attr_type = FALSE;
@@ -313,7 +347,8 @@ static gboolean is_binary_attr_type = FALSE;
 
 static dissector_handle_t gssapi_handle;
 static dissector_handle_t gssapi_wrap_handle;
-
+static dissector_handle_t ntlmssp_handle = NULL;
+static dissector_handle_t spnego_handle;
 
 /* different types of rpc calls ontop of ms cldap */
 #define        MSCLDAP_RPC_NETLOGON    1
@@ -356,7 +391,6 @@ typedef struct ldap_conv_info_t {
   GHashTable *unmatched;
   GHashTable *matched;
   gboolean is_mscldap;
-  gboolean first_time;
   guint32  num_results;
 } ldap_conv_info_t;
 static ldap_conv_info_t *ldap_info_items;
@@ -414,7 +448,7 @@ static char *ldapvalue_string=NULL;
  * display it as a string, othervise just display it in hex.
  */
 static int
-dissect_ldap_AssertionValue(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index)
+dissect_ldap_AssertionValue(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index)
 {
        gint8 class;
        gboolean pc, ind, is_ascii;
@@ -449,8 +483,7 @@ dissect_ldap_AssertionValue(gboolean implicit_tag, tvbuff_t *tvb, int offset, pa
                /* this octet string contains an NT SID */
                sid_tvb=tvb_new_subset(tvb, offset, len, len);
                dissect_nt_sid(sid_tvb, 0, tree, "SID", &tmpstr, hf_index);
-               ldapvalue_string=ep_strdup(tmpstr);
-               g_free(tmpstr);
+               ldapvalue_string=tmpstr;
 
                goto finished;
        } else if ( (len==16) /* GUIDs are always 16 bytes */
@@ -459,7 +492,7 @@ dissect_ldap_AssertionValue(gboolean implicit_tag, tvbuff_t *tvb, int offset, pa
                e_uuid_t uuid;
 
                /* This octet string contained a GUID */
-               dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_ldap_guid, &uuid);
+               dissect_dcerpc_uuid_t(tvb, offset, actx->pinfo, tree, drep, hf_ldap_guid, &uuid);
 
                ldapvalue_string=ep_alloc(1024);
                g_snprintf(ldapvalue_string, 1023, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
@@ -661,13 +694,18 @@ ldap_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
     /* we have found a match */
 
     if(lcrp){
+      proto_item *it;
+
       if(lcrp->is_request){
-        proto_tree_add_uint(tree, hf_ldap_response_in, tvb, 0, 0, lcrp->rep_frame);
+        it=proto_tree_add_uint(tree, hf_ldap_response_in, tvb, 0, 0, lcrp->rep_frame);
+        PROTO_ITEM_SET_GENERATED(it);
       } else {
         nstime_t ns;
-        proto_tree_add_uint(tree, hf_ldap_response_to, tvb, 0, 0, lcrp->req_frame);
+        it=proto_tree_add_uint(tree, hf_ldap_response_to, tvb, 0, 0, lcrp->req_frame);
+        PROTO_ITEM_SET_GENERATED(it);
         nstime_delta(&ns, &pinfo->fd->abs_ts, &lcrp->req_time);
-        proto_tree_add_time(tree, hf_ldap_time, tvb, 0, 0, &ns);
+        it=proto_tree_add_time(tree, hf_ldap_time, tvb, 0, 0, &ns);
+        PROTO_ITEM_SET_GENERATED(it);
       }
     }
 
@@ -682,20 +720,16 @@ ldap_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
 /* Filter -> Filter/and -> Filter/and/_item -> Filter */
 /* Filter -> Filter/or -> Filter/or/_item -> Filter */
 /* Filter -> Filter/not -> Filter */
-static int dissect_ldap_Filter(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
-
-
-
-/*--- Fields for imported types ---*/
+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_);
 
 
 
 
 static int
-dissect_ldap_MessageID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 53 "ldap.cnf"
+dissect_ldap_MessageID(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 67 "ldap.cnf"
 
-    offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   &MessageID);
 
   
@@ -705,39 +739,33 @@ dissect_ldap_MessageID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pac
 
   return offset;
 }
-static int dissect_messageID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_MessageID(FALSE, tvb, offset, pinfo, tree, hf_ldap_messageID);
-}
 
 
 
 static int
-dissect_ldap_INTEGER_1_127(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+dissect_ldap_INTEGER_1_127(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_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   NULL);
 
   return offset;
 }
-static int dissect_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_INTEGER_1_127(FALSE, tvb, offset, pinfo, tree, hf_ldap_version);
-}
 
 
 
 static int
-dissect_ldap_LDAPString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 240 "ldap.cnf"
+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 266 "ldap.cnf"
   tvbuff_t     *parameter_tvb = NULL;
   char          *ldapstring;
   gchar                *sc = NULL; /* semi-colon pointer */
  
-    offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+    offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
 
   if (parameter_tvb || (hf_index == hf_ldap_baseObject)) {
   
-     ldap_do_protocolop(pinfo);
+     ldap_do_protocolop(actx->pinfo);
 
      if(parameter_tvb)
         ldapstring = tvb_get_ephemeral_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb, 0));
@@ -745,21 +773,28 @@ dissect_ldap_LDAPString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
         ldapstring = "<ROOT>";
 
      if(hf_index == hf_ldap_baseObject) {
-       /* this is search - but it on the scanline */
-       if(check_col(pinfo->cinfo, COL_INFO)) 
-         col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\" ", ldapstring);
+       /* this is search - put it on the scanline */
+       if(check_col(actx->pinfo->cinfo, COL_INFO)) 
+         col_append_fstr(actx->pinfo->cinfo, COL_INFO, "\"%s\" ", ldapstring);
   
        if(ldm_tree)
          proto_item_append_text(ldm_tree, " \"%s\"", ldapstring); 
+
+
+       if(!parameter_tvb) {
+
+         proto_item_append_text(ber_last_created_item, " (%s)", ldapstring); 
+       }
+
      } else if ((hf_index == hf_ldap_errorMessage) && result) { /* only show message if not success */
-       if(check_col(pinfo->cinfo, COL_INFO)) 
-          col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", ldapstring);     
+       if(check_col(actx->pinfo->cinfo, COL_INFO)) 
+          col_append_fstr(actx->pinfo->cinfo, COL_INFO, "(%s) ", ldapstring);     
 
         if(ldm_tree)
          proto_item_append_text(ldm_tree, " (%s)", ldapstring); 
      } else if (hf_index == hf_ldap_objectName) {
-       if(check_col(pinfo->cinfo, COL_INFO)) 
-          col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\" ", ldapstring);     
+       if(check_col(actx->pinfo->cinfo, COL_INFO)) 
+          col_append_fstr(actx->pinfo->cinfo, COL_INFO, "\"%s\" ", ldapstring);     
 
         if(ldm_tree)
          proto_item_append_text(ldm_tree, " \"%s\"", ldapstring); 
@@ -806,83 +841,50 @@ dissect_ldap_LDAPString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
 
   return offset;
 }
-static int dissect_initial_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPString(TRUE, tvb, offset, pinfo, tree, hf_ldap_initial);
-}
-static int dissect_any_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPString(TRUE, tvb, offset, pinfo, tree, hf_ldap_any);
-}
-static int dissect_final_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPString(TRUE, tvb, offset, pinfo, tree, hf_ldap_final);
-}
 
 
 
 static int
-dissect_ldap_LDAPDN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_LDAPDN(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_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_matchedDN(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPDN(FALSE, tvb, offset, pinfo, tree, hf_ldap_matchedDN);
-}
-static int dissect_name(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPDN(FALSE, tvb, offset, pinfo, tree, hf_ldap_name);
-}
-static int dissect_baseObject(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPDN(FALSE, tvb, offset, pinfo, tree, hf_ldap_baseObject);
-}
-static int dissect_objectName(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPDN(FALSE, tvb, offset, pinfo, tree, hf_ldap_objectName);
-}
-static int dissect_object(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPDN(FALSE, tvb, offset, pinfo, tree, hf_ldap_object);
-}
-static int dissect_entry(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPDN(FALSE, tvb, offset, pinfo, tree, hf_ldap_entry);
-}
-static int dissect_newSuperior_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPDN(TRUE, tvb, offset, pinfo, tree, hf_ldap_newSuperior);
-}
 
 
 
 static int
-dissect_ldap_Simple(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 103 "ldap.cnf"
+dissect_ldap_Simple(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 117 "ldap.cnf"
 ldap_conv_info_t *ldap_info;
 
-  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+  offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        NULL);
 
        
-       ldap_info = pinfo->private_data;
+       ldap_info = actx->pinfo->private_data;
        ldap_info->auth_type = LDAP_AUTH_SIMPLE;
 
-       pinfo->private_data = ldap_info;
+       actx->pinfo->private_data = ldap_info;
 
 
 
   return offset;
 }
-static int dissect_simple_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_Simple(TRUE, tvb, offset, pinfo, tree, hf_ldap_simple);
-}
 
 
 
 static int
-dissect_ldap_Mechanism(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 114 "ldap.cnf"
+dissect_ldap_Mechanism(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 127 "ldap.cnf"
 
 ldap_conv_info_t *ldap_info;
 tvbuff_t       *parameter_tvb;
 char *mechanism = NULL;
-  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+  offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       ldap_info = pinfo->private_data;
+       ldap_info = actx->pinfo->private_data;
        ldap_info->auth_type = LDAP_AUTH_SASL;
 
        if (!parameter_tvb)
@@ -912,107 +914,150 @@ char *mechanism = NULL;
       }
       ldap_info->auth_mech = mechanism;
     }
-       pinfo->private_data = ldap_info;
+       actx->pinfo->private_data = ldap_info;
 
 
 
   return offset;
 }
-static int dissect_mechanism(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_Mechanism(FALSE, tvb, offset, pinfo, tree, hf_ldap_mechanism);
-}
 
 
 
 static int
-dissect_ldap_Credentials(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 153 "ldap.cnf"
+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 165 "ldap.cnf"
 
 tvbuff_t       *parameter_tvb;
 ldap_conv_info_t *ldap_info;
+gint8 class;
+gboolean pc;
+gint32 tag;
 
-  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+  offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
+
        if (!parameter_tvb)
                return offset;
 
-       ldap_info = pinfo->private_data;
-       if (ldap_info->auth_mech != NULL && strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) {
-               /*
-         * This is a GSS-API token ancapsulated within GSS-SPNEGO.
-                */
-                if (parameter_tvb)
-                       call_dissector(gssapi_handle, parameter_tvb, pinfo, tree);
-       } else if (ldap_info->auth_mech != NULL && strcmp(ldap_info->auth_mech, "GSSAPI") == 0) {
-        /*
-         * This is a raw GSS-API token.
-         */
-                if (parameter_tvb)
-                       call_dissector(gssapi_handle, parameter_tvb, pinfo, tree);
+       ldap_info = actx->pinfo->private_data;
+       get_ber_identifier(parameter_tvb, 0, &class, &pc, &tag);
+
+       /*if ((ldap_info->auth_mech != NULL) && (strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) && (class==BER_CLASS_CON)) {*/
+       if ((ldap_info->auth_mech != NULL) && (class==BER_CLASS_CON)) {
+         /*
+          * This is a GSS-API token ancapsulated within GSS-SPNEGO.
+          * We need to check the first byte to check whether the blob
+          * contains SPNEGO or GSSAPI.
+          * All SPNEGO PDUs are of class CONSTRUCTED while
+          * GSS PDUs are class APPLICATION
+          */
+         if (parameter_tvb && (tvb_length(parameter_tvb) > 0))
+           call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree);
        }
-       pinfo->private_data = ldap_info;
+       /*if ((ldap_info->auth_mech != NULL) && ((strcmp(ldap_info->auth_mech, "GSSAPI") == 0) || (class==BER_CLASS_APP))) {*/
+       if ((ldap_info->auth_mech != NULL) && (class==BER_CLASS_APP)) {
+         /*
+          * This is a raw GSS-API token.
+          */
+         if (parameter_tvb && (tvb_length(parameter_tvb) > 0)) {
+           call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree);
+         }
+       }
+       actx->pinfo->private_data = ldap_info;
+
 
 
 
   return offset;
 }
-static int dissect_credentials(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_Credentials(FALSE, tvb, offset, pinfo, tree, hf_ldap_credentials);
-}
 
 
 static const ber_sequence_t SaslCredentials_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_mechanism },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_credentials },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_mechanism      , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_Mechanism },
+  { &hf_ldap_credentials    , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ldap_Credentials },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_SaslCredentials(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_SaslCredentials(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    SaslCredentials_sequence, hf_index, ett_ldap_SaslCredentials);
 
   return offset;
 }
-static int dissect_sasl_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_SaslCredentials(TRUE, tvb, offset, pinfo, tree, hf_ldap_sasl);
+
+
+
+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 619 "ldap.cnf"
+       /* make sure the protocol op comes first */
+               ldap_do_protocolop(actx->pinfo);
+
+       call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree);
+       offset+=tvb_length_remaining(tvb, offset);
+
+
+
+  return offset;
+}
+
+
+
+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 626 "ldap.cnf"
+       /* make sure the protocol op comes first */
+               ldap_do_protocolop(actx->pinfo);
+
+       call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree);
+       offset+=tvb_length_remaining(tvb, offset);
+
+
+
+  return offset;
 }
 
 
 static const value_string ldap_AuthenticationChoice_vals[] = {
   {   0, "simple" },
   {   3, "sasl" },
+  {  10, "ntlmsspNegotiate" },
+  {  11, "ntlmsspAuth" },
   { 0, NULL }
 };
 
 static const ber_choice_t AuthenticationChoice_choice[] = {
-  {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_simple_impl },
-  {   3, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_sasl_impl },
-  { 0, 0, 0, 0, NULL }
+  {   0, &hf_ldap_simple         , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_Simple },
+  {   3, &hf_ldap_sasl           , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ldap_SaslCredentials },
+  {  10, &hf_ldap_ntlmsspNegotiate, BER_CLASS_CON, 10, BER_FLAGS_IMPLTAG, dissect_ldap_T_ntlmsspNegotiate },
+  {  11, &hf_ldap_ntlmsspAuth    , BER_CLASS_CON, 11, BER_FLAGS_IMPLTAG, dissect_ldap_T_ntlmsspAuth },
+  { 0, NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_AuthenticationChoice(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 415 "ldap.cnf"
+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 440 "ldap.cnf"
   gint branch = -1;
   gint auth = -1;
   const gchar *valstr;
   
-    offset = dissect_ber_choice(pinfo, tree, tvb, offset,
+    offset = dissect_ber_choice(actx, tree, tvb, offset,
                                  AuthenticationChoice_choice, hf_index, ett_ldap_AuthenticationChoice,
                                  &branch);
 
   
-  ldap_do_protocolop(pinfo);
+  ldap_do_protocolop(actx->pinfo);
   
   if((branch > -1) && (branch < (gint)(sizeof AuthenticationChoice_choice/sizeof AuthenticationChoice_choice[0])))
     auth = AuthenticationChoice_choice[branch].value;
 
   valstr = val_to_str(auth, ldap_AuthenticationChoice_vals, "Unknown auth(%u)");
   
-  if (check_col(pinfo->cinfo, COL_INFO))
-    col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", valstr);
+  /* If auth is NTLM (10 or 11) don't add to column as the NTLM dissection will do this */
+  if (check_col(actx->pinfo->cinfo, COL_INFO) && (auth !=  10) && (auth != 11))
+    col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);
   
   if(ldm_tree)
     proto_item_append_text(ldm_tree, " %s", valstr);
@@ -1022,28 +1067,22 @@ dissect_ldap_AuthenticationChoice(gboolean implicit_tag _U_, tvbuff_t *tvb, int
 
   return offset;
 }
-static int dissect_authentication(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AuthenticationChoice(FALSE, tvb, offset, pinfo, tree, hf_ldap_authentication);
-}
 
 
 static const ber_sequence_t BindRequest_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_name },
-  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_authentication },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_version        , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER_1_127 },
+  { &hf_ldap_name           , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_authentication , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_AuthenticationChoice },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_BindRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_BindRequest(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    BindRequest_sequence, hf_index, ett_ldap_BindRequest);
 
   return offset;
 }
-static int dissect_bindRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_BindRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_bindRequest);
-}
 
 
 static const value_string ldap_BindResponse_resultCode_vals[] = {
@@ -1091,23 +1130,23 @@ static const value_string ldap_BindResponse_resultCode_vals[] = {
 
 
 static int
-dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 357 "ldap.cnf"
+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 384 "ldap.cnf"
 
   const gchar *valstr;
 
-    offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   &result);
 
 
-  ldap_do_protocolop(pinfo);
+  ldap_do_protocolop(actx->pinfo);
 
   if(result) {
   
     valstr = val_to_str(result, ldap_BindResponse_resultCode_vals, "Unknown result(%u)");
 
-    if (check_col(pinfo->cinfo, COL_INFO))
-      col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", valstr);
+    if (check_col(actx->pinfo->cinfo, COL_INFO))
+      col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);
 
     if(ldm_tree)
       proto_item_append_text(ldm_tree, " %s", valstr); 
@@ -1119,68 +1158,83 @@ dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb, i
 
   return offset;
 }
-static int dissect_bindResponse_resultCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_BindResponse_resultCode(FALSE, tvb, offset, pinfo, tree, hf_ldap_bindResponse_resultCode);
-}
 
 
 
 static int
-dissect_ldap_ErrorMessage(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_T_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 633 "ldap.cnf"
+       tvbuff_t *new_tvb=NULL;
+
+       offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_ldap_matchedDN, &new_tvb);
+
+       if(  new_tvb
+       &&  (tvb_length(new_tvb)>=7)
+       &&  (!tvb_memeql(new_tvb, 0, "NTLMSSP", 7))){
+
+               /* make sure the protocol op comes first */
+               ldap_do_protocolop(actx->pinfo);
+
+               call_dissector(ntlmssp_handle, new_tvb, actx->pinfo, tree);
+       }
+       return offset;
+
+
 
   return offset;
 }
-static int dissect_errorMessage(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ErrorMessage(FALSE, tvb, offset, pinfo, tree, hf_ldap_errorMessage);
-}
 
 
 
 static int
-dissect_ldap_LDAPURL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_ErrorMessage(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_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_Referral_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPURL(FALSE, tvb, offset, pinfo, tree, hf_ldap_Referral_item);
-}
-static int dissect_SearchResultReference_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPURL(FALSE, tvb, offset, pinfo, tree, hf_ldap_SearchResultReference_item);
+
+
+
+static int
+dissect_ldap_LDAPURL(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_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                       NULL);
+
+#line 38 "ldap.cnf"
+       PROTO_ITEM_SET_URL(get_ber_last_created_item());
+
+
+  return offset;
 }
 
 
 static const ber_sequence_t Referral_sequence_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_Referral_item },
+  { &hf_ldap_Referral_item  , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPURL },
 };
 
 static int
-dissect_ldap_Referral(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_Referral(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       Referral_sequence_of, hf_index, ett_ldap_Referral);
 
   return offset;
 }
-static int dissect_referral_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_Referral(TRUE, tvb, offset, pinfo, tree, hf_ldap_referral);
-}
 
 
 
 static int
-dissect_ldap_ServerSaslCreds(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 179 "ldap.cnf"
+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 205 "ldap.cnf"
 
 tvbuff_t       *parameter_tvb;
 ldap_conv_info_t *ldap_info;
 
-  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+  offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
        if (!parameter_tvb)
                return offset;
-       ldap_info = pinfo->private_data;
+       ldap_info = actx->pinfo->private_data;
     switch (ldap_info->auth_type) {
 
       /* For Kerberos V4, dissect it as a ticket. */
@@ -1213,65 +1267,61 @@ ldap_conv_info_t *ldap_info;
        * assumption that we won't have more than 2^24 bytes of
        * encapsulated stuff.
        */
-      ldap_info->first_auth_frame = pinfo->fd->num + 1;
+      ldap_info->first_auth_frame = actx->pinfo->fd->num + 1;
       if (ldap_info->auth_mech != NULL &&
           strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) {
         /*
          * This is a GSS-API token.
          */
-        call_dissector(gssapi_handle, parameter_tvb, pinfo, tree);
+       if(parameter_tvb && (tvb_length(parameter_tvb) > 0))
+         call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree);
       } else if (ldap_info->auth_mech != NULL &&
           strcmp(ldap_info->auth_mech, "GSSAPI") == 0) {
         /*
          * This is a GSS-API token.
          */
-        call_dissector(gssapi_handle, parameter_tvb, pinfo, tree);
+        if(parameter_tvb && (tvb_length(parameter_tvb) > 0))
+          call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree);
                }
        break;
        }
-       pinfo->private_data = ldap_info;
+       actx->pinfo->private_data = ldap_info;
 
 
 
   return offset;
 }
-static int dissect_serverSaslCreds_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ServerSaslCreds(TRUE, tvb, offset, pinfo, tree, hf_ldap_serverSaslCreds);
-}
 
 
 static const ber_sequence_t BindResponse_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_bindResponse_resultCode },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_matchedDN },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_errorMessage },
-  { BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_referral_impl },
-  { BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_serverSaslCreds_impl },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_bindResponse_resultCode, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_BindResponse_resultCode },
+  { &hf_ldap_matchedDN_01   , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_T_matchedDN },
+  { &hf_ldap_errorMessage   , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ErrorMessage },
+  { &hf_ldap_referral       , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Referral },
+  { &hf_ldap_serverSaslCreds, BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_ServerSaslCreds },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_BindResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_BindResponse(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    BindResponse_sequence, hf_index, ett_ldap_BindResponse);
 
   return offset;
 }
-static int dissect_bindResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_BindResponse(FALSE, tvb, offset, pinfo, tree, hf_ldap_bindResponse);
-}
 
 
 
 static int
-dissect_ldap_UnbindRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 436 "ldap.cnf"
+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 462 "ldap.cnf"
 
  implicit_tag = TRUE; /* correct problem with asn2wrs */
 
-   offset = dissect_ber_null(implicit_tag, pinfo, tree, tvb, offset, hf_index);
+   offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
 
 
- ldap_do_protocolop(pinfo);  
+ ldap_do_protocolop(actx->pinfo);  
 
 
 
@@ -1281,9 +1331,6 @@ dissect_ldap_UnbindRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
 
   return offset;
 }
-static int dissect_unbindRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_UnbindRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_unbindRequest);
-}
 
 
 static const value_string ldap_T_scope_vals[] = {
@@ -1295,22 +1342,22 @@ static const value_string ldap_T_scope_vals[] = {
 
 
 static int
-dissect_ldap_T_scope(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 316 "ldap.cnf"
+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 347 "ldap.cnf"
 
   gint         scope;
   const gchar *valstr;
 
-    offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   &scope);
 
 
-  ldap_do_protocolop(pinfo);
+  ldap_do_protocolop(actx->pinfo);
 
   valstr = val_to_str(scope, ldap_T_scope_vals, "Unknown scope(%u)");
 
-  if (check_col(pinfo->cinfo, COL_INFO))
-    col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", valstr);    
+  if (check_col(actx->pinfo->cinfo, COL_INFO))
+    col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);    
     
   if(ldm_tree)
     proto_item_append_text(ldm_tree, " %s", valstr); 
@@ -1319,9 +1366,6 @@ dissect_ldap_T_scope(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packe
 
   return offset;
 }
-static int dissect_scope(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_scope(FALSE, tvb, offset, pinfo, tree, hf_ldap_scope);
-}
 
 
 static const value_string ldap_T_derefAliases_vals[] = {
@@ -1334,69 +1378,39 @@ static const value_string ldap_T_derefAliases_vals[] = {
 
 
 static int
-dissect_ldap_T_derefAliases(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+dissect_ldap_T_derefAliases(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_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   NULL);
 
   return offset;
 }
-static int dissect_derefAliases(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_derefAliases(FALSE, tvb, offset, pinfo, tree, hf_ldap_derefAliases);
-}
 
 
 
 static int
-dissect_ldap_INTEGER_0_maxInt(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+dissect_ldap_INTEGER_0_maxInt(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_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   NULL);
 
   return offset;
 }
-static int dissect_sizeLimit(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_INTEGER_0_maxInt(FALSE, tvb, offset, pinfo, tree, hf_ldap_sizeLimit);
-}
-static int dissect_timeLimit(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_INTEGER_0_maxInt(FALSE, tvb, offset, pinfo, tree, hf_ldap_timeLimit);
-}
 
 
 
 static int
-dissect_ldap_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 529 "ldap.cnf"
-       gboolean val;
-
-       offset = dissect_ber_boolean_value(implicit_tag, pinfo, tree, tvb, offset, hf_index, &val);
-
-       if (hf_index == hf_ldap_dnAttributes) {
-               matching_rule_dnattr = val;
-       }
-
-
+dissect_ldap_BOOLEAN(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_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index);
 
   return offset;
 }
-static int dissect_criticality(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_ldap_criticality);
-}
-static int dissect_typesOnly(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_ldap_typesOnly);
-}
-static int dissect_dnAttributes_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_BOOLEAN(TRUE, tvb, offset, pinfo, tree, hf_ldap_dnAttributes);
-}
-static int dissect_deleteoldrdn(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_ldap_deleteoldrdn);
-}
 
 
 
 static int
-dissect_ldap_T_and_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_Filter(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 470 "ldap.cnf"
+#line 496 "ldap.cnf"
        if(and_filter_string){
                and_filter_string=ep_strdup_printf("(&%s%s)",and_filter_string,Filter_string);
        } else {
@@ -1406,20 +1420,15 @@ dissect_ldap_T_and_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
 
   return offset;
 }
-static int dissect_and_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_and_item(FALSE, tvb, offset, pinfo, tree, hf_ldap_and_item);
-}
 
 
 static const ber_sequence_t T_and_set_of[1] = {
-  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_and_item },
+  { &hf_ldap_and_item       , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_and_item },
 };
 
 static int
-dissect_ldap_T_and(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 477 "ldap.cnf"
-       const ber_sequence_t and_set_of[1] = {  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_and_item },
-};
+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 503 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
        char *old_and_filter_string=and_filter_string;
@@ -1428,9 +1437,12 @@ dissect_ldap_T_and(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_
        if(tree){
                it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "and: ");
                tr=proto_item_add_subtree(it, ett_ldap_T_and);
+               tree = tr;
        } 
-       offset = dissect_ber_set_of(implicit_tag, pinfo, tr, tvb, offset,
-                                 and_set_of, -1, ett_ldap_T_and);
+
+  offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
+                                 T_and_set_of, hf_index, ett_ldap_T_and);
+
 
        proto_item_append_text(it, "%s", and_filter_string);
        Filter_string=ep_strdup_printf("%s",and_filter_string);
@@ -1440,17 +1452,14 @@ dissect_ldap_T_and(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_
 
   return offset;
 }
-static int dissect_and_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_and(TRUE, tvb, offset, pinfo, tree, hf_ldap_and);
-}
 
 
 
 static int
-dissect_ldap_T_or_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_Filter(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 496 "ldap.cnf"
+#line 521 "ldap.cnf"
        if(or_filter_string){
                or_filter_string=ep_strdup_printf("(|%s%s)",or_filter_string,Filter_string);
        } else {
@@ -1461,20 +1470,15 @@ dissect_ldap_T_or_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pac
 
   return offset;
 }
-static int dissect_or_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_or_item(FALSE, tvb, offset, pinfo, tree, hf_ldap_or_item);
-}
 
 
 static const ber_sequence_t T_or_set_of[1] = {
-  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_or_item },
+  { &hf_ldap_or_item        , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_or_item },
 };
 
 static int
-dissect_ldap_T_or(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 504 "ldap.cnf"
-       const ber_sequence_t or_set_of[1] = {  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_or_item },
-};
+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 529 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
        char *old_or_filter_string=or_filter_string;
@@ -1483,9 +1487,10 @@ dissect_ldap_T_or(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_i
        if(tree){
                it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "or: ");
                tr=proto_item_add_subtree(it, ett_ldap_T_or);
+               tree = tr;
        } 
-       offset = dissect_ber_set_of(implicit_tag, pinfo, tr, tvb, offset,
-                                 or_set_of, -1, ett_ldap_T_or);
+  offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
+                                 T_or_set_of, hf_index, ett_ldap_T_or);
 
        proto_item_append_text(it, "%s", or_filter_string);
        Filter_string=ep_strdup_printf("%s",or_filter_string);
@@ -1495,88 +1500,58 @@ dissect_ldap_T_or(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_i
 
   return offset;
 }
-static int dissect_or_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_or(TRUE, tvb, offset, pinfo, tree, hf_ldap_or);
-}
 
 
 
 static int
-dissect_ldap_T_not(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_Filter(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 526 "ldap.cnf"
+#line 548 "ldap.cnf"
        Filter_string=ep_strdup_printf("(!%s)",Filter_string);
 
 
   return offset;
 }
-static int dissect_not_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_not(TRUE, tvb, offset, pinfo, tree, hf_ldap_not);
-}
 
 
 
 static int
-dissect_ldap_AttributeDescription(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_AttributeDescription(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_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_AttributeDescriptionList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeDescription(FALSE, tvb, offset, pinfo, tree, hf_ldap_AttributeDescriptionList_item);
-}
-static int dissect_attributeDesc(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeDescription(FALSE, tvb, offset, pinfo, tree, hf_ldap_attributeDesc);
-}
-static int dissect_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeDescription(FALSE, tvb, offset, pinfo, tree, hf_ldap_type);
-}
-static int dissect_type_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeDescription(TRUE, tvb, offset, pinfo, tree, hf_ldap_type);
-}
 
-static int dissect_assertionValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AssertionValue(FALSE, tvb, offset, pinfo, tree, hf_ldap_assertionValue);
-}
-static int dissect_matchValue_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AssertionValue(TRUE, tvb, offset, pinfo, tree, hf_ldap_matchValue);
-}
 
 
 static const ber_sequence_t AttributeValueAssertion_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_attributeDesc },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_assertionValue },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_attributeDesc  , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
+  { &hf_ldap_assertionValue , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AssertionValue },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_AttributeValueAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_AttributeValueAssertion(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    AttributeValueAssertion_sequence, hf_index, ett_ldap_AttributeValueAssertion);
 
   return offset;
 }
-static int dissect_ava(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeValueAssertion(FALSE, tvb, offset, pinfo, tree, hf_ldap_ava);
-}
 
 
 
 static int
-dissect_ldap_T_equalityMatch(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 455 "ldap.cnf"
+#line 481 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s=%s)",attributedesc_string,ldapvalue_string);
 
 
 
   return offset;
 }
-static int dissect_equalityMatch_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_equalityMatch(TRUE, tvb, offset, pinfo, tree, hf_ldap_equalityMatch);
-}
 
 
 static const value_string ldap_T_substringFilter_substrings_item_vals[] = {
@@ -1587,19 +1562,19 @@ static const value_string ldap_T_substringFilter_substrings_item_vals[] = {
 };
 
 static const ber_choice_t T_substringFilter_substrings_item_choice[] = {
-  {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_initial_impl },
-  {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_any_impl },
-  {   2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_final_impl },
-  { 0, 0, 0, 0, NULL }
+  {   0, &hf_ldap_initial        , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPString },
+  {   1, &hf_ldap_any            , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPString },
+  {   2, &hf_ldap_final          , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPString },
+  { 0, NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_T_substringFilter_substrings_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_choice(pinfo, tree, tvb, offset,
+dissect_ldap_T_substringFilter_substrings_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_ber_choice(actx, tree, tvb, offset,
                                  T_substringFilter_substrings_item_choice, hf_index, ett_ldap_T_substringFilter_substrings_item,
                                  NULL);
 
-#line 552 "ldap.cnf"
+#line 574 "ldap.cnf"
        if (substring_item_final) {
                substring_value=ep_strdup_printf("%s%s",
                                                 (substring_value?substring_value:"*"),
@@ -1616,36 +1591,30 @@ dissect_ldap_T_substringFilter_substrings_item(gboolean implicit_tag _U_, tvbuff
 
   return offset;
 }
-static int dissect_substringFilter_substrings_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_substringFilter_substrings_item(FALSE, tvb, offset, pinfo, tree, hf_ldap_substringFilter_substrings_item);
-}
 
 
 static const ber_sequence_t T_substringFilter_substrings_sequence_of[1] = {
-  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_substringFilter_substrings_item },
+  { &hf_ldap_substringFilter_substrings_item, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_substringFilter_substrings_item },
 };
 
 static int
-dissect_ldap_T_substringFilter_substrings(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_T_substringFilter_substrings(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       T_substringFilter_substrings_sequence_of, hf_index, ett_ldap_T_substringFilter_substrings);
 
   return offset;
 }
-static int dissect_substringFilter_substrings(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_substringFilter_substrings(FALSE, tvb, offset, pinfo, tree, hf_ldap_substringFilter_substrings);
-}
 
 
 static const ber_sequence_t SubstringFilter_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_type },
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_substringFilter_substrings },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_type           , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
+  { &hf_ldap_substringFilter_substrings, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_T_substringFilter_substrings },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_SubstringFilter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 566 "ldap.cnf"
+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 588 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
        char *old_substring_value=substring_value;
@@ -1657,10 +1626,10 @@ dissect_ldap_SubstringFilter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offse
        if(tree){
                it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "substring: ");
                tr=proto_item_add_subtree(it, ett_ldap_SubstringFilter);
+               tree = tr;
        }
-       offset = dissect_ber_sequence(implicit_tag, pinfo, tr, tvb, offset,
-                                     SubstringFilter_sequence, hf_index,
-                                     ett_ldap_SubstringFilter);
+  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);
        proto_item_append_text(it, "%s", Filter_string);
@@ -1670,100 +1639,100 @@ dissect_ldap_SubstringFilter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offse
 
   return offset;
 }
-static int dissect_substrings_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_SubstringFilter(TRUE, tvb, offset, pinfo, tree, hf_ldap_substrings);
-}
 
 
 
 static int
-dissect_ldap_T_greaterOrEqual(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 459 "ldap.cnf"
+#line 485 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s>=%s)",attributedesc_string,ldapvalue_string);
 
 
 
   return offset;
 }
-static int dissect_greaterOrEqual_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_greaterOrEqual(TRUE, tvb, offset, pinfo, tree, hf_ldap_greaterOrEqual);
-}
 
 
 
 static int
-dissect_ldap_T_lessOrEqual(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 463 "ldap.cnf"
+#line 489 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s<=%s)",attributedesc_string,ldapvalue_string);
 
 
 
   return offset;
 }
-static int dissect_lessOrEqual_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_lessOrEqual(TRUE, tvb, offset, pinfo, tree, hf_ldap_lessOrEqual);
-}
 
 
 
 static int
-dissect_ldap_T_present(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_AttributeDescription(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 523 "ldap.cnf"
+#line 545 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s=*)",Filter_string);
 
 
   return offset;
 }
-static int dissect_present_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_present(TRUE, tvb, offset, pinfo, tree, hf_ldap_present);
-}
 
 
 
 static int
-dissect_ldap_T_approxMatch(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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 467 "ldap.cnf"
+#line 493 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s~=%s)",attributedesc_string,ldapvalue_string);
 
 
   return offset;
 }
-static int dissect_approxMatch_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_approxMatch(TRUE, tvb, offset, pinfo, tree, hf_ldap_approxMatch);
-}
 
 
 
 static int
-dissect_ldap_MatchingRuleId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_MatchingRuleId(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_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_matchingRule_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_MatchingRuleId(TRUE, tvb, offset, pinfo, tree, hf_ldap_matchingRule);
+
+
+
+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 551 "ldap.cnf"
+       gboolean val;
+
+offset = dissect_ber_boolean_value(implicit_tag, actx, tree, tvb, offset, hf_index, &val);
+
+
+               matching_rule_dnattr = val;
+
+
+
+
+  return offset;
 }
 
 
 static const ber_sequence_t MatchingRuleAssertion_sequence[] = {
-  { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_matchingRule_impl },
-  { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_type_impl },
-  { BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_matchValue_impl },
-  { BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_dnAttributes_impl },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_matchingRule   , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_MatchingRuleId },
+  { &hf_ldap_type           , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_AttributeDescription },
+  { &hf_ldap_matchValue     , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ldap_AssertionValue },
+  { &hf_ldap_dnAttributes   , BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_T_dnAttributes },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_MatchingRuleAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_MatchingRuleAssertion(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    MatchingRuleAssertion_sequence, hf_index, ett_ldap_MatchingRuleAssertion);
 
   return offset;
@@ -1772,17 +1741,17 @@ dissect_ldap_MatchingRuleAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb, int
 
 
 static int
-dissect_ldap_T_extensibleMatch(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 538 "ldap.cnf"
+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 560 "ldap.cnf"
        attr_type=NULL;
        matching_rule_string=NULL;
        ldapvalue_string=NULL;
        matching_rule_dnattr=FALSE;
 
 
-  offset = dissect_ldap_MatchingRuleAssertion(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+  offset = dissect_ldap_MatchingRuleAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 544 "ldap.cnf"
+#line 566 "ldap.cnf"
        Filter_string=ep_strdup_printf("(%s:%s%s%s=%s)",
                                        (attr_type?attr_type:""),
                                        (matching_rule_dnattr?"dn:":""),
@@ -1793,9 +1762,6 @@ dissect_ldap_T_extensibleMatch(gboolean implicit_tag _U_, tvbuff_t *tvb, int off
 
   return offset;
 }
-static int dissect_extensibleMatch_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_extensibleMatch(TRUE, tvb, offset, pinfo, tree, hf_ldap_extensibleMatch);
-}
 
 
 static const value_string ldap_Filter_vals[] = {
@@ -1813,31 +1779,32 @@ static const value_string ldap_Filter_vals[] = {
 };
 
 static const ber_choice_t Filter_choice[] = {
-  {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_and_impl },
-  {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_or_impl },
-  {   2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_not_impl },
-  {   3, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_equalityMatch_impl },
-  {   4, BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_substrings_impl },
-  {   5, BER_CLASS_CON, 5, BER_FLAGS_IMPLTAG, dissect_greaterOrEqual_impl },
-  {   6, BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, dissect_lessOrEqual_impl },
-  {   7, BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_present_impl },
-  {   8, BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, dissect_approxMatch_impl },
-  {   9, BER_CLASS_CON, 9, BER_FLAGS_IMPLTAG, dissect_extensibleMatch_impl },
-  { 0, 0, 0, 0, NULL }
+  {   0, &hf_ldap_and            , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_T_and },
+  {   1, &hf_ldap_or             , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ldap_T_or },
+  {   2, &hf_ldap_not            , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ldap_T_not },
+  {   3, &hf_ldap_equalityMatch  , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ldap_T_equalityMatch },
+  {   4, &hf_ldap_substrings     , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_ldap_SubstringFilter },
+  {   5, &hf_ldap_greaterOrEqual , BER_CLASS_CON, 5, BER_FLAGS_IMPLTAG, dissect_ldap_T_greaterOrEqual },
+  {   6, &hf_ldap_lessOrEqual    , BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, dissect_ldap_T_lessOrEqual },
+  {   7, &hf_ldap_present        , BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_ldap_T_present },
+  {   8, &hf_ldap_approxMatch    , BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, dissect_ldap_T_approxMatch },
+  {   9, &hf_ldap_extensibleMatch, BER_CLASS_CON, 9, BER_FLAGS_IMPLTAG, dissect_ldap_T_extensibleMatch },
+  { 0, NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 587 "ldap.cnf"
+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 607 "ldap.cnf"
        proto_tree *tr=NULL;
        proto_item *it=NULL;
 
        if(tree){
                it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Filter: ");
                tr=proto_item_add_subtree(it, ett_ldap_Filter);
+               tree = tr;
        }
-       offset = dissect_ber_choice(pinfo, tr, tvb, offset,
-                                 Filter_choice, -1, ett_ldap_Filter,
+  offset = dissect_ber_choice(actx, tree, tvb, offset,
+                                 Filter_choice, hf_index, ett_ldap_Filter,
                                  NULL);
 
        proto_item_append_text(it, "%s", Filter_string);
@@ -1850,69 +1817,60 @@ dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet
 
 
 static int
-dissect_ldap_T_filter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 448 "ldap.cnf"
+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 474 "ldap.cnf"
        Filter_string=NULL;
 
 
-  offset = dissect_ldap_Filter(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+  offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
 
-#line 451 "ldap.cnf"
+#line 477 "ldap.cnf"
        Filter_string=NULL;
        and_filter_string=NULL;
 
 
   return offset;
 }
-static int dissect_filter(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_filter(FALSE, tvb, offset, pinfo, tree, hf_ldap_filter);
-}
 
 
 static const ber_sequence_t AttributeDescriptionList_sequence_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_AttributeDescriptionList_item },
+  { &hf_ldap_AttributeDescriptionList_item, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
 };
 
 static int
-dissect_ldap_AttributeDescriptionList(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_AttributeDescriptionList(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       AttributeDescriptionList_sequence_of, hf_index, ett_ldap_AttributeDescriptionList);
 
   return offset;
 }
-static int dissect_searchRequest_attributes(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeDescriptionList(FALSE, tvb, offset, pinfo, tree, hf_ldap_searchRequest_attributes);
-}
 
 
 static const ber_sequence_t SearchRequest_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_baseObject },
-  { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_scope },
-  { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_derefAliases },
-  { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_sizeLimit },
-  { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_timeLimit },
-  { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_typesOnly },
-  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_filter },
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_searchRequest_attributes },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_baseObject     , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_scope          , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_scope },
+  { &hf_ldap_derefAliases   , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_derefAliases },
+  { &hf_ldap_sizeLimit      , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER_0_maxInt },
+  { &hf_ldap_timeLimit      , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER_0_maxInt },
+  { &hf_ldap_typesOnly      , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_ldap_BOOLEAN },
+  { &hf_ldap_filter         , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_filter },
+  { &hf_ldap_searchRequest_attributes, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescriptionList },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_SearchRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_SearchRequest(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    SearchRequest_sequence, hf_index, ett_ldap_SearchRequest);
 
   return offset;
 }
-static int dissect_searchRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_SearchRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_searchRequest);
-}
 
 
 
 static int
-dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 378 "ldap.cnf"
+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 405 "ldap.cnf"
 
   tvbuff_t     *next_tvb;
   gchar                *string;
@@ -1921,14 +1879,14 @@ dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset
   int           old_offset = offset;
 
   /* extract the value of the octetstring */
-  offset = dissect_ber_octet_string(FALSE, pinfo, NULL, tvb, offset, hf_index, &next_tvb);
+  offset = dissect_ber_octet_string(FALSE, actx, NULL, tvb, offset, hf_index, &next_tvb);
 
   /* if we have an attribute type that isn't binary see if there is a better dissector */
-  if(!attr_type || !dissector_try_string(ldap_name_dissector_table, attr_type, next_tvb, pinfo, tree)) {
+  if(!attr_type || !dissector_try_string(ldap_name_dissector_table, attr_type, next_tvb, actx->pinfo, tree)) {
        offset = old_offset;
        
        /* do the default thing */
-         offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+         offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        NULL);
        
 
@@ -1953,77 +1911,62 @@ dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset
 
   return offset;
 }
-static int dissect_vals_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeValue(FALSE, tvb, offset, pinfo, tree, hf_ldap_vals_item);
-}
 
 
 static const ber_sequence_t SET_OF_AttributeValue_set_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_vals_item },
+  { &hf_ldap_vals_item      , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeValue },
 };
 
 static int
-dissect_ldap_SET_OF_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_SET_OF_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_) {
+  offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
                                  SET_OF_AttributeValue_set_of, hf_index, ett_ldap_SET_OF_AttributeValue);
 
   return offset;
 }
-static int dissect_vals(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_SET_OF_AttributeValue(FALSE, tvb, offset, pinfo, tree, hf_ldap_vals);
-}
 
 
 static const ber_sequence_t PartialAttributeList_item_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_type },
-  { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_vals },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_type           , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
+  { &hf_ldap_vals           , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_ldap_SET_OF_AttributeValue },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_PartialAttributeList_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_PartialAttributeList_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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    PartialAttributeList_item_sequence, hf_index, ett_ldap_PartialAttributeList_item);
 
   return offset;
 }
-static int dissect_PartialAttributeList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_PartialAttributeList_item(FALSE, tvb, offset, pinfo, tree, hf_ldap_PartialAttributeList_item);
-}
 
 
 static const ber_sequence_t PartialAttributeList_sequence_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_PartialAttributeList_item },
+  { &hf_ldap_PartialAttributeList_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_PartialAttributeList_item },
 };
 
 static int
-dissect_ldap_PartialAttributeList(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_PartialAttributeList(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       PartialAttributeList_sequence_of, hf_index, ett_ldap_PartialAttributeList);
 
   return offset;
 }
-static int dissect_searchResultEntry_attributes(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_PartialAttributeList(FALSE, tvb, offset, pinfo, tree, hf_ldap_searchResultEntry_attributes);
-}
 
 
 static const ber_sequence_t SearchResultEntry_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_objectName },
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_searchResultEntry_attributes },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_objectName     , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_searchResultEntry_attributes, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_PartialAttributeList },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_SearchResultEntry(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_SearchResultEntry(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    SearchResultEntry_sequence, hf_index, ett_ldap_SearchResultEntry);
 
   return offset;
 }
-static int dissect_searchResEntry(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_SearchResultEntry(FALSE, tvb, offset, pinfo, tree, hf_ldap_searchResEntry);
-}
 
 
 static const value_string ldap_T_resultCode_vals[] = {
@@ -2071,23 +2014,23 @@ static const value_string ldap_T_resultCode_vals[] = {
 
 
 static int
-dissect_ldap_T_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 335 "ldap.cnf"
+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 364 "ldap.cnf"
 
   const gchar *valstr;
 
-    offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+    offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   &result);
 
 
-  ldap_do_protocolop(pinfo);
+  ldap_do_protocolop(actx->pinfo);
 
   if(result) {
   
     valstr = val_to_str(result, ldap_T_resultCode_vals, "Unknown result(%u)");
 
-    if (check_col(pinfo->cinfo, COL_INFO))
-      col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", valstr);
+    if (check_col(actx->pinfo->cinfo, COL_INFO))
+      col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);
 
     if(ldm_tree)
       proto_item_append_text(ldm_tree, " %s", valstr); 
@@ -2098,22 +2041,19 @@ dissect_ldap_T_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
 
   return offset;
 }
-static int dissect_resultCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_resultCode(FALSE, tvb, offset, pinfo, tree, hf_ldap_resultCode);
-}
 
 
 static const ber_sequence_t LDAPResult_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_resultCode },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_matchedDN },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_errorMessage },
-  { BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_referral_impl },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_resultCode     , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_resultCode },
+  { &hf_ldap_matchedDN      , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_errorMessage   , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ErrorMessage },
+  { &hf_ldap_referral       , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Referral },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_LDAPResult(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_LDAPResult(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    LDAPResult_sequence, hf_index, ett_ldap_LDAPResult);
 
   return offset;
@@ -2122,30 +2062,24 @@ dissect_ldap_LDAPResult(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
 
 
 static int
-dissect_ldap_SearchResultDone(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPResult(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_SearchResultDone(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_LDAPResult(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_searchResDone(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_SearchResultDone(FALSE, tvb, offset, pinfo, tree, hf_ldap_searchResDone);
-}
 
 
 static const ber_sequence_t SearchResultReference_sequence_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_SearchResultReference_item },
+  { &hf_ldap_SearchResultReference_item, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPURL },
 };
 
 static int
-dissect_ldap_SearchResultReference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+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_) {
+  offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       SearchResultReference_sequence_of, hf_index, ett_ldap_SearchResultReference);
 
   return offset;
 }
-static int dissect_searchResRef(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_SearchResultReference(FALSE, tvb, offset, pinfo, tree, hf_ldap_searchResRef);
-}
 
 
 static const value_string ldap_T_operation_vals[] = {
@@ -2157,293 +2091,245 @@ static const value_string ldap_T_operation_vals[] = {
 
 
 static int
-dissect_ldap_T_operation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+dissect_ldap_T_operation(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_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   NULL);
 
   return offset;
 }
-static int dissect_operation(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_operation(FALSE, tvb, offset, pinfo, tree, hf_ldap_operation);
-}
 
 
 static const ber_sequence_t AttributeTypeAndValues_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_type },
-  { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_vals },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_type           , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
+  { &hf_ldap_vals           , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_ldap_SET_OF_AttributeValue },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_AttributeTypeAndValues(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_AttributeTypeAndValues(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    AttributeTypeAndValues_sequence, hf_index, ett_ldap_AttributeTypeAndValues);
 
   return offset;
 }
-static int dissect_modification(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeTypeAndValues(FALSE, tvb, offset, pinfo, tree, hf_ldap_modification);
-}
 
 
 static const ber_sequence_t T_modifyRequest_modification_item_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_operation },
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_modification },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_operation      , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_operation },
+  { &hf_ldap_modification   , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeTypeAndValues },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_T_modifyRequest_modification_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_T_modifyRequest_modification_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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    T_modifyRequest_modification_item_sequence, hf_index, ett_ldap_T_modifyRequest_modification_item);
 
   return offset;
 }
-static int dissect_modifyRequest_modification_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_T_modifyRequest_modification_item(FALSE, tvb, offset, pinfo, tree, hf_ldap_modifyRequest_modification_item);
-}
 
 
 static const ber_sequence_t ModifyRequest_modification_sequence_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_modifyRequest_modification_item },
+  { &hf_ldap_modifyRequest_modification_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_T_modifyRequest_modification_item },
 };
 
 static int
-dissect_ldap_ModifyRequest_modification(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_ModifyRequest_modification(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       ModifyRequest_modification_sequence_of, hf_index, ett_ldap_ModifyRequest_modification);
 
   return offset;
 }
-static int dissect_modifyRequest_modification(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ModifyRequest_modification(FALSE, tvb, offset, pinfo, tree, hf_ldap_modifyRequest_modification);
-}
 
 
 static const ber_sequence_t ModifyRequest_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_object },
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_modifyRequest_modification },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_object         , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_modifyRequest_modification, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyRequest_modification },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_ModifyRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_ModifyRequest(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    ModifyRequest_sequence, hf_index, ett_ldap_ModifyRequest);
 
   return offset;
 }
-static int dissect_modifyRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ModifyRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_modifyRequest);
-}
 
 
 
 static int
-dissect_ldap_ModifyResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPResult(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_ModifyResponse(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_LDAPResult(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_modifyResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ModifyResponse(FALSE, tvb, offset, pinfo, tree, hf_ldap_modifyResponse);
-}
 
 
 static const ber_sequence_t AttributeList_item_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_type },
-  { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_vals },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_type           , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
+  { &hf_ldap_vals           , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_ldap_SET_OF_AttributeValue },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_AttributeList_item(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_AttributeList_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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    AttributeList_item_sequence, hf_index, ett_ldap_AttributeList_item);
 
   return offset;
 }
-static int dissect_AttributeList_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeList_item(FALSE, tvb, offset, pinfo, tree, hf_ldap_AttributeList_item);
-}
 
 
 static const ber_sequence_t AttributeList_sequence_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_AttributeList_item },
+  { &hf_ldap_AttributeList_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeList_item },
 };
 
 static int
-dissect_ldap_AttributeList(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_AttributeList(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       AttributeList_sequence_of, hf_index, ett_ldap_AttributeList);
 
   return offset;
 }
-static int dissect_attributes(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AttributeList(FALSE, tvb, offset, pinfo, tree, hf_ldap_attributes);
-}
 
 
 static const ber_sequence_t AddRequest_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_entry },
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_attributes },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_entry          , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_attributes     , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeList },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_AddRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_AddRequest(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    AddRequest_sequence, hf_index, ett_ldap_AddRequest);
 
   return offset;
 }
-static int dissect_addRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AddRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_addRequest);
-}
 
 
 
 static int
-dissect_ldap_AddResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPResult(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_AddResponse(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_LDAPResult(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_addResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AddResponse(FALSE, tvb, offset, pinfo, tree, hf_ldap_addResponse);
-}
 
 
 
 static int
-dissect_ldap_DelRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPDN(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_DelRequest(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_LDAPDN(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_delRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_DelRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_delRequest);
-}
 
 
 
 static int
-dissect_ldap_DelResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPResult(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_DelResponse(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_LDAPResult(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_delResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_DelResponse(FALSE, tvb, offset, pinfo, tree, hf_ldap_delResponse);
-}
 
 
 
 static int
-dissect_ldap_RelativeLDAPDN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_RelativeLDAPDN(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_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_newrdn(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_RelativeLDAPDN(FALSE, tvb, offset, pinfo, tree, hf_ldap_newrdn);
-}
 
 
 static const ber_sequence_t ModifyDNRequest_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_entry },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_newrdn },
-  { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_deleteoldrdn },
-  { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_newSuperior_impl },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_entry          , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_newrdn         , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_RelativeLDAPDN },
+  { &hf_ldap_deleteoldrdn   , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_ldap_BOOLEAN },
+  { &hf_ldap_newSuperior    , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_LDAPDN },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_ModifyDNRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_ModifyDNRequest(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    ModifyDNRequest_sequence, hf_index, ett_ldap_ModifyDNRequest);
 
   return offset;
 }
-static int dissect_modDNRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ModifyDNRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_modDNRequest);
-}
 
 
 
 static int
-dissect_ldap_ModifyDNResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPResult(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_ModifyDNResponse(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_LDAPResult(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_modDNResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ModifyDNResponse(FALSE, tvb, offset, pinfo, tree, hf_ldap_modDNResponse);
-}
 
 
 static const ber_sequence_t CompareRequest_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_entry },
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ava },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_entry          , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_ava            , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeValueAssertion },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_CompareRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_CompareRequest(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    CompareRequest_sequence, hf_index, ett_ldap_CompareRequest);
 
   return offset;
 }
-static int dissect_compareRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_CompareRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_compareRequest);
-}
 
 
 
 static int
-dissect_ldap_CompareResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPResult(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_CompareResponse(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_LDAPResult(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_compareResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_CompareResponse(FALSE, tvb, offset, pinfo, tree, hf_ldap_compareResponse);
-}
 
 
 
 static int
-dissect_ldap_AbandonRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_MessageID(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+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_) {
+  offset = dissect_ldap_MessageID(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_abandonRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_AbandonRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_abandonRequest);
-}
 
 
 
 static int
-dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 33 "ldap.cnf"
+dissect_ldap_LDAPOID(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 41 "ldap.cnf"
 
        tvbuff_t        *parameter_tvb;
        const gchar *name;
        proto_item      *item = NULL;
 
 
-
-  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+  offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-#line 40 "ldap.cnf"
+#line 49 "ldap.cnf"
+       
+       object_identifier_id = NULL;
+
        if (!parameter_tvb)
                return offset;
-       item = get_ber_last_created_item();
-       name = get_oid_str_name(tvb_get_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0)));
+
+       object_identifier_id = tvb_get_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0));
+       name = get_oid_str_name(object_identifier_id);
+
        if(name){
+               item = get_ber_last_created_item();
+
                proto_item_append_text(item, " (%s)", name);
                proto_item_append_text(tree, " %s", name);      
        }
@@ -2452,46 +2338,31 @@ dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packe
 
   return offset;
 }
-static int dissect_requestName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_LDAPOID(TRUE, tvb, offset, pinfo, tree, hf_ldap_requestName);
-}
 
 
 
 static int
-dissect_ldap_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+dissect_ldap_OCTET_STRING(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_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        NULL);
 
   return offset;
 }
-static int dissect_controlValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_ldap_controlValue);
-}
-static int dissect_requestValue_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_OCTET_STRING(TRUE, tvb, offset, pinfo, tree, hf_ldap_requestValue);
-}
-static int dissect_response_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_OCTET_STRING(TRUE, tvb, offset, pinfo, tree, hf_ldap_response);
-}
 
 
 static const ber_sequence_t ExtendedRequest_sequence[] = {
-  { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_requestName_impl },
-  { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_requestValue_impl },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_requestName    , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPOID },
+  { &hf_ldap_requestValue   , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_OCTET_STRING },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_ExtendedRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_ExtendedRequest(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    ExtendedRequest_sequence, hf_index, ett_ldap_ExtendedRequest);
 
   return offset;
 }
-static int dissect_extendedReq(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ExtendedRequest(FALSE, tvb, offset, pinfo, tree, hf_ldap_extendedReq);
-}
 
 
 static const value_string ldap_ExtendedResponse_resultCode_vals[] = {
@@ -2539,49 +2410,40 @@ static const value_string ldap_ExtendedResponse_resultCode_vals[] = {
 
 
 static int
-dissect_ldap_ExtendedResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
+dissect_ldap_ExtendedResponse_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_) {
+  offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                   NULL);
 
   return offset;
 }
-static int dissect_extendedResponse_resultCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ExtendedResponse_resultCode(FALSE, tvb, offset, pinfo, tree, hf_ldap_extendedResponse_resultCode);
-}
 
 
 
 static int
-dissect_ldap_ResponseName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPOID(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_ResponseName(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_LDAPOID(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_responseName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ResponseName(TRUE, tvb, offset, pinfo, tree, hf_ldap_responseName);
-}
 
 
 static const ber_sequence_t ExtendedResponse_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_extendedResponse_resultCode },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_matchedDN },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_errorMessage },
-  { BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_referral_impl },
-  { BER_CLASS_CON, 10, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_responseName_impl },
-  { BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_response_impl },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_extendedResponse_resultCode, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_ExtendedResponse_resultCode },
+  { &hf_ldap_matchedDN      , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
+  { &hf_ldap_errorMessage   , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ErrorMessage },
+  { &hf_ldap_referral       , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Referral },
+  { &hf_ldap_responseName   , BER_CLASS_CON, 10, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_ResponseName },
+  { &hf_ldap_response       , BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_OCTET_STRING },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_ExtendedResponse(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_ExtendedResponse(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    ExtendedResponse_sequence, hf_index, ett_ldap_ExtendedResponse);
 
   return offset;
 }
-static int dissect_extendedResp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ExtendedResponse(FALSE, tvb, offset, pinfo, tree, hf_ldap_extendedResp);
-}
 
 
 static const value_string ldap_ProtocolOp_vals[] = {
@@ -2609,47 +2471,47 @@ static const value_string ldap_ProtocolOp_vals[] = {
 };
 
 static const ber_choice_t ProtocolOp_choice[] = {
-  {   0, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_bindRequest },
-  {   1, BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_bindResponse },
-  {   2, BER_CLASS_APP, 2, BER_FLAGS_NOOWNTAG, dissect_unbindRequest },
-  {   3, BER_CLASS_APP, 3, BER_FLAGS_NOOWNTAG, dissect_searchRequest },
-  {   4, BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_searchResEntry },
-  {   5, BER_CLASS_APP, 5, BER_FLAGS_NOOWNTAG, dissect_searchResDone },
-  {  19, BER_CLASS_APP, 19, BER_FLAGS_NOOWNTAG, dissect_searchResRef },
-  {   6, BER_CLASS_APP, 6, BER_FLAGS_NOOWNTAG, dissect_modifyRequest },
-  {   7, BER_CLASS_APP, 7, BER_FLAGS_NOOWNTAG, dissect_modifyResponse },
-  {   8, BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_addRequest },
-  {   9, BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_addResponse },
-  {  10, BER_CLASS_APP, 10, BER_FLAGS_NOOWNTAG, dissect_delRequest },
-  {  11, BER_CLASS_APP, 11, BER_FLAGS_NOOWNTAG, dissect_delResponse },
-  {  12, BER_CLASS_APP, 12, BER_FLAGS_NOOWNTAG, dissect_modDNRequest },
-  {  13, BER_CLASS_APP, 13, BER_FLAGS_NOOWNTAG, dissect_modDNResponse },
-  {  14, BER_CLASS_APP, 14, BER_FLAGS_NOOWNTAG, dissect_compareRequest },
-  {  15, BER_CLASS_APP, 15, BER_FLAGS_NOOWNTAG, dissect_compareResponse },
-  {  16, BER_CLASS_APP, 16, BER_FLAGS_NOOWNTAG, dissect_abandonRequest },
-  {  23, BER_CLASS_APP, 23, BER_FLAGS_NOOWNTAG, dissect_extendedReq },
-  {  24, BER_CLASS_APP, 24, BER_FLAGS_NOOWNTAG, dissect_extendedResp },
-  { 0, 0, 0, 0, NULL }
+  {   0, &hf_ldap_bindRequest    , BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_ldap_BindRequest },
+  {   1, &hf_ldap_bindResponse   , BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_ldap_BindResponse },
+  {   2, &hf_ldap_unbindRequest  , BER_CLASS_APP, 2, BER_FLAGS_NOOWNTAG, dissect_ldap_UnbindRequest },
+  {   3, &hf_ldap_searchRequest  , BER_CLASS_APP, 3, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchRequest },
+  {   4, &hf_ldap_searchResEntry , BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchResultEntry },
+  {   5, &hf_ldap_searchResDone  , BER_CLASS_APP, 5, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchResultDone },
+  {  19, &hf_ldap_searchResRef   , BER_CLASS_APP, 19, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchResultReference },
+  {   6, &hf_ldap_modifyRequest  , BER_CLASS_APP, 6, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyRequest },
+  {   7, &hf_ldap_modifyResponse , BER_CLASS_APP, 7, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyResponse },
+  {   8, &hf_ldap_addRequest     , BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_ldap_AddRequest },
+  {   9, &hf_ldap_addResponse    , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_ldap_AddResponse },
+  {  10, &hf_ldap_delRequest     , BER_CLASS_APP, 10, BER_FLAGS_NOOWNTAG, dissect_ldap_DelRequest },
+  {  11, &hf_ldap_delResponse    , BER_CLASS_APP, 11, BER_FLAGS_NOOWNTAG, dissect_ldap_DelResponse },
+  {  12, &hf_ldap_modDNRequest   , BER_CLASS_APP, 12, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyDNRequest },
+  {  13, &hf_ldap_modDNResponse  , BER_CLASS_APP, 13, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyDNResponse },
+  {  14, &hf_ldap_compareRequest , BER_CLASS_APP, 14, BER_FLAGS_NOOWNTAG, dissect_ldap_CompareRequest },
+  {  15, &hf_ldap_compareResponse, BER_CLASS_APP, 15, BER_FLAGS_NOOWNTAG, dissect_ldap_CompareResponse },
+  {  16, &hf_ldap_abandonRequest , BER_CLASS_APP, 16, BER_FLAGS_NOOWNTAG, dissect_ldap_AbandonRequest },
+  {  23, &hf_ldap_extendedReq    , BER_CLASS_APP, 23, BER_FLAGS_NOOWNTAG, dissect_ldap_ExtendedRequest },
+  {  24, &hf_ldap_extendedResp   , BER_CLASS_APP, 24, BER_FLAGS_NOOWNTAG, dissect_ldap_ExtendedResponse },
+  { 0, NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_ProtocolOp(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-#line 61 "ldap.cnf"
+dissect_ldap_ProtocolOp(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 75 "ldap.cnf"
 
   ldap_call_response_t *lcrp;
-  ldap_conv_info_t *ldap_info = (ldap_conv_info_t *)pinfo->private_data;
+  ldap_conv_info_t *ldap_info = (ldap_conv_info_t *)actx->pinfo->private_data;
   do_protocolop = TRUE;
 
 
-  offset = dissect_ber_choice(pinfo, tree, tvb, offset,
+  offset = dissect_ber_choice(actx, tree, tvb, offset,
                                  ProtocolOp_choice, hf_index, ett_ldap_ProtocolOp,
                                  &ProtocolOp);
 
-#line 67 "ldap.cnf"
+#line 81 "ldap.cnf"
 
-  lcrp=ldap_match_call_response(tvb, pinfo, tree, MessageID, ProtocolOp);
+  lcrp=ldap_match_call_response(tvb, actx->pinfo, tree, MessageID, ProtocolOp);
   if(lcrp){
-    tap_queue_packet(ldap_tap, pinfo, lcrp);
+    tap_queue_packet(ldap_tap, actx->pinfo, lcrp);
   }
   
   /* XXX: the count will not work if the results span multiple TCP packets */
@@ -2667,8 +2529,8 @@ dissect_ldap_ProtocolOp(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
 
     case LDAP_RES_SEARCH_RESULT:
   
-       if (check_col(pinfo->cinfo, COL_INFO))
-          col_append_fstr(pinfo->cinfo, COL_INFO, " [%d result%s]", 
+       if (check_col(actx->pinfo->cinfo, COL_INFO))
+          col_append_fstr(actx->pinfo->cinfo, COL_INFO, " [%d result%s]", 
                        ldap_info->num_results, ldap_info->num_results == 1 ? "" : "s");
                        
        proto_item_append_text(tree, " [%d result%s]", 
@@ -2684,68 +2546,85 @@ dissect_ldap_ProtocolOp(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
 
   return offset;
 }
-static int dissect_protocolOp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ProtocolOp(FALSE, tvb, offset, pinfo, tree, hf_ldap_protocolOp);
-}
 
 
 
 static int
-dissect_ldap_ControlType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ldap_LDAPOID(implicit_tag, tvb, offset, pinfo, tree, hf_index);
+dissect_ldap_ControlType(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_LDAPOID(implicit_tag, tvb, offset, actx, tree, hf_index);
 
   return offset;
 }
-static int dissect_controlType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_ControlType(FALSE, tvb, offset, pinfo, tree, hf_ldap_controlType);
+
+
+
+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 649 "ldap.cnf"
+       gint8 class;
+       gboolean pc, ind;
+       gint32 tag;
+       guint32 len;
+       
+       if((object_identifier_id != NULL) && oid_has_dissector(object_identifier_id)) {
+               /* remove the OCTET STRING encoding */          
+               offset=dissect_ber_identifier(actx->pinfo, NULL, tvb, offset, &class, &pc, &tag);
+               offset=dissect_ber_length(actx->pinfo, NULL, tvb, offset, &len, &ind);
+
+               call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
+
+               offset += len;
+       } else {
+                 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                       NULL);
+
+       }
+
+
+
+  return offset;
 }
 
 
 static const ber_sequence_t Control_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_controlType },
-  { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_criticality },
-  { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_controlValue },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_controlType    , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ControlType },
+  { &hf_ldap_criticality    , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ldap_BOOLEAN },
+  { &hf_ldap_controlValue   , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ldap_T_controlValue },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_Control(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_Control(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    Control_sequence, hf_index, ett_ldap_Control);
 
   return offset;
 }
-static int dissect_Controls_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_Control(FALSE, tvb, offset, pinfo, tree, hf_ldap_Controls_item);
-}
 
 
 static const ber_sequence_t Controls_sequence_of[1] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_Controls_item },
+  { &hf_ldap_Controls_item  , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_Control },
 };
 
 static int
-dissect_ldap_Controls(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_Controls(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
                                       Controls_sequence_of, hf_index, ett_ldap_Controls);
 
   return offset;
 }
-static int dissect_controls_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
-  return dissect_ldap_Controls(TRUE, tvb, offset, pinfo, tree, hf_ldap_controls);
-}
 
 
 static const ber_sequence_t LDAPMessage_sequence[] = {
-  { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_messageID },
-  { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_protocolOp },
-  { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_controls_impl },
-  { 0, 0, 0, NULL }
+  { &hf_ldap_messageID      , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_MessageID },
+  { &hf_ldap_protocolOp     , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_ProtocolOp },
+  { &hf_ldap_controls       , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Controls },
+  { NULL, 0, 0, 0, NULL }
 };
 
 static int
-dissect_ldap_LDAPMessage(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
-  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+dissect_ldap_LDAPMessage(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    LDAPMessage_sequence, hf_index, ett_ldap_LDAPMessage);
 
   return offset;
@@ -2753,23 +2632,154 @@ dissect_ldap_LDAPMessage(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, p
 
 
 
+
+
+static int
+dissect_ldap_INTEGER(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_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                  NULL);
+
+  return offset;
+}
+
+
+static const ber_sequence_t SearchControlValue_sequence[] = {
+  { &hf_ldap_size           , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER },
+  { &hf_ldap_cookie         , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_OCTET_STRING },
+  { NULL, 0, 0, 0, NULL }
+};
+
+static int
+dissect_ldap_SearchControlValue(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
+                                   SearchControlValue_sequence, hf_index, ett_ldap_SearchControlValue);
+
+  return offset;
+}
+
+
+static const ber_sequence_t SortKeyList_item_sequence[] = {
+  { &hf_ldap_attributeType  , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
+  { &hf_ldap_orderingRule   , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_MatchingRuleId },
+  { &hf_ldap_reverseOrder   , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_BOOLEAN },
+  { NULL, 0, 0, 0, NULL }
+};
+
+static int
+dissect_ldap_SortKeyList_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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
+                                   SortKeyList_item_sequence, hf_index, ett_ldap_SortKeyList_item);
+
+  return offset;
+}
+
+
+static const ber_sequence_t SortKeyList_sequence_of[1] = {
+  { &hf_ldap_SortKeyList_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_SortKeyList_item },
+};
+
+static int
+dissect_ldap_SortKeyList(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_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
+                                      SortKeyList_sequence_of, hf_index, ett_ldap_SortKeyList);
+
+  return offset;
+}
+
+
+static const value_string ldap_T_sortResult_vals[] = {
+  {   0, "success" },
+  {   1, "operationsError" },
+  {   3, "timeLimitExceeded" },
+  {   8, "strongAuthRequired" },
+  {  11, "adminLimitExceeded" },
+  {  16, "noSuchAttribute" },
+  {  18, "inappropriateMatching" },
+  {  50, "insufficientAccessRights" },
+  {  51, "busy" },
+  {  53, "unwillingToPerform" },
+  {  80, "other" },
+  { 0, NULL }
+};
+
+
+static int
+dissect_ldap_T_sortResult(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_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
+                                  NULL);
+
+  return offset;
+}
+
+
+static const ber_sequence_t SortResult_sequence[] = {
+  { &hf_ldap_sortResult     , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_sortResult },
+  { &hf_ldap_attributeType  , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_AttributeDescription },
+  { NULL, 0, 0, 0, NULL }
+};
+
+static int
+dissect_ldap_SortResult(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
+                                   SortResult_sequence, hf_index, ett_ldap_SortResult);
+
+  return offset;
+}
+
+
+static const ber_sequence_t ReplControlValue_sequence[] = {
+  { &hf_ldap_parentsFirst   , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER },
+  { &hf_ldap_maxReturnLength, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER },
+  { &hf_ldap_cookie         , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_OCTET_STRING },
+  { NULL, 0, 0, 0, NULL }
+};
+
+static int
+dissect_ldap_ReplControlValue(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_ber_sequence(implicit_tag, actx, tree, tvb, offset,
+                                   ReplControlValue_sequence, hf_index, ett_ldap_ReplControlValue);
+
+  return offset;
+}
+
 /*--- PDUs ---*/
 
-static void dissect_LDAPMessage_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
-  dissect_ldap_LDAPMessage(FALSE, tvb, 0, pinfo, tree, hf_ldap_LDAPMessage_PDU);
+static void dissect_LDAPMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+  asn1_ctx_t asn1_ctx;
+  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+  dissect_ldap_LDAPMessage(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_LDAPMessage_PDU);
+}
+static void dissect_SearchControlValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+  asn1_ctx_t asn1_ctx;
+  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+  dissect_ldap_SearchControlValue(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_SearchControlValue_PDU);
+}
+static void dissect_SortKeyList_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+  asn1_ctx_t asn1_ctx;
+  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+  dissect_ldap_SortKeyList(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_SortKeyList_PDU);
+}
+static void dissect_SortResult_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+  asn1_ctx_t asn1_ctx;
+  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+  dissect_ldap_SortResult(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_SortResult_PDU);
+}
+static void dissect_ReplControlValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+  asn1_ctx_t asn1_ctx;
+  asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+  dissect_ldap_ReplControlValue(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_ReplControlValue_PDU);
 }
 
 
 /*--- End of included file: packet-ldap-fn.c ---*/
-#line 526 "packet-ldap-template.c"
+#line 543 "packet-ldap-template.c"
 
 static void
 dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo,
                     proto_tree *tree, ldap_conv_info_t *ldap_info,
-                    gboolean rest_is_pad, gboolean is_mscldap)
+                    gboolean is_mscldap)
 {
   int offset = 0;
-  gboolean first_time = TRUE;
   guint length_remaining;
   guint msg_len = 0;
   int messageOffset = 0;
@@ -2780,15 +2790,12 @@ dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo,
   gboolean pc, ind = 0;
   gint32 ber_tag;
 
-  while (tvb_reported_length_remaining(tvb, offset) > 0) {
-    /*
-     * This will throw an exception if we don't have any data left.
-     * That's what we want.  (See "tcp_dissect_pdus()", which is
-     * similar)
-     */
+
+one_more_pdu:
+
     length_remaining = tvb_ensure_length_remaining(tvb, offset);
 
-    if (rest_is_pad && length_remaining < 6) return;
+    if (length_remaining < 6) return;
 
     /*
      * OK, try to read the "Sequence Of" header; this gets the total
@@ -2797,7 +2804,10 @@ dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo,
        messageOffset = get_ber_identifier(tvb, offset, &class, &pc, &ber_tag);
        messageOffset = get_ber_length(tree, tvb, messageOffset, &msg_len, &ind);
 
-    if (ber_tag == BER_UNI_TAG_SEQUENCE) {
+    /* sanity check */
+    if((msg_len<4) || (msg_len>10000000)) return;
+
+    if ( (class==BER_CLASS_UNI) && (ber_tag==BER_UNI_TAG_SEQUENCE) ) {
        /*
         * Add the length of the "Sequence Of" header to the message
         * length.
@@ -2845,18 +2855,22 @@ dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo,
     /*
      * Now dissect the LDAP message.
      */
+    ldap_info->is_mscldap = is_mscldap;
+    pinfo->private_data = ldap_info;
+    dissect_LDAPMessage_PDU(msg_tvb, pinfo, tree);
 
-    /*dissect_ldap_message(msg_tvb, 0, pinfo, msg_tree, msg_item, first_time, ldap_info, is_mscldap);*/
-       ldap_info->first_time= first_time;
-       ldap_info->is_mscldap = is_mscldap;
-       pinfo->private_data = ldap_info;
-       dissect_LDAPMessage_PDU(msg_tvb, pinfo, tree);
+    offset += msg_len;
 
+    /* If this was a sasl blob there might be another PDU following in the
+     * same blob
+     */
+    if(tvb_length_remaining(tvb, offset)>=6){
+        tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), -1);
+       offset = 0;
 
-    offset += msg_len;
+        goto one_more_pdu;
+    }
 
-    first_time = FALSE;
-  }
 }
 
 static void
@@ -2920,17 +2934,6 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
     }
   }
 
-  while (tvb_reported_length_remaining(tvb, offset) > 0) {
-
-    /*
-     * This will throw an exception if we don't have any data left.
-     * That's what we want.  (See "tcp_dissect_pdus()", which is
-     * similar, but doesn't have to deal with the SASL issues.
-     * XXX - can we make "tcp_dissect_pdus()" provide enough information
-     * to the "get_pdu_len" routine so that we could have one dealing
-     * with the SASL issues, have that routine deal with SASL and
-     * ASN.1, and just use "tcp_dissect_pdus()"?)
-     */
     length_remaining = tvb_ensure_length_remaining(tvb, offset);
 
     /* It might still be a packet containing a SASL security layer
@@ -3026,12 +3029,14 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
         proto_tree_add_uint(ldap_tree, hf_ldap_sasl_buffer_length, sasl_tvb, 0, 4,
                             sasl_len);
 
-        sasl_item = proto_tree_add_text(ldap_tree, sasl_tvb, 0,  sasl_msg_len, "SASL buffer");
+        sasl_item = proto_tree_add_text(ldap_tree, sasl_tvb, 0,  sasl_msg_len, "SASL Buffer");
         sasl_tree = proto_item_add_subtree(sasl_item, ett_ldap_sasl_blob);
       }
 
       if (ldap_info->auth_mech != NULL &&
-          strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) {
+          ((strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) ||
+          /* auth_mech may have been set from the bind */
+          (strcmp(ldap_info->auth_mech, "GSSAPI") == 0))) {
          tvbuff_t *gssapi_tvb, *plain_tvb = NULL, *decr_tvb= NULL;
          int ver_len;
          int length;
@@ -3092,6 +3097,11 @@ 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_add_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,
                                 "GSS-API Encrypted payload (%d byte%s)",
@@ -3099,7 +3109,7 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
                                 plurality(sasl_len - ver_len, "", "s"));
              enc_tree = proto_item_add_subtree(enc_item, ett_ldap_payload);
             }
-           dissect_ldap_payload(decr_tvb, pinfo, enc_tree, ldap_info, TRUE, is_mscldap);
+           dissect_ldap_payload(decr_tvb, pinfo, enc_tree, ldap_info, is_mscldap);
           } else if (plain_tvb) {
            proto_item *plain_item = NULL;
            proto_tree *plain_tree = NULL;
@@ -3108,6 +3118,10 @@ 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_add_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,
                                 "GSS-API payload (%d byte%s)",
@@ -3116,14 +3130,14 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
              plain_tree = proto_item_add_subtree(plain_item, ett_ldap_payload);
             }
 
-           dissect_ldap_payload(plain_tvb, pinfo, plain_tree, ldap_info, TRUE, is_mscldap);
+           dissect_ldap_payload(plain_tvb, pinfo, plain_tree, ldap_info, is_mscldap);
          } else {
             /*
              * 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, "LDAP GSS-API Encrypted payload (%d byte%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"));
             }
@@ -3138,11 +3152,8 @@ dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean i
       offset += sasl_msg_len;
     } else {
        /* plain LDAP, so dissect the payload */
-       dissect_ldap_payload(tvb, pinfo, ldap_tree, ldap_info, FALSE, is_mscldap);
-       /* dissect_ldap_payload() has it's own loop so go out here */
-       break;
+       dissect_ldap_payload(tvb, pinfo, ldap_tree, ldap_info, is_mscldap);
     }
-  }
 }
 
 static int dissect_mscldap_string(tvbuff_t *tvb, int offset, char *str, int maxlen, gboolean prepend_dot)
@@ -3299,7 +3310,7 @@ static int dissect_mscldap_netlogon_flags(proto_tree *parent_tree, tvbuff_t *tvb
   return offset;
 }
 
-static void dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static void dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
 {
   int old_offset, offset=0;
   char str[256];
@@ -3376,7 +3387,7 @@ static void dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
 
 
 static guint
-get_sasl_ldap_pdu_len(tvbuff_t *tvb, int offset)
+get_sasl_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
 {
        /* sasl encapsulated ldap is 4 bytes plus the length in size */
        return tvb_get_ntohl(tvb, offset)+4;
@@ -3390,18 +3401,18 @@ dissect_sasl_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 }
 
 static guint
-get_normal_ldap_pdu_len(tvbuff_t *tvb, int offset)
+get_normal_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
 {
        guint32 len;
        gboolean ind;
        int data_offset;
 
        /* normal ldap is tag+len bytes plus the length
-        * offset==0 is where the tag is
-        * offset==1 is where length starts
+        * offset is where the tag is
+        * offset+1 is where length starts
         */
-       data_offset=get_ber_length(NULL, tvb, 1, &len, &ind);
-       return len+data_offset;
+       data_offset=get_ber_length(NULL, tvb, offset+1, &len, &ind);
+       return len+data_offset-offset;
 }
 
 static void
@@ -3412,9 +3423,10 @@ dissect_normal_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 }
 
 static void
-dissect_ldap_oid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_ldap_oid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
 {
-       char *oid, *oidname;
+       char *oid;
+       const char *oidname;
 
        /* tvb here contains an ascii string that is really an oid */
 /* XXX   we should convert the string oid into a real oid so we can use
@@ -3435,15 +3447,95 @@ dissect_ldap_oid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        }
 }
 
+#define LDAP_ACCESSMASK_ADS_CREATE_CHILD       0x00000001
+static const true_false_string ldap_AccessMask_ADS_CREATE_CHILD_tfs = {
+   "ADS CREATE CHILD is SET",
+   "Ads create child is NOT set",
+};
+
+#define LDAP_ACCESSMASK_ADS_DELETE_CHILD       0x00000002
+static const true_false_string ldap_AccessMask_ADS_DELETE_CHILD_tfs = {
+   "ADS DELETE CHILD is SET",
+   "Ads delete child is NOT set",
+};
+#define LDAP_ACCESSMASK_ADS_LIST               0x00000004
+static const true_false_string ldap_AccessMask_ADS_LIST_tfs = {
+   "ADS LIST is SET",
+   "Ads list is NOT set",
+};
+#define LDAP_ACCESSMASK_ADS_SELF_WRITE         0x00000008
+static const true_false_string ldap_AccessMask_ADS_SELF_WRITE_tfs = {
+   "ADS SELF WRITE is SET",
+   "Ads self write is NOT set",
+};
+#define LDAP_ACCESSMASK_ADS_READ_PROP          0x00000010
+static const true_false_string ldap_AccessMask_ADS_READ_PROP_tfs = {
+   "ADS READ PROP is SET",
+   "Ads read prop is NOT set",
+};
+#define LDAP_ACCESSMASK_ADS_WRITE_PROP         0x00000020
+static const true_false_string ldap_AccessMask_ADS_WRITE_PROP_tfs = {
+   "ADS WRITE PROP is SET",
+   "Ads write prop is NOT set",
+};
+#define LDAP_ACCESSMASK_ADS_DELETE_TREE                0x00000040
+static const true_false_string ldap_AccessMask_ADS_DELETE_TREE_tfs = {
+   "ADS DELETE TREE is SET",
+   "Ads delete tree is NOT set",
+};
+#define LDAP_ACCESSMASK_ADS_LIST_OBJECT                0x00000080
+static const true_false_string ldap_AccessMask_ADS_LIST_OBJECT_tfs = {
+   "ADS LIST OBJECT is SET",
+   "Ads list object is NOT set",
+};
+#define LDAP_ACCESSMASK_ADS_CONTROL_ACCESS     0x00000100
+static const true_false_string ldap_AccessMask_ADS_CONTROL_ACCESS_tfs = {
+   "ADS CONTROL ACCESS is SET",
+   "Ads control access is NOT set",
+};
+
 static void
-dissect_ldap_sid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+ldap_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 access)
+{
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CONTROL_ACCESS, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST_OBJECT, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_TREE, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_WRITE_PROP, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_READ_PROP, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_SELF_WRITE, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_CHILD, tvb, offset, 4, access);
+
+       proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CREATE_CHILD, tvb, offset, 4, access);
+}
+struct access_mask_info ldap_access_mask_info = {
+       "LDAP",                 /* Name of specific rights */
+       ldap_specific_rights,   /* Dissection function */
+       NULL,                   /* Generic mapping table */
+       NULL                    /* Standard mapping table */
+};
+
+static void
+dissect_ldap_nt_sec_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+       dissect_nt_sec_desc(tvb, 0, pinfo, tree, NULL, TRUE, tvb_length(tvb), &ldap_access_mask_info);
+}
+
+static void
+dissect_ldap_sid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
 {
        char *tmpstr;
 
        /* this octet string contains an NT SID */
        dissect_nt_sid(tvb, 0, tree, "SID", &tmpstr, hf_ldap_sid);
-       ldapvalue_string=ep_strdup(tmpstr);
-       g_free(tmpstr);
+       ldapvalue_string=tmpstr;
 }
 
 static void
@@ -3465,71 +3557,83 @@ dissect_ldap_guid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 }
 
 static void
-dissect_ldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
+       guint32 sasl_len;
+       guint32 gss_len;
+       guint32 ldap_len;
+       int offset;
+       gboolean ind;
+
         ldm_tree = NULL;
 
-       /* Here we must take care of reassembly but this is tricky since
-        * depending on whether SASL is present or not, the heuristics
-        * will be very different.
+       /* This is a bit tricky. We have to find out whether SASL is used
+        * so that we know how big a header we are supposed to pass
+        * to tcp_dissect_pdus()
         */
-       if(ldap_desegment && (tvb_length(tvb)==tvb_reported_length(tvb))){
-               guint32 len;
-
-               /* check for a SASL header, i.e. four byte integer where the
-                * first two bytes are 0x00 and the value is <64k and >2
-                * (>2 to fight false positives, 0x00000000 is a common
-                *     "random" tcp payload)
-                * (no SASL ldap PDUs are ever going to be >64k in size?)
-                *
-                * Following the SASL header is a GSSAPI blob so the next byte
-                * is always 0x60. (only true for MS SASL LDAP, there are other
-                * blobs that may follow in real-world)
-                */
-               len=tvb_get_ntohl(tvb, 0);
-               if( (len<65535)
-               &&  (len>2)
-               &&  (tvb_get_guint8(tvb, 4)==0x60)){
-                       if(len<=tvb_length_remaining(tvb, 4)){
-                               /* we have a full ldap pdu */
-                               dissect_ldap_pdu(tvb, pinfo, tree, FALSE);
-                               return;
-                       } else {
-                               /* we have to do reassembly */
-                               tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu);
-                               return;
-                       }
-               }
-               /* check if it is a normal BER encoded LDAP packet
-                * i.e. first byte is 0x30 followed by a length that is
-                * <64k
-                * (no ldap PDUs are ever >64kb? )
-                */
-               if(tvb_get_guint8(tvb, 0)==0x30){
-                       gboolean ind;
-                       int data_offset;
-
-                       /* check that length makes sense */
-                       data_offset=get_ber_length(NULL, tvb, 1, &len, &ind);
-
-                       /* dont check ind since indefinite length is never used for ldap (famous last words)*/
-                       if(len<2 || len>65535){
-                               return;
-                       }
-
-                       if(len<=tvb_length_remaining(tvb, data_offset)){
-                               /* we have a full ldap pdu */
-                               dissect_ldap_pdu(tvb, pinfo, tree, FALSE);
-                               return;
-                       } else {
-                               /* we have to do reassembly */
-                               tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu);
-                               return;
-                       }
-               }
+       /* check for a SASL header, i.e. assume it is SASL if 
+        * 1, first four bytes (SASL length) is an integer 
+        *    with a value that must be <64k and >2
+        *    (>2 to fight false positives, 0x00000000 is a common
+        *        "random" tcp payload)
+        * (no SASL ldap PDUs are ever going to be >64k in size?)
+        *
+        * Following the SASL header is a GSSAPI blob so the next byte
+        * is always 0x60. (only true for MS SASL LDAP, there are other
+        * blobs that may follow in real-world)
+        *
+        * 2, Then one byte with the value 0x60 indicating the GSSAPI blob
+        *
+        * 3, Then X bytes describing the BER encoded lengtyh of the blob.
+        *    This length should point to the same end-of-pdu as 1,
+        *
+        * 4, finally a byte 0x06 indicating that the next object is an OID
+        */
+       sasl_len=tvb_get_ntohl(tvb, 0);
+       if( sasl_len<2 ){
+               goto this_was_not_sasl;
        }
 
-       dissect_ldap_pdu(tvb, pinfo, tree, FALSE);
+       if(tvb_get_guint8(tvb, 4)!=0x60){
+               goto this_was_not_sasl;
+       }
+               
+       offset=get_ber_length(NULL, tvb, 5, &gss_len, &ind);
+       if(sasl_len!=(gss_len+offset-4)){
+               goto this_was_not_sasl;
+       }
+
+       if(tvb_get_guint8(tvb, offset)!=0x06){
+               goto this_was_not_sasl;
+       }
+
+       tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu);
+
+
+this_was_not_sasl:
+       /* check if it is a normal BER encoded LDAP packet
+        * i.e. first byte is 0x30 followed by a length that is
+        * <64k
+        * (no ldap PDUs are ever >64kb? )
+        */
+       if(tvb_get_guint8(tvb, 0)!=0x30){
+               goto this_was_not_normal_ldap;
+       }
+
+       /* check that length makes sense */
+       offset=get_ber_length(NULL, tvb, 1, &ldap_len, &ind);
+
+       /* dont check ind since indefinite length is never used for ldap (famous last words)*/
+       if(ldap_len<2){
+               goto this_was_not_normal_ldap;
+       }
+
+       tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu);
+
+
+this_was_not_normal_ldap:
+
        return;
 }
 
@@ -3721,400 +3825,491 @@ void proto_register_ldap(void) {
       { "GUID", "ldap.guid", FT_GUID, BASE_NONE,
         NULL, 0, "GUID", HFILL }},
 
+    { &hf_ldap_AccessMask_ADS_CREATE_CHILD, 
+         { "Create Child", "ldap.AccessMask.ADS_CREATE_CHILD", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_CREATE_CHILD_tfs), LDAP_ACCESSMASK_ADS_CREATE_CHILD, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_DELETE_CHILD, 
+         { "Delete Child", "ldap.AccessMask.ADS_DELETE_CHILD", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_DELETE_CHILD_tfs), LDAP_ACCESSMASK_ADS_DELETE_CHILD, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_LIST, 
+         { "List", "ldap.AccessMask.ADS_LIST", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_LIST_tfs), LDAP_ACCESSMASK_ADS_LIST, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_SELF_WRITE, 
+         { "Self Write", "ldap.AccessMask.ADS_SELF_WRITE", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_SELF_WRITE_tfs), LDAP_ACCESSMASK_ADS_SELF_WRITE, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_READ_PROP, 
+         { "Read Prop", "ldap.AccessMask.ADS_READ_PROP", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_READ_PROP_tfs), LDAP_ACCESSMASK_ADS_READ_PROP, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_WRITE_PROP, 
+         { "Write Prop", "ldap.AccessMask.ADS_WRITE_PROP", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_WRITE_PROP_tfs), LDAP_ACCESSMASK_ADS_WRITE_PROP, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_DELETE_TREE, 
+         { "Delete Tree", "ldap.AccessMask.ADS_DELETE_TREE", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_DELETE_TREE_tfs), LDAP_ACCESSMASK_ADS_DELETE_TREE, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_LIST_OBJECT, 
+         { "List Object", "ldap.AccessMask.ADS_LIST_OBJECT", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_LIST_OBJECT_tfs), LDAP_ACCESSMASK_ADS_LIST_OBJECT, "", HFILL }},
+
+    { &hf_ldap_AccessMask_ADS_CONTROL_ACCESS, 
+         { "Control Access", "ldap.AccessMask.ADS_CONTROL_ACCESS", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_CONTROL_ACCESS_tfs), LDAP_ACCESSMASK_ADS_CONTROL_ACCESS, "", HFILL }},
+
 
 /*--- Included file: packet-ldap-hfarr.c ---*/
 #line 1 "packet-ldap-hfarr.c"
     { &hf_ldap_LDAPMessage_PDU,
       { "LDAPMessage", "ldap.LDAPMessage",
         FT_NONE, BASE_NONE, NULL, 0,
-        "LDAPMessage", HFILL }},
+        "ldap.LDAPMessage", HFILL }},
+    { &hf_ldap_SearchControlValue_PDU,
+      { "SearchControlValue", "ldap.SearchControlValue",
+        FT_NONE, BASE_NONE, NULL, 0,
+        "ldap.SearchControlValue", HFILL }},
+    { &hf_ldap_SortKeyList_PDU,
+      { "SortKeyList", "ldap.SortKeyList",
+        FT_UINT32, BASE_DEC, NULL, 0,
+        "ldap.SortKeyList", HFILL }},
+    { &hf_ldap_SortResult_PDU,
+      { "SortResult", "ldap.SortResult",
+        FT_NONE, BASE_NONE, NULL, 0,
+        "ldap.SortResult", HFILL }},
+    { &hf_ldap_ReplControlValue_PDU,
+      { "ReplControlValue", "ldap.ReplControlValue",
+        FT_NONE, BASE_NONE, NULL, 0,
+        "ldap.ReplControlValue", HFILL }},
     { &hf_ldap_messageID,
       { "messageID", "ldap.messageID",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "LDAPMessage/messageID", HFILL }},
+        "ldap.MessageID", HFILL }},
     { &hf_ldap_protocolOp,
       { "protocolOp", "ldap.protocolOp",
         FT_UINT32, BASE_DEC, VALS(ldap_ProtocolOp_vals), 0,
-        "LDAPMessage/protocolOp", HFILL }},
+        "ldap.ProtocolOp", HFILL }},
     { &hf_ldap_controls,
       { "controls", "ldap.controls",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "LDAPMessage/controls", HFILL }},
+        "ldap.Controls", HFILL }},
     { &hf_ldap_bindRequest,
       { "bindRequest", "ldap.bindRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/bindRequest", HFILL }},
+        "ldap.BindRequest", HFILL }},
     { &hf_ldap_bindResponse,
       { "bindResponse", "ldap.bindResponse",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/bindResponse", HFILL }},
+        "ldap.BindResponse", HFILL }},
     { &hf_ldap_unbindRequest,
       { "unbindRequest", "ldap.unbindRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/unbindRequest", HFILL }},
+        "ldap.UnbindRequest", HFILL }},
     { &hf_ldap_searchRequest,
       { "searchRequest", "ldap.searchRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/searchRequest", HFILL }},
+        "ldap.SearchRequest", HFILL }},
     { &hf_ldap_searchResEntry,
       { "searchResEntry", "ldap.searchResEntry",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/searchResEntry", HFILL }},
+        "ldap.SearchResultEntry", HFILL }},
     { &hf_ldap_searchResDone,
       { "searchResDone", "ldap.searchResDone",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/searchResDone", HFILL }},
+        "ldap.SearchResultDone", HFILL }},
     { &hf_ldap_searchResRef,
       { "searchResRef", "ldap.searchResRef",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "ProtocolOp/searchResRef", HFILL }},
+        "ldap.SearchResultReference", HFILL }},
     { &hf_ldap_modifyRequest,
       { "modifyRequest", "ldap.modifyRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/modifyRequest", HFILL }},
+        "ldap.ModifyRequest", HFILL }},
     { &hf_ldap_modifyResponse,
       { "modifyResponse", "ldap.modifyResponse",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/modifyResponse", HFILL }},
+        "ldap.ModifyResponse", HFILL }},
     { &hf_ldap_addRequest,
       { "addRequest", "ldap.addRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/addRequest", HFILL }},
+        "ldap.AddRequest", HFILL }},
     { &hf_ldap_addResponse,
       { "addResponse", "ldap.addResponse",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/addResponse", HFILL }},
+        "ldap.AddResponse", HFILL }},
     { &hf_ldap_delRequest,
       { "delRequest", "ldap.delRequest",
         FT_STRING, BASE_NONE, NULL, 0,
-        "ProtocolOp/delRequest", HFILL }},
+        "ldap.DelRequest", HFILL }},
     { &hf_ldap_delResponse,
       { "delResponse", "ldap.delResponse",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/delResponse", HFILL }},
+        "ldap.DelResponse", HFILL }},
     { &hf_ldap_modDNRequest,
       { "modDNRequest", "ldap.modDNRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/modDNRequest", HFILL }},
+        "ldap.ModifyDNRequest", HFILL }},
     { &hf_ldap_modDNResponse,
       { "modDNResponse", "ldap.modDNResponse",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/modDNResponse", HFILL }},
+        "ldap.ModifyDNResponse", HFILL }},
     { &hf_ldap_compareRequest,
       { "compareRequest", "ldap.compareRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/compareRequest", HFILL }},
+        "ldap.CompareRequest", HFILL }},
     { &hf_ldap_compareResponse,
       { "compareResponse", "ldap.compareResponse",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/compareResponse", HFILL }},
+        "ldap.CompareResponse", HFILL }},
     { &hf_ldap_abandonRequest,
       { "abandonRequest", "ldap.abandonRequest",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "ProtocolOp/abandonRequest", HFILL }},
+        "ldap.AbandonRequest", HFILL }},
     { &hf_ldap_extendedReq,
       { "extendedReq", "ldap.extendedReq",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/extendedReq", HFILL }},
+        "ldap.ExtendedRequest", HFILL }},
     { &hf_ldap_extendedResp,
       { "extendedResp", "ldap.extendedResp",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ProtocolOp/extendedResp", HFILL }},
+        "ldap.ExtendedResponse", HFILL }},
     { &hf_ldap_AttributeDescriptionList_item,
       { "Item", "ldap.AttributeDescriptionList_item",
         FT_STRING, BASE_NONE, NULL, 0,
-        "AttributeDescriptionList/_item", HFILL }},
+        "ldap.AttributeDescription", HFILL }},
     { &hf_ldap_attributeDesc,
       { "attributeDesc", "ldap.attributeDesc",
         FT_STRING, BASE_NONE, NULL, 0,
-        "AttributeValueAssertion/attributeDesc", HFILL }},
+        "ldap.AttributeDescription", HFILL }},
     { &hf_ldap_assertionValue,
       { "assertionValue", "ldap.assertionValue",
         FT_STRING, BASE_NONE, NULL, 0,
-        "AttributeValueAssertion/assertionValue", HFILL }},
+        "ldap.AssertionValue", HFILL }},
     { &hf_ldap_type,
       { "type", "ldap.type",
         FT_STRING, BASE_NONE, NULL, 0,
-        "", HFILL }},
+        "ldap.AttributeDescription", HFILL }},
     { &hf_ldap_vals,
       { "vals", "ldap.vals",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "", HFILL }},
+        "ldap.SET_OF_AttributeValue", HFILL }},
     { &hf_ldap_vals_item,
       { "Item", "ldap.vals_item",
         FT_BYTES, BASE_HEX, NULL, 0,
-        "", HFILL }},
+        "ldap.AttributeValue", HFILL }},
     { &hf_ldap_resultCode,
       { "resultCode", "ldap.resultCode",
         FT_UINT32, BASE_DEC, VALS(ldap_T_resultCode_vals), 0,
-        "LDAPResult/resultCode", HFILL }},
+        "ldap.T_resultCode", HFILL }},
     { &hf_ldap_matchedDN,
       { "matchedDN", "ldap.matchedDN",
         FT_STRING, BASE_NONE, NULL, 0,
-        "", HFILL }},
+        "ldap.LDAPDN", HFILL }},
     { &hf_ldap_errorMessage,
       { "errorMessage", "ldap.errorMessage",
         FT_STRING, BASE_NONE, NULL, 0,
-        "", HFILL }},
+        "ldap.ErrorMessage", HFILL }},
     { &hf_ldap_referral,
       { "referral", "ldap.referral",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "", HFILL }},
+        "ldap.Referral", HFILL }},
     { &hf_ldap_Referral_item,
       { "Item", "ldap.Referral_item",
         FT_STRING, BASE_NONE, NULL, 0,
-        "Referral/_item", HFILL }},
+        "ldap.LDAPURL", HFILL }},
     { &hf_ldap_Controls_item,
       { "Item", "ldap.Controls_item",
         FT_NONE, BASE_NONE, NULL, 0,
-        "Controls/_item", HFILL }},
+        "ldap.Control", HFILL }},
     { &hf_ldap_controlType,
       { "controlType", "ldap.controlType",
         FT_STRING, BASE_NONE, NULL, 0,
-        "Control/controlType", HFILL }},
+        "ldap.ControlType", HFILL }},
     { &hf_ldap_criticality,
       { "criticality", "ldap.criticality",
         FT_BOOLEAN, 8, NULL, 0,
-        "Control/criticality", HFILL }},
+        "ldap.BOOLEAN", HFILL }},
     { &hf_ldap_controlValue,
       { "controlValue", "ldap.controlValue",
         FT_BYTES, BASE_HEX, NULL, 0,
-        "Control/controlValue", HFILL }},
+        "ldap.T_controlValue", HFILL }},
     { &hf_ldap_version,
       { "version", "ldap.version",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "BindRequest/version", HFILL }},
+        "ldap.INTEGER_1_127", HFILL }},
     { &hf_ldap_name,
       { "name", "ldap.name",
         FT_STRING, BASE_NONE, NULL, 0,
-        "BindRequest/name", HFILL }},
+        "ldap.LDAPDN", HFILL }},
     { &hf_ldap_authentication,
       { "authentication", "ldap.authentication",
         FT_UINT32, BASE_DEC, VALS(ldap_AuthenticationChoice_vals), 0,
-        "BindRequest/authentication", HFILL }},
+        "ldap.AuthenticationChoice", HFILL }},
     { &hf_ldap_simple,
       { "simple", "ldap.simple",
         FT_BYTES, BASE_HEX, NULL, 0,
-        "AuthenticationChoice/simple", HFILL }},
+        "ldap.Simple", HFILL }},
     { &hf_ldap_sasl,
       { "sasl", "ldap.sasl",
         FT_NONE, BASE_NONE, NULL, 0,
-        "AuthenticationChoice/sasl", HFILL }},
+        "ldap.SaslCredentials", HFILL }},
+    { &hf_ldap_ntlmsspNegotiate,
+      { "ntlmsspNegotiate", "ldap.ntlmsspNegotiate",
+        FT_BYTES, BASE_HEX, NULL, 0,
+        "ldap.T_ntlmsspNegotiate", HFILL }},
+    { &hf_ldap_ntlmsspAuth,
+      { "ntlmsspAuth", "ldap.ntlmsspAuth",
+        FT_BYTES, BASE_HEX, NULL, 0,
+        "ldap.T_ntlmsspAuth", HFILL }},
     { &hf_ldap_mechanism,
       { "mechanism", "ldap.mechanism",
         FT_STRING, BASE_NONE, NULL, 0,
-        "SaslCredentials/mechanism", HFILL }},
+        "ldap.Mechanism", HFILL }},
     { &hf_ldap_credentials,
       { "credentials", "ldap.credentials",
         FT_BYTES, BASE_HEX, NULL, 0,
-        "SaslCredentials/credentials", HFILL }},
+        "ldap.Credentials", HFILL }},
     { &hf_ldap_bindResponse_resultCode,
       { "resultCode", "ldap.resultCode",
         FT_UINT32, BASE_DEC, VALS(ldap_BindResponse_resultCode_vals), 0,
-        "BindResponse/resultCode", HFILL }},
+        "ldap.BindResponse_resultCode", HFILL }},
+    { &hf_ldap_matchedDN_01,
+      { "matchedDN", "ldap.matchedDN",
+        FT_STRING, BASE_NONE, NULL, 0,
+        "ldap.T_matchedDN", HFILL }},
     { &hf_ldap_serverSaslCreds,
       { "serverSaslCreds", "ldap.serverSaslCreds",
         FT_BYTES, BASE_HEX, NULL, 0,
-        "BindResponse/serverSaslCreds", HFILL }},
+        "ldap.ServerSaslCreds", HFILL }},
     { &hf_ldap_baseObject,
       { "baseObject", "ldap.baseObject",
         FT_STRING, BASE_NONE, NULL, 0,
-        "SearchRequest/baseObject", HFILL }},
+        "ldap.LDAPDN", HFILL }},
     { &hf_ldap_scope,
       { "scope", "ldap.scope",
         FT_UINT32, BASE_DEC, VALS(ldap_T_scope_vals), 0,
-        "SearchRequest/scope", HFILL }},
+        "ldap.T_scope", HFILL }},
     { &hf_ldap_derefAliases,
       { "derefAliases", "ldap.derefAliases",
         FT_UINT32, BASE_DEC, VALS(ldap_T_derefAliases_vals), 0,
-        "SearchRequest/derefAliases", HFILL }},
+        "ldap.T_derefAliases", HFILL }},
     { &hf_ldap_sizeLimit,
       { "sizeLimit", "ldap.sizeLimit",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "SearchRequest/sizeLimit", HFILL }},
+        "ldap.INTEGER_0_maxInt", HFILL }},
     { &hf_ldap_timeLimit,
       { "timeLimit", "ldap.timeLimit",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "SearchRequest/timeLimit", HFILL }},
+        "ldap.INTEGER_0_maxInt", HFILL }},
     { &hf_ldap_typesOnly,
       { "typesOnly", "ldap.typesOnly",
         FT_BOOLEAN, 8, NULL, 0,
-        "SearchRequest/typesOnly", HFILL }},
+        "ldap.BOOLEAN", HFILL }},
     { &hf_ldap_filter,
       { "filter", "ldap.filter",
         FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
-        "SearchRequest/filter", HFILL }},
+        "ldap.T_filter", HFILL }},
     { &hf_ldap_searchRequest_attributes,
       { "attributes", "ldap.attributes",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "SearchRequest/attributes", HFILL }},
+        "ldap.AttributeDescriptionList", HFILL }},
     { &hf_ldap_and,
       { "and", "ldap.and",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "Filter/and", HFILL }},
+        "ldap.T_and", HFILL }},
     { &hf_ldap_and_item,
       { "Item", "ldap.and_item",
         FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
-        "Filter/and/_item", HFILL }},
+        "ldap.T_and_item", HFILL }},
     { &hf_ldap_or,
       { "or", "ldap.or",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "Filter/or", HFILL }},
+        "ldap.T_or", HFILL }},
     { &hf_ldap_or_item,
       { "Item", "ldap.or_item",
         FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
-        "Filter/or/_item", HFILL }},
+        "ldap.T_or_item", HFILL }},
     { &hf_ldap_not,
       { "not", "ldap.not",
         FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
-        "Filter/not", HFILL }},
+        "ldap.T_not", HFILL }},
     { &hf_ldap_equalityMatch,
       { "equalityMatch", "ldap.equalityMatch",
         FT_NONE, BASE_NONE, NULL, 0,
-        "Filter/equalityMatch", HFILL }},
+        "ldap.T_equalityMatch", HFILL }},
     { &hf_ldap_substrings,
       { "substrings", "ldap.substrings",
         FT_NONE, BASE_NONE, NULL, 0,
-        "Filter/substrings", HFILL }},
+        "ldap.SubstringFilter", HFILL }},
     { &hf_ldap_greaterOrEqual,
       { "greaterOrEqual", "ldap.greaterOrEqual",
         FT_NONE, BASE_NONE, NULL, 0,
-        "Filter/greaterOrEqual", HFILL }},
+        "ldap.T_greaterOrEqual", HFILL }},
     { &hf_ldap_lessOrEqual,
       { "lessOrEqual", "ldap.lessOrEqual",
         FT_NONE, BASE_NONE, NULL, 0,
-        "Filter/lessOrEqual", HFILL }},
+        "ldap.T_lessOrEqual", HFILL }},
     { &hf_ldap_present,
       { "present", "ldap.present",
         FT_STRING, BASE_NONE, NULL, 0,
-        "Filter/present", HFILL }},
+        "ldap.T_present", HFILL }},
     { &hf_ldap_approxMatch,
       { "approxMatch", "ldap.approxMatch",
         FT_NONE, BASE_NONE, NULL, 0,
-        "Filter/approxMatch", HFILL }},
+        "ldap.T_approxMatch", HFILL }},
     { &hf_ldap_extensibleMatch,
       { "extensibleMatch", "ldap.extensibleMatch",
         FT_NONE, BASE_NONE, NULL, 0,
-        "Filter/extensibleMatch", HFILL }},
+        "ldap.T_extensibleMatch", HFILL }},
     { &hf_ldap_substringFilter_substrings,
       { "substrings", "ldap.substrings",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "SubstringFilter/substrings", HFILL }},
+        "ldap.T_substringFilter_substrings", HFILL }},
     { &hf_ldap_substringFilter_substrings_item,
       { "Item", "ldap.substrings_item",
         FT_UINT32, BASE_DEC, VALS(ldap_T_substringFilter_substrings_item_vals), 0,
-        "SubstringFilter/substrings/_item", HFILL }},
+        "ldap.T_substringFilter_substrings_item", HFILL }},
     { &hf_ldap_initial,
       { "initial", "ldap.initial",
         FT_STRING, BASE_NONE, NULL, 0,
-        "SubstringFilter/substrings/_item/initial", HFILL }},
+        "ldap.LDAPString", HFILL }},
     { &hf_ldap_any,
       { "any", "ldap.any",
         FT_STRING, BASE_NONE, NULL, 0,
-        "SubstringFilter/substrings/_item/any", HFILL }},
+        "ldap.LDAPString", HFILL }},
     { &hf_ldap_final,
       { "final", "ldap.final",
         FT_STRING, BASE_NONE, NULL, 0,
-        "SubstringFilter/substrings/_item/final", HFILL }},
+        "ldap.LDAPString", HFILL }},
     { &hf_ldap_matchingRule,
       { "matchingRule", "ldap.matchingRule",
         FT_STRING, BASE_NONE, NULL, 0,
-        "MatchingRuleAssertion/matchingRule", HFILL }},
+        "ldap.MatchingRuleId", HFILL }},
     { &hf_ldap_matchValue,
       { "matchValue", "ldap.matchValue",
         FT_STRING, BASE_NONE, NULL, 0,
-        "MatchingRuleAssertion/matchValue", HFILL }},
+        "ldap.AssertionValue", HFILL }},
     { &hf_ldap_dnAttributes,
       { "dnAttributes", "ldap.dnAttributes",
         FT_BOOLEAN, 8, NULL, 0,
-        "MatchingRuleAssertion/dnAttributes", HFILL }},
+        "ldap.T_dnAttributes", HFILL }},
     { &hf_ldap_objectName,
       { "objectName", "ldap.objectName",
         FT_STRING, BASE_NONE, NULL, 0,
-        "SearchResultEntry/objectName", HFILL }},
+        "ldap.LDAPDN", HFILL }},
     { &hf_ldap_searchResultEntry_attributes,
       { "attributes", "ldap.attributes",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "SearchResultEntry/attributes", HFILL }},
+        "ldap.PartialAttributeList", HFILL }},
     { &hf_ldap_PartialAttributeList_item,
       { "Item", "ldap.PartialAttributeList_item",
         FT_NONE, BASE_NONE, NULL, 0,
-        "PartialAttributeList/_item", HFILL }},
+        "ldap.PartialAttributeList_item", HFILL }},
     { &hf_ldap_SearchResultReference_item,
       { "Item", "ldap.SearchResultReference_item",
         FT_STRING, BASE_NONE, NULL, 0,
-        "SearchResultReference/_item", HFILL }},
+        "ldap.LDAPURL", HFILL }},
     { &hf_ldap_object,
       { "object", "ldap.object",
         FT_STRING, BASE_NONE, NULL, 0,
-        "ModifyRequest/object", HFILL }},
+        "ldap.LDAPDN", HFILL }},
     { &hf_ldap_modifyRequest_modification,
       { "modification", "ldap.modification",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "ModifyRequest/modification", HFILL }},
+        "ldap.ModifyRequest_modification", HFILL }},
     { &hf_ldap_modifyRequest_modification_item,
       { "Item", "ldap.modification_item",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ModifyRequest/modification/_item", HFILL }},
+        "ldap.T_modifyRequest_modification_item", HFILL }},
     { &hf_ldap_operation,
       { "operation", "ldap.operation",
         FT_UINT32, BASE_DEC, VALS(ldap_T_operation_vals), 0,
-        "ModifyRequest/modification/_item/operation", HFILL }},
+        "ldap.T_operation", HFILL }},
     { &hf_ldap_modification,
       { "modification", "ldap.modification",
         FT_NONE, BASE_NONE, NULL, 0,
-        "ModifyRequest/modification/_item/modification", HFILL }},
+        "ldap.AttributeTypeAndValues", HFILL }},
     { &hf_ldap_entry,
       { "entry", "ldap.entry",
         FT_STRING, BASE_NONE, NULL, 0,
-        "", HFILL }},
+        "ldap.LDAPDN", HFILL }},
     { &hf_ldap_attributes,
       { "attributes", "ldap.attributes",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "AddRequest/attributes", HFILL }},
+        "ldap.AttributeList", HFILL }},
     { &hf_ldap_AttributeList_item,
       { "Item", "ldap.AttributeList_item",
         FT_NONE, BASE_NONE, NULL, 0,
-        "AttributeList/_item", HFILL }},
+        "ldap.AttributeList_item", HFILL }},
     { &hf_ldap_newrdn,
       { "newrdn", "ldap.newrdn",
         FT_STRING, BASE_NONE, NULL, 0,
-        "ModifyDNRequest/newrdn", HFILL }},
+        "ldap.RelativeLDAPDN", HFILL }},
     { &hf_ldap_deleteoldrdn,
       { "deleteoldrdn", "ldap.deleteoldrdn",
         FT_BOOLEAN, 8, NULL, 0,
-        "ModifyDNRequest/deleteoldrdn", HFILL }},
+        "ldap.BOOLEAN", HFILL }},
     { &hf_ldap_newSuperior,
       { "newSuperior", "ldap.newSuperior",
         FT_STRING, BASE_NONE, NULL, 0,
-        "ModifyDNRequest/newSuperior", HFILL }},
+        "ldap.LDAPDN", HFILL }},
     { &hf_ldap_ava,
       { "ava", "ldap.ava",
         FT_NONE, BASE_NONE, NULL, 0,
-        "CompareRequest/ava", HFILL }},
+        "ldap.AttributeValueAssertion", HFILL }},
     { &hf_ldap_requestName,
       { "requestName", "ldap.requestName",
         FT_STRING, BASE_NONE, NULL, 0,
-        "ExtendedRequest/requestName", HFILL }},
+        "ldap.LDAPOID", HFILL }},
     { &hf_ldap_requestValue,
       { "requestValue", "ldap.requestValue",
         FT_BYTES, BASE_HEX, NULL, 0,
-        "ExtendedRequest/requestValue", HFILL }},
+        "ldap.OCTET_STRING", HFILL }},
     { &hf_ldap_extendedResponse_resultCode,
       { "resultCode", "ldap.resultCode",
         FT_UINT32, BASE_DEC, VALS(ldap_ExtendedResponse_resultCode_vals), 0,
-        "ExtendedResponse/resultCode", HFILL }},
+        "ldap.ExtendedResponse_resultCode", HFILL }},
     { &hf_ldap_responseName,
       { "responseName", "ldap.responseName",
         FT_STRING, BASE_NONE, NULL, 0,
-        "ExtendedResponse/responseName", HFILL }},
+        "ldap.ResponseName", HFILL }},
     { &hf_ldap_response,
       { "response", "ldap.response",
         FT_BYTES, BASE_HEX, NULL, 0,
-        "ExtendedResponse/response", HFILL }},
+        "ldap.OCTET_STRING", HFILL }},
+    { &hf_ldap_size,
+      { "size", "ldap.size",
+        FT_INT32, BASE_DEC, NULL, 0,
+        "ldap.INTEGER", HFILL }},
+    { &hf_ldap_cookie,
+      { "cookie", "ldap.cookie",
+        FT_BYTES, BASE_HEX, NULL, 0,
+        "ldap.OCTET_STRING", HFILL }},
+    { &hf_ldap_SortKeyList_item,
+      { "Item", "ldap.SortKeyList_item",
+        FT_NONE, BASE_NONE, NULL, 0,
+        "ldap.SortKeyList_item", HFILL }},
+    { &hf_ldap_attributeType,
+      { "attributeType", "ldap.attributeType",
+        FT_STRING, BASE_NONE, NULL, 0,
+        "ldap.AttributeDescription", HFILL }},
+    { &hf_ldap_orderingRule,
+      { "orderingRule", "ldap.orderingRule",
+        FT_STRING, BASE_NONE, NULL, 0,
+        "ldap.MatchingRuleId", HFILL }},
+    { &hf_ldap_reverseOrder,
+      { "reverseOrder", "ldap.reverseOrder",
+        FT_BOOLEAN, 8, NULL, 0,
+        "ldap.BOOLEAN", HFILL }},
+    { &hf_ldap_sortResult,
+      { "sortResult", "ldap.sortResult",
+        FT_UINT32, BASE_DEC, VALS(ldap_T_sortResult_vals), 0,
+        "ldap.T_sortResult", HFILL }},
+    { &hf_ldap_parentsFirst,
+      { "parentsFirst", "ldap.parentsFirst",
+        FT_INT32, BASE_DEC, NULL, 0,
+        "ldap.INTEGER", HFILL }},
+    { &hf_ldap_maxReturnLength,
+      { "maxReturnLength", "ldap.maxReturnLength",
+        FT_INT32, BASE_DEC, NULL, 0,
+        "ldap.INTEGER", HFILL }},
 
 /*--- End of included file: packet-ldap-hfarr.c ---*/
-#line 1486 "packet-ldap-template.c"
+#line 1623 "packet-ldap-template.c"
   };
 
   /* List of subtrees */
@@ -4165,9 +4360,14 @@ void proto_register_ldap(void) {
     &ett_ldap_CompareRequest,
     &ett_ldap_ExtendedRequest,
     &ett_ldap_ExtendedResponse,
+    &ett_ldap_SearchControlValue,
+    &ett_ldap_SortKeyList,
+    &ett_ldap_SortKeyList_item,
+    &ett_ldap_SortResult,
+    &ett_ldap_ReplControlValue,
 
 /*--- End of included file: packet-ldap-ettarr.c ---*/
-#line 1497 "packet-ldap-template.c"
+#line 1634 "packet-ldap-template.c"
   };
 
     module_t *ldap_module;
@@ -4179,19 +4379,21 @@ void proto_register_ldap(void) {
   proto_register_subtree_array(ett, array_length(ett));
 
 
-  register_dissector("ldap", dissect_ldap, proto_ldap);
+  register_dissector("ldap", dissect_ldap_tcp, proto_ldap);
 
   ldap_module = prefs_register_protocol(proto_ldap, NULL);
   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, and disable \"Verify length\" in the BER 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",
                                 "Set the port for LDAP operations",
                                 10, &ldap_tcp_port);
 
+  prefs_register_obsolete_preference(ldap_module, "max_pdu");
+
   proto_cldap = proto_register_protocol(
          "Connectionless Lightweight Directory Access Protocol",
          "CLDAP", "cldap");
@@ -4209,7 +4411,7 @@ void
 proto_reg_handoff_ldap(void)
 {
        dissector_handle_t ldap_handle, cldap_handle;
-       ldap_handle = create_dissector_handle(dissect_ldap, proto_ldap);
+       ldap_handle = create_dissector_handle(dissect_ldap_tcp, proto_ldap);
 
        dissector_add("tcp.port", ldap_tcp_port, ldap_handle);
        dissector_add("tcp.port", TCP_PORT_GLOBALCAT_LDAP, ldap_handle);
@@ -4219,6 +4421,9 @@ proto_reg_handoff_ldap(void)
 
        gssapi_handle = find_dissector("gssapi");
        gssapi_wrap_handle = find_dissector("gssapi_verf");
+       spnego_handle = find_dissector("spnego");
+
+       ntlmssp_handle = find_dissector("ntlmssp");
 
 /*  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dsml/dsml/ldap_controls_and_session_support.asp */
        add_oid_str_name("1.2.840.113556.1.4.319","LDAP_PAGED_RESULT_OID_STRING");
@@ -4228,7 +4433,10 @@ proto_reg_handoff_ldap(void)
        add_oid_str_name("1.2.840.113556.1.4.521","LDAP_SERVER_CROSSDOM_MOVE_TARGET_OID");
        add_oid_str_name("1.2.840.113556.1.4.528","LDAP_SERVER_NOTIFICATION_OID");
        add_oid_str_name("1.2.840.113556.1.4.529","LDAP_SERVER_EXTENDED_DN_OID");
+       add_oid_str_name("1.2.840.113556.1.4.582","meetingAdvertiseScope");
        add_oid_str_name("1.2.840.113556.1.4.619","LDAP_SERVER_LAZY_COMMIT_OID");
+       add_oid_str_name("1.2.840.113556.1.4.650","mhsORAddress");
+       add_oid_str_name("1.2.840.113556.1.4.654","managedObjects");
        add_oid_str_name("1.2.840.113556.1.4.800","LDAP_CAP_ACTIVE_DIRECTORY_OID");
        add_oid_str_name("1.2.840.113556.1.4.801","LDAP_SERVER_SD_FLAGS_OID");
        add_oid_str_name("1.2.840.113556.1.4.804","LDAP_OID_COMPARATOR_OR");
@@ -4243,7 +4451,13 @@ proto_reg_handoff_ldap(void)
        add_oid_str_name("1.2.840.113556.1.4.1670","LDAP_CAP_ACTIVE_DIRECTORY_V51_OID");
        add_oid_str_name("1.2.840.113556.1.4.1781","LDAP_SERVER_FAST_BIND_OID");
        add_oid_str_name("1.2.840.113556.1.4.1791","LDAP_CAP_ACTIVE_DIRECTORY_LDAP_INTEG_OID");
+       add_oid_str_name("1.2.840.113556.1.4.1840","msDS-ObjectReference");
+       add_oid_str_name("1.2.840.113556.1.4.1848","msDS-QuotaEffective");
        add_oid_str_name("1.2.840.113556.1.4.1851","LDAP_CAP_ACTIVE_DIRECTORY_ADAM_OID");
+       add_oid_str_name("1.2.840.113556.1.4.1860","msDS-PortSSL");
+       add_oid_str_name("1.2.840.113556.1.4.1960","msDS-isRODC");
+       add_oid_str_name("1.2.840.113556.1.4.1711","msDS-SDReferenceDomain");
+       add_oid_str_name("1.2.840.113556.1.4.1717","msDS-AdditionalDnsHostName");
        add_oid_str_name("1.3.6.1.4.1.1466.101.119.1","None");
        add_oid_str_name("1.3.6.1.4.1.1466.20037","LDAP_START_TLS_OID");
        add_oid_str_name("2.16.840.1.113730.3.4.9","LDAP_CONTROL_VLVREQUEST VLV");
@@ -4254,6 +4468,21 @@ proto_reg_handoff_ldap(void)
        register_ldap_name_dissector("supportedControl", dissect_ldap_oid, proto_ldap);
        register_ldap_name_dissector("supportedCapabilities", dissect_ldap_oid, proto_ldap);
        register_ldap_name_dissector("objectSid", dissect_ldap_sid, proto_ldap);
+       register_ldap_name_dissector("nTSecurityDescriptor", dissect_ldap_nt_sec_desc, proto_ldap);
+
+
+/*--- Included file: packet-ldap-dis-tab.c ---*/
+#line 1 "packet-ldap-dis-tab.c"
+  register_ber_oid_dissector("1.2.840.113556.1.4.319", dissect_SearchControlValue_PDU, proto_ldap, "pagedResultsControl");
+  register_ber_oid_dissector("1.2.840.113556.1.4.473", dissect_SortKeyList_PDU, proto_ldap, "sortKeyList");
+  register_ber_oid_dissector("1.2.840.113556.1.4.474", dissect_SortResult_PDU, proto_ldap, "sortResult");
+  register_ber_oid_dissector("1.2.840.113556.1.4.841", dissect_ReplControlValue_PDU, proto_ldap, "replControlValue");
+
+
+/*--- End of included file: packet-ldap-dis-tab.c ---*/
+#line 1737 "packet-ldap-template.c"
+       
+
 }