summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/common/ldb.c')
-rw-r--r--source4/lib/ldb/common/ldb.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index a743b2f584..29ee323ad4 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -172,13 +172,23 @@ int ldb_search(struct ldb_context *ldb,
const char *expression,
const char * const *attrs, struct ldb_message ***res)
{
- ldb_reset_err_string(ldb);
+ struct ldb_parse_tree *tree;
+ int ret;
+
+ tree = ldb_parse_tree(ldb, expression);
+ if (tree == NULL) {
+ ldb_set_errstring(ldb->modules, talloc_strdup(ldb, "Unable to parse search expression"));
+ return -1;
+ }
+
+ ret = ldb_search_bytree(ldb, base, scope, tree, attrs, res);
+ talloc_free(tree);
- return ldb->modules->ops->search(ldb->modules, base, scope, expression, attrs, res);
+ return ret;
}
/*
- search the database given a LDAP-like search expression
+ search the database given a search tree
return the number of records found, or -1 on error