summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2020-02-07 16:56:13 +1300
committerKarolin Seeger <kseeger@samba.org>2020-02-25 19:32:28 +0000
commit81bdcf9ee4e26e7b9d40b26c2195cb6f7a786d80 (patch)
treea466d4f033eee799ffeeef2d38f8ef1cc42a176f
parentc521913e4268b5b406c5439a58b1049d605c45cf (diff)
downloadsamba-81bdcf9ee4e26e7b9d40b26c2195cb6f7a786d80.tar.gz
ldb: Fix search with scope ONE and small result sets
This changes the LDB behaviour in the combination of a SCOPE_ONE search and an index returning less than 10 results. After b6b5b5fe355fee2a4096e9214831cb88c7a2a4c6 the list->strict flag became set to false in all cases, rather than being left to the value set by the caller. This changes the ldb_kv_index_dn_one() code to force strict mode on success instead. Thanks to Marcus Granér, ICEYE Oy for reporting. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14270 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 3c7261c43da491b57f50e0e64d7050d85c6b973e)
-rw-r--r--lib/ldb/ldb_key_value/ldb_kv_index.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c
index 059abef6748..a7e341552ea 100644
--- a/lib/ldb/ldb_key_value/ldb_kv_index.c
+++ b/lib/ldb/ldb_key_value/ldb_kv_index.c
@@ -2113,16 +2113,19 @@ static int ldb_kv_index_dn_one(struct ldb_module *module,
struct dn_list *list,
enum key_truncation *truncation)
{
- /*
- * Ensure we do not shortcut on intersection for this list.
- * We must never be lazy and return an entry not in this
- * list. This allows the index for
- * SCOPE_ONELEVEL to be trusted.
- */
-
- list->strict = true;
- return ldb_kv_index_dn_attr(
+ int ret = ldb_kv_index_dn_attr(
module, ldb_kv, LDB_KV_IDXONE, parent_dn, list, truncation);
+ if (ret == LDB_SUCCESS) {
+ /*
+ * Ensure we do not shortcut on intersection for this
+ * list. We must never be lazy and return an entry
+ * not in this list. This allows the index for
+ * SCOPE_ONELEVEL to be trusted.
+ */
+
+ list->strict = true;
+ }
+ return ret;
}
/*