ldap_bind

This function 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,
  UNICODE PTCHAR dn,
  UNICODE PTCHAR cred,
  ULONG method
);

Parameters

  • ld
    [in] Session handle.
  • dn
    [in] Distinguished name of the entry used to bind.
  • cred
    [in] 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. See the Remarks section for more information.
  • method
    [in] Indicates the authentication method to use.

Return Values

If this function succeeds, the return value is the message identifier of the operation initiated.

If this function fails, it returns –1 and sets the session error parameters in the LDAP structure.

Remarks

The following table shows the authentication methods supported in the implementation of this function.

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 asynchronous version of binding; ldap_bind. Using any other authentication method with this function will result in failure and will return LDAP_PARAM_ERROR. All other authentication methods require synchronous binding as provided by the ldap_bind_s function.

If your application does not require the level of security provided by these authentication services, consider using the ldap_simple_bind function, 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.

In a multithreading environment, 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.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Winldap.h.
Link Library: Wldap32.lib.

See Also

ldap_bind_s | ldap_simple_bind | ldap_simple_bind_s | ldap_unbind

 Last updated on Friday, April 09, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.