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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 4f45fdf376..7883ee6e7b 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -472,9 +472,14 @@ int ltdb_search(struct ldb_module *module, const char *base,
struct ldb_parse_tree *tree;
int ret;
+ if (ltdb_lock_read(module) != 0) {
+ return -1;
+ }
+
ltdb->last_err_string = NULL;
if (ltdb_cache_load(module) != 0) {
+ ltdb_unlock_read(module);
return -1;
}
@@ -484,6 +489,7 @@ int ltdb_search(struct ldb_module *module, const char *base,
tree = ldb_parse_tree(ldb, expression);
if (!tree) {
ltdb->last_err_string = "expression parse failed";
+ ltdb_unlock_read(module);
return -1;
}
@@ -501,6 +507,7 @@ int ltdb_search(struct ldb_module *module, const char *base,
}
ldb_parse_tree_free(ldb, tree);
+ ltdb_unlock_read(module);
return ret;
}