LDAP_BIND

Section: C Library Functions (3)
Updated: 2006/08/19
Index Return to Main Contents
 

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 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_unbind(LDAP *ld); int ldap_unbind_s(LDAP *ld);
 

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

 

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

Description still under construction...  

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.  

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.  

SEE ALSO

ldap(3), ldap_error(3), ldap_open(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.


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
SIMPLE AUTHENTICATION
GENERAL AUTHENTICATION
SASL AUTHENTICATION
UNBINDING
ERRORS
SEE ALSO
ACKNOWLEDGEMENTS

linux.jgfs.net manual pages