ldap_sasl_bind()--Perform an LDAP SASL Bind Request



  Syntax
 #include <ldap.h>

 int ldap_sasl_bind(
                LDAP                 *ld,
                const char           *dn,
                const char           *mechanism,
                const struct berval  *cred,
                LDAPControl         **serverctrls,
                LDAPControl         **clientctrls,
                int                  *msgidp)

  Default Public Authority: *USE

  Library Name/Service Program: QSYS/QGLDCLNT

  Threadsafe: Yes

The ldap_sasl_bind() function is used to authenticate a distinguished name (DN) to a directory server using Simple Authentication Security Layer (SASL).

After a connection is made to an LDAP V2 server an LDAP bind API must be called before any other LDAP APIs can be called for that connection. For LDAP V3 servers, binding is optional.

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

The asynchronous version of this API only supports the LDAP_SASL_SIMPLE mechanism. You must use ldap_sasl_bind_s() for other mechanisms.


Authorities and Locks

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


Parameters

ld
(Input) Specifies the LDAP pointer returned by a previous call to ldap_init(), ldap_ssl_init(), or ldap_open().
dn
(Input) Specifies the Distinguished Name of the entry to bind as.
mechanism
(Input) This value can be set to NULL to perform a simple bind. Other mechanisms (EXTERNAL, CRAM-MD5, and GSSAPI) are implemented, but do not support the asynchronous SASL bind. You must use ldap_sasl_bind_s() for other mechanisms.
cred
(Input) Specifies the credentials with which to authenticate. Arbitrary credentials can be passed using this parameter. In most cases, this is the user's password.
serverctrls
(Input) Specifies a list of LDAP server controls. This parameter may be set to null. See LDAP Controls for more information about server controls.
clientctrls
(Input) Specifies a list of LDAP client controls. This parameter may be set to null. See LDAP Controls for more information about client controls.
msgidp
(Output) This result parameter is set to the message id of the request if the ldap_sasl_bind() call succeeds.

Return Value

Message ID of the operation initiated
if the request was successfully sent. A subsequent call to ldap_result(), can be used to obtain the result of the operation.

-1
if the request was not successful.

Error Conditions

If ldap_sasl_bind() is not successful, an error code will be returned. See LDAP Client API Error Conditions for possible LDAP error code values.


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_sasl_bind API.


Related Information



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