ldap_bind()--Perform an LDAP Bind Request


  Syntax
 #include <ldap.h>
 
 int ldap_bind(
        LDAP            *ld,
        const char      *dn,
        const char      *cred,
        int             method)

  Library Name/Service Program: QSYS/QGLDCLNT

  Default Public Authority: *USE

  Threadsafe: Yes

The ldap_bind() function provides general authentication routines, where in principle an authentication method can be chosen. In this toolkit, method must be set to LDAP_AUTH_SIMPLE.

The ldap_bind() function is used to authenticate a distinguished name (DN) to a directory server. When connecting to an LDAP V2 server, after a connection is made by using the ldap_open() API, an LDAP bind API must be called before any other LDAP APIs can be called for that connection. Binding the connection is not required for LDAP V3.

ldap_bind() is an asynchronous request. The result of the operation can be obtained by a subsequent call to ldap_result().

Since this API is deprecated, ldap_simple_bind() should be used instead.


Authorities and Locks

No i5/OS authority is required. All authority checking is done by the LDAP server.


Parameters

ld
(Input) The LDAP pointer returned by a previous call to ldap_init(), ldap_ssl_init(), or ldap_open().

dn
(Input) The distinguished name of the entry to bind as.

cred
(Input) The credentials with which to authenticate. Arbitrary credentials can be passed using this parameter. In most cases, this is the user's password.

method
(Input) Selects the authentication method to use. Specify LDAP_AUTH_SIMPLE for simple authentication. Simple authentication is the only supported method.

Note that use of the ldap_bind() API is deprecated.


Return Value

Message ID of the Initiated Request
if the ldap_bind() was successful.

-1
if the request was not successful.

Error Conditions

If ldap_bind() is not successful, ld_errno will be set to indicate the error. See LDAP Client API Error Conditions for possible LDAP error code values. Use ldap_get_errno() function to retrieve the error information.


Error Messages

The following message may be sent from this function.

Message ID Error Message Text
CPF3CF2 E Error(s) occurred during running of ldap_bind API.


Related Information



API introduced: V4R3
Top | LDAP APIs | APIs by category