summaryrefslogtreecommitdiff
path: root/server/providers/ldap/ldap_common.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-11-05 17:00:03 -0500
committerSimo Sorce <ssorce@redhat.com>2009-11-06 17:26:09 -0500
commit1ee2b5ee491eed2bce2df3606a7a570c7ebac8ce (patch)
tree9569072485330f31855d40e58846174a944b706c /server/providers/ldap/ldap_common.c
parenta6706a28c6a48d6d34a3086963bfc519de7d3f68 (diff)
downloadsssd-1ee2b5ee491eed2bce2df3606a7a570c7ebac8ce.tar.gz
sssd-1ee2b5ee491eed2bce2df3606a7a570c7ebac8ce.tar.bz2
sssd-1ee2b5ee491eed2bce2df3606a7a570c7ebac8ce.zip
Reorganize ldap id provider files
Split enum task in a separate file.
Diffstat (limited to 'server/providers/ldap/ldap_common.c')
-rw-r--r--server/providers/ldap/ldap_common.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/server/providers/ldap/ldap_common.c b/server/providers/ldap/ldap_common.c
index f7cdf75e..d8e73f71 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;
+}