ldap_multisort_entries

Sorts a chain of entries, returned by an LDAP search operation, using either the entries’ DN or a specified array of attributes.

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

Parameters

ld

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

res

(IN) Points to a message chain returned by the ldap_result, ldap_search_s, ldap_search_st, or ldap_search_ext_s function.

attrs

(IN) Points to the array of attributes 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

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.

The sorting order is not well defined when attributes have multiple values. The number of values and the order in which they are received affect the sorting order. For consistent results, use this function with attributes containing single values.

See Also

ldap_result, ldap_sort_entries, ldap_search_s, ldap_sort_strcasecmp.