ldap_explode_rdn()

Purpose

Parse a relative distinguished name into an array of attributes

Format

include <ldap.h> 

char ** ldap_explode_rdn(
    const char *               rdn,
    int                        notypes)

Parameters

Input

rdn
Specifies the relative distinguished name as a null-terminated character string in the local EBCDIC code page or UTF-8, as determined by the LDAP_LIBASCII compiler variable.
notypes
Specify 0 (FALSE) if the returned attribute strings should contain the attribute types and the attribute values. Specify 1 (TRUE) if the returned attribute strings should contain just the attribute values.

Usage

The ldap_explode_rdn() routine breaks a relative distinguished name (RDN) into one or more attributes following the rules defined in RFC 2253. The attribute strings contain just the attribute values if notypes is nonzero; otherwise the attribute strings contain both the attribute types and the attributes values. Leading and trailing blanks are removed for each attribute but embedded blanks remain unchanged. Escape sequences are not removed from the attribute values.

Example: "cn=John+sn=Doe "  is parsed as follows:
  • If notypes is nonzero: {"John", "Doe", NULL}
  • If notypes is zero: {"cn=John", "sn=Doe", NULL}

Function return value

The function return value is NULL if an error is detected. Otherwise, it is the address of an array of character strings. The end of the array is indicated by a NULL address. The application should call the ldap_value_free() routine to release the character string array when it is no longer needed.