]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap.3
Happy new year
[openldap] / doc / man / man3 / ldap.3
1 .TH LDAP 3 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2004 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap - OpenLDAP Lightweight Directory Access Protocol API
7 .SH LIBRARY
8 OpenLDAP LDAP (libldap, -lldap)
9 .SH SYNOPSIS
10 .nf
11 .ft B
12 #include <ldap.h>
13 .ft
14 .fi
15 .SH DESCRIPTION
16 .LP
17 The Lightweight Directory Access Protocol (LDAP) (RFC 3377) provides
18 access to X.500 directory services.  These services may be stand\-alone
19 or part of a distributed directory service.  This client API supports
20 LDAP over TCP (RFC2251), LDAP over TLS/SSL, and LDAP over IPC (UNIX
21 domain sockets).  This API supports SASL (RFC2829) and Start TLS
22 (RFC2830) as well as a number of protocol extensions.  This API is
23 loosely based upon IETF/LDAPEXT C LDAP API draft specification, a (orphaned)
24 work in progress.
25 .LP
26 The OpenLDAP Software package includes a stand\-alone server in
27 .BR slapd (8),
28 various LDAP clients, and an LDAP client library used to provide
29 programmatic access to the LDAP protocol. This man page gives an
30 overview of the LDAP library routines.
31 .LP
32 Both synchronous and asynchronous APIs are provided.  Also included are
33 various routines to parse the results returned from these routines.
34 These routines are found in the \-lldap library.
35 .LP
36 The basic interaction is as follows.  A session handle is
37 created using
38 .BR ldap_initialize (3)
39 and set the protocol version to 3 by calling
40 .BR ldap_set_option (3).
41 The underlying session is established first operation is
42 issued.  This would generally be a Start TLS or Bind operation.
43 A Start TLS operation is performed by calling
44 .BR ldap_start_tls_s (3).
45 A LDAP bind operation is performed by calling
46 .BR ldap_sasl_bind (3)
47 or one of its friends.  Subsequently, other operations are performed
48 by calling one of the synchronous or asynchronous routines (e.g.,
49 .BR ldap_search_ext_s (3)
50 or
51 .BR ldap_search_ext (3)
52 followed by
53 .BR ldap_result (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).
61 .SH LDAP versions
62 This library supports version 3 of the Lightweight Directory Access
63 Protocol (LDAPv3) as defined in RFC 3377.  It also supports a varient
64 of version 2 of LDAP as defined by U-Mich LDAP and, to some degree,
65 RFC 1777.  Version 2 (all varients) should be viewed as obsolete.
66 Version 3 should be used instead.
67 .LP
68 For backwards compatibility reasons, the library defaults to version 2.
69 Hence, all new applications (and all actively maintained applications)
70 should use
71 .BR ldap_set_option (3)
72 to select version 3.  The library manual pages assume version 3
73 has been selected.
74 .SH INPUT and OUTPUT PARAMETERS
75 All character string input/output is expected to be/is UTF\-8
76 encoded Unicode (version 3.2). 
77 .LP
78 Distinguished names (DN) (and relative distinguished names (RDN) to
79 be passed to the LDAP routines should conform to RFC 2253.  The
80 .BR ldap_explode_dn (3)
81 routines can be used to work with DNs.
82 .LP
83 Search filters to be passed to the search routines are to be
84 constructed by hand and should conform to RFC 2254.
85 .LP
86 LDAP URL are to be passed to routines are expected to conform
87 to RFC 2255.
88 The
89 .BR ldap_url (3)
90 routines can be used to work with LDAP URLs.
91 .SH DISPLAYING RESULTS
92 Results obtained from the search routines can be output by hand,
93 by calling
94 .BR ldap_first_entry (3)
95 and
96 .BR ldap_next_entry (3)
97 to step through
98 the entries returned,
99 .BR ldap_first_attribute (3)
100 and
101 .BR ldap_next_attribute (3)
102 to step through an entry's attributes, and
103 .BR ldap_get_values (3)
104 to retrieve a given attribute's values.  Attribute values
105 may or may not be displayable.
106 .SH UTILITY ROUTINES
107 Also provided are various utility routines.  The
108 .BR ldap_sort (3)
109 routines are used to sort the entries and values returned via
110 the ldap search routines. 
111 .SH BER LIBRARY
112 Also included in the distribution is a set of lightweight Basic
113 Encoding Rules routines.  These routines are used by the LDAP library
114 routines to encode and decode LDAP protocol elements using the
115 (slightly simplified) Basic Encoding Rules defined by LDAP.  They are
116 not normally used directly by an LDAP application program except
117 in the handling of controls and extended operations.  The
118 routines provide a printf and scanf\-like interface, as well as
119 lower\-level access.  These routines are discussed in
120 .BR lber\-decode (3),
121 .BR lber\-encode (3),
122 .BR lber\-memory (3),
123 and
124 .BR lber\-types (3).
125 .SH INDEX
126 .TP 20
127 .SM ldap_initialize(3)
128 initialize the LDAP library without opening a connection to a server
129 .TP
130 .SM ldap_result(3)
131 wait for the result from an asynchronous operation
132 .TP
133 .SM ldap_abandon_ext(3)
134 abandon (abort) an asynchronous operation
135 .TP
136 .SM ldap_add_ext(3)
137 asynchronously add an entry
138 .TP
139 .SM ldap_add_ext_s(3)
140 synchronously add an entry
141 .TP
142 .SM ldap_sasl_bind(3)
143 asynchronously bind to the directory
144 .TP
145 .SM ldap_sasl_bind_s(3)
146 synchronously bind to the directory
147 .TP
148 .SM ldap_unbind_ext(3)
149 synchronously unbind from the LDAP server and close the connection
150 .TP
151 .SM ldap_unbind_ext_s(3)
152 equivalent to
153 .BR ldap_unbind_ext (3)
154 .TP
155 .SM ldap_memfree(3)
156 dispose of memory allocated by LDAP routines.
157 .TP
158 .SM ldap_compare_ext(3)
159 asynchronously compare to a directory entry
160 .TP
161 .SM ldap_compare_ext_s(3)
162 synchronously compare to a directory entry
163 .TP
164 .SM ldap_delete_ext(3)
165 asynchronously delete an entry
166 .TP
167 .SM ldap_delete_ext_s(3)
168 synchronously delete an entry
169 .TP
170 .SM ld_errno(3)
171 LDAP error indication
172 .TP
173 .SM ldap_errlist(3)
174 list of LDAP errors and their meanings
175 .TP
176 .SM ldap_err2string(3)
177 convert LDAP error indication to a string
178 .TP
179 .SM ldap_first_attribute(3)
180 return first attribute name in an entry
181 .TP
182 .SM ldap_next_attribute(3)
183 return next attribute name in an entry
184 .TP
185 .SM ldap_first_entry(3)
186 return first entry in a chain of search results
187 .TP
188 .SM ldap_next_entry(3)
189 return next entry in a chain of search results
190 .TP
191 .SM ldap_count_entries(3)
192 return number of entries in a search result
193 .TP
194 .SM ldap_get_dn(3)
195 extract the DN from an entry
196 .TP
197 .SM ldap_explode_dn(3)
198 convert a DN into its component parts (deprecated)
199 .TP
200 .SM ldap_explode_rdn(3)
201 convert an RDN into its component parts (deprecated)
202 .TP
203 .SM ldap_get_values_len(3)
204 return an attribute's values with lengths
205 .TP
206 .SM ldap_value_free_len(3)
207 free memory allocated by ldap_get_values_len(3)
208 .TP
209 .SM ldap_count_values_len(3)
210 return number of values
211 .TP
212 .SM ldap_modify_ext(3)
213 asynchronously modify an entry
214 .TP
215 .SM ldap_modify_ext_s(3)
216 synchronously modify an entry
217 .TP
218 .SM ldap_mods_free(3)
219 free array of pointers to mod structures used by ldap_modify_ext(3)
220 .TP
221 .SM ldap_rename(3)
222 asynchronously rename an entry
223 .TP
224 .SM ldap_rename_s(3)
225 synchronously rename an entry
226 .TP
227 .SM ldap_msgfree(3)
228 free results allocated by ldap_result(3)
229 .TP
230 .SM ldap_msgtype(3)
231 return the message type of a message from ldap_result(3)
232 .TP
233 .SM ldap_msgid(3)
234 return the message id of a message from ldap_result(3)
235 .TP
236 .SM ldap_search_ext(3)
237 asynchronously search the directory
238 .TP
239 .SM ldap_search_ext_s(3)
240 synchronously search the directory
241 .TP
242 .SM ldap_is_ldap_url(3)
243 check a URL string to see if it is an LDAP URL
244 .TP
245 .SM ldap_url_parse(3)
246 break up an LDAP URL string into its components
247 .TP
248 .SM ldap_sort_entries(3)
249 sort a list of search results
250 .TP
251 .SM ldap_sort_values(3)
252 sort a list of attribute values
253 .TP
254 .SM ldap_sort_strcasecmp(3)
255 case insensitive string comparison
256 .SH SEE ALSO
257 .BR ldap.conf (5),
258 .BR slapd (8),
259 .BR draft-ietf-ldapext-ldap-c-api-xx.txt \ <http://www.ietf.org>
260 .SH ACKNOWLEDGEMENTS
261 .B OpenLDAP
262 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
263 .B OpenLDAP
264 is derived from University of Michigan LDAP 3.3 Release.  
265 .LP
266 These API manual pages are loosely based upon descriptions provided
267 in the IETF/LDAPEXT C LDAP API Internet Draft, a (orphaned) work
268 in progress.
269