summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/db_wrap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c
index 33c2af2851..c277f2d975 100644
--- a/source4/lib/db_wrap.c
+++ b/source4/lib/db_wrap.c
@@ -82,6 +82,8 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
struct ldb_context *ldb;
struct ldb_wrap *w;
int ret;
+ struct event_context *ev;
+
for (w = ldb_list; w; w = w->next) {
if (strcmp(url, w->url) == 0) {
@@ -93,6 +95,14 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
if (ldb == NULL) {
return NULL;
}
+
+ /* we want to use the existing event context if possible. This
+ relies on the fact that in smbd, everything is a child of
+ the main event_context */
+ ev = talloc_find_parent_bytype(mem_ctx, struct event_context);
+ if (ev) {
+ ldb_set_opaque(ldb, "EventContext", ev);
+ }
ret = ldb_connect(ldb, url, flags, options);
if (ret == -1) {