ldap_first_entry

Returns a pointer to the first entry of message type, LDAP_RES_SEARCH_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>
  
  LDAPMessage *ldap_first_entry (
     LDAP          *ld,
     LDAPMessage   *res);
  
  

Parameters

ld

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

res

(IN) Points to the result chain returned by the ldap_result function or a synchronous search function.

Return Values

NULL

No more entries in the chain or failure

>0

Pointer to the next entry in the chain

Remarks

The ldap_first_entry function parses the results received from the ldap_result, the ldap_search_s, the ldap_search_ext_s, or the ldap_search_st functions.

If the ldap_first_entry function encounters an error, the function returns NULL and sets the LDAP_OPT_RESULT_CODE option in the LDAP session handle.

Use the ldap_get_dn, ldap_first_attribute, ldap_get_values functions to retrieve information about the entry.

Use the value returned by the ldap_first_entry function as the entry parameter for the ldap_next_entry function to retrieve the next entry.

See Also

ldap_next_entry, ldap_count_entries, ldap_search, ldap_search_ext, ldap_search_ext_s, ldap_search_s, ldap_search_st