summaryrefslogtreecommitdiffstats
path: root/src/responder
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-06-25 12:33:03 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-07-08 20:38:16 +0200
commitb76419cf8830440b46c20a15585562343c7b1924 (patch)
treeaa7846d57deb98274a1bb49bc67797b20ea86a41 /src/responder
parent0c1d65998907930678da2d091789446f2c344d5d (diff)
downloadsssd-b76419cf8830440b46c20a15585562343c7b1924.tar.gz
sssd-b76419cf8830440b46c20a15585562343c7b1924.tar.xz
sssd-b76419cf8830440b46c20a15585562343c7b1924.zip
IFP: Provide a SBUS method to reconnect to sysbus
Introduces a new method implemented only by the IFP responder. When this method is received, the responder attempts to reconnect to the system bus, if not connected already. Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Pavel Reichl <preichl@redhat.com>
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/autofs/autofssrv.c1
-rw-r--r--src/responder/ifp/ifpsrv.c37
-rw-r--r--src/responder/nss/nsssrv.c3
-rw-r--r--src/responder/pac/pacsrv.c1
-rw-r--r--src/responder/pam/pamsrv.c1
-rw-r--r--src/responder/ssh/sshsrv.c1
-rw-r--r--src/responder/sudo/sudosrv.c1
7 files changed, 44 insertions, 1 deletions
diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c
index 9b5aa02dd..bd5aa135a 100644
--- a/src/responder/autofs/autofssrv.c
+++ b/src/responder/autofs/autofssrv.c
@@ -41,6 +41,7 @@ struct mon_cli_iface monitor_autofs_methods = {
.rotateLogs = responder_logrotate,
.clearMemcache = NULL,
.clearEnumCache = autofs_clean_hash_table,
+ .sysbusReconnect = NULL,
};
static struct data_provider_iface autofs_dp_methods = {
diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index 9014c3e85..4af836543 100644
--- a/src/responder/ifp/ifpsrv.c
+++ b/src/responder/ifp/ifpsrv.c
@@ -44,6 +44,8 @@
#define DEFAULT_ALLOWED_UIDS "0"
+static int ifp_sysbus_reconnect(struct sbus_request *dbus_req, void *data);
+
struct mon_cli_iface monitor_ifp_methods = {
{ &mon_cli_iface_meta, 0 },
.ping = monitor_common_pong,
@@ -52,6 +54,7 @@ struct mon_cli_iface monitor_ifp_methods = {
.goOffline = NULL,
.resetOffline = NULL,
.rotateLogs = responder_logrotate,
+ .sysbusReconnect = ifp_sysbus_reconnect,
};
static struct data_provider_iface ifp_dp_methods = {
@@ -257,6 +260,40 @@ fail:
return ret;
}
+static int ifp_sysbus_reconnect(struct sbus_request *dbus_req, void *data)
+{
+ struct resp_ctx *rctx = talloc_get_type(data, struct resp_ctx);
+ struct ifp_ctx *ifp_ctx = (struct ifp_ctx*) rctx->pvt_ctx;
+ errno_t ret;
+
+ DEBUG(SSSDBG_TRACE_FUNC, "Attempting to reconnect to the system bus\n");
+
+ if (ifp_ctx->sysbus) {
+ DEBUG(SSSDBG_TRACE_LIBS, "Already connected to sysbus\n");
+ goto done;
+ }
+
+ /* Connect to the D-BUS system bus and set up methods */
+ ret = sysbus_init(ifp_ctx, ifp_ctx->rctx->ev,
+ INFOPIPE_IFACE,
+ ifp_ifaces,
+ ifp_ctx, &ifp_ctx->sysbus);
+ if (ret == ERR_NO_SYSBUS) {
+ DEBUG(SSSDBG_MINOR_FAILURE,
+ "The system bus is not available..\n");
+ goto done;
+ } else if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to connect to the system message bus\n");
+ return ret;
+ }
+
+ DEBUG(SSSDBG_TRACE_LIBS, "Reconnected to the system bus!\n");
+
+done:
+ return sbus_request_return_and_finish(dbus_req, DBUS_TYPE_INVALID);
+}
+
int ifp_process_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct confdb_ctx *cdb)
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 1f762cca8..84a6b7fed 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -67,7 +67,8 @@ struct mon_cli_iface monitor_nss_methods = {
.resetOffline = NULL,
.rotateLogs = responder_logrotate,
.clearMemcache = nss_clear_memcache,
- .clearEnumCache = nss_clear_netgroup_hash_table
+ .clearEnumCache = nss_clear_netgroup_hash_table,
+ .sysbusReconnect = NULL,
};
static int nss_clear_memcache(struct sbus_request *dbus_req, void *data)
diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c
index bff15058a..47a9d1a68 100644
--- a/src/responder/pac/pacsrv.c
+++ b/src/responder/pac/pacsrv.c
@@ -58,6 +58,7 @@ struct mon_cli_iface monitor_pac_methods = {
.rotateLogs = responder_logrotate,
.clearMemcache = NULL,
.clearEnumCache = NULL,
+ .sysbusReconnect = NULL,
};
static struct data_provider_iface pac_dp_methods = {
diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c
index 2823f01a0..c0841d2bd 100644
--- a/src/responder/pam/pamsrv.c
+++ b/src/responder/pam/pamsrv.c
@@ -57,6 +57,7 @@ struct mon_cli_iface monitor_pam_methods = {
.rotateLogs = responder_logrotate,
.clearMemcache = NULL,
.clearEnumCache = NULL,
+ .sysbusReconnect = NULL,
};
static struct data_provider_iface pam_dp_methods = {
diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c
index 30142ae0d..8aa603d79 100644
--- a/src/responder/ssh/sshsrv.c
+++ b/src/responder/ssh/sshsrv.c
@@ -38,6 +38,7 @@ struct mon_cli_iface monitor_ssh_methods = {
.rotateLogs = responder_logrotate,
.clearMemcache = NULL,
.clearEnumCache = NULL,
+ .sysbusReconnect = NULL,
};
static struct data_provider_iface ssh_dp_methods = {
diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c
index a70d944a9..cafe9da53 100644
--- a/src/responder/sudo/sudosrv.c
+++ b/src/responder/sudo/sudosrv.c
@@ -38,6 +38,7 @@ struct mon_cli_iface monitor_sudo_methods = {
.rotateLogs = responder_logrotate,
.clearMemcache = NULL,
.clearEnumCache = NULL,
+ .sysbusReconnect = NULL,
};
static struct data_provider_iface sudo_dp_methods = {