1 .TH LDAP 3 "RELEASEDATE" "OpenLDAP LDVERSION"
3 .\" Copyright 1998-2002 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap - OpenLDAP Lightweight Directory Access Protocol API
8 OpenlDAP LDAP (libldap, -lldap)
17 The Lightweight Directory Access Protocol provides access to X.500
18 directory services. The services may be stand\-alone or part of
19 a distributed directory service. This API supports LDAP over TCP
20 (RFC2251), LDAP over SSL, and LDAP over IPC (UNIX domain sockets).
21 This API supports SASL (RFC2829) and Start TLS (RFC2830). This
22 API is based upon IETF C LDAP API draft specification, a work in
25 The OpenLDAP Software package includes a stand\-alone server in
27 various LDAP clients, and an LDAP client library used to provide
28 programmatic access to the LDAP protocol. This man page gives an
29 overview of the LDAP library routines.
31 Both synchronous and asynchronous APIs are provided. Also included are
32 various routines to parse the results returned from these routines.
33 These routines are found in the \-lldap library.
35 The basic interaction is as follows. A session handle is
39 .BR ldap_initialize (3).
41 .BR ldap_initialize (3)
42 routine is preferred, but is not part of the draft specification.)
43 The underlying session is established upon first use which is
44 commonly an LDAP bind operation. The LDAP bind operation is
46 .BR ldap_sasl_bind (3)
47 or one of its friends. Next, other operations are performed
48 by calling one of the synchronous or asynchronous routines (e.g.,
49 .BR ldap_search_ext_s (3)
51 .BR ldap_search_ext (3)
54 Results returned from these routines are interpreted by calling the
55 LDAP parsing routines such as
56 .BR ldap_parse_result (3).
57 The LDAP association and underlying connection is terminated by calling
58 .BR ldap_unbind_ext (3).
59 Errors can be interpreted by calling
60 .BR ldap_err2string (3).
62 Search filters to be passed to the ldap search routines are to be
63 constructed by hand and should conform to RFC 2254.
64 .SH DISPLAYING RESULTS
65 Results obtained from the ldap search routines can be output by hand,
67 .BR ldap_first_entry (3)
69 .BR ldap_next_entry (3)
72 .BR ldap_first_attribute (3)
74 .BR ldap_next_attribute (3)
75 to step through an entry's attributes, and
76 .BR ldap_get_values (3)
77 to retrieve a given attribute's values. Attribute values
78 may or may not be displayable.
80 This library supports both LDAP Version 2 and Version 3, with the Version 2
81 protocol selected by default.
82 LDAP Version 3 operations can be extended through the use of controls. Controls
83 can be sent to a server or returned to the client with any LDAP message.
84 Extended versions of the standard routines are available for use with
85 controls. These routines are generally named by adding
87 to the regular routine's name.
88 .SH UNIFORM RESOURCE LOCATORS (URLS)
91 routines can be used to test a URL to see if it is an LDAP URL, to parse LDAP
92 URLs into their component pieces, and to initiate searches directly using
97 routines implement a local client caching scheme,
98 providing a substantial performance increase for repeated queries.
99 Caching is experiemental.
101 Also provided are various utility routines. The
103 routines are used to sort the entries and values returned via
104 the ldap search routines.
106 Also included in the distribution is a set of lightweight Basic
107 Encoding Rules routines. These routines are used by the LDAP library
108 routines to encode and decode LDAP protocol elements using the
109 (slightly simplified) Basic Encoding Rules defined by LDAP. They are
110 not normally used directly by an LDAP application program except
111 in the handling of controls and extended operations. The
112 routines provide a printf and scanf\-like interface, as well as
113 lower\-level access. These routines are discussed in
114 .BR lber\-decode (3),
115 .BR lber\-encode (3),
116 .BR lber\-memory (3),
122 open a connection to an LDAP server (deprecated, use
126 initialize the LDAP library without opening a connection to a server
128 .SM ldap_initialize(3)
129 initialize the LDAP library without opening a connection to a server
132 wait for the result from an asynchronous operation
135 abandon (abort) an asynchronous operation
138 asynchronously add an entry
141 synchronously add an entry
144 asynchronously bind to the directory
147 synchronously bind to the directory
149 .SM ldap_simple_bind(3)
150 asynchronously bind to the directory using simple authentication
152 .SM ldap_simple_bind_s(3)
153 synchronously bind to the directory using simple authentication
156 synchronously unbind from the LDAP server and close the connection
163 dispose of memory allocated by LDAP routines.
165 .SM ldap_enable_cache(3)
166 enable LDAP client caching
168 .SM ldap_disable_cache(3)
169 disable LDAP client caching
171 .SM ldap_destroy_cache(3)
172 disable LDAP client caching and destroy cache contents
174 .SM ldap_flush_cache(3)
175 flush LDAP client cache
177 .SM ldap_uncache_entry(3)
178 uncache requests pertaining to an entry
180 .SM ldap_uncache_request(3)
183 .SM ldap_set_cache_options(3)
187 asynchronously compare to a directory entry
189 .SM ldap_compare_s(3)
190 synchronously compare to a directory entry
193 asynchronously delete an entry
196 synchronously delete an entry
199 print an LDAP error indication to standard error
202 LDAP error indication
204 .SM ldap_result2error(3)
205 extract LDAP error indication from LDAP result
208 list of LDAP errors and their meanings
210 .SM ldap_err2string(3)
211 convert LDAP error indication to a string
213 .SM ldap_first_attribute(3)
214 return first attribute name in an entry
216 .SM ldap_next_attribute(3)
217 return next attribute name in an entry
219 .SM ldap_first_entry(3)
220 return first entry in a chain of search results
222 .SM ldap_next_entry(3)
223 return next entry in a chain of search results
225 .SM ldap_count_entries(3)
226 return number of entries in a search result
229 extract the DN from an entry
231 .SM ldap_explode_dn(3)
232 convert a DN into its component parts
234 .SM ldap_explode_rdn(3)
235 convert an RDN into its component parts
237 .SM ldap_get_values(3)
238 return an attribute's values
240 .SM ldap_get_values_len(3)
241 return an attribute's values with lengths
243 .SM ldap_value_free(3)
244 free memory allocated by ldap_get_values(3)
246 .SM ldap_value_free_len(3)
247 free memory allocated by ldap_get_values_len(3)
249 .SM ldap_count_values(3)
250 return number of values
252 .SM ldap_count_values_len(3)
253 return number of values
256 asynchronously modify an entry
259 synchronously modify an entry
261 .SM ldap_mods_free(3)
262 free array of pointers to mod structures used by ldap_modify(3)
265 asynchronously modify the RDN of an entry
267 .SM ldap_modrdn2_s(3)
268 synchronously modify the RDN of an entry
271 deprecated - use ldap_modrdn2(3)
274 depreciated - use ldap_modrdn2_s(3)
277 free results allocated by ldap_result(3)
280 return the message type of a message from ldap_result(3)
283 return the message id of a message from ldap_result(3)
286 asynchronously search the directory
289 synchronously search the directory
291 .SM ldap_search_st(3)
292 synchronously search the directory with timeout
294 .SM ldap_is_ldap_url(3)
295 check a URL string to see if it is an LDAP URL
297 .SM ldap_url_parse(3)
298 break up an LDAP URL string into its components
300 .SM ldap_sort_entries(3)
301 sort a list of search results
303 .SM ldap_sort_values(3)
304 sort a list of attribute values
306 .SM ldap_sort_strcasecmp(3)
307 case insensitive string comparison
310 .BR draft-ietf-ldapext-ldap-c-api-xx.txt \ <http://www.ietf.org>
313 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
315 is derived from University of Michigan LDAP 3.3 Release.
317 These API manual pages are based upon descriptions provided in the
318 IETF C LDAP API Internet Draft, a work in progress, edited by