ldap_open()--Perform an LDAP Open Operation



  Syntax
 #include <ldap.h>

 LDAP *ldap_open(
                char  *host,
                int    port)

  Default Public Authority: *USE

  Library Name/Service Program: QSYS/QGLDCLNT

  Threadsafe: Yes

The ldap_open() function opens a connection to an LDAP server and allocates an LDAP structure, which is used to identify the connection and to maintain per-connection information.

The ldap_open() function 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().

Although still supported, the use of ldap_open() is deprecated. The ldap_open() API allocates an LDAP structure and opens a connection to the LDAP server. Use of ldap_init() instead of ldap_open() is recommended.

As a rule of thumb, the LDAP application is typically running as LDAP version 2 when it uses ldap_open() to create the LDAP connection. The LDAP application is typically running as LDAP version 3 when it uses ldap_init() to create the LDAP connection. However, it was possible with the LDAP V2 API to call ldap_init() so that there may be cases where this rule of thumb is not true.


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
(Input) Specifies the TCP port number the server is listening on. If the default IANA-assigned port of 389 is desired, LDAP_PORT should be specified. To use the default SSL port 636 for SSL connections, use LDAPS_PORT.


Return Value

Pointer to an LDAP structure
if the request was successful.

NULL
if the request was not successful.


Error Conditions

The ldap_open() API will return NULL and set the ld_errno error code, if not successful. See LDAP Client API Error Conditions for possible LDAP error codes values.


Error Messages

The following message may be sent from this function.



Related Information


API introduced: V4R3

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