Description of problem:
LDAP reports an error "Server does not support sorting", if no entries present in the Suffix DN.
How reproducible: Consistently
Steps to Reproduce:
1. Run a simple paged search for a suffix which doesn't have any entry or give a filter which doesn't match any of entry in the DN.
2. Observe the output of the paged search.
3. It shows "Server does not support sorting".
Expected results: Error message is misleading as Sorting is not implemented.
It's a bug in server side sorting. If the search result candidate is NULL, sort control is not created.
ldapsearch -b "dc=test,dc=com" -x -S "cn" "(cn=*)" dn
ldap_parse_sort_control: Requested LDAP control not found
Created attachment 354770 [details]
git patch file for ldbm_search.c
Fix description: When sort request control is given, even if the search result is NULL, sort response control should be created and passed to the client. This change fixes it.
Reviewed by Rich (Thank you!!)
Pushed to master.
$ git merge paged
ldap/servers/slapd/back-ldbm/ldbm_search.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
$ git push
Counting objects: 13, done.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 891 bytes, done.
Total 7 (delta 5), reused 0 (delta 0)
fa2fd42..35a54ff master -> master
verified - RHEL 4
1. No users in subtree searched:
ldapsearch -x -h hostname.example.com -p 389 -D "cn=Directory Manager" -w Secret -b "ou=Special Users,dc=example,dc=com"
# extended LDIF
# base <ou=Special Users,dc=example,dc=com> with scope sub
# filter: (objectclass=*)
# requesting: ALL
# Special Users, example.com
dn: ou=Special Users,dc=example,dc=com
ou: Special Users
description: Special Administrative Accounts
# search result
result: 0 Success
# numResponses: 2
#perl ./ldapsearch.pl -x -pg 4 "(uid=*)" "dn sn"
# echo $?
Returns no error