summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_index.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_index.c')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index f78d840206..c2a4fb1ea8 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -676,7 +676,8 @@ int ltdb_search_indexed(struct ldb_module *module,
struct dn_list *dn_list;
int ret;
- if (ltdb->cache->indexlist->num_elements == 0) {
+ if (ltdb->cache->indexlist->num_elements == 0 &&
+ scope != LDB_SCOPE_BASE) {
/* no index list? must do full search */
return -1;
}
@@ -686,7 +687,18 @@ int ltdb_search_indexed(struct ldb_module *module,
return -1;
}
- ret = ltdb_index_dn(module, tree, ltdb->cache->indexlist, dn_list);
+ if (scope == LDB_SCOPE_BASE) {
+ /* with BASE searches only one DN can match */
+ char *dn = ldb_dn_linearize(dn_list, base);
+ if (dn == NULL) {
+ return -1;
+ }
+ dn_list->count = 1;
+ dn_list->dn = &dn;
+ ret = 1;
+ } else {
+ ret = ltdb_index_dn(module, tree, ltdb->cache->indexlist, dn_list);
+ }
if (ret == 1) {
/* we've got a candidate list - now filter by the full tree