diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/monitor/monitor_iface.xml | 4 | ||||
-rw-r--r-- | src/monitor/monitor_iface_generated.c | 7 | ||||
-rw-r--r-- | src/monitor/monitor_iface_generated.h | 2 | ||||
-rw-r--r-- | src/providers/data_provider_be.c | 1 | ||||
-rw-r--r-- | src/responder/autofs/autofssrv.c | 1 | ||||
-rw-r--r-- | src/responder/ifp/ifpsrv.c | 37 | ||||
-rw-r--r-- | src/responder/nss/nsssrv.c | 3 | ||||
-rw-r--r-- | src/responder/pac/pacsrv.c | 1 | ||||
-rw-r--r-- | src/responder/pam/pamsrv.c | 1 | ||||
-rw-r--r-- | src/responder/ssh/sshsrv.c | 1 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv.c | 1 |
11 files changed, 58 insertions, 1 deletions
diff --git a/src/monitor/monitor_iface.xml b/src/monitor/monitor_iface.xml index 1f61de5b7..3d0e67f71 100644 --- a/src/monitor/monitor_iface.xml +++ b/src/monitor/monitor_iface.xml @@ -47,5 +47,9 @@ <!-- no arguments, raw handler --> <annotation name="org.freedesktop.sssd.RawHandler" value="true"/> </method> + <method name="sysbusReconnect"> + <!-- no arguments, raw handler --> + <annotation name="org.freedesktop.sssd.RawHandler" value="true"/> + </method> </interface> </node> diff --git a/src/monitor/monitor_iface_generated.c b/src/monitor/monitor_iface_generated.c index ee59242c1..0eee10cae 100644 --- a/src/monitor/monitor_iface_generated.c +++ b/src/monitor/monitor_iface_generated.c @@ -117,6 +117,13 @@ const struct sbus_method_meta mon_cli_iface__methods[] = { offsetof(struct mon_cli_iface, clearEnumCache), NULL, /* no invoker */ }, + { + "sysbusReconnect", /* name */ + NULL, /* no in_args */ + NULL, /* no out_args */ + offsetof(struct mon_cli_iface, sysbusReconnect), + NULL, /* no invoker */ + }, { NULL, } }; diff --git a/src/monitor/monitor_iface_generated.h b/src/monitor/monitor_iface_generated.h index 37e4d480b..f93f11731 100644 --- a/src/monitor/monitor_iface_generated.h +++ b/src/monitor/monitor_iface_generated.h @@ -26,6 +26,7 @@ #define MON_CLI_IFACE_ROTATELOGS "rotateLogs" #define MON_CLI_IFACE_CLEARMEMCACHE "clearMemcache" #define MON_CLI_IFACE_CLEARENUMCACHE "clearEnumCache" +#define MON_CLI_IFACE_SYSBUSRECONNECT "sysbusReconnect" /* ------------------------------------------------------------------------ * DBus handlers @@ -63,6 +64,7 @@ struct mon_cli_iface { sbus_msg_handler_fn rotateLogs; sbus_msg_handler_fn clearMemcache; sbus_msg_handler_fn clearEnumCache; + sbus_msg_handler_fn sysbusReconnect; }; /* ------------------------------------------------------------------------ diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 1982b9315..dbd48b20d 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -69,6 +69,7 @@ struct mon_cli_iface monitor_be_methods = { .rotateLogs = data_provider_logrotate, .clearMemcache = NULL, .clearEnumCache = NULL, + .sysbusReconnect = NULL, }; static int client_registration(struct sbus_request *dbus_req, void *data); 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 = { |