GNU/Linux |
RedHat 6.2(Zoot) |
|
![]() |
ldap_url_parse(3) |
![]() |
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
#include
<lber.h>
#include <ldap.h>
int ldap_is_ldap_url( url )
char |
*url; |
int ldap_url_parse( url, ludpp )
char |
*url; |
||||
LDAPURLDesc |
**ludpp; |
typedef struct ldap_url_desc {
*lud_host; |
/* LDAP host to contact */ | ||||||
lud_port; |
/* port on host */ | ||||||
*lud_dn; |
/* base for search */ | ||||||
**lud_attrs; |
/* NULL-terminate list of attributes */ | ||||||
lud_scope; |
/* a valid LDAP_SCOPE_... value */ | ||||||
*lud_filter; |
/* LDAP search filter */ | ||||||
*lud_string; |
/* for internal use only */ |
} LDAPURLDesc;
ldap_free_urldesc( ludp )
LDAPURLDesc |
*ludp; |
int ldap_url_search( ld, url, attrsonly )
LDAP |
*ld; | |||
char |
*url; | |||
int |
attrsonly; |
int ldap_url_search_s( ld, url, attrsonly, res )
LDAP |
*ld; |
||||
char |
*url; |
||||
int |
attrsonly; |
||||
LDAPMessage |
**res; |
int ldap_url_search_st( ld, url, attrsonly, timeout, res )
LDAP |
*ld; |
||||
char |
*url; |
||||
int |
attrsonly; |
||||
struct timeval |
*timeout; | ||||
LDAPMessage |
**res; |
These routines support the use of LDAP URLs (Uniform Resource Locators). LDAP URLs look like this:
ldap://hostport/dn[?attributes[?scope[?filter]]]
where:
hostport is a host name with an optional
":portnumber"
dnis the base DN to be used for an LDAP search operation
attributes is a comma separated list of attributes to be
retrieved
scope is one of these three strings: base one sub
(default=base)
filteris LDAP search filter as used in a call to
ldap_search(3)
e.g., 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, zero 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:
- URL doesn’t begin with "ldap://" |
|||||
- URL has no DN (required) |
- URL scope string is invalid | ||||
- 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(3) 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(3) 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(3) except that many search parameters are pulled out of the URL.
ldap(3), ldap_search(3)
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
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release.
![]() |
ldap_url_parse(3) | ![]() |