TODO: We need an error_string parameter
*/
struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
struct loadparm_context *lp_ctx,
const char *url,
struct auth_session_info *session_info,
{
struct ldb_context *ldb;
int ret;
- struct event_context *ev;
char *real_url = NULL;
size_t *startup_blocks;
ldb_set_modules_dir(ldb,
talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
- /* 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 = event_context_find(ldb);
+ if (ev == NULL) {
+ ev = event_context_find(mem_ctx);
+ }
if (ldb_set_opaque(ldb, "EventContext", ev)) {
talloc_free(ldb);