From e3eec57b06f7e0f7c6c3e4dbbc814db27cc19a25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 20 Jun 2005 05:04:45 +0000 Subject: r7779: use the parent event context in ldb_wrap_connect(). See the comment in the previous commit for the method. (This used to be commit b0ad505510b9df8e7f05fb646046114eb6b997ed) --- source4/lib/db_wrap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) { -- cgit