LDAP Library Functions ldapopen(3LDAP)
NAME
ldapopen, ldapinit - initialize an LDAP session
SYNOPSIS
cc [ flag... ] file... -lldap [ library... ]
#include
#include
LDAP *ldapopen(const char *host, int port);
LDAP *ldapinit(const char *host, int port);
DESCRIPTION
The ldapopen() function initializes an LDAP session and
also opens a connection to an LDAP server before it returns
to the caller. Unlike ldapopen(), ldapinit() does not open
a connection to the LDAP server until an operation, such as
a search request, is performed.
The ldapopen() function is deprecated and should no longer
be used. Call ldapinit() instead.
A list of LDAP hostnames or an IPv4 or IPv6 address can be
specified with the ldapopen() and ldapinit() functions.
The hostname can include a port number, separated from the
hostname by a colon (:). A port number included as part of
the hostname takes precedence over the port parameter. The
ldapopen() and ldapinit() functions attempt connections
with LDAP hosts in the order listed and return the first
successful connection.
PARAMETERS
These functions support the following parameters.
host The hostname, IPv4 or IPv6 address of the host that
runs the LDAP server. A space-separated list of
hostnames can also be used for this parameter.
port TCP port number of a connection. Supply the constant
LDAPORT to obtain the default LDAP port of 389. If
a host includes a port number, the default parameter
is ignored.
RETURN VALUES
The ldapopen() and ldapinit() functions return a handle to
an LDAP session that contains a pointer to an opaque
SunOS 5.11 Last change: 15 Jan 2004 1
LDAP Library Functions ldapopen(3LDAP)
structure. The structure must be passed to subsequent calls
for the session. If a session cannot be initialized, the
functions return NUL and errno should be set appropriately.
Various aspects of this opaque structure can be read or
written to control the session-wide parameters. Use the
ldapgetoption(3LDAP) to access the current option values
and the ldapsetoption(3LDAP) to set values for these
options.
EXAMPLES
Example 1 Specifying IPv4 and IPv6 Addresses
LDAP sessions can be initialized with hostnames, IPv4 or
IPv6 addresses, such as those shown in the following exam-
ples.
ldapinit("hosta:636 hostb", 389)
ldapinit("192.168.82.110:389", 389)
ldapinit("[fec0::114:a00:20ff:ab3d:83ed]", 389)
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level Safe
SEE ALSO
errno(3C), ldap(3LDAP), ldapbind(3LDAP),
ldapgetoption(3LDAP), ldapsetoption(3LDAP), attri-
butes(5)
SunOS 5.11 Last change: 15 Jan 2004 2
|