ldap_sort_entries

Sorts a chain of entries, returned by an LDAP search operation, using either the entries' DN or a specified attribute.

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>
  
  int ldap_sort_entries (
     LDAP           *ld,
     LDAPMessage   **res,
     char           *attr,
     int     (*cmp) (const void *, const void *));
  
  

Parameters

ld

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

res

(IN) Points to an LDAPMessage containing the results returned by the ldap_result or ldap_search_s function.

attr

(IN) Points to name of the attribute to use for sorting. Pass in NULL to sort by distinguished name.

cmp

(IN) Points to a function to use for sorting. This function returns an int and has two void pointers for parameters.

Return Values

0

LDAP_SUCCESS

-1

Failure.

Remarks

If the function returns failure, use ldap_get_option to check the LDAP_OPT_RESULT_CODE option in the LDAP handle for the error code.

See Also

ldap_result, ldap_search_s, ldap_sort_strcasecmp