LDAP_BIND(3) | 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_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);
These routines provide various interfaces to the LDAP bind operation.
After an association with an LDAP server is made using
ldap_init(3),
an LDAP bind operation should be performed before other operations are
attempted over the connection. An LDAP bind is required when using
Version 2 of the LDAP protocol; it is optional for Version 3 but is
usually needed due to security considerations.
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)
that 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:
LDAP_SASL_AUTOMATIC |
use defaults if available, prompt otherwise |
LDAP_SASL_INTERACTIVE |
always prompt |
LDAP_SASL_QUIET |
never prompt |
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:
SASL_CB_GETREALM |
the realm for the authentication attempt |
SASL_CB_AUTHNAME |
the username to authenticate |
SASL_CB_PASS |
the password for the provided username |
SASL_CB_USER |
the username to use for proxy authorization |
SASL_CB_NOECHOPROMPT |
generic prompt for input with input echoing disabled |
SASL_CB_ECHOPROMPT |
generic prompt for input with input echoing enabled |
SASL_CB_LIST_END |
indicates the end of the array of prompts |
See the Cyrus SASL documentation for more details.
The
ldap_set_rebind_proc
function() sets the process to use for binding when an operation returns a
referral. This function is used when an application needs to bind to another server
in order to follow a referral or search continuation reference.
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.
2010/06/30 | OpenLDAP 2.4.23 |