ldap_explode_dn()--Break a Distinguished Name into Its Components


  Syntax
 
 #include <ldap.h>
 
 char **ldap_explode_dn(
                const char  *dn,
                int          notypes)

  Default Public Authority: *USE

  Library Name/Service Program: QSYS/QGLDCLNT

  Threadsafe: Yes

The ldap_explode_dn() function uses the distinguished name in local codepage returned by ldap_get_dn() and breaks it up into its component parts. Each part is known as a Relative Distinguished Name (RDN). If the dn is in UTF8, use ldap_explode_dn_utf8().

ldap_explode_dn() returns a NULL-terminated array, each component of which contains an RDN from the DN. The notypes parameter is used to request that only the RDN values be returned, not their types.

For example, the distinguished name cn=Bob,c=US would return as either "cn=Bob","c=US",NULL or "Bob","US", NULL depending on whether notypes was 0 or 1, respectively. The result can be freed by calling ldap_value_free().


Authorities and Locks

No IBM® i authority is required.


Parameters

dn
(Input) Specifies the DN to be exploded (as returned from ldap_get_dn()).
notypes
(Input) Specifies if type information is to be returned with each RDN. If non-zero, the type information will be stripped. If zero, the type information is retained. For example, setting notypes to 1 would result in the RDN "cn=Fido" being returned as "Fido".

Return Value

Relative Distinguished Name (RDN)
if the request was successful.

NULL
if the request was not successful.

Error Conditions

If ldap_explode_dn() is not successful, then there was no memory available for either the array or its component parts.


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_explode_dn API.


Related Information


API introduced: V4R3

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