Sorts a chain of entries, returned by an LDAP search operation, using either the entries’ DN or a specified array of attributes.
#include <ldap.h> int ldap_multisort_entries ( LDAPMessage *ld LDAPMessage **res char **attrs int (*cmp) (const void *, const void *));
(IN) Points to the handle of the LDAP session.
(IN) Points to a message chain returned by the ldap_result, ldap_search_s, ldap_search_st, or ldap_search_ext_s function.
(IN) Points to the array of attributes to use for sorting. Pass in NULL to sort by distinguished name.
(IN) Points to a function to use for sorting. This function returns an int and has two void pointers for parameters.
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.
ldap_result, ldap_sort_entries, ldap_search_s, ldap_sort_strcasecmp.