1LDAP_BIND(3)               Library Functions Manual               LDAP_BIND(3)
2
3
4

NAME

6       ldap_bind,     ldap_bind_s,    ldap_simple_bind,    ldap_simple_bind_s,
7       ldap_sasl_bind,     ldap_sasl_bind_s,     ldap_sasl_interactive_bind_s,
8       ldap_parse_sasl_bind_result,  ldap_unbind,  ldap_unbind_s  -  LDAP bind
9       routines
10

LIBRARY

12       OpenLDAP LDAP (libldap, -lldap)
13

SYNOPSIS

15       #include <ldap.h>
16
17       int ldap_bind(LDAP *ld, const char *who, const char *cred,
18              int method);
19
20       int ldap_bind_s(LDAP *ld, const char *who, const char *cred,
21              int method);
22
23       int ldap_simple_bind(LDAP *ld, const char *who, const char *passwd);
24
25       int ldap_simple_bind_s(LDAP *ld, const char *who, const char *passwd);
26
27       int ldap_sasl_bind(LDAP *ld, const char *dn, const char *mechanism,
28              struct berval *cred, LDAPControl *sctrls[],
29              LDAPControl *cctrls[], int *msgidp);
30
31       int ldap_sasl_bind_s(LDAP *ld, const char *dn, const char *mechanism,
32              struct berval *cred, LDAPControl *sctrls[],
33              LDAPControl *cctrls[], struct berval **servercredp);
34
35       int ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res,
36              struct berval **servercredp, int freeit);
37
38       int ldap_sasl_interactive_bind_s(LDAP *ld, const char *dn,
39              const char *mechs,
40              LDAPControl *sctrls[], LDAPControl *cctrls[],
41              unsigned flags, LDAP_SASL_INTERACT_PROC *interact,
42              void *defaults);
43
44       int ldap_unbind(LDAP *ld);
45
46       int ldap_unbind_s(LDAP *ld);
47

DESCRIPTION

49       These routines provide various interfaces to the LDAP  bind  operation.
50       After an association with an LDAP server is made using ldap_init(3), an
51       LDAP bind operation should be performed  before  other  operations  are
52       attempted  over  the  connection.   An LDAP bind is required when using
53       Version 2 of the LDAP protocol; it is optional for  Version  3  but  is
54       usually needed due to security considerations.
55
56       There  are three types of bind calls, ones providing simple authentica‐
57       tion, ones providing SASL authentication, and general routines  capable
58       of doing either simple or SASL authentication.
59
60       SASL  (Simple Authentication and Security Layer) that can negotiate one
61       of many different kinds of authentication.  Both synchronous and  asyn‐
62       chronous  versions  of each variant of the bind call are provided.  All
63       routines  take  ld  as  their  first  parameter,   as   returned   from
64       ldap_init(3).
65

SIMPLE AUTHENTICATION

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

GENERAL AUTHENTICATION

76       The ldap_bind() and ldap_bind_s() routines can be used when the authen‐
77       tication method to use needs to be selected at runtime.  They both take
78       an  extra  method parameter selecting the authentication method to use.
79       It should be set to LDAP_AUTH_SIMPLE to select  simple  authentication.
80       ldap_bind()  returns  the  message  id  of  the  request  it initiates.
81       ldap_bind_s() returns an LDAP error indication.
82

SASL AUTHENTICATION

84       Description still under construction...
85

UNBINDING

87       The ldap_unbind() call is used to unbind from the directory,  terminate
88       the  current  association,  and  free the resources contained in the ld
89       structure.  Once it is called, the connection to  the  LDAP  server  is
90       closed,  and  the ld structure is invalid.  The ldap_unbind_s() call is
91       just another name for ldap_unbind(); both of these calls  are  synchro‐
92       nous in nature.
93

ERRORS

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

SEE ALSO

100       ldap(3),  ldap_error(3),  ldap_open(3), RFC 2222 (http://www.ietf.org),
101       Cyrus SASL (http://asg.web.cmu.edu/sasl/)
102

ACKNOWLEDGEMENTS

104       OpenLDAP  is  developed  and  maintained  by   The   OpenLDAP   Project
105       (http://www.openldap.org/).   OpenLDAP  is  derived  from University of
106       Michigan LDAP 3.3 Release.
107
108
109
110OpenLDAP 2.3.34                    2007/2/16                      LDAP_BIND(3)
Impressum