ldap_is_ldap_url(3ldap)


ldap_is_ldap_url, ldap_url_parse, ldap_free_urldesc, ldap_url_search, ldap_url_search_s, ldap_url_search_st -- LDAP Uniform Resource Locator routines

Synopsis

#include <lber.h> 
#include <ldap.h> 

int ldap_is_ldap_url(char *url);

int ldap_url_parse(char *url, LDAPURLDesc **ludpp);

ldap_free_urldesc(LDAPURLDesc *ludpp);

int ldap_url_search(LDAP *ld, char *url, int attrsonly);

int ldap_url_search_s(LDAP *ld, char *url, int attrsonly, LDAPMessage **res);

int ldap_url_search_st(LDAP *ld, char *url, int attrsonly, struct timeval *timeout, LDAPMessage **res);

Description

These routines support the use of LDAP URLs (Uniform Resource Locators), as defined in RFC 1959. LDAP URLs look like this:

ldap://hostport/dn[?attributes[?scope[?filter]]]

where:

hostport
Host name with an optional :portnumber.

dn
Base DN to be used for an LDAP search operation.

attributes
Comma separated list of attributes to be retrieved.

scope
One of the following three strings:

The default is ``base''.

filter
LDAP search filter as used in a call to ldap_search(3ldap).
For example:
   ldap://ldap.itd.umich.edu/c=US?o,description?one?o=umich 
URLs that are wrapped in angle-brackets and/or preceded by ``URL:'' are also tolerated.

ldap_is_ldap_url 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 ldap_url_parse routine should be used if a more thorough check is needed.

ldap_url_parse breaks down an LDAP URL passed in url into its component pieces. If successful, 0 is returned, an LDAP URL description is allocated, filled in, and ludpp is set to point to it. If an error occurs, one of these values is returned:

LDAP_URL_ERR_NOTLDAP
URL doesn't begin with ``ldap://''.

LDAP_URL_ERR_NODN
URL has no DN (required).

LDAP_URL_ERR_BADSCOPE
URL scope string is invalid.

LDAP_URL_ERR_MEM
Can't allocate memory space.
ldap_free_urldesc should be called to free an LDAP URL description that was obtained from a call to ldap_url_parse.

ldap_url_search initiates an asynchronous LDAP search based on the contents of the url string. This routine acts just like ldap_search(3ldap) except that many search parameters are pulled out of the URL.

ldap_url_search_s performs a synchronous LDAP search based on the contents of the url string. This routine acts just like ldap_search_s(3ldap) except that many search parameters are pulled out of the URL.

ldap_url_search_st performs a synchronous LDAP URL search with a specified timeout. This routine acts just like ldap_search_st(3ldap) except that many search parameters are pulled out of the URL.

References

Intro(3ldap), ldap_search(3ldap)

RFC 1959: An LDAP URL Format.


30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.