/// <summary> /// SearchExtSynchronous /// </summary> /// <param name="basedn"></param> /// <param name="scope"></param> /// <param name="filter"></param> /// <param name="search_attrs"></param> /// <param name="attrsonly"></param> /// <param name="ServerControls"></param> /// <param name="ClientControls"></param> /// <param name="timeout"></param> /// <param name="SizeLimit"></param> /// <param name="ret"> Return value to show up the correct pop up to the user while querying</param> /// <returns>LdapMessage</returns> public int SearchExtSynchronous( string basedn, LdapAPI.LDAPSCOPE scope, string filter, string[] search_attrs, int attrsonly, IntPtr[] ServerControls, IntPtr[] ClientControls, LdapTimeVal timeout, int SizeLimit, out LdapMessage message ) { message = null; int ret = 0; lock (lockThis_searchExtsyn) { ret = _ldapHandle.Ldap_Search_Ext_S( basedn, (int)scope, filter, search_attrs, attrsonly, ServerControls, ClientControls, timeout, SizeLimit, out message); } ret = handleSearchError("SearchExtSynchronous", basedn, ret); return ret; }
//Function to create domain level dirContext object public static DirectoryContext CreateDirectoryContext( string DomainControllerName, string rootDN, string UserName, string Password, int portNumber, bool usingSimpleBind, out string errorMessage) { int ret = -1; errorMessage = null; string sDomainControllerIP = null; IPHostEntry domainControllerEntry=null; try { if (DomainControllerName != null) { domainControllerEntry = Dns.GetHostEntry(DomainControllerName); } else { return null; } } catch(Exception ex) { errorMessage = String.Format( "The specified domain either does not exist or DNS could not resolve the address of the domain controller : {0}", DomainControllerName); Logger.Log("DirectoryContext.CreateDirectoryContext():" + ex.Message); Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); //Logger.ShowUserError(errorMessage); return null; } if (domainControllerEntry != null && domainControllerEntry.AddressList.Length > 0) { sDomainControllerIP = domainControllerEntry.AddressList[0].ToString(); } else { errorMessage = String.Format( "DirectoryContext.CreateDirectoryContext(): Could not resolve address of domain controller : {0}", DomainControllerName); //Logger.ShowUserError("DirectoryContext.CreateDirectoryContext(): Could not resolve address of domain controller: {0}"); Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } IntPtr ld = LdapAPI.ldap_open(sDomainControllerIP, portNumber); if (ld == IntPtr.Zero) { errorMessage = "The specified domain either does not exist or could not be contacted. " + "Please contact your system administrator to verify that your domain is " + "properly configured and is currently online."; Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; //Logger.ShowUserError(errorMessage); return null; } //LdapTimeVal timeout = new LdapTimeVal(1, 0); ////IntPtr ptrTimeout = IntPtr.Zero; ////ptrTimeout = Marshal.AllocHGlobal(Marshal.SizeOf(timeout)); ////Marshal.WriteInt32(ptrTimeout, timeout.); //ret = LdapAPI.ldap_connect(ld, timeout.ConvertToUM()); //if (BailOnLdapError("LdapAPI.ldap_connect :", ret, out errorMessage)) //{ // Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); // errorMessage = ""; // return null; //} LdapHandle ldapHandle = new LdapHandle(ld); string distinguishedName = string.Format("cn={0},cn=Users,{1}", UserName, rootDN); if (!String.IsNullOrEmpty(UserName) && !UserName.Equals("administrator", StringComparison.InvariantCultureIgnoreCase)) distinguishedName = UserName; int version = LDAP_VERSION3; IntPtr ptrVersion = IntPtr.Zero; ptrVersion = Marshal.AllocHGlobal(Marshal.SizeOf(version)); Marshal.WriteInt32(ptrVersion, version); ret = LdapAPI.ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, ptrVersion); if(BailOnLdapError("ldap_set_option OPT_PROTOCOL_VERSION :", ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } ret = LdapAPI.ldap_set_option(ld, LDAP_OPT_REFERRALS, IntPtr.Zero); if(BailOnLdapError("ldap_set_option LDAP_OPT_REFERRALS :", ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } if (!String.IsNullOrEmpty(Password)) { usingSimpleBind = Configurations.SSOFailed = true; } if (usingSimpleBind) { if (Configurations.currentPlatform == LikewiseTargetPlatform.Windows) { ret = LdapAPI.ldap_bind_s(ld, distinguishedName, Password, (ulong)LDAP_AUTHWindows.LDAP_AUTH_SIMPLE); } else { ret = LdapAPI.ldap_bind_s(ld, distinguishedName, Password, (ulong)LDAP_AUTHLinux.LDAP_AUTH_SIMPLE); } if (BailOnLdapError("", ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); return null; } } else /***GSS-bind***/ { if (Configurations.currentPlatform != LikewiseTargetPlatform.Windows) { //set GSS-Remote Principal Name //char ber_pvt_opt_on; /* used to get a non-NULL address for *_OPT_ON */ ///* option on/off values */ //#define LDAP_OPT_ON ((void *) &ber_pvt_opt_on) //#define LDAP_OPT_OFF ((void *) 0) //status = ldap_set_option(ld, LDAP_OPT_X_GSSAPI_ALLOW_REMOTE_PRINCIPAL, LDAP_OPT_ON); char ber_pvt_opt_on = '1'; IntPtr ptrRemotePrincipalflags = IntPtr.Zero; ptrRemotePrincipalflags = Marshal.AllocHGlobal(Marshal.SizeOf(ber_pvt_opt_on)); Marshal.WriteInt32(ptrRemotePrincipalflags, ber_pvt_opt_on); ret = LdapAPI.ldap_set_option(ld, LDAP_OPT_X_GSSAPI_ALLOW_REMOTE_PRINCIPAL, ptrRemotePrincipalflags); if (BailOnLdapError("DirectoryContext GSS-Bind: ldap_set_option LDAP_OPT_X_GSSAPI_ALLOW_REMOTE_PRINCIPAL, ptrRemotePrincipalflags=" + ptrRemotePrincipalflags, ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } } //set GSS-SPNEGO options int secflags = ISC_REQ_MUTUAL_AUTH | ISC_REQ_REPLAY_DETECT; IntPtr ptrSecflags = IntPtr.Zero; ptrSecflags = Marshal.AllocHGlobal(Marshal.SizeOf(secflags)); Marshal.WriteInt32(ptrSecflags, secflags); ret = LdapAPI.ldap_set_option(ld, LDAP_OPT_SSPI_FLAGS, ptrSecflags); if (BailOnLdapError("DirectoryContext GSS-Bind: ldap_set_option LDAP_OPT_SSPI_FLAGS, secflags=" + secflags, ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } if (Configurations.currentPlatform != LikewiseTargetPlatform.Windows) { secflags |= ISC_REQ_INTEGRITY; ptrSecflags = IntPtr.Zero; ptrSecflags = Marshal.AllocHGlobal(Marshal.SizeOf(secflags)); Marshal.WriteInt32(ptrSecflags, secflags); ret = LdapAPI.ldap_set_option(ld, LDAP_OPT_SSPI_FLAGS, ptrSecflags); if (BailOnLdapError("DirectoryContext GSS-Bind: ldap_set_option LDAP_OPT_SSPI_FLAGS, secflags=" + secflags, ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } secflags |= ISC_REQ_CONFIDENTIALITY; ptrSecflags = IntPtr.Zero; ptrSecflags = Marshal.AllocHGlobal(Marshal.SizeOf(secflags)); Marshal.WriteInt32(ptrSecflags, secflags); ret = LdapAPI.ldap_set_option(ld, LDAP_OPT_SSPI_FLAGS, ptrSecflags); if (BailOnLdapError("DirectoryContext GSS-Bind: ldap_set_option LDAP_OPT_SSPI_FLAGS, secflags=" + secflags, ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } } if (Configurations.currentPlatform == LikewiseTargetPlatform.Windows) { ret = LdapAPI.ldap_bind_s(ld, null, null, (ulong)LDAP_AUTHWindows.LDAP_AUTH_NEGOTIATE); } else { ret = LdapAPI.ldap_bind_s(ld, null, null, (ulong)LDAP_AUTHLinux.LDAP_AUTH_NEGOTIATE); } if (BailOnLdapError("DirectoryContext GSS-Bind:ldap_bind_s :", ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } } //try to figure out the DC that serves as GC string configurationName = null; //searching with baseDn="" allows ldap to access the domain “RootDSE”. //Without passing that, it cannot access the configurationNamingContext DirectoryContext dirContext = new DirectoryContext( DomainControllerName, rootDN, distinguishedName, UserName, Password, ldapHandle, portNumber); dirContext._domainControllerIP = sDomainControllerIP; LdapMessage ldapMessage; string gcServer = DomainControllerName; Logger.Log("root query is started querying ", Logger.ldapLogLevel); IntPtr MessagePtr; ret = LdapAPI.ldap_search_s(ld, "", (int)LdapAPI.LDAPSCOPE.BASE, "(objectClass=*)", null, 0, out MessagePtr); ldapMessage = new LdapMessage(ldapHandle, MessagePtr); Logger.Log("root query is finished querying " + ret, Logger.ldapLogLevel); List<LdapEntry> ldapEntries = (ldapMessage != null ? ldapMessage.Ldap_Get_Entries() : null); Logger.Log("root query is finished querying with ldapEntries count : " + ldapEntries, Logger.ldapLogLevel); #region //Obtaining RootDSE attributes if (ldapEntries != null && ldapEntries.Count > 0) { LdapEntry rootDseEntry = ldapEntries[0]; LdapValue[] values = rootDseEntry.GetAttributeValues("defaultNamingContext", dirContext); if (values != null && values.Length > 0) { dirContext.DefaultNamingContext = values[0].stringData; } Logger.Log("defaultNamingContext is " + dirContext.DefaultNamingContext, Logger.ldapLogLevel); values = rootDseEntry.GetAttributeValues("schemaNamingContext", dirContext); if (values != null && values.Length > 0) { dirContext.SchemaNamingContext = values[0].stringData; } Logger.Log("schemaNamingContext is " + dirContext.SchemaNamingContext, Logger.ldapLogLevel); values = rootDseEntry.GetAttributeValues("dnsHostName", dirContext); if (values != null && values.Length > 0) { dirContext.DnsHostName = values[0].stringData; } Logger.Log("dnsHostName is " + dirContext.DnsHostName, Logger.ldapLogLevel); values = rootDseEntry.GetAttributeValues("rootDomainNamingContext", dirContext); if (values != null && values.Length > 0) { dirContext.RootDomainNamingContext = values[0].stringData; } Logger.Log("dnsHostName is " + dirContext.RootDomainNamingContext, Logger.ldapLogLevel); values = rootDseEntry.GetAttributeValues("configurationNamingContext", dirContext); if (values != null && values.Length > 0) { configurationName = values[0].stringData; } Logger.Log( "configurationNamingContext is " + configurationName, Logger.ldapLogLevel); values = rootDseEntry.GetAttributeValues("SupportedSASLMechanisms", dirContext); if (values != null && values.Length > 0) { _supportedSASLMechanisms = new string[values.Length]; int index = 0; foreach (LdapValue value in values) { _supportedSASLMechanisms[index] = value.stringData; Logger.Log( "SupportedSASLMechanisms is " + value.stringData, Logger.ldapLogLevel); index++; } } dirContext.ConfigurationNamingContext = configurationName; #endregion ret = LdapAPI.ldap_search_s(ld, configurationName, (int)LdapAPI.LDAPSCOPE.BASE, "(&(objectcategory=ntdsdsa)(options=1))", new string[] { "distinguishedName", null }, 0, out MessagePtr); ldapMessage = new LdapMessage(ldapHandle, MessagePtr); if(BailOnLdapError("ldap_search_s :", ret, out errorMessage)) { Logger.Log("DirectoryContext.CreateDirectoryContext(): " + errorMessage); errorMessage = ""; return null; } ldapEntries = (ldapMessage != null ? ldapMessage.Ldap_Get_Entries() : null); if (ldapEntries != null && ldapEntries.Count > 0) { //we only check the first one, then we quit finding others (when we do optimization, this algorithm shall be a lot more complicated LdapEntry ldapNextEntry = ldapEntries[0]; values = ldapNextEntry.GetAttributeValues("distinguishedName", dirContext); if (values != null && values.Length > 0) { string dn = values[0].stringData; string[] splits1 = dn.Split(','); string[] splits2 = rootDN.Split(','); gcServer = splits1[1].Substring(3).ToLower(); foreach (string str in splits2) gcServer = string.Concat(gcServer, ".", str.Substring(3).ToLower()); Logger.Log( "global catelog server is " + gcServer, Logger.ldapLogLevel); } } } dirContext.GCServername = gcServer; dirContext.BindMethod = usingSimpleBind; ldapHandle.DirectoryContext = dirContext; return dirContext; }
private void ldapMsgCallback(LdapMessage ldapMessage) { Logger.Log("processing call back", Logger.ldapLogLevel); if (ldapMessage == null) { Logger.Log("DirectoryContext.ListChildEntriesSynchronous(): LDAP search returned NULL message", Logger.ldapLogLevel); _ListChildEntriesSync = null; return; } Logger.Log("ldapMessage is not null", Logger.ldapLogLevel); _ListChildEntriesSync = ldapMessage.Ldap_Get_Entries(); if (_ListChildEntriesSync != null && _ListChildEntriesSync.Count > 0) Logger.Log(string.Format("ldap entry is {0}", _ListChildEntriesSync.Count), Logger.ldapLogLevel); }
/// <summary> /// SearchSynchronous function /// </summary> /// <param name="basedn"></param> /// <param name="scope"></param> /// <param name="filter"></param> /// <param name="search_attrs"></param> /// <param name="attrsonly"></param> /// <returns>LdapMessage</returns> public int SearchSynchronous( string basedn, LdapAPI.LDAPSCOPE scope, string filter, string[] search_attrs, bool attrsonly, out LdapMessage message ) { int ret = 0; message = null; lock (lockThis_searchsyn) { ret = _ldapHandle.Ldap_Search_S( basedn, (int)scope, filter, search_attrs, 0, out message); ret = handleSearchError("SearchSynchronous", basedn, ret); } return ret; }
public LdapEntry(LdapMessage ldapMessage, IntPtr ldapEntry) { _ldapEntry = ldapEntry; _ldapMessage = ldapMessage; }
public int Ldap_Add_Ext_S( string dn, LDAPMod[] attrs, LDAPControl[] ServerControls, LDAPControl[] ClientControls, out LdapMessage ldapMessage ) { int ret = -1; ldapMessage = null; Monitor.Enter(Ldap_ApiCallSync); try { IntPtr umldapMessage = new IntPtr(); IntPtr[] umattrs = new IntPtr[attrs.Length + 1]; for (int i = 0; i < attrs.Length; i++) { umattrs[i] = attrs[i].ConvertToUM(); } umattrs[attrs.Length] = IntPtr.Zero; IntPtr[] umServerControls = new IntPtr[ServerControls.Length]; for (int i = 0; i < ServerControls.Length; i++) { umServerControls[i] = ServerControls[i].ConvertToUM(); } IntPtr[] umClientControls = new IntPtr[ClientControls.Length]; for (int i = 0; i < ClientControls.Length; i++) { umClientControls[i] = ClientControls[i].ConvertToUM(); } Logger.Log(string.Format("Calling Ldap_Add_Ext_S(_ld={0}, dn={1}, umattrs={2})", _ld, dn, umattrs), Logger.ldapLogLevel); ret = Ldap_Rebind_S(); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); return ret; } unsafe { ret = LdapAPI.ldap_add_ext_s(_ld, dn, umattrs, umServerControls, umClientControls, out umldapMessage); } Logger.Log(String.Format("LdapHandle.Ldap_Add_Ext_S: ret={0}", ret), Logger.ldapLogLevel); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); } ldapMessage = new LdapMessage(this, umldapMessage); for (int i = 0; i < attrs.Length; i++) { attrs[i].ldapfree(); } return ret; } catch (Exception ex) { Logger.LogException("LdapHandle.Ldap_Add_Ext_S", ex); return ret; } finally { Monitor.Exit(Ldap_ApiCallSync); } }
public int Ldap_Search_Ext_S( string basedn, int scope, string filter, string[] attrs, int attrsonly, //LDAPControl[] ServerControls, IntPtr[] ServerControls, IntPtr[] ClientControls, LdapTimeVal timeout, int SizeLimit, out LdapMessage ldapMessage ) { IntPtr umldapMessage = new IntPtr(); // IntPtr[] umServerControls = null; //IntPtr umClientControls = IntPtr.Zero; IntPtr umtimeout = IntPtr.Zero; /* if (ServerControls != null && ServerControls.Length > 0) { umServerControls = new IntPtr[ServerControls.Length]; for (int i = 0; i < ServerControls.Length; i++) { umServerControls[i] = ServerControls[i].ConvertToUM(); } }*/ //if (ClientControls != null && ClientControls.Length > 0) //{ // umClientControls = new IntPtr[ClientControls.Length]; // for (int i = 0; i < ClientControls.Length; i++) // { // umClientControls[i] = ClientControls[i].ConvertToUM(); // } //} if (timeout != null) umtimeout = timeout.ConvertToUM(); int ret = -1; ldapMessage = null; Monitor.Enter(Ldap_ApiCallSync); try { Logger.Log(String.Format("Calling Ldap_Search_Ext_S(basedn={0}, scope={1}, filter={2})", basedn, scope, filter), Logger.ldapLogLevel); /* int ret = LdapApi.ldap_search_ext_s( _ld, basedn, scope, filter, attrs, attrsonly, umServerControls, umClientControls, umtimeout, SizeLimit, out umldapMessage);*/ unsafe { ret = Ldap_Rebind_S(); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); ldapMessage = null; return ret; } ret = LdapAPI.ldap_search_ext_s(_ld, basedn, scope, filter, attrs, 0, ServerControls, ClientControls, umtimeout, SizeLimit, out umldapMessage); } Logger.Log(String.Format("LdapHandle.Ldap_Search_Ext_S: ret={0}", ret), Logger.ldapLogLevel); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); } if (umldapMessage == IntPtr.Zero) { ldapMessage = null; return ret; } ldapMessage = new LdapMessage(this, umldapMessage); return ret; } catch (Exception ex) { Logger.LogException("LdapHandle.Ldap_Search_Ext_S", ex); return ret; } finally { Monitor.Exit(Ldap_ApiCallSync); } }
public int Ldap_Search_Ext( IntPtr ld, string basedn, int scope, string filter, string[] attrs, int attrsonly, LDAPControl[] ServerControls, LDAPControl[] ClientControls, int TimeLimit, int SizeLimit, out LdapMessage ldapMessage ) { int ret = -1; ldapMessage = null; IntPtr umldapMessage = new IntPtr(); LdapTimeVal tm = new LdapTimeVal(5, 6); Monitor.Enter(Ldap_ApiCallSync); try { Logger.Log(String.Format("Calling Ldap_Search_Ext(basedn={0}, scope={1}, filter={2})", basedn, scope, filter), Logger.ldapLogLevel); unsafe { ret = Ldap_Rebind_S(); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); ldapMessage = null; return ret; } ret = LdapAPI.ldap_search_s(_ld, basedn, scope, filter, attrs, attrsonly, out umldapMessage); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); ldapMessage = null; return ret; } if (umldapMessage == IntPtr.Zero) { ldapMessage = null; return ret; } ldapMessage = new LdapMessage(this, umldapMessage); return ret; } } catch (Exception ex) { Logger.LogException("LdapHandle.Ldap_Search_Ext", ex); return ret; } finally { Monitor.Exit(Ldap_ApiCallSync); } }
public int Ldap_Search_S( string basedn, int scope, string filter, string[] attrs, int attrsonly, out LdapMessage ldapMessage ) { DateTime beforeSearch = DateTime.Now; DateTime afterSearch = DateTime.Now; int ret = -1; ldapMessage = null; if (String.IsNullOrEmpty(basedn)) { return ret; } Monitor.Enter(Ldap_ApiCallSync); try { unsafe { IntPtr umldapMessage = IntPtr.Zero; Logger.Log(String.Format("Calling ldap_search_s(basedn={0}, scope={1}, filter={2})", basedn, scope, filter), Logger.ldapLogLevel); ret = Ldap_Rebind_S(); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); ldapMessage = null; return ret; } ret = LdapAPI.ldap_search_s(_ld, basedn, scope, filter, attrs, attrsonly, out umldapMessage); if (ret != 0 && ret != (int)Likewise.LMC.Utilities.ErrorCodes.LDAPEnum.LDAP_SIZELIMIT_EXCEEDED && ret != 1) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); ldapMessage = null; return ret; } if (umldapMessage == IntPtr.Zero) { ldapMessage = null; return ret; } ldapMessage = new LdapMessage(this, umldapMessage); return ret; } } catch (AccessViolationException) { //Catching this exception type separately is a workaround HACK for bug# 4878. Logger.Log(String.Format( "LdapHandle.LdapSearch_S: Caught AccessViolationException, possibly due to MS Windows LDAP Bug. baseDN={0}", basedn), Logger.ldapLogLevel); return ret; } catch (Exception ex) { Logger.LogException("LdapHandle.Ldap_Search_s", ex); return ret; } finally { afterSearch = DateTime.Now; Logger.Log(String.Format("ldap_search_s complete. Time elapsed: {0}", afterSearch - beforeSearch), Logger.ldapLogLevel); Monitor.Exit(Ldap_ApiCallSync); } }
public int Ldap_Search_ST( string basedn, int scope, string filter, string[] attrs, int attrsonly, LdapTimeVal tv, out LdapMessage ldapMessage ) { DateTime beforeSearch = DateTime.Now; DateTime afterSearch = DateTime.Now; int ret = -1; ldapMessage = null; Monitor.Enter(Ldap_ApiCallSync); try { unsafe { IntPtr umldapMessage = new IntPtr(); IntPtr timeout = tv.ConvertToUM(); Logger.Log(String.Format("Calling Ldap_Search_ST(basedn={0}, scope={1}, filter={2})", basedn, scope, filter), Logger.ldapLogLevel); ret = Ldap_Rebind_S(); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); ldapMessage = null; return ret; } ret = LdapAPI.ldap_search_st(_ld, basedn, scope, filter, attrs, attrsonly, timeout, out umldapMessage); if (ret != 0) { Logger.Log(ErrorCodes.LDAPString(ret), Logger.ldapLogLevel); ldapMessage = null; return ret; } if (umldapMessage == IntPtr.Zero) { ldapMessage = null; return ret; } ldapMessage = new LdapMessage(this, umldapMessage); return ret; } } catch (Exception ex) { Logger.LogException("LdapHandle.Ldap_Search_ST", ex); return ret; } finally { afterSearch = DateTime.Now; Logger.Log(String.Format("Ldap_Search_ST complete. Time elapsed: {0}", afterSearch - beforeSearch), Logger.ldapLogLevel); Monitor.Exit(Ldap_ApiCallSync); } }