r7779: use the parent event context in ldb_wrap_connect(). See the comment in
authorAndrew Tridgell <tridge@samba.org>
Mon, 20 Jun 2005 05:04:45 +0000 (05:04 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:35 +0000 (13:18 -0500)
the previous commit for the method.
(This used to be commit b0ad505510b9df8e7f05fb646046114eb6b997ed)

source4/lib/db_wrap.c

index 33c2af28515460218096bae2f58706b7f6a58f48..c277f2d9752beb7dd6b9b5b7f79eab68c25b6b5b 100644 (file)
@@ -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) {