1
votes

Im using Ldap to get the list of users and groups from the active directory. When I apply a filter like "(&(objectClass=user)(samAccountName=L*))" then I get all users with Samaccount name starting with L and the list returned is sorted. Though I did not use any sorting mechanism. Is it that for search filter, it first sorts and then filters the results? Also when I give a filter ""(&(objectClass=user)(samAccountName=*))" I get all users sorted.

But the same thing doesnot work for groups. Can somebody throw some light on this.

Or can some one atlease provide a sample on how to retrieve sorted results from LDAP search using C++

1

1 Answers

1
votes

The order in which entries are returned by the server is not specified by the LDAP protocol and data model, and thus is implementation dependent. Most LDAP directory servers I know would return the entries in their order of creation, but it's not always the case.

LDAP client toolkits support client side sorting. But you can also request Server side sorting with an LDAP Control, if the server supports it.