ldap_url_parse()--Parse an LDAP URL
Syntax
#include <ldap.h> typedef struct ldap_url_desc { char *lud_host; /* LDAP host to contact */ int lud_port; /* port on host */ char *lud_dn; /* base for search */ char **lud_attrs; /* NULL-terminate list of attributes */ int lud_scope; /* a valid LDAP_SCOPE_... value */ char *lud_filter; /* LDAP search filter */ char *lud_string; /* for internal use only */ } LDAPURLDesc; int ldap_url_parse( char *url, LDAPURLDesc **ludpp)
Default Public Authority: *USE
Library Name/Service Program: QSYS/QGLDCLNT
Threadsafe: Yes
The ldap_url_parse() function breaks down the LDAP URL passed in url into its component pieces. The URLs passed in to ldap_url_parse() must be in the local codepage. Use ldap_url_parse_utf8() for UTF-8 URLs.
The LDAPURLDesc structure returned by this API should be freed with ldap_free_urldesc().
This routine supports the use of LDAP URLs (Uniform Resource Locators). Supported LDAP URLs look like this, where sections in brackets are optional:
ldap[s]://[hostport][/[dn[?[attributes][?[scope][?[filter]]]]]]
where:
- hostport is a host name with an optional ":portnumber"
- dn is 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)
- filter is LDAP search filter as used in a call to ldap_search
For example:
ldap://example.ibm.com/c=US?o,description?one?o=ibm
URLs that are wrapped in angle-brackets and/or preceded by "URL:" are also tolerated, including the form url:ldapurl.
For example:
URL:ldaps://example.ibm.com/c=US?o,description?one?o=ibm
This form also is allowed: <url:ldapurl>
For example:
<URL:ldap://example.ibm.com/c=US?o,description?one?o=ibm>
Authorities and Locks
No IBM® i authority is required.
Parameters
- url
- (Input) Specifies a pointer to the URL string.
- ludpp
- (Output) This result parameter will be set to a LDAPURLDesc structure containing the parsed URL.
Return Value
- LDAP_SUCCESS
- If successful, an LDAP URL description is allocated, filled in, and
ludpp is set to point to it.
- other LDAP Error code
- If an error occurs, one of these values is returned:
LDAP_URL_ERR_NOTLDAP URL doesn't begin with "ldap://" LDAP_URL_ERR_BADSCOPE URL scope string is invalid LDAP_URL_ERR_MEM can't allocate memory space
Error Messages
The following message may be sent from this function.
Message ID | Error Message Text |
---|---|
CPF3CF2 E | Error(s) occurred during running of ldap_url_parse API. |
Related Information
- ldap_free_urldesc() -- Frees an LDAP URL description.
- ldap_is_ldap_url() -- Check a URL string to see if it is an LDAP URL.
- ldap_url_parse_utf8() -- Parse a UTF8 codepage LDAP URL string
- ldap_url_search() -- Asynchronously search using an LDAP URL.
- ldap_url_search_s() -- Synchronously search using an LDAP URL.
- ldap_url_search_st() -- Synchronously search using an LDAP URL and a timeout.
API introduced: V4R3
[ Back to top | LDAP APIs | APIs by category ]