From 1ee2b5ee491eed2bce2df3606a7a570c7ebac8ce Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 5 Nov 2009 17:00:03 -0500 Subject: Reorganize ldap id provider files Split enum task in a separate file. --- server/providers/ldap/ldap_common.c | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'server/providers/ldap/ldap_common.c') diff --git a/server/providers/ldap/ldap_common.c b/server/providers/ldap/ldap_common.c index f7cdf75e4..d8e73f71f 100644 --- a/server/providers/ldap/ldap_common.c +++ b/server/providers/ldap/ldap_common.c @@ -264,3 +264,44 @@ void sdap_handler_done(struct be_req *req, int dp_err, return req->fn(req, dp_err, error, errstr); } +bool sdap_connected(struct sdap_id_ctx *ctx) +{ + if (ctx->gsh) { + return ctx->gsh->connected; + } + + return false; +} + +void sdap_mark_offline(struct sdap_id_ctx *ctx) +{ + if (ctx->gsh) { + /* make sure we mark the connection as gone when we go offline so that + * we do not try to reuse a bad connection by mistale later */ + talloc_zfree(ctx->gsh); + } + + be_mark_offline(ctx->be); +} + + +int sdap_id_setup_tasks(struct sdap_id_ctx *ctx) +{ + struct tevent_timer *enum_task; + int ret = EOK; + + /* set up enumeration task */ + if (ctx->be->domain->enumerate) { + /* run the first one in a couple of seconds so that we have time to + * finish initializations first*/ + ctx->last_run = tevent_timeval_current_ofs(2, 0); + enum_task = tevent_add_timer(ctx->be->ev, ctx, ctx->last_run, + ldap_id_enumerate, ctx); + if (!enum_task) { + DEBUG(0, ("FATAL: failed to setup enumeration task!\n")); + ret = EFAULT; + } + } + + return ret; +} -- cgit