Example #1
0
        public static void ConnectI(this ILdapConnection connection, string unixSocketPath = "",
                                    LdapVersion version = LdapVersion.LDAP_VERSION3)
        {
            var encoded = HttpUtility.UrlEncode(unixSocketPath, Encoding.UTF8);

            connection.Connect($"{LdapSchema.LDAPI.ToString()}://{encoded}/", version);
        }
Example #2
0
        public void Connect(string hostname, int port = (int)LdapPort.LDAP, LdapVersion version = LdapVersion.LDAP_VERSION3)
        {
            ThrowIfError(
                ldap_initialize(ref _ld, $"LDAP://{hostname}:{port}"),
                nameof(ldap_initialize)
                );
            var ldapVersion = (int)version;

            ThrowIfError(
                ldap_set_option(_ld, (int)LdapOption.LDAP_OPT_PROTOCOL_VERSION, ref ldapVersion),
                nameof(ldap_set_option)
                );
        }
Example #3
0
 public static void Connect(this ILdapConnection connection, int port = (int)LdapPort.LDAP, LdapVersion version = LdapVersion.LDAP_VERSION3)
 {
     connection.Connect(DomainUtils.GetDomainFromHostname(), port, version);
 }
Example #4
0
 private Native.Native.LdapVersion GetLdapVersion()
 {
     return((Native.Native.LdapVersion)Enum.Parse(typeof(Native.Native.LdapVersion), LdapVersion.ToString()));
 }
Example #5
0
 public static void Connect(this ILdapConnection connection, string hostname, int port,
                            LdapSchema ldapSchema = LdapSchema.LDAP,
                            LdapVersion version   = LdapVersion.LDAP_VERSION3)
 {
     connection.Connect(new Uri($"{ldapSchema.ToString()}://{hostname}:{port}"), version);
 }
Example #6
0
 public static void Connect(this ILdapConnection connection, Uri uri,
                            LdapVersion version = LdapVersion.LDAP_VERSION3)
 {
     connection.Connect(uri.ToString(), version);
 }