ldap_dup, ldap_destroy, − Duplicate and destroy LDAP session handles


OpenLDAP LDAP (libldap, −lldap)


#include <ldap.h>

LDAP *ldap_dup(

LDAP *old );

int ldap_destroy(

LDAP *old );


ldap_dup() duplicates an existing LDAP (LDAP *) session handle. The new session handle may be used concurrently with the original session handle. In a threaded environment, different threads may execute concurrent requests on the same connection/session without fear of contamination. Each session handle manages its own private error results.

ldap_destroy() destroys an existing session handle.

The ldap_dup() and ldap_destroy() functions are used in conjunction with a "thread safe" version of libldap (libldap_r) to enable operation thread safe API calls, so that a single session may be simultaneously used across multiple threads with consistent error handling.

When a session is created through the use of one of the session creation functions including ldap_open(3), ldap_init(3), ldap_initialize(3) or ldap_init_fd(3) an LDAP * session handle is returned to the application. The session handle may be shared amongst threads, however the error codes are unique to a session handle. Multiple threads performing different operations using the same session handle will result in inconsistent error codes and return values.

To prevent this confusion, ldap_dup() is used duplicate an existing session handle so that multiple threads can share the session, and maintain consistent error information and results.

The message queues for a session are shared between sibling session handles. Results of operations on a sibling session handles are accessible to all the sibling session handles. Applications desiring results associated with a specific operation should provide the appropriate msgid to ldap_result(). Applications should avoid calling ldap_result() with LDAP_RES_ANY as that may "steal" and return results in the calling thread that another operation in a different thread, using a different session handle, may require to complete.

When ldap_unbind() is called on a session handle with siblings, all the siblings become invalid.

Siblings must be destroyed using ldap_destroy(). Session handle resources associated with the original (LDAP *) will be freed when the last session handle is destroyed or when ldap_unbind() is called, if no other session handles currently exist.


If an error occurs, ldap_dup() will return NULL and errno should be set appropriately. ldap_destroy() will directly return the LDAP code associated to the error (or LDAP_SUCCESS in case of success); errno should be set as well whenever appropriate.


ldap_open(3), ldap_init(3), ldap_initialize(3), ldap_init_fd(3), errno(3)


This work is based on the previously proposed LDAP C API Concurrency Extensions draft (draft-zeilenga-ldap-c-api-concurrency-00.txt) effort. OpenLDAP Software is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>. OpenLDAP Software is derived from University of Michigan LDAP 3.3 Release.

More Linux Commands

EZMAN - Linux Manual Page Search (Linux man pages)..........
Ezman is a simplifed interface that searches the short descriptions of the man page names for the keywords and displays the web pages matching those keywords.

glutAddMenuEntry(3) - adds a menu entry to the bottom of the
glutAddMenuEntry adds a menu entry to the bottom of the current menu. The string name will be displayed for the newly added menu entry. If the menu entry is sel

Mail::SPF::MacroString(3pm) - SPF record macro string class
An object of class Mail::SPF::MacroString represents a macro string that can be expanded to a plain string in the context of an SPF request. Constructor The fol

gnutls_anon_allocate_server_credentials(3) - API function...
gnutls_anon_allocate_server_credentials.3 - This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate i

finitef(3) - BSD floating-point classification functions....
The finite(), finitef(), and finitel() functions return a nonzero value if x is neither infinite nor a not-a-number (NaN) value, and 0 otherwise. The isnan(), i

gethostent(3) - get network host entry - Linux manual page
The gethostbyname*(), gethostbyaddr*(), herror(), and hstrerror() functions are obsolete. Applications should use getaddrinfo(3), getnameinfo(3), and gai_strerr

XSetClipOrigin(3) - GC convenience routines - Linux man page
The XSetClipOrigin function sets the clip origin in the specified GC. The clip-mask origin is interpreted relative to the origin of whatever destination drawabl

catanhf(3) - complex arc tangents hyperbolic (Man Page).....
The catanh() function calculates the complex arc hyperbolic tangent of z. If y = catanh(z), then z = ctanh(y). The imaginary part of y is chosen in the interval

msgunfmt(1) - uncompile message catalog from binary format
Convert binary message catalog to Uniforum style .po file. Mandatory arguments to long options are mandatory for short options too. Operation mode: -j, --java J

key_secretkey_is_set(3) - interfaces to rpc keyserver daemon
The functions here are used within the RPCs secure authentication mechanism (AUTH_DES). There should be no need for user programs to use this functions. The fun

systemd-tmpfiles-clean.timer(8) Creates, deletes and cleans
systemd-tmpfiles creates, deletes, and cleans up volatile and temporary files and directories, based on the configuration file format and location specified in

biosdecode(8) - BIOS information decoder - Linux man page...
biosdecode parses the BIOS memory and prints information about all structures (or entry points) it knows of. Currently known entry point types are: * SMBIOS (Sy

We can't live, work or learn in freedom unless the software we use is free.