Platform SDK: Active Directory, ADSI, and Directory Services |
The ldap_bind is an asynchronous function that authenticates a client to the LDAP server. The bind operation identifies a client to the directory server by providing a distinguished name and some type of authentication credential, such as a password. The authentication method being used determines the particular type of credential.
ULONG ldap_bind( LDAP* ld, PCHAR dn, PCHAR cred, ULONG method );
If the function succeeds, the return value is the message ID of the operation initiated.
If the function fails, it returns –1 and sets the session error parameters in the LDAP structure.
This implementation of ldap_bind supports the following authentication method:
Authentication Method | Description | Credential |
---|---|---|
LDAP_AUTH_SIMPLE | Authentication with a simple clear-text password. | A string containing the user's password. |
LDAP_AUTH_SIMPLE is the only authentication method compatible with the asychronous version of binding; ldap_bind. Using any other authentication method with ldap_bind will result in failure and will return LDAP_PARAM_ERROR. All other authentication methods require synchronous binding as provided by ldap_bind_s.
If your application does not require the level of security provided by these authentication services, consider using ldap_simple_bind, which requires only a clear-text password to bind. If you prefer a synchronous bind operation, use ldap_bind_s or ldap_simple_bind_s.
Note that LDAP 2 servers require an application to bind before attempting any other operations that require authentication.
Multithreading: Bind calls are not safe because they apply to the connection as a whole. Use caution if threads share connections and, whenever possible, thread the bind operations with other operations.
Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib.
Unicode: Declared as Unicode and ANSI prototypes.
Functions, ldap_bind_s, ldap_simple_bind, ldap_simple_bind_s, SEC_WINNT_AUTH_IDENTITY