ldap_get_dn()

Purpose

Return the distinguished name from the search entry

Format

#include <ldap.h> 

char * ldap_get_dn(
    LDAP *              ld,
    LDAPMessage *       entry)

Parameters

Input

ld
Specifies the LDAP handle.
entry
Specifies a search entry returned by the ldap_first_entry() or ldap_next_entry() routine.

Usage

The ldap_get_dn() routine returns the distinguished name from a search entry.

Function return value

The function return value is the address of the distinguished name for the entry or NULL if an error is detected. The name is returned as a null-terminated character string in UTF-8 or the local EBCDIC code page, as determined by the LDAP_OPT_UTF8_IO option for the LDAP handle. The application should call the ldap_memfree() routine to release the name when it is no longer needed. The ldap_get_errno() routine can be called to obtain the error code when the return value is NULL.

The following are some common errors for this routine:
LDAP_NO_MEMORY
Insufficient storage available.
LDAP_PARAM_ERROR
A parameter is not valid.