From 78e4441f0f8692bfb7e460de90f65f3f143835c9 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Tue, 18 May 2010 12:18:13 +0200 Subject: [PATCH 10/10] Add offline callback to disconnect global SDAP handle --- src/providers/ipa/ipa_init.c | 7 +++++++ src/providers/ldap/ldap_common.c | 10 +++++++++- src/providers/ldap/ldap_common.h | 1 + src/providers/ldap/ldap_init.c | 7 +++++++ 4 files changed, 24 insertions(+), 1 deletions(-) diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c index 59e479e..f3fa610 100644 --- a/src/providers/ipa/ipa_init.c +++ b/src/providers/ipa/ipa_init.c @@ -175,6 +175,13 @@ int sssm_ipa_id_init(struct be_ctx *bectx, goto done; } + ret = be_add_offline_cb(ctx, bectx, sdap_gsh_disconnect_callback, ctx, + NULL); + if (ret != EOK) { + DEBUG(1, ("be_add_offline_cb failed.\n")); + goto done; + } + ret = sdap_id_setup_tasks(ctx); if (ret != EOK) { goto done; diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index 697971d..5beb2e6 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -6,7 +6,7 @@ Authors: Simo Sorce - Copyright (C) 2008-2009 Red Hat + Copyright (C) 2008-2010 Red Hat This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -675,3 +675,11 @@ done: return ret; } +void sdap_gsh_disconnect_callback(void *pvt) +{ + struct sdap_id_ctx *ctx = talloc_get_type(pvt, struct sdap_id_ctx); + + if (ctx->gsh) { + ctx->gsh->connected = false; + } +} diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h index 2fec7e2..1ee7378 100644 --- a/src/providers/ldap/ldap_common.h +++ b/src/providers/ldap/ldap_common.h @@ -117,4 +117,5 @@ int groups_get_recv(struct tevent_req *req); /* setup child logging */ int setup_child(struct sdap_id_ctx *ctx); +void sdap_gsh_disconnect_callback(void *pvt); #endif /* _LDAP_COMMON_H_ */ diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c index 396dbfd..5c6f4b7 100644 --- a/src/providers/ldap/ldap_init.c +++ b/src/providers/ldap/ldap_init.c @@ -105,6 +105,13 @@ int sssm_ldap_id_init(struct be_ctx *bectx, goto done; } + ret = be_add_offline_cb(ctx, bectx, sdap_gsh_disconnect_callback, ctx, + NULL); + if (ret != EOK) { + DEBUG(1, ("be_add_offline_cb failed.\n")); + goto done; + } + ret = sdap_id_setup_tasks(ctx); if (ret != EOK) { goto done; -- 1.6.6.1