#include <lber.h> #include <ldap.h>int ldap_bind(LDAP
ld, char
who, char
cred, int method);
int ldap_bind_s(LDAP
ld, char
who, char
cred, int method);
The method parameter is used to indicate the type of authentication used. The only currently supported value for method is LDAP_AUTH_SIMPLE. The effect of calling ldap_bind or ldap_bind_s with LDAP_AUTH_SIMPLE may also be obtained by calling ldap_simple_bind(3ldap) or ldap_simple_bind_s(3ldap).
The ld parameter is the LDAP session identifier as returned from ldap_init(3ldap) or ldap_open(3ldap).
The who parameter is the DN (distinguished name) of the user being authenticated. For an anonymous bind, the who parameter may be set to NULL or to a pointer to a null string ("").
The cred parameter is the credentials associated with the user.
ldap_bind_s returns LDAP_SUCESS upon successful completion, otherwise an LDAP error indication (see ldap_perror(3ldap) for details).