ldap_bindW function (winldap.h)
The ldap_bind function asynchronously authenticates a client with 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 used determines the type of required credential.
Syntax
WINLDAPAPI ULONG LDAPAPI ldap_bindW(
[in] LDAP *ld,
[in] PWSTR dn,
[in] PWCHAR cred,
[in] ULONG method
);
Parameters
[in] ld
The session handle.
[in] dn
A pointer to a null-terminated string that contains the distinguished name of the entry used to bind.
[in] cred
A pointer to a null-terminated string that contains the credentials to use for authentication. Arbitrary credentials can be passed using this parameter. The format and content of the credentials depend on the setting of the method parameter. For more information, see the Remarks section.
[in] method
The authentication method to use.
Return value
If the function succeeds, the return value is the message ID of the initiated operation.
If the function fails, it returns –1 and sets the session error parameters in the LDAP structure.
Remarks
This implementation of ldap_bind supports the following authentication method.
Authentication method | Description | Credential |
---|---|---|
LDAP_AUTH_SIMPLE | Authentication with a plaintext password. | A string that contains the user password. |
LDAP_AUTH_SIMPLE is the only authentication method compatible with the asynchronous version of binding; ldap_bind. Using any other authentication method with ldap_bind will fail and return LDAP_PARAM_ERROR. Calling ldap_bind with the LDAP_AUTH_SIMPLE method is equivalent to calling ldap_simple_bind. All other authentication methods require synchronous binding as provided by ldap_bind_s.
Be aware 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, when possible, thread the bind operations with other operations.
Note
The winldap.h header defines ldap_bind as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista |
Minimum supported server | Windows Server 2008 |
Target Platform | Windows |
Header | winldap.h |
Library | Wldap32.lib |
DLL | Wldap32.dll |