From 9ee8bf83ab1cb53e93111adb64c4a66e607d7115 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 13 Aug 2014 13:38:26 +0200 Subject: BE: Handle SIGUSR2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was possible to send SIGUSR1 and to both sssd and sssd_be processes, but only possible to send SIGUSR2 to sssd. This patches fixes the dichotomy by making the sssd_be process handle SIGUSR2 as well. Reviewed-by: Lukáš Slebodník Reviewed-by: Dan Lavu --- src/man/sssd.8.xml | 12 ++++++++---- src/providers/data_provider_be.c | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml index 0e584cd2..923da682 100644 --- a/src/man/sssd.8.xml +++ b/src/man/sssd.8.xml @@ -170,8 +170,11 @@ SIGUSR1 - Tells the SSSD to simulate offline operation for one - minute. This is mostly useful for testing purposes. + Tells the SSSD to simulate offline operation for the + duration of the offline_timeout + parameter. This is useful for testing. The signal + can be sent to either the sssd process or any sssd_be + process directly. @@ -179,8 +182,9 @@ SIGUSR2 - Tells the SSSD to go online immediately. This is mostly - useful for testing purposes. + Tells the SSSD to go online immediately. This is + useful for testing. The signal can be sent to either + the sssd process or any sssd_be process directly. diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 37d1e28c..a8cfab6d 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -2478,6 +2478,17 @@ static void signal_be_offline(struct tevent_context *ev, be_mark_offline(ctx); } +static void signal_be_reset_offline(struct tevent_context *ev, + struct tevent_signal *se, + int signum, + int count, + void *siginfo, + void *private_data) +{ + struct be_ctx *ctx = talloc_get_type(private_data, struct be_ctx); + check_if_online(ctx); +} + int be_process_init_sudo(struct be_ctx *be_ctx) { TALLOC_CTX *tmp_ctx = NULL; @@ -2766,6 +2777,15 @@ int be_process_init(TALLOC_CTX *mem_ctx, goto fail; } + /* Handle SIGUSR2 to force going online */ + BlockSignals(false, SIGUSR2); + tes = tevent_add_signal(ctx->ev, ctx, SIGUSR2, 0, + signal_be_reset_offline, ctx); + if (tes == NULL) { + ret = EIO; + goto fail; + } + return EOK; fail: -- cgit