ldap_init()--Perform an LDAP Initialization Operation


  Syntax
#include <ldap.h>

LDAP *ldap_init(
                char  *host,
                int    port)

  Default Public Authority: *USE

  Library Name/Service Program: QSYS/QGLDCLNT

  Threadsafe: Yes

The ldap_init() API is used to allocate an LDAP structure, which is used to identify the connection and to maintain per-connection information.

The ldap_init() API returns a pointer to an LDAP structure, which should be passed to subsequent calls to other LDAP functions such as ldap_bind() and ldap_search().

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, but before actually contacting the host. It allocates an LDAP structure which is used to identify the connection and maintain per-connection information. Although still supported, the use of ldap_open() is deprecated. Use of ldap_init() instead of ldap_open() is recommended.


Authorities and Locks

No IBM® i authority is required.


Parameters

host
(Input) Several methods are supported for specifying one or more target LDAP servers, including the following:


port
Specifies the port number to which to connect. If the default IANA-assigned port of 389 is desired, LDAP_PORT should be specified.


Return Value

Pointer to an LDAP structure
if the request was successful.

NULL
if the request was not successful.

Error Conditions

The ldap_init() API will return NULL if not successful.


Error Messages

The following message may be sent from this function.



Related Information


API introduced: V4R3

[ Back to top | LDAP APIs | APIs by category ]