This manual page is for Mac OS X version 10.6.3

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • For more information about the manual page format, see the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Reference Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.



LDAP_BIND(3)                                                                                    LDAP_BIND(3)



NAME
       ldap_bind,   ldap_bind_s,  ldap_simple_bind,  ldap_simple_bind_s,  ldap_sasl_bind,  ldap_sasl_bind_s,
       ldap_sasl_interactive_bind_s,      ldap_parse_sasl_bind_result,      ldap_unbind,      ldap_unbind_s,
       ldap_unbind_ext, ldap_unbind_ext_s, ldap_set_rebind_proc - LDAP bind routines

LIBRARY
       OpenLDAP LDAP (libldap, -lldap)

SYNOPSIS
       #include <ldap.h>

       int ldap_bind(LDAP *ld, const char *who, const char *cred,
              int method);

       int ldap_bind_s(LDAP *ld, const char *who, const char *cred,
              int method);

       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,
              struct berval *cred, LDAPControl *sctrls[],
              LDAPControl *cctrls[], int *msgidp);

       int ldap_sasl_bind_s(LDAP *ld, const char *dn, const char *mechanism,
              struct berval *cred, LDAPControl *sctrls[],
              LDAPControl *cctrls[], struct berval **servercredp);

       int ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res,
              struct berval **servercredp, int freeit);

       int ldap_sasl_interactive_bind_s(LDAP *ld, const char *dn,
              const char *mechs,
              LDAPControl *sctrls[], LDAPControl *cctrls[],
              unsigned flags, LDAP_SASL_INTERACT_PROC *interact,
              void *defaults);

       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[],
              LDAPControl *cctrls[]);

       int ldap_unbind_ext_s(LDAP *ld, LDAPControl *sctrls[],
              LDAPControl *cctrls[]);

       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);

DESCRIPTION
       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 oper-ations operations
       ations  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 pro-vided. provided.
       vided.  All routines take ld as their first parameter, as returned from ldap_init(3).

SIMPLE AUTHENTICATION
       The  simplest  form of the bind call is ldap_simple_bind_s().  It takes the DN to bind as in who, and
       the userPassword associated with the entry in passwd.  It  returns  an  LDAP  error  indication  (see
       ldap_error(3)).   The  ldap_simple_bind()  call  is asynchronous, taking the same parameters but only
       initiating the bind operation and returning the message id of the request it sent.  The result of the
       operation can be obtained by a subsequent call to ldap_result(3).

GENERAL AUTHENTICATION
       The ldap_bind() and ldap_bind_s() routines can be used when the authentication method to use needs to
       be selected at runtime.  They both take an extra method parameter selecting the authentication method
       to  use.   It should be set to LDAP_AUTH_SIMPLE to select simple authentication.  ldap_bind() returns
       the message id of the request it initiates.  ldap_bind_s() returns an LDAP error indication.

SASL AUTHENTICATION
       For SASL binds the server always ignores any provided DN, so the dn parameter should always be  NULL.
       ldap_sasl_bind_s()  sends a single SASL bind request with the given SASL mechanism and credentials in
       the cred parameter. The format of the credentials depends on the particular SASL  mechanism  in  use.
       For  mechanisms  that  provide mutual authentication the server's credentials will be returned in the
       servercredp parameter.  The routine returns  an  LDAP  error  indication  (see  ldap_error(3)).   The
       ldap_sasl_bind()  call  is  asynchronous, taking the same parameters but only sending the request and
       returning the message id of the request it sent. The result of the operation can  be  obtained  by  a
       subsequent    call    to    ldap_result(3).     The   result   must   be   additionally   parsed   by
       ldap_parse_sasl_bind_result() to obtain any server credentials sent from the server.

       Many SASL mechanisms require multiple message exchanges to perform a complete authentication.  Appli-cations Applications
       cations   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 supported-SASLMechanisms supportedSASLMechanisms
       SASLMechanisms attribute from the server's rootDSE for the list of SASL mechanisms  the  server  sup-ports. supports.
       ports.  The  flags parameter controls the interaction used to retrieve any necessary SASL authentica-tion authentication
       tion 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 partic-ular particular
       ular  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_inter-act sasl_interact
       act  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.

REBINDING
       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 fol-low follow
       low 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 applica-tion application
       tion wants the libraries to follow the referral.

       The url parameter points to the URL referral string received from the LDAP server.  The LDAP applica-tion application
       tion 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.

UNBINDING
       The  ldap_unbind()  call is used to unbind from the directory, terminate the current association, and
       free the resources contained in the ld structure.  Once it is called,  the  connection  to  the  LDAP
       server is closed, and the ld structure is invalid.  The ldap_unbind_s() call is just another name for
       ldap_unbind(); both of these calls are synchronous in nature.

       The ldap_unbind_ext() and ldap_unbind_ext_s() allows the operations to specify  controls.

ERRORS
       Asynchronous routines will return -1 in case of error, setting  the  ld_errno  parameter  of  the  ld
       structure.   Synchronous  routines  return  whatever  ld_errno is set to.  See ldap_error(3) for more
       information.

NOTES
       If an anonymous bind is sufficient for the application, the rebind process need not be provided.  The
       LDAP libraries with the LDAP_OPT_REFERRALS option set to ON (default value) will automatically follow
       referrals using an anonymous bind.

       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.

SEE ALSO
       ldap(3), ldap_error(3), ldap_open(3), ldap_set_option(3), ldap_url_parse(3) RFC 4422 (http://www.rfc-
       editor.org), Cyrus SASL (http://asg.web.cmu.edu/sasl/)

ACKNOWLEDGEMENTS
       OpenLDAP Software is developed and maintained by  The  OpenLDAP  Project  <http://www.openldap.org/>.
       OpenLDAP Software is derived from University of Michigan LDAP 3.3 Release.



OpenLDAP 2.4.11                                  2008/07/16                                     LDAP_BIND(3)

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.

Did this document help you? Yes It's good, but... Not helpful...