summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-06-10 10:33:53 +1000
committerAndrew Tridgell <tridge@samba.org>2009-06-10 10:33:53 +1000
commit6836b16ddac590b9cb23c4c5497aacd3bc371968 (patch)
tree8336e32c777041fe5bdd0d44905ae0024d31e685 /source4/lib/ldb
parent48dbfc89cf532704a0e2fedff828a0a48476053f (diff)
downloadsamba-6836b16ddac590b9cb23c4c5497aacd3bc371968.tar.gz
samba-6836b16ddac590b9cb23c4c5497aacd3bc371968.tar.bz2
samba-6836b16ddac590b9cb23c4c5497aacd3bc371968.zip
fixed server side sort control
when sorting a record that does not have the requested sort attribute then put those records last in the sort result
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/modules/sort.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c
index b4f76e1007..a95a86140c 100644
--- a/source4/lib/ldb/modules/sort.c
+++ b/source4/lib/ldb/modules/sort.c
@@ -117,10 +117,13 @@ static int sort_compare(struct ldb_message **msg1, struct ldb_message **msg2, vo
el1 = ldb_msg_find_element(*msg1, ac->attributeName);
el2 = ldb_msg_find_element(*msg2, ac->attributeName);
- if (!el1 || !el2) {
- /* the attribute was not found return and
- * set an error */
- ac->sort_result = LDB_ERR_UNWILLING_TO_PERFORM;
+ if (!el1 && el2) {
+ return 1;
+ }
+ if (el1 && !el2) {
+ return -1;
+ }
+ if (!el1 && !el2) {
return 0;
}