Man page - ldap_dup(3)
Packages contas this manual
- ldap_dn2ad_canonical(3)
- ldap_parse_reference(3)
- ldap_attributetype2str(3)
- ld_errno(3)
- ldap_set_option(3)
- ldap_compare_ext_s(3)
- ber_int_t(3)
- ldap_extended_operation_s(3)
- ldap_explode_rdn(3)
- ldap_parse_intermediate(3)
- ldap_url(3)
- ber_put_string(3)
- ber_put_bitstring(3)
- ldap_count_entries(3)
- ldap_modify_s(3)
- ldap_search_ext_s(3)
- ldap_str2attributetype(3)
- ldap_control_free(3)
- ber_get_null(3)
- ldap_set_rebind_proc(3)
- ldap_syntax2name(3)
- ldap_unbind_ext_s(3)
- ldap_sasl_bind(3)
- ldap_next_message(3)
- ldap_next_reference(3)
- ldap_unbind_s(3)
- ldap_add(3)
- ldap_parse_sasl_bind_result(3)
- ber_printf(3)
- ldap_str2syntax(3)
- ldap_set_urllist_proc(3)
- ldap_open(3)
- ldap_first_reference(3)
- ldap_msgfree(3)
- ber_bvarray_add(3)
- ber_bvstr(3)
- ber_put_seq(3)
- ber_get_int(3)
- ldap_count_values_len(3)
- ldap_rename(3)
- lber-sockbuf(3)
- ldap_control_dup(3)
- ldap_controls_dup(3)
- ber_put_enum(3)
- ldap_simple_bind(3)
- ldap_first_attribute(3)
- ldap_matchingrule2str(3)
- ldap_is_ldap_url(3)
- ldap_result(3)
- ldap_sort_entries(3)
- ldap_extended_operation(3)
- ber_put_null(3)
- ber_bvecfree(3)
- ber_bvfree(3)
- ber_memrealloc(3)
- ldap_delete_ext_s(3)
- ldap_initialize(3)
- ldap_modify_ext(3)
- ldap_syntax_free(3)
- ldap_error(3)
- ldap_init_fd(3)
- ldap_strdup(3)
- ldap_delete_s(3)
- ldap_memfree(3)
- lber-encode(3)
- ldap_sort_values(3)
- ldap_explode_dn(3)
- ldap_modrdn2(3)
- ldap_get_dn(3)
- ber_next_element(3)
- ldap_install_tls(3)
- ldap_schema(3)
- ber_len_t(3)
- ldap_count_references(3)
- ldap_memory(3)
- ber_peek_tag(3)
- ber_get_next(3)
- ldap_parse_extended_result(3)
- ldap_sort_strcasecmp(3)
- ber_alloc_t(3)
- ldap_matchingrule_free(3)
- ldap_bind(3)
- ber_start_set(3)
- ber_scanf(3)
- ldap_controls(3)
- ldap_start_tls(3)
- ldap_objectclass_free(3)
- ber_memalloc(3)
- ldap_parse_result(3)
- ldap_add_ext(3)
- lber-types(3)
- ber_bvecadd(3)
- ldap_parse_vlv_control(3)
- ldap_scherr2str(3)
- ldap_bind_s(3)
- ber_memcalloc(3)
- ldap_err2string(3)
- ldap_search(3)
- ldap_get_attribute_ber(3)
- ldap_count_values(3)
- ldap_first_entry(3)
- ber_first_element(3)
- ldap_destroy(3)
- ldap_value_free(3)
- ldap_delete(3)
- ldap_compare(3)
- ldap_get_values_len(3)
- ldap_parse_sort_control(3)
- ber_tag_t(3)
- ldap_url_parse(3)
- ldap_dn2ufn(3)
- ldap_rename_s(3)
- ldap_add_ext_s(3)
- ber_bvstrdup(3)
- ber_skip_tag(3)
- ber_get_enum(3)
- ldap_dcedn2dn(3)
- ldap_str2objectclass(3)
- ldap_matchingrule2name(3)
- ldap_unbind_ext(3)
- ber_get_stringb(3)
- ber_get_boolean(3)
- ber_bvdup(3)
- ldap_modrdn_s(3)
- ldap_objectclass2name(3)
- ber_get_stringa(3)
- ldap_dn2str(3)
- ldap_abandon(3)
- ldap_search_s(3)
- ldap_tls_inplace(3)
- ldap_init(3)
- ber_flush(3)
- ber_free(3)
- ber_put_boolean(3)
- ldap_first_message(3)
- ldap_tls(3)
- ber_bvarray_free(3)
- ber_put_set(3)
- ldap_sync(3)
- ldap_get_values(3)
- ldap_count_messages(3)
- ldap_str2matchingrule(3)
- ldap_modify(3)
- ldap_msgid(3)
- ber_put_int(3)
- ldap_modrdn(3)
- ldap_attributetype2name(3)
- ldap_str2dn(3)
- ldap_next_entry(3)
- ldap_control_find(3)
- ldap_mods_free(3)
- lber-decode(3)
- ldap_compare_ext(3)
- ldap_attributetype_free(3)
- ldap_memrealloc(3)
- ldap_get_option(3)
- ldap_controls_free(3)
- ldap_compare_s(3)
- ldap_memalloc(3)
- ldap_syntax2str(3)
- ldap_simple_bind_s(3)
- ldap_abandon_ext(3)
- ber_str2bv(3)
- ldap_perror(3)
- ldap_memvfree(3)
- ldap_add_s(3)
- ldap_dnfree(3)
- ldap_unbind(3)
- ber_memfree(3)
- ldap_modify_ext_s(3)
- ldap_msgtype(3)
- ldap_result2error(3)
- ldap_free_urldesc(3)
- ldap(3)
- ldap_search_ext(3)
- ldap_memcalloc(3)
- ldap_sort(3)
- ldap_dup(3)
- ldap_delete_ext(3)
- ldap_value_free_len(3)
- ldap_next_attribute(3)
- ber_get_bitstring(3)
- ber_dupbv(3)
- ldap_control_create(3)
- ldap_modrdn2_s(3)
- ldap_start_tls_s(3)
- ber_start_seq(3)
- ldap_errlist(3)
- ldap_dn2dcedn(3)
- ldap_search_st(3)
- lber-memory(3)
- ldap_objectclass2str(3)
- ldap_sasl_bind_s(3)
- ber_put_ostring(3)
apt-get install libldap-dev
Manual
| LDAP_OPEN(3) | Library Functions Manual | LDAP_OPEN(3) |
NAME
ldap_dup, ldap_destroy, - Duplicate and destroy LDAP session handles
LIBRARY
OpenLDAP LDAP (libldap, -lldap)
SYNOPSIS
#include <ldap.h>
LDAP *ldap_dup(
LDAP *old );
int ldap_destroy(
LDAP *old );
DESCRIPTION
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 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.
ERRORS
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.
SEE ALSO
ldap_open(3), ldap_init(3), ldap_initialize(3), ldap_init_fd(3), errno(3)
ACKNOWLEDGEMENTS
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 the University of Michigan LDAP 3.3 Release.
| 2025/05/22 | OpenLDAP 2.6.10+dfsg-1 |