Red Hat DIRECTORY SERVER 7.1 - PLUG-IN PROGRAMMERS Manual page 385

Table of Contents

Advertisement

This function allocates an
including the hostname and port of the LDAP server, preferences for the session
(such as the maximum number of entries to return in a search), and the error code
of the last LDAP operation performed.
You can specify a list of LDAP servers that you want to attempt to connect to. Your
client will attempt to connect to the first LDAP server in the list. If the attempt fails,
your client will attempt to connect to the next LDAP server in the list.
If you specify a non-zero value for the
the plug-in for SSL and installs the I/O routines for SSL.
If you specify a non-zero value for the
server's threading functions and allows multiple threads to share this session (the
returned
structure). The Directory Server processes each request in a separate
LDAP
thread. When handling multiple requests, it is possible for the server to call your
plug-in function concurrently for different threads.
If you initialize a session by calling this function, make sure to call the
slapi_ldap_unbind()
functions provided with the Directory Server SDK) when you are done with the
session.
As the
slapi_ldap_init()
LDAP C SDK connect timeout feature for plug-ins. That is, when connecting to an
external LDAP server from a plug-in, you can specify a time limit for establishing
the connection. To specify the timeout, call
LDAP_X_OPT_CONNECT_TIMEOUT
illustrated in the sample code below:
void
my_ldap_function( void )
{
LDAP *ld;
int to = 5000;
if (( ld = slapi_ldap_init( host, port, 0, 1 )) == NULL ) {
/* error trying to create an LDAP session */
return -1;
}
if ( ldap_set_option( ld, LDAP_X_OPT_CONNECT_TIMEOUT, &to ) != 0 ) {
/* error setting timeout */
slapi_ldap_unbind( ld );
return -1;
structure containing information about the session,
LDAP
secure
shared
function (not the
function returns a regular
option after calling
/* 5000 milliseconds == 5 second timeout */
Functions for Thread-Safe LDAP Connections
argument, this function initializes
argument, this function installs the
or
ldap_unbind()
ldap_unbind_s()
LDAP *
ldap_set_option()
slapi_ldap_init()
Chapter 15
, you can use the
with the
, as
Function Reference
383

Advertisement

Table of Contents
loading

This manual is also suitable for:

Directory server 7.1

Table of Contents