2 .\" Copyright (C) 1990, Regents of the University of Michigan. All Rights Reserved.
3 .\" Portions Copyright (C) 2003, Sun Microsystems, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH LDAP_URL 3LDAP "Dec 02, 2003"
9 ldap_url, ldap_is_ldap_url, ldap_url_parse, ldap_url_parse_nodn,
10 ldap_free_urldesc, ldap_url_search, ldap_url_search_s, ldap_url_search_st,
11 ldap_dns_to_url, ldap_dn_to_url \- LDAP Uniform Resource Locator functions
15 cc[ \fIflag\fR... ] \fIfile\fR... -lldap[ \fIlibrary\fR... ]
19 \fBint\fR \fBldap_is_ldap_url\fR(\fBchar\fR \fI*url\fR);
24 \fBint\fR \fBldap_url_parse\fR(\fBchar\fR \fI*url\fR, \fBLDAPURLDesc\fR \fI**ludpp\fR);
29 \fBint\fR \fBldap_url_parse_nodn\fR(\fBchar\fR \fI*url\fR, \fBLDAPURLDesc\fR \fI**ludpp\fR);
34 \fB\fR\fBldap_free_urldesc\fR(\fBLDAPURLDesc\fR \fI*ludp\fR);
39 \fBint\fR \fBldap_url_search\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*url\fR, \fBint\fR \fIattrsonly\fR);
44 \fBint\fR \fBldap_url_search_s\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*url\fR,
45 \fBint\fR \fIattrsonly\fR, \fBLDAPMessage\fR \fI**res\fR);
50 \fBint\fR \fBldap_url_search_st\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*url\fR, \fBint\fR \fIattrsonly\fR,
51 \fBstruct timeval\fR \fI*timeout\fR, \fBLDAPMessage\fR \fI**res\fR);
56 \fBchar *\fR\fBldap_dns_to_url\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dns_name\fR, \fBchar\fR \fI*attrs\fR,
57 \fBchar\fR \fI*scope\fR, \fBchar\fR \fI*filter\fR);
62 \fBchar *\fR\fBldap_dn_to_url\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBint\fR \fInameparts\fR);
68 These functions support the use of LDAP URLs (Uniform Resource Locators). The
69 following shows the formatting used for LDAP URLs.
73 \fBldap://\fR\fIhostport\fR\fB/\fR\fIdn\fR[\fB?\fR\fIattributes\fR[\fB?\fR\fIscope\fR[\fB?\fR\fIfilter\fR]]]
86 Host name with an optional \fB:portnumber\fR.
95 Base DN to be used for an LDAP search operation.
101 \fB\fIattributes\fR\fR
104 Comma separated list of attributes to be retrieved.
113 One of these three strings: base one sub (default=base).
122 LDAP search filter as used in a call to \fBldap_search\fR(3LDAP).
127 The following is an example of an LDAP URL:
131 ldap://ldap.itd.umich.edu/c=US?o,description?one?o=umich
137 URLs preceded \fBURL:\fR or wrapped in angle-brackets are tolerated. URLs can
138 also be preceded by \fBURL:\fR and wrapped in angle-brackets.
141 \fBldap_is_ldap_url()\fR returns a non-zero value if \fIurl\fR looks like an
142 LDAP URL (as opposed to some other kind of URL). It can be used as a quick
143 check for an LDAP URL; the \fBldap_url_parse()\fR function should be used if a
144 more thorough check is needed.
147 \fBldap_url_parse()\fR breaks down an LDAP URL passed in \fIurl\fR into its
148 component pieces. If successful, zero is returned, an LDAP URL description is
149 allocated, filled in, and \fIludpp\fR is set to point to it. See \fBRETURN
150 VALUES\fR for values returned upon error.
153 \fBldap_url_parse_nodn()\fR acts just like \fBldap_url_parse()\fR but does not
154 require \fIdn\fR in the LDAP URL.
157 \fBldap_free_urldesc()\fR should be called to free an LDAP URL description that
158 was obtained from a call to \fBldap_url_parse()\fR.
161 \fBldap_url_search()\fR initiates an asynchronous LDAP search based on the
162 contents of the \fIurl\fR string. This function acts just like
163 \fBldap_search\fR(3LDAP) except that many search parameters are pulled out of
167 \fBldap_url_search_s()\fR performs a synchronous LDAP search based on the
168 contents of the \fIurl\fR string. This function acts just like
169 \fBldap_search_s\fR(3LDAP) except that many search parameters are pulled out of
173 \fBldap_url_search_st()\fR performs a synchronous LDAP URL search with a
174 specified \fItimeout\fR. This function acts just like
175 \fBldap_search_st\fR(3LDAP) except that many search parameters are pulled out
179 \fBldap_dns_to_url()\fR locates the LDAP URL associated with a DNS domain name.
180 The supplied DNS domain name is converted into a distinguished name. The
181 directory entry specified by that distinguished name is searched for a labeled
182 URI attribute. If successful then the corresponding LDAP URL is returned. If
183 unsuccessful then that entry's parent is searched and so on until the target
184 distinguished name is reduced to only two nameparts. If \fIdns_name\fR is
185 \fINULL\fR then the environment variable LOCALDOMAIN is used. If \fIattrs\fR is
186 not \fINULL\fR then it is appended to the URL's attribute list. If \fIscope\fR
187 is not NULL then it overrides the URL's scope. If \fIfilter\fR is not
188 \fINULL\fR then it is merged with the URL's filter. If an error is encountered
189 then zero is returned, otherwise a string URL is returned. The caller should
190 free the returned string if it is non-zero.
193 \fBldap_dn_to_url()\fR locates the LDAP URL associated with a distinguished
194 name. The number of nameparts in the supplied distinguished name must be
195 provided. The specified directory entry is searched for a labeledURI attribute.
196 If successful then the LDAP URL is returned. If unsuccessful then that entry's
197 parent is searched and so on until the target distinguished name is reduced to
198 only two nameparts. If an error is encountered then zero is returned, otherwise
199 a string URL is returned. The caller should free the returned string if it is
204 Upon error, one of these values is returned for \fBldap_url_parse()\fR:
208 \fB\fBLDAP_URL_ERR_BADSCOPE\fR\fR
211 URL scope string is invalid.
217 \fB\fBLDAP_URL_ERR_HOSTPORT\fR\fR
220 URL hostport is invalid.
226 \fB\fBLDAP_URL_ERR_MEM\fR\fR
229 Can't allocate memory space.
235 \fB\fBLDAP_URL_ERR_NODN\fR\fR
238 URL has no DN (required).
244 \fB\fBLDAP_URL_ERR_NOTLDAP\fR\fR
247 URL doesn't begin with \fBldap://\fR.
253 See \fBattributes\fR(7) for a description of the following attributes:
261 ATTRIBUTE TYPE ATTRIBUTE VALUE
262 Interface Stability Evolving
269 .BR ldap_search (3LDAP),
273 \fBAn\fR \fBLDAP\fR \fBURL\fR \fBFormat,\fR Tim Howes and Mark Smith, December
274 1995. Internet Draft (work in progress). Currently available at this URL.
278 ftp://ds.internic.net/internet-drafts/draft-ietf-asid-ldap-format-03.txt