ldap_explode_dn

Breaks a distinguished name into its components.

LDAP Version:v2 or higher
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>
  
  char **ldap_explode_dn (
     const char   *dn,
     int           notypes);
  
  

Parameters

dn

(IN) Points to the distinguished name to explode.

notypes

(IN) Specifies whether the name should include type information:

  • If zero, type information is included, for example "cn=Kim".

  • If non-zero, type information is stripped, for example "cn=Kim" becomes "Kim".

Return Values

>0

Pointer to a character array of components

NULL

Failure

Remarks

The ldap_explode_dn function takes a dn returned by ldap_get_dn and returns a NULL-terminated character array of the components in the name. The components are returned in the order they appear in the dn and are with or without types as indicated by the notypes parameter.

For example, if the dn is "cn=kim,ou=sales,o=myorg", the function returns the following array: {"cn=kim", "ou=sales", "o=myorg", NULL}.

When the array is no longer in use, free the memory by calling the ldap_value_free function.

See Also

ldap_get_dn, ldap_explode_rdn, ldap_dn2ufn