Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

When an LDAP client needs sorted results and is not able or is unwilling to perform the sort itself, the client can request that the server do it. The Sort control allows the client to give the server the information required to sort the result set.

The client sends the server a search request with the Sort control, which specifies the sort keys. Each sort key consists of an AttributeType, an Ordering Rule, and a flag that indicates whether entries are sorted in forward or reverse order. The server then tells the client whether the sorting operation is successful and returns entries.

Sort is indicated as a control on the ldap_search_extfunction call. To construct this control, the API provides ldap_create_sort_control. The control must then be added to the list of server controls in the ldap_search_extcall. When the server returns the results, it returns a control in the SearchResultDone message to reflect the success or failure of the search. The API provides ldap_parse_search_controlas a method of parsing the Sort control as returned by the server in the SearchResultDone message.

See Also