Sorts a chain of entries, returned by an LDAP search operation, using either the entries' DN or a specified attribute.
#include <ldap.h>
int ldap_sort_entries (
LDAP *ld,
LDAPMessage **res,
char *attr,
int (*cmp) (const void *, const void *));
(IN) Points to the handle of the LDAP session.
(IN) Points to an LDAPMessage containing the results returned by the ldap_result or ldap_search_s function.
(IN) Points to name of the attribute 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.