From 08f3ec77e68e92e6fe8c56b1b29216a436401eda Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Thu, 10 Mar 2016 15:25:44 +1300 Subject: [PATCH 1/2] sort: enable custom behaviour on critical control The sort module should simply return unsorted results when a sort is unsupported but not critical. A similar custom behaviour should be expected with VLV pagination when it is enabled. Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett --- lib/ldb/modules/sort.c | 2 ++ source4/dsdb/samdb/ldb_modules/rootdse.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/ldb/modules/sort.c b/lib/ldb/modules/sort.c index 19cf60b..cb6f8df 100644 --- a/lib/ldb/modules/sort.c +++ b/lib/ldb/modules/sort.c @@ -309,6 +309,8 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req } } + control->critical = 0; + /* We are asked to sort on an attribute, and if that attribute is not already in the search attributes we need to add it (and later remove it on the return journey). diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index ff13458..6a1b8ef 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -701,11 +701,20 @@ static int rootdse_filter_controls(struct ldb_module *module, struct ldb_request continue; } - /* If the control is DIRSYNC control then we keep the critical - * flag as the dirsync module will need to act upon it + /* + * If the control is DIRSYNC, SORT or VLV then we keep the + * critical flag as the modules will need to act upon it. + * + * These modules have to unset the critical flag after the + * request has been seen by the correct module. */ - if (is_registered && strcmp(req->controls[i]->oid, - LDB_CONTROL_DIRSYNC_OID)!= 0) { + if (is_registered && + strcmp(req->controls[i]->oid, + LDB_CONTROL_DIRSYNC_OID) != 0 && + strcmp(req->controls[i]->oid, + LDB_CONTROL_VLV_REQ_OID) != 0 && + strcmp(req->controls[i]->oid, + LDB_CONTROL_SERVER_SORT_OID) != 0) { req->controls[i]->critical = 0; } } -- 1.9.1