LDAP_BIND(3) | Library Functions Manual | LDAP_BIND(3) |
int ldap_bind(LDAP *ld, const char *who, const char *cred,
int ldap_bind_s(LDAP *ld, const char *who, const char *cred,
int ldap_simple_bind(LDAP *ld, const char *who, const char *passwd);
int ldap_simple_bind_s(LDAP *ld, const char *who, const char *passwd);
int ldap_sasl_bind(LDAP *ld, const char *dn, const char *mechanism,
int ldap_sasl_bind_s(LDAP *ld, const char *dn, const char *mechanism,
int ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res,
int ldap_sasl_interactive_bind_s(LDAP *ld, const char *dn,
int ldap_sasl_interactive_bind(LDAP *ld, const char *dn,
int (LDAP_SASL_INTERACT_PROC)(LDAP *ld, unsigned flags, void *defaults, void *sasl_interact);
int ldap_unbind(LDAP *ld);
int ldap_unbind_s(LDAP *ld);
int ldap_unbind_ext(LDAP *ld, LDAPControl *sctrls[],
int ldap_unbind_ext_s(LDAP *ld, LDAPControl *sctrls[],
int ldap_set_rebind_proc (LDAP *ld, LDAP_REBIND_PROC *ldap_proc, void *params);
int (LDAP_REBIND_PROC)(LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msgid, void *params);
There are three types of bind calls, ones providing simple authentication, ones providing SASL authentication, and general routines capable of doing either simple or SASL authentication.
SASL (Simple Authentication and Security Layer) can negotiate one of many different kinds of authentication. Both synchronous and asynchronous versions of each variant of the bind call are provided. All routines take ld as their first parameter, as returned from ldap_init(3).
Many SASL mechanisms require multiple message exchanges to perform a complete authentication. Applications should generally use ldap_sasl_interactive_bind_s() rather than calling the basic ldap_sasl_bind() functions directly. The mechs parameter should contain a space-separated list of candidate mechanisms to use. If this parameter is NULL or empty the library will query the supportedSASLMechanisms attribute from the server's rootDSE for the list of SASL mechanisms the server supports. The flags parameter controls the interaction used to retrieve any necessary SASL authentication parameters and should be one of:
The interact function uses the provided defaults to handle requests from the SASL library for particular authentication parameters. There is no defined format for the defaults information; it is up to the caller to use whatever format is appropriate for the supplied interact function. The sasl_interact parameter comes from the underlying SASL library. When used with Cyrus SASL this is an array of sasl_interact_t structures. The Cyrus SASL library will prompt for a variety of inputs, including:
See the Cyrus SASL documentation for more details.
Applications which need to manage connections asynchronously may use ldap_sasl_interactive_bind() instead of the synchronous version. A valid mechs parameter must be supplied, otherwise the library will be forced to query the server for a list of supported mechanisms, and this query will be performed synchronously. The other parameters are the same as for the synchronous function, with three additional parameters. The actual SASL mechanism that was used, and the message ID for use with ldap_result() will be returned in rmechp and msgidp, respectively. The value in rmechp must not be modified by the caller and must be passed back on each subsequent call. The message obtained from ldap_result() must be passed in the result parameter. This parameter must be NULL when initiating a new Bind. The caller must free the result message after each call using ldap_msgfree(). The ldap_sasl_interactive_bind() function returns an LDAP result code. If the code is LDAP_SASL_BIND_IN_PROGRESS then the Bind is not complete yet, and this function must be called again with the next result from the server.
The function takes ld, the rebind function, and the params, the arbitrary data like state information which the client might need to properly rebind. The LDAP_OPT_REFERRALS option in the ld must be set to ON for the libraries to use the rebind function. Use the ldap_set_option function to set the value.
The rebind function parameters are as follows:
The ld parameter must be used by the application when binding to the referred server if the application wants the libraries to follow the referral.
The url parameter points to the URL referral string received from the LDAP server. The LDAP application can use the ldap_url_parse(3) function to parse the string into its components.
The request parameter specifies the type of request that generated the referral.
The msgid parameter specifies the message ID of the request generating the referral.
The params parameter is the same value as passed originally to the ldap_set_rebind_proc() function.
The LDAP libraries set all the parameters when they call the rebind function. The application should not attempt to free either the ld or the url structures in the rebind function.
The application must supply to the rebind function the required authentication information such as, user name, password, and certificates. The rebind function must use a synchronous bind method.
The ldap_unbind_ext() and ldap_unbind_ext_s() allows the operations to specify controls.
If the application needs stronger authentication than an anonymous bind, you need to provide a rebind process for that authentication method. The bind method must be synchronous.
2014/01/26 | OpenLDAP 2.4.39 |