ldap_bind (Windows Embedded CE 6.0)

1/6/2010

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.

Syntax

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 Value

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

Header winldap.h
Library wldap32.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

LDAP Session Functions
ldap_bind_s
ldap_simple_bind
ldap_simple_bind_s
ldap_unbind