From: Andrew Tridgell Date: Wed, 10 Jun 2009 00:33:53 +0000 (+1000) Subject: fixed server side sort control X-Git-Tag: tdb-1.1.5~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6836b16ddac590b9cb23c4c5497aacd3bc371968;p=thirdparty%2Fsamba.git 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 --- diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c index b4f76e1007a..a95a86140c4 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; }