From: Andrew Bartlett Date: Fri, 1 Feb 2019 01:22:17 +0000 (+1300) Subject: ldb: Add even more comments on what strict does to the list intersections X-Git-Tag: ldb-1.6.1~259 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7f524fd2128aacb82e980652af8eb6fd275e1a8;p=thirdparty%2Fsamba.git ldb: Add even more comments on what strict does to the list intersections BUG: https://bugzilla.samba.org/show_bug.cgi?id=13762 Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c index 9a4a0db7e74..6d02c91a597 100644 --- a/lib/ldb/ldb_key_value/ldb_kv_index.c +++ b/lib/ldb/ldb_key_value/ldb_kv_index.c @@ -1259,6 +1259,14 @@ static bool list_intersect(struct ldb_context *ldb, return true; } + /* + * In both of the below we check for strict and in that + * case do not optimise the intersection of this list, + * we must never return an entry not in this + * list. This allows the index for + * SCOPE_ONELEVEL to be trusted. + */ + /* the indexing code is allowed to return a longer list than what really matches, as all results are filtered by the full expression at the end - this shortcut avoids a lot of @@ -1660,7 +1668,13 @@ 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 */ + /* + * 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( module, ldb_kv, LDB_KV_IDXONE, parent_dn, list, truncation);