Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function authenticates a client to a server using a clear text password.

Syntax

ULONG ldap_simple_bind(
  LDAP* 
ld,
  UNICODE PTCHAR 
dn,
  UNICODE PTCHAR 
passwd
);

Parameters

ld

[in] Session handle.

dn

[in] Distinguished name of the user used to bind. The bind operation uses the dnand passwdparameters to authenticate the user.

passwd

[in] Password of the user specified in the dnparameter.

Return Value

If this function succeeds, it returns the message identifier of the operation initiated.

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

Remarks

This function initiates a simple asynchronous bind operation to authenticate a client to an LDAP server. Subsequent bind calls can be used to re-authenticate over the same connection.

To authenticate as a specific user, provide both the distinguished name of the entry (user) and the password for that entry. To authenticate an anonymous user (when no access permissions are required), pass NULL to both the dnand passwdparameters.

As an asynchronous function, this function returns a message identifier for the operation. Call the ldap_resultfunction with the message identifier to get the result of the operation. To cancel an asynchronous bind operation before it has completed, call ldap_abandon.

Note:
If an LDAP 2 server is contacted, no other operations over the connection should be attempted before the bind call has successfully completed.

If you prefer to have the function return the results directly, use the synchronous routine 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 try to thread binds with other operations.

Requirements

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

See Also