From 6836b16ddac590b9cb23c4c5497aacd3bc371968 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 10 Jun 2009 10:33:53 +1000 Subject: 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 --- source4/lib/ldb/modules/sort.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source4') 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; } -- cgit