Exemplo n.º 1
0
        public ConnectionHandle() : base(true)
        {
            SetHandle(Interop.Ldap.ldap_init(null, 389));

            if (handle == IntPtr.Zero)
            {
                int error = Interop.Ldap.LdapGetLastError();
                if (LdapErrorMappings.IsLdapError(error))
                {
                    string errorMessage = LdapErrorMappings.MapResultCode(error);
                    throw new LdapException(error, errorMessage);
                }
                else
                {
                    throw new LdapException(error);
                }
            }
        }
Exemplo n.º 2
0
 internal ConnectionHandle(IntPtr value, bool disposeHandle) : base(true)
 {
     _needDispose = disposeHandle;
     if (value == IntPtr.Zero)
     {
         int error = Interop.Ldap.LdapGetLastError();
         if (LdapErrorMappings.IsLdapError(error))
         {
             string errorMessage = LdapErrorMappings.MapResultCode(error);
             throw new LdapException(error, errorMessage);
         }
         else
         {
             throw new LdapException(error);
         }
     }
     else
     {
         SetHandle(value);
     }
 }