From 83eefb156ec3ba8cd42886c63af19af8e7bc9b69 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 19 Mar 2009 11:55:13 -0400 Subject: Avoid nested events in confdb --- server/confdb/confdb.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'server/confdb/confdb.c') diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c index eda2d2b41..838a9a737 100644 --- a/server/confdb/confdb.c +++ b/server/confdb/confdb.c @@ -39,6 +39,7 @@ } while(0) struct confdb_ctx { + struct tevent_context *pev; struct ldb_context *ldb; }; @@ -658,7 +659,20 @@ int confdb_init(TALLOC_CTX *mem_ctx, if (!cdb) return ENOMEM; - cdb->ldb = ldb_init(cdb, ev); + /* Because condb calls use sync ldb calls, we create a separate event + * context here. This will prevent the ldb sync calls to start nested + * events. + * NOTE: this means that we *cannot* do async calls and return in confdb + * unless we convert all calls and hook back to the main event context. + */ + + cdb->pev = tevent_context_init(cdb); + if (!cdb->pev) { + talloc_free(cdb); + return EIO; + } + + cdb->ldb = ldb_init(cdb, cdb->pev); if (!cdb->ldb) { talloc_free(cdb); return EIO; -- cgit