ldap_simple_bind

Asynchronously authenticates an entry to the directory.

LDAP Version:v2 or higher
Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_simple_bind (
     LDAP   *ld,
     char   *dn,
     char   *passwd);
  
  

Parameters

ld

(IN) Points to the handle for the LDAP session.

dn

(IN) Points to the name of the entry to use for authentication. For an anonymous authentication, set this parameter to NULL.

passwd

(IN) Points to the entry's password which will be compared to the entry's userPassword attribute. For an anonymous authentication, set this parameter to NULL.

Return Values

>0

Message ID of operation

-1

Failure

Remarks

To obtain the results of the operation, call the ldap_result function using the message ID returned by the ldap_simple_bind function.

If the function returns a -1, use the ldap_get_option function with the option parameter set to LDAP_OPT_RESULT_CODE to retrieve the error code from the LDAP session handle.

By default, eDirectory does not accept clear text passwords. Make sure that the parameter for encrypted passwords is set to allow unencrypted passwords.

An anonymous bind to an eDirectory directory allows clients to access whatever the [Public] user has been granted access to. By default, this is just enough to allow the user to find an eDirectory server, match a distinguished name, and authenticate.

The LDAP_OPT_NETWORK_TIMEOUT option (set by calling ldap_set_option) enables you to set a timeout for the initial connection to a server. If no timeout is set, timeout depends upon the underlying socket timeout setting of the operating system.

Using the connection timeout, you can also specify multiple hosts separated by spaces in a bind call, then use a timeout to determine how long your application will wait for an initial response before attempting a connection to the next host in the list.

Passing NULL for the ld parameter of ldap_set_option sets this timeout as the default connection timeout for subsequent session handles created with ldap_init or ldapssl_init. To clear the timeout pass NULL for the invalue parameter of ldap_set_option.

A connection timeout will cause an LDAP_SERVER_DOWN error (81) "Can't contact LDAP server".

See Also

ldap_bind, ldap_simple_bind_s, ldap_unbind, ldap_unbind_s, ldap_unbind_ext, ldap_unbind_ext_s