ldap_get_dn

Returns the distinguished name of an entry from a search result chain.

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_get_dn (
     LDAP          *ld,
     LDAPMessage   *entry);
  
  

Parameters

ld

(IN) Points to the handle for the LDAP session.

entry

(IN) Points to the entry returned by the ldap_first_entry or the ldap_next_entry function.

Return Values

>0

Pointer to the distinguished name of the entry

NULL

Failure to parse the name

Remarks

The ldap_get_dn function takes an entry returned by either the ldap_first_entry or ldap_next_entry function and returns a copy of the entry's dn. It returns a pointer to this newly allocated memory. When you are finished with the name, free the memory with a call to the ldap_memfree function.

The distinguished name is returned in the UTF-8 string format as described in RFC 2253.

See Also

ldap_explode_dn, ldap_explode_rdn, ldap_dn2ufn