LDAPBIND(3) LDAPBIND(3)
NAME
ldapbind, ldapbinds, ldapsimplebind, ldapsimplebinds, ldapker-
berosbinds, ldapkerberosbind1, ldapkerberosbind1s, ldapker-
berosbind2, ldapkerberosbind2s, ldapsaslbind, ldapsaslbinds,
ldapsaslinteractivebinds, ldapparsesaslbindresult, ldapunbind,
ldapunbinds - LDAP bind routines
LIBRARY
OpenLDAP LDAP (libldap, -lldap)
SYNOPSIS
##include <>
int ldapbind(LDAP **ld,, const char **who,, const char **cred,,
int method);;
int ldapbinds(LDAP **ld,, const char **who,, const char **cred,,
int method);;
int ldapsimplebind(LDAP **ld,, const char **who,, const char **passwd);;
int ldapsimplebinds(LDAP **ld,, const char **who,, const char **passwd);;
int ldapkerberosbinds(LDAP **ld,, const char **who);;
int ldapkerberosbind1(LDAP **ld,, const char **who);;
int ldapkerberosbind1s(LDAP **ld,, const char **who);;
int ldapkerberosbind2(LDAP **ld,, const char **who);;
int ldapkerberosbind2s(LDAP **ld,, const char **who);;
int ldapsaslbind(LDAP **ld,, const char **dn,, const char **mechanism,,
struct berval **cred,, LDAPControl **sctrls[],,
LDAPControl **cctrls[],, int **msgidp);;
int ldapsaslbinds(LDAP **ld,, const char **dn,, const char **mechanism,,
struct berval **cred,, LDAPControl **sctrls[],,
LDAPControl **cctrls[],, struct berval ****servercredp);;
int ldapparsesaslbindresult(LDAP **ld,, LDAPessage **res,,
struct berval ****servercredp,, int freeit);;
int ldapsaslinteractivebinds(LDAP **ld,, const char **dn,,
const char **mechs,,
LDAPControl **sctrls[],, LDAPControl **cctrls[],,
unsigned flags,, LDAPSASLINTERACTPROC **interact,,
void **defaults);;
int ldapunbind(LDAP **ld);;
int ldapunbinds(LDAP **ld);;
DESCRIPTION
These routines provide various interfaces to the LDAP bind operation.
After an association with an LDAP server is made using ldapinit(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 many types of bind calls, providing simple authentication,
Kerberos version 4 authentication, and general routines to do either
one, as well as calls using SASL (Simple Authentication and Security
Layer) that can negotiate one of many different kinds of authentica-
tion. Both synchronous and asynchronous versions of each variant of
the bind call are provided. All routines take ld as their first param-
eter, as returned from ldapinit(3).
Kerberos version 4 has been superseded by Kerberos version 5, and the
Kerberos version 4 support is only provided for backward compatibility.
The SASL interfaces should be used for new applications. SASL provides
a general interface for using Kerberos versions 4 and 5 and many other
security systems.
SIMPLE AUTHENTICATION
The simplest form of the bind call is ldapsimplebinds(). 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
ldaperror(3)). The ldapsimplebind() call is asynchronous, taking
the same parameters but only initiating the bind operation and return-
ing the message id of the request it sent. The result of the operation
can be obtained by a subsequent call to ldapresult(3).
KERBEROS AUTHENTICATION
If the LDAP library and LDAP server being contacted have been compiled
with the KERBEROS option defined, Kerberos version 4 authentication can
be performed. As mentioned above, these Kerberos routines are provided
only for backward compatibility.
These routines assume the user already has obtained a ticket granting
ticket. The routines take who, the DN of the entry to bind as. The
ldapkerberosbinds() routine does both steps of the Kerberos binding
process synchronously. The ldapkerberosbind1s() and ldapker-
berosbind2s() routines allow synchronous access to the individual
steps, authenticating to the LDAP server and X.500 DSA, respectively.
The ldapkerberosbind1() and ldapkerberosbind2() routines provide
equivalent asynchronous access.
The ldapkerberosbinds() routine is used to perform both authentica-
tion steps when contacting an LDAP server that is a gateway to an X.500
DSA. This kind of server configuration is only supported in the (very
old) University of Michigan LDAP release. The OpenLDAP package no
longer provides this gateway server. The standalone LDAP server pro-
vided in OpenLDAP may still be configured with Kerberos version 4 sup-
port, but it only requires one authentication step, and will return an
error if the second step is attempted. Therefore, only the ldapker-
berosbind1() routine or its synchronous equivalent may be used when
contacting an OpenLDAP server.
GENERAL AUTHENTICATION
The ldapbind() and ldapbinds() routines can be used when the authen-
tication 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 one of LDAPAUTHSIMPLE, LDAPAUTHKRBV41, or
LDAPAUTHKRBV42, to select simple authentication, Kerberos authentica-
tion to the LDAP server, or Kerberos authentication to the X.500 DSA,
respectively. ldapbind() returns the message id of the request it
initiates. ldapbinds() returns an LDAP error indication.
SASL AUTHENTICATION
Description still under construction...
UNBINDING
The ldapunbind() 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 ldapunbinds() call is
just another name for ldapunbind(); both of these calls are synchro-
nous in nature.
ERORS
Asynchronous routines will return -1 in case of error, setting the
lderrno parameter of the ld structure. Synchronous routines return
whatever lderrno is set to. See ldaperror(3) for more information.
SEE ALSO
ldap(3), ldaperror(3), ldapopen(3), RFC 2222 (http:/www.ietf.org),
Cyrus SASL (http:/asg.web.cmu.edu/sasl/)
ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project
(http:/www.openldap.org/). OpenLDAP is derived from University of
Michigan LDAP 3.3 Release.
OpenLDAP 2.2.19 2004/11/26 LDAPBIND(3)
|