1 .TH LDAP 3 "RELEASEDATE" "OpenLDAP LDVERSION"
3 .\" Copyright 1998-2003 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
95 Also provided are various utility routines. The
97 routines are used to sort the entries and values returned via
98 the ldap search routines.
100 Also included in the distribution is a set of lightweight Basic
101 Encoding Rules routines. These routines are used by the LDAP library
102 routines to encode and decode LDAP protocol elements using the
103 (slightly simplified) Basic Encoding Rules defined by LDAP. They are
104 not normally used directly by an LDAP application program except
105 in the handling of controls and extended operations. The
106 routines provide a printf and scanf\-like interface, as well as
107 lower\-level access. These routines are discussed in
108 .BR lber\-decode (3),
109 .BR lber\-encode (3),
110 .BR lber\-memory (3),
116 open a connection to an LDAP server (deprecated, use
120 initialize the LDAP library without opening a connection to a server
122 .SM ldap_initialize(3)
123 initialize the LDAP library without opening a connection to a server
126 wait for the result from an asynchronous operation
129 abandon (abort) an asynchronous operation
132 asynchronously add an entry
135 synchronously add an entry
138 asynchronously bind to the directory
141 synchronously bind to the directory
143 .SM ldap_simple_bind(3)
144 asynchronously bind to the directory using simple authentication
146 .SM ldap_simple_bind_s(3)
147 synchronously bind to the directory using simple authentication
150 synchronously unbind from the LDAP server and close the connection
157 dispose of memory allocated by LDAP routines.
160 asynchronously compare to a directory entry
162 .SM ldap_compare_s(3)
163 synchronously compare to a directory entry
166 asynchronously delete an entry
169 synchronously delete an entry
172 print an LDAP error indication to standard error
175 LDAP error indication
177 .SM ldap_result2error(3)
178 extract LDAP error indication from LDAP result
181 list of LDAP errors and their meanings
183 .SM ldap_err2string(3)
184 convert LDAP error indication to a string
186 .SM ldap_first_attribute(3)
187 return first attribute name in an entry
189 .SM ldap_next_attribute(3)
190 return next attribute name in an entry
192 .SM ldap_first_entry(3)
193 return first entry in a chain of search results
195 .SM ldap_next_entry(3)
196 return next entry in a chain of search results
198 .SM ldap_count_entries(3)
199 return number of entries in a search result
202 extract the DN from an entry
204 .SM ldap_explode_dn(3)
205 convert a DN into its component parts
207 .SM ldap_explode_rdn(3)
208 convert an RDN into its component parts
210 .SM ldap_get_values(3)
211 return an attribute's values
213 .SM ldap_get_values_len(3)
214 return an attribute's values with lengths
216 .SM ldap_value_free(3)
217 free memory allocated by ldap_get_values(3)
219 .SM ldap_value_free_len(3)
220 free memory allocated by ldap_get_values_len(3)
222 .SM ldap_count_values(3)
223 return number of values
225 .SM ldap_count_values_len(3)
226 return number of values
229 asynchronously modify an entry
232 synchronously modify an entry
234 .SM ldap_mods_free(3)
235 free array of pointers to mod structures used by ldap_modify(3)
238 asynchronously modify the RDN of an entry
240 .SM ldap_modrdn2_s(3)
241 synchronously modify the RDN of an entry
244 deprecated - use ldap_modrdn2(3)
247 depreciated - use ldap_modrdn2_s(3)
250 free results allocated by ldap_result(3)
253 return the message type of a message from ldap_result(3)
256 return the message id of a message from ldap_result(3)
259 asynchronously search the directory
262 synchronously search the directory
264 .SM ldap_search_st(3)
265 synchronously search the directory with timeout
267 .SM ldap_is_ldap_url(3)
268 check a URL string to see if it is an LDAP URL
270 .SM ldap_url_parse(3)
271 break up an LDAP URL string into its components
273 .SM ldap_sort_entries(3)
274 sort a list of search results
276 .SM ldap_sort_values(3)
277 sort a list of attribute values
279 .SM ldap_sort_strcasecmp(3)
280 case insensitive string comparison
284 .BR draft-ietf-ldapext-ldap-c-api-xx.txt \ <http://www.ietf.org>
287 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
289 is derived from University of Michigan LDAP 3.3 Release.
291 These API manual pages are based upon descriptions provided in the
292 IETF C LDAP API Internet Draft, a work in progress, edited by