summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_search.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_search.c')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 160affd4e7..ca0ae06354 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -465,6 +465,9 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
struct ltdb_private *ltdb = module->private_data;
int ret;
+ if ((base == NULL || base->comp_num == 0) &&
+ (scope == LDB_SCOPE_BASE || scope == LDB_SCOPE_ONELEVEL)) return -1;
+
/* it is important that we handle dn queries this way, and not
via a full db search, otherwise ldb is horribly slow */
if (tree->operation == LDB_OP_EQUALITY &&
@@ -516,6 +519,9 @@ int ltdb_search(struct ldb_module *module, const struct ldb_dn *base,
struct ldb_parse_tree *tree;
int ret;
+ if ((base == NULL || base->comp_num == 0) &&
+ (scope == LDB_SCOPE_BASE || scope == LDB_SCOPE_ONELEVEL)) return -1;
+
/* check if we are looking for a simple dn */
if (scope == LDB_SCOPE_BASE && (expression == NULL || expression[0] == '\0')) {
ret = ltdb_search_dn(module, base, attrs, res);