ldap_url_parse

Parses the specified URL into its components.

LDAP Version:v3
Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_url_parse (
     const char     *url,
     LDAPURLDesc   **ludpp);
  
  

Parameters

url

(IN) Points to the URL that you want to parse.

ludpp

(OUT) Points to an LDAPURLDesc structure that contains the components of the URL.

Return Values

This function does not return a standard LDAP error code. It returns one of the following:

0x00

LDAP_URL_SUCCESS

Non-zero

Failure

0x01

LDAP_URL_ERR_MEM—can't allocate memory space

0x02

LDAP_URL_ERR_PARAM—invalid parameter

0x03

LDAP_URL_ERR_NOTLDAP—URL doesn't begin with "ldap[s]://"

0x04

LDAP_URL_ERR_BADENCLOSURE—URL is missing trailing ">"

0x05

LDAP_URL_ERR_BADURL—invalid URL

0x06

LDAP_URL_ERR_BADHOST—host port is invalid

0x07

LDAP_URL_ERR_BADATTRS—invalid or missing attributes

0x08

LDAP_URL_ERR_BADSCOPE—invalid or missing scope string

0x09

LDAP_URL_ERR_BADFILTER—invalid or missing filter

0x0A

LDAP_URL_ERR_BADEXTS—invalid or missing extensions

Remarks

Since this function does not return a standard LDAP error code, you should not call ldap_err2string to parse the return code.

ldap_url_parse_ext performs a similar function, but handles default values differently. ldap_url_parse_ext is better suited for situations where you must convert an LDAPURLDesc structure back to a URL string, retaining the original form of the string.

The following lists describes how each field in the LDAPURLDesc structure is determined from the LDAP URL:

See Also

ldap_free_urldesc, ldap_url_parse_ext