LDAP Library Functions ldapurl(3LDAP)
NAME
ldapurl, ldapisldapurl, ldapurlparse,
ldapurlparsenodn, ldapfreeurldesc, ldapurlsearch,
ldapurlsearchs, ldapurlsearchst, ldapdnstourl,
ldapdntourl - LDAP Uniform Resource Locator functions
SYNOPSIS
cc[ flag... ] file... -lldap[ library... ]
#include
#include
int ldapisldapurl(char *url);
int ldapurlparse(char *url, LDAPURLDesc **ludpp);
int ldapurlparsenodn(char *url, LDAPURLDesc **ludpp);
ldapfreeurldesc(LDAPURLDesc *ludp);
int ldapurlsearch(LDAP *ld, char *url, int attrsonly);
int ldapurlsearchs(LDAP *ld, char *url,
int attrsonly, LDAPMessage **res);
int ldapurlsearchst(LDAP *ld, char *url, int attrsonly,
struct timeval *timeout, LDAPMessage **res);
char *ldapdnstourl(LDAP *ld, char *dnsname, char *attrs,
char *scope, char *filter);
char *ldapdntourl(LDAP *ld, char *dn, int nameparts);
DESCRIPTION
These functions support the use of LDAP URLs (Uniform
Resource Locators). The following shows the formatting used
for LDAP URLs.
ldap:/hostport/dn[?attributes[?scope[?filter]
where:
SunOS 5.11 Last change: 02 Dec 2003 1
LDAP Library Functions ldapurl(3LDAP)
hostport Host name with an optional :portnumber.
dn Base DN to be used for an LDAP search opera-
tion.
attributes Comma separated list of attributes to be
retrieved.
scope One of these three strings: base one sub
(default=base).
filter LDAP search filter as used in a call to
ldapsearch(3LDAP).
The following is an example of an LDAP URL:
ldap:/ldap.itd.umich.edu/c=US?o,description?one?o=umich
URLs preceded URL: or wrapped in angle-brackets are
tolerated. URLs can also be preceded by URL: and wrapped in
angle-brackets.
ldapisldapurl() returns a non-zero value if url looks
like an LDAP URL (as opposed to some other kind of URL). It
can be used as a quick check for an LDAP URL; the
ldapurlparse() function should be used if a more thorough
check is needed.
ldapurlparse() breaks down an LDAP URL passed in url into
its component pieces. If successful, zero is returned, an
LDAP URL description is allocated, filled in, and ludpp is
set to point to it. See RETURN VALUES for values returned
upon error.
ldapurlparsenodn() acts just like ldapurlparse() but
does not require dn in the LDAP URL.
ldapfreeurldesc() should be called to free an LDAP URL
description that was obtained from a call to
ldapurlparse().
SunOS 5.11 Last change: 02 Dec 2003 2
LDAP Library Functions ldapurl(3LDAP)
ldapurlsearch() initiates an asynchronous LDAP search
based on the contents of the url string. This function acts
just like ldapsearch(3LDAP) except that many search parame-
ters are pulled out of the URL.
ldapurlsearchs() performs a synchronous LDAP search based
on the contents of the url string. This function acts just
like ldapsearchs(3LDAP) except that many search parameters
are pulled out of the URL.
ldapurlsearchst() performs a synchronous LDAP URL search
with a specified timeout. This function acts just like
ldapsearchst(3LDAP) except that many search parameters are
pulled out of the URL.
ldapdnstourl() locates the LDAP URL associated with a DNS
domain name. The supplied DNS domain name is converted into
a distinguished name. The directory entry specified by that
distinguished name is searched for a labeled URI attribute.
If successful then the corresponding LDAP URL is returned.
If unsuccessful then that entry's parent is searched and so
on until the target distinguished name is reduced to only
two nameparts. If dnsname is NUL then the environment
variable LOCALDOMAIN is used. If attrs is not NUL then it
is appended to the URL's attribute list. If scope is not
NUL then it overrides the URL's scope. If filter is not
NUL then it is merged with the URL's filter. If an error is
encountered then zero is returned, otherwise a string URL is
returned. The caller should free the returned string if it
is non-zero.
ldapdntourl() locates the LDAP URL associated with a dis-
tinguished name. The number of nameparts in the supplied
distinguished name must be provided. The specified directory
entry is searched for a labeledURI attribute. If successful
then the LDAP URL is returned. If unsuccessful then that
entry's parent is searched and so on until the target dis-
tinguished name is reduced to only two nameparts. If an
error is encountered then zero is returned, otherwise a
string URL is returned. The caller should free the returned
string if it is non-zero.
RETURN VALUES
Upon error, one of these values is returned for
ldapurlparse():
LDAPURLERBADSCOPE URL scope string is invalid.
SunOS 5.11 Last change: 02 Dec 2003 3
LDAP Library Functions ldapurl(3LDAP)
LDAPURLERHOSTPORT URL hostport is invalid.
LDAPURLERMEM Can't allocate memory space.
LDAPURLERNODN URL has no DN (required).
LDAPURLERNOTLDAP URL doesn't begin with ldap:/.
ATRIBUTES
See attributes(5) for a description of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
SEE ALSO
ldap(3LDAP), ldapsearch(3LDAP), attributes(5)
An LDAP URL Format, Tim Howes and Mark Smith, December 1995.
Internet Draft (work in progress). Currently available at
this URL.
ftp:/ds.internic.net/internet-drafts/draft-ietf-asid-ldap-format-03.txt
SunOS 5.11 Last change: 02 Dec 2003 4
|