diff options
Diffstat (limited to 'mcs/class/Novell.Directory.Ldap')
11 files changed, 272 insertions, 84 deletions
diff --git a/mcs/class/Novell.Directory.Ldap/ChangeLog b/mcs/class/Novell.Directory.Ldap/ChangeLog index 96f20d057b1..1a379cf9181 100644 --- a/mcs/class/Novell.Directory.Ldap/ChangeLog +++ b/mcs/class/Novell.Directory.Ldap/ChangeLog @@ -1,6 +1,23 @@ +2005-27-09 Palaniappan N <npalaniappan@novell.com> + * The folder is made in synch. with the Novell Forge's C# LDAP SDK with the following updates: + - Changes in Connection.cs regarding appropriate handling + in method ServerCertificateValidation. + - Added support for error code 113 SSL_HANDSHAKE_FAILED. + - Added two files ResultCodeMessages.txt and ExceptionMessages.txt in + Novell.Directory.Ldap.Utilclass + - Added support for subordinate subtree scope. + - Removed hard coded dependency on Mono Security + - Fix for a race condition in Connection.cs + - Updated with support for Interactiveness of SSL Handshake, + Ldap Events, Edir Events, Intermediate Response + - Connection.cs class is modified by synchronizing the stream + threads so as to avoid the memory consumption and handle consumption. + - Changed version from 2.1.1 to 2.1.4 in Connection.cs. + - Updated ChangeLog so that latest changes are on the top. + 2005-26-09 Boris Kirzner <borisk@mainsoft.com> * Novell.Directory.Ldap.dll.sources: added reference to Consts.cs.in - + 2005-15-09 Boris Kirzner <borisk@mainsoft.com> * Novell.Directory.Ldap.vmwcsproj: added reference to Consts.cs.in diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ExceptionMessages.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ExceptionMessages.cs index ace778e240d..236562c441c 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ExceptionMessages.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ExceptionMessages.cs @@ -110,6 +110,7 @@ namespace Novell.Directory.Ldap.Utilclass public const System.String NO_SCHEMA = "NO_SCHEMA"; public const System.String READ_MULTIPLE = "READ_MULTIPLE"; public const System.String CANNOT_BIND = "CANNOT_BIND"; + public const System.String SSL_PROVIDER_MISSING = "SSL_PROVIDER_MISSING"; //End constants diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ResourcesHandler.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ResourcesHandler.cs index 342913e2776..5fad354da24 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ResourcesHandler.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/ResourcesHandler.cs @@ -30,6 +30,10 @@ // using System; +using System.Resources; +using System.Threading; +using System.Reflection; +using System.Text; namespace Novell.Directory.Ldap.Utilclass { @@ -102,33 +106,26 @@ namespace Novell.Directory.Ldap.Utilclass /// </returns> public static System.String getMessage(System.String messageOrKey, System.Object[] arguments, System.Globalization.CultureInfo locale) { - System.String pattern; - System.Resources.ResourceManager messages = null; + if (defaultMessages == null) + { + defaultMessages = new ResourceManager("ExceptionMessages", Assembly.GetExecutingAssembly()); + } - if ((System.Object) messageOrKey == null) + if (defaultLocale == null) + defaultLocale = Thread.CurrentThread.CurrentUICulture; + + if (locale == null) + locale = defaultLocale; + + if (messageOrKey == null) { messageOrKey = ""; } + string pattern; try { - if ((locale == null) || defaultLocale.Equals(locale)) - { - locale = defaultLocale; - // Default Locale - if (defaultMessages == null) - { - System.Threading.Thread.CurrentThread.CurrentUICulture = defaultLocale; - defaultMessages = System.Resources.ResourceManager.CreateFileBasedResourceManager(pkg + "ExceptionMessages", "", null); - } - messages = defaultMessages; - } - else - { - System.Threading.Thread.CurrentThread.CurrentUICulture = locale; - messages = System.Resources.ResourceManager.CreateFileBasedResourceManager(pkg + "ExceptionMessages", "", null); - } - pattern = messages.GetString(messageOrKey); + pattern = defaultMessages.GetString(messageOrKey, locale); } catch (System.Resources.MissingManifestResourceException mre) { @@ -138,8 +135,11 @@ namespace Novell.Directory.Ldap.Utilclass // Format the message if arguments were passed if (arguments != null) { -// MessageFormat mf = new MessageFormat(pattern); - pattern=System.String.Format(locale,pattern,arguments); + StringBuilder strB = new StringBuilder(); + strB.AppendFormat(pattern, arguments); + pattern = strB.ToString(); + // MessageFormat mf = new MessageFormat(pattern); + // pattern=System.String.Format(locale,pattern,arguments); // mf.setLocale(locale); //this needs to be reset with the new local - i18n defect in java // mf.applyPattern(pattern); @@ -177,38 +177,34 @@ namespace Novell.Directory.Ldap.Utilclass /// </returns> public static System.String getResultString(int code, System.Globalization.CultureInfo locale) { - System.Resources.ResourceManager messages; - System.String result; + if (defaultResultCodes == null) + { +/* + defaultResultCodes = ResourceManager.CreateFileBasedResourceManager("ResultCodeMessages", "Resources", null);*/ + defaultResultCodes = new ResourceManager("ResultCodeMessages", Assembly.GetExecutingAssembly()); + } + + if (defaultLocale == null) + defaultLocale = Thread.CurrentThread.CurrentUICulture; + + if (locale == null) + locale = defaultLocale; + + string result; try { - if ((locale == null) || defaultLocale.Equals(locale)) - { - locale = defaultLocale; - // Default Locale - if (defaultResultCodes == null) - { -// System.Threading.Thread.CurrentThread.CurrentUICulture = defaultLocale; - defaultResultCodes = System.Resources.ResourceManager.CreateFileBasedResourceManager(pkg + "ResultCodeMessages", "", null); - } - messages = defaultResultCodes; - } - else - { - System.Threading.Thread.CurrentThread.CurrentUICulture = locale; - messages = System.Resources.ResourceManager.CreateFileBasedResourceManager(pkg + "ResultCodeMessages", "", null); - } -// result = messages.GetString(System.Convert.ToString(code)); - result = Convert.ToString(code); + result = defaultResultCodes.GetString(Convert.ToString(code), defaultLocale); } - catch (System.Resources.MissingManifestResourceException mre) + catch (ArgumentNullException mre) { - result = getMessage(ExceptionMessages.UNKNOWN_RESULT, new System.Object[]{code}, locale); + result = getMessage(ExceptionMessages.UNKNOWN_RESULT, new Object[]{code}, locale); } return result; } + static ResourcesHandler() { -// defaultLocale = System.Globalization.CultureInfo.CurrentCulture; + defaultLocale = Thread.CurrentThread.CurrentUICulture; } } //end class ResourcesHandler } diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/RespExtensionSet.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/RespExtensionSet.cs index b6411627b8a..846f3c8957c 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/RespExtensionSet.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Utilclass/RespExtensionSet.cs @@ -37,7 +37,7 @@ namespace Novell.Directory.Ldap.Utilclass /// so that it can be used to maintain a list of currently /// registered extended responses. /// </summary> - public class RespExtensionSet:AbstractSetSupport + public class RespExtensionSet:SupportClass.AbstractSetSupport { /// <summary> Returns the number of extensions in this set. /// diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs index 61dbf0177d7..bc0a26b62f6 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs @@ -50,9 +50,13 @@ using Mono.Security.X509; #endif using System.Text.RegularExpressions; using System.Globalization; +using System.Reflection; namespace Novell.Directory.Ldap { + public delegate bool CertificateValidationCallback( + Syscert.X509Certificate certificate, + int[] certificateErrors); /// <summary> The class that creates a connection to the Ldap server. After the /// connection is made, a thread is created that reads data from the @@ -78,6 +82,38 @@ namespace Novell.Directory.Ldap /*package*/ sealed class Connection { + public event CertificateValidationCallback OnCertificateValidation; + public enum CertificateProblem : long + { + CertEXPIRED = 0x800B0101, + CertVALIDITYPERIODNESTING = 0x800B0102, + CertROLE = 0x800B0103, + CertPATHLENCONST = 0x800B0104, + CertCRITICAL = 0x800B0105, + CertPURPOSE = 0x800B0106, + CertISSUERCHAINING = 0x800B0107, + CertMALFORMED = 0x800B0108, + CertUNTRUSTEDROOT = 0x800B0109, + CertCHAINING = 0x800B010A, + CertREVOKED = 0x800B010C, + CertUNTRUSTEDTESTROOT = 0x800B010D, + CertREVOCATION_FAILURE = 0x800B010E, + CertCN_NO_MATCH = 0x800B010F, + CertWRONG_USAGE = 0x800B0110, + CertUNTRUSTEDCA = 0x800B0112 + } + private static String GetProblemMessage(CertificateProblem Problem) + { + String ProblemMessage = ""; + String ProblemCodeName = CertificateProblem.GetName(typeof(CertificateProblem), Problem); + if(ProblemCodeName != null) + ProblemMessage = ProblemMessage + ProblemCodeName; + else + ProblemMessage = "Unknown Certificate Problem"; + return ProblemMessage; + } + + private ArrayList handshakeProblemsEncountered = new ArrayList(); private void InitBlock() { writeSemaphore = new System.Object(); @@ -292,8 +328,8 @@ namespace Novell.Directory.Ldap private BindProperties bindProperties = null; private int bindSemaphoreId = 0; // 0 is never used by to lock a semaphore - private SupportClass.ThreadClass reader = null; // New thread that reads data from the server. - private SupportClass.ThreadClass deadReader = null; // Identity of last reader thread + private Thread reader = null; // New thread that reads data from the server. + private Thread deadReader = null; // Identity of last reader thread private System.IO.IOException deadReaderException = null; // Last exception of reader private LBEREncoder encoder; @@ -515,14 +551,14 @@ namespace Novell.Directory.Ldap * * @param the thread id to match */ - private void waitForReader(SupportClass.ThreadClass thread) + private void waitForReader(Thread thread) { // wait for previous reader thread to terminate System.Threading.Thread rInst; System.Threading.Thread tInst; if(reader!=null) { - rInst=reader.Instance; + rInst=reader; } else { @@ -531,7 +567,7 @@ namespace Novell.Directory.Ldap if(thread!=null) { - tInst=thread.Instance; + tInst=thread; } else { @@ -572,7 +608,7 @@ namespace Novell.Directory.Ldap } if(reader!=null) { - rInst=reader.Instance; + rInst=reader; } else { @@ -581,7 +617,7 @@ namespace Novell.Directory.Ldap if(thread!=null) { - tInst=thread.Instance; + tInst=thread; } else { @@ -615,7 +651,18 @@ namespace Novell.Directory.Ldap Syscert.X509Certificate certificate, int[] certificateErrors) { - + if (null != OnCertificateValidation) + { + return OnCertificateValidation(certificate, certificateErrors); + } + + return DefaultCertificateValidationHandler(certificate, certificateErrors); + } + + public bool DefaultCertificateValidationHandler( + Syscert.X509Certificate certificate, + int[] certificateErrors) + { bool retFlag=false; if (certificateErrors != null && @@ -631,6 +678,7 @@ namespace Novell.Directory.Ldap for (int i = 0; i < certificateErrors.Length; i++) { + handshakeProblemsEncountered.Add((CertificateProblem)((uint)certificateErrors[i])); Console.WriteLine(certificateErrors[i]); } retFlag = false; @@ -696,17 +744,55 @@ namespace Novell.Directory.Ldap IPEndPoint ephost = new IPEndPoint(hostadd,port); sock.Connect(ephost); NetworkStream nstream = new NetworkStream(sock,true); + // Load Mono.Security.dll + Assembly a; + try + { + a = Assembly.LoadFrom("Mono.Security.dll"); + } + catch(System.IO.FileNotFoundException) + { + throw new LdapException(ExceptionMessages.SSL_PROVIDER_MISSING, LdapException.SSL_PROVIDER_NOT_FOUND, null); + } + Type tSslClientStream = a.GetType("Mono.Security.Protocol.Tls.SslClientStream"); + BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | + BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); + + object[] consArgs = new object[4]; + consArgs[0] = nstream; + consArgs[1] = host; + consArgs[2] = false; + Type tSecurityProtocolType = a.GetType("Mono.Security.Protocol.Tls.SecurityProtocolType"); + Enum objSPType = (Enum)(Activator.CreateInstance(tSecurityProtocolType)); + int nSsl3Val = (int) Enum.Parse(tSecurityProtocolType, "Ssl3"); + int nTlsVal = (int) Enum.Parse(tSecurityProtocolType, "Tls"); + consArgs[3] = Enum.ToObject(tSecurityProtocolType, nSsl3Val | nTlsVal); + + object objSslClientStream = + Activator.CreateInstance(tSslClientStream, consArgs); + + // Register ServerCertValidationDelegate handler + PropertyInfo pi = tSslClientStream.GetProperty("ServerCertValidationDelegate"); + pi.SetValue(objSslClientStream, + Delegate.CreateDelegate(pi.PropertyType, this, "ServerCertificateValidation"), + null); + + // Get the in and out streams + in_Renamed = (System.IO.Stream) objSslClientStream; + out_Renamed = (System.IO.Stream) objSslClientStream; + /* SslClientStream sslstream = new SslClientStream( nstream, host, false, Mono.Security.Protocol.Tls.SecurityProtocolType.Ssl3|Mono.Security.Protocol.Tls.SecurityProtocolType.Tls); - sslstream.ServerCertValidationDelegate += new CertificateValidationCallback(ServerCertificateValidation); -// byte[] buffer = new byte[0]; -// sslstream.Read(buffer, 0, buffer.Length); -// sslstream.doHandshake(); - in_Renamed = (System.IO.Stream) sslstream; - out_Renamed = (System.IO.Stream) sslstream; + sslstream.ServerCertValidationDelegate += new CertificateValidationCallback(ServerCertificateValidation);*/ + // byte[] buffer = new byte[0]; + // sslstream.Read(buffer, 0, buffer.Length); + // sslstream.doHandshake(); + /* + in_Renamed = (System.IO.Stream) sslstream; + out_Renamed = (System.IO.Stream) sslstream;*/ } else{ #endif @@ -892,13 +978,34 @@ namespace Novell.Directory.Ldap { throw new System.IO.IOException("Output stream not initialized"); } + if (!(myOut.CanWrite)) + { + return; + } sbyte[] ber = msg.Asn1Object.getEncoding(encoder); myOut.Write(SupportClass.ToByteArray(ber), 0, ber.Length); myOut.Flush(); } catch (System.IO.IOException ioe) { - + if ((msg.Type == LdapMessage.BIND_REQUEST) && + (ssl)) + { + string strMsg = "Following problem(s) occurred while establishing SSL based Connection : "; + if (handshakeProblemsEncountered.Count > 0) + { + strMsg += GetProblemMessage((CertificateProblem)handshakeProblemsEncountered[0]); + for (int nProbIndex = 1; nProbIndex < handshakeProblemsEncountered.Count; nProbIndex++) + { + strMsg += ", " + GetProblemMessage((CertificateProblem)handshakeProblemsEncountered[nProbIndex]); + } + } + else + { + strMsg += "Unknown Certificate Problem"; + } + throw new LdapException(strMsg, new System.Object[]{host, port}, LdapException.SSL_HANDSHAKE_FAILED, null, ioe); + } /* * IOException could be due to a server shutdown notification which * caused our Connection to quit. If so we send back a slightly @@ -924,6 +1031,7 @@ namespace Novell.Directory.Ldap finally { freeWriteSemaphore(id); + handshakeProblemsEncountered.Clear(); } return ; } @@ -988,7 +1096,7 @@ namespace Novell.Directory.Ldap int semId = acquireWriteSemaphore(semaphoreId); // Now send unbind if socket not closed - if ((bindProperties != null) && (out_Renamed != null) && (!bindProperties.Anonymous)) + if ((bindProperties != null) && (out_Renamed != null) && (out_Renamed.CanWrite) && (!bindProperties.Anonymous)) { try { @@ -1005,10 +1113,10 @@ namespace Novell.Directory.Ldap } bindProperties = null; - in_Renamed = null; - out_Renamed = null; if (socket != null) { + // Just before closing the sockets, abort the reader thread + reader.Abort(); // Close the socket try { @@ -1018,7 +1126,11 @@ namespace Novell.Directory.Ldap sock.Close(); } else + { + if(in_Renamed != null) + in_Renamed.Close(); socket.Close(); + } } catch (System.IO.IOException ie) { @@ -1026,6 +1138,8 @@ namespace Novell.Directory.Ldap } socket = null; sock = null; + in_Renamed=null; + out_Renamed=null; } freeWriteSemaphore(semId); return ; @@ -1086,8 +1200,7 @@ namespace Novell.Directory.Ldap internal void startReader() { // Start Reader Thread - SupportClass.ThreadClass r =new SupportClass.ThreadClass(new System.Threading.ThreadStart(new ReaderThread(this).Run)); -// Thread r = new Thread(new ThreadStart(new ReaderThread(this).Run)); + Thread r = new Thread(new ThreadStart(new ReaderThread(this).Run)); r.IsBackground = true; // If the last thread running, allow exit. r.Start(); waitForReader(r); @@ -1132,15 +1245,44 @@ namespace Novell.Directory.Ldap sock.Connect(ephost); */ // NetworkStream nstream = new NetworkStream(this.socket,true); + // Load Mono.Security.dll + Assembly a = Assembly.LoadFrom("Mono.Security.dll"); + Type tSslClientStream = a.GetType("Mono.Security.Protocol.Tls.SslClientStream"); + BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | + BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); + + object[] consArgs = new object[4]; + consArgs[0] = socket.GetStream(); + consArgs[1] = host; + consArgs[2] = false; + Type tSecurityProtocolType = a.GetType("Mono.Security.Protocol.Tls.SecurityProtocolType"); + Enum objSPType = (Enum)(Activator.CreateInstance(tSecurityProtocolType)); + int nSsl3Val = (int) Enum.Parse(tSecurityProtocolType, "Ssl3"); + int nTlsVal = (int) Enum.Parse(tSecurityProtocolType, "Tls"); + consArgs[3] = Enum.ToObject(tSecurityProtocolType, nSsl3Val | nTlsVal); + + object objSslClientStream = + Activator.CreateInstance(tSslClientStream, consArgs); + + // Register ServerCertValidationDelegate handler + EventInfo ei = tSslClientStream.GetEvent("ServerCertValidationDelegate"); + ei.AddEventHandler(objSslClientStream, + Delegate.CreateDelegate(ei.EventHandlerType, this, "ServerCertificateValidation")); + + // Get the in and out streams + in_Renamed = (System.IO.Stream) objSslClientStream; + out_Renamed = (System.IO.Stream) objSslClientStream; + + /* SslClientStream sslstream = new SslClientStream( socket.GetStream(), -// nstream, + nstream, host, false, Mono.Security.Protocol.Tls.SecurityProtocolType.Ssl3| Mono.Security.Protocol.Tls.SecurityProtocolType.Tls); sslstream.ServerCertValidationDelegate = new CertificateValidationCallback(ServerCertificateValidation); this.in_Renamed = (System.IO.Stream) sslstream; - this.out_Renamed = (System.IO.Stream) sslstream; + this.out_Renamed = (System.IO.Stream) sslstream;*/ } catch (System.IO.IOException ioe) { @@ -1258,7 +1400,7 @@ namespace Novell.Directory.Ldap InterThreadException notify = null; Message info = null; System.IO.IOException ioex = null; - this.enclosingInstance.reader = SupportClass.ThreadClass.Current(); + this.enclosingInstance.reader = System.Threading.Thread.CurrentThread; // Enclosing_Instance.reader = SupportClass.ThreadClass.Current(); // Console.WriteLine("Inside run:" + this.enclosingInstance.reader.Name); try @@ -1358,6 +1500,12 @@ namespace Novell.Directory.Ldap } } } + catch(ThreadAbortException tae) + { + // Abort has been called on reader + // before closing sockets, from shutdown + return; + } catch (System.IO.IOException ioe) { @@ -1516,7 +1664,7 @@ namespace Novell.Directory.Ldap static Connection() { nameLock = new System.Object(); - sdk = new System.Text.StringBuilder("2.1.1").ToString(); + sdk = new System.Text.StringBuilder("2.1.4").ToString(); protocol = 3; } } diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapAttributeSet.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapAttributeSet.cs index 2c7af7e2d40..ddb8216d192 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapAttributeSet.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapAttributeSet.cs @@ -52,7 +52,7 @@ namespace Novell.Directory.Ldap /// </seealso> /// <seealso cref="LdapEntry"> /// </seealso> - public class LdapAttributeSet:AbstractSetSupport, System.ICloneable//, SupportClass.SetSupport + public class LdapAttributeSet:SupportClass.AbstractSetSupport, System.ICloneable//, SupportClass.SetSupport { /// <summary> Returns the number of attributes in this set. /// diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapBindRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapBindRequest.cs index 7bd8ee58563..43eea90153a 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapBindRequest.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapBindRequest.cs @@ -112,11 +112,12 @@ namespace Novell.Directory.Ldap /// or null if none. /// </param> [CLSCompliantAttribute(false)] - public LdapBindRequest(int version, System.String dn, String mechanism, sbyte[] credentials, LdapControl[] cont):base(LdapMessage.BIND_REQUEST, new RfcBindRequest(version, dn, mechanism, credentials), cont) + public LdapBindRequest(int version, System.String dn, String mechanism, sbyte[] credentials, LdapControl[] + cont):base(LdapMessage.BIND_REQUEST, new RfcBindRequest(version, dn, mechanism, credentials), cont) { return ; } - + /// <summary> Return an Asn1 representation of this add request. /// /// #return an Asn1 representation of this object. diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs index 374b3f61b5c..5ae24c17383 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs @@ -587,6 +587,18 @@ namespace Novell.Directory.Ldap /// <summary> The OID string that identifies a StartTLS request and response.</summary> private const System.String START_TLS_OID = "1.3.6.1.4.1.1466.20037"; + public event CertificateValidationCallback UserDefinedServerCertValidationDelegate + { + add + { + this.conn.OnCertificateValidation += value; + } + + remove + { + this.conn.OnCertificateValidation -= value; + } + } /* * Constructors */ diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapException.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapException.cs index 99bf0c011bd..a69650c0bd1 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapException.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapException.cs @@ -758,6 +758,17 @@ namespace Novell.Directory.Ldap /// </summary> public const int TLS_NOT_SUPPORTED = 112; + /// <summary> Indicates that SSL Handshake could not succeed. + /// + /// SSL_HANDSHAKE_FAILED = 113 + /// </summary> + public const int SSL_HANDSHAKE_FAILED = 113; + + /// <summary> Indicates that SSL Provider could not be found. + /// + /// SSL_PROVIDER_NOT_FOUND = 114 + /// </summary> + public const int SSL_PROVIDER_NOT_FOUND = 114; /* * Note: Error strings have been pulled out into * ResultCodeMessages.properties diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Message.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Message.cs index 8f70e3f066f..4706750c862 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Message.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Message.cs @@ -466,7 +466,10 @@ namespace Novell.Directory.Ldap { return ; } + lock(replies) + { replies.Add(message); + } message.RequestingMessage = msg; // Save request message info switch (message.Type) { diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/SupportClass.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/SupportClass.cs index 27f8dc3fcdb..2fe88cf1e6c 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/SupportClass.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/SupportClass.cs @@ -1631,6 +1631,15 @@ using System; /// <summary> /// This class manages different operation with collections. /// </summary> + public class AbstractSetSupport : SetSupport + { + /// <summary> + /// The constructor with no parameters to create an abstract set. + /// </summary> + public AbstractSetSupport() + { + } + } /*******************************/ @@ -2155,13 +2164,3 @@ using System; } } - - public class AbstractSetSupport : SupportClass.SetSupport - { - /// <summary> - /// The constructor with no parameters to create an abstract set. - /// </summary> - public AbstractSetSupport() - { - } - } |