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:

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



API introduced: V4R3

[ Back to top | LDAP APIs | APIs by category ]