ldap_init() initializes a session with an LDAP server. The server is not actually contacted until an operation is performed that requires it, allowing various options to be set after initialization.
LDAP *ldap_init( char *hostname, int portno );
Use of the following routine is deprecated.
LDAP *ldap_open( char *hostname, int portno );
Parameters are:
ldap_init() and ldap_open() both return a "session handle," a pointer to an opaque structure that should be passed to subsequent calls pertaining to the session. These routines return NULL if the session cannot be initialized in which case the operating system error reporting mechanism can be checked to see why the call failed.
Note that if you connect to an LDAPv2 server, one of the ldap_bind() calls described below must be completed before other operations can be performed on the session. LDAPv3 does not require that a bind operation be completed before other operations can be performed.
The calling program can set various attributes of the session by calling the routines described in the next section.