summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-08-13 13:38:26 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-08-13 15:57:19 +0200
commit9ee8bf83ab1cb53e93111adb64c4a66e607d7115 (patch)
treed28c3c12f9a5af2ebe9125b978dede4f3f335be0
parentef49e1d709c3cbb3eccbc22710964e1ffe2612c9 (diff)
downloadsssd-9ee8bf83ab1cb53e93111adb64c4a66e607d7115.tar.gz
sssd-9ee8bf83ab1cb53e93111adb64c4a66e607d7115.tar.xz
sssd-9ee8bf83ab1cb53e93111adb64c4a66e607d7115.zip
BE: Handle SIGUSR2
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 <lslebodn@redhat.com> Reviewed-by: Dan Lavu <dlavu@redhat.com>
-rw-r--r--src/man/sssd.8.xml12
-rw-r--r--src/providers/data_provider_be.c20
2 files changed, 28 insertions, 4 deletions
diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml
index 0e584cd26..923da6824 100644
--- a/src/man/sssd.8.xml
+++ b/src/man/sssd.8.xml
@@ -170,8 +170,11 @@
<term>SIGUSR1</term>
<listitem>
<para>
- 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 <quote>offline_timeout</quote>
+ parameter. This is useful for testing. The signal
+ can be sent to either the sssd process or any sssd_be
+ process directly.
</para>
</listitem>
</varlistentry>
@@ -179,8 +182,9 @@
<term>SIGUSR2</term>
<listitem>
<para>
- 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.
</para>
</listitem>
</varlistentry>
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index 37d1e28c4..a8cfab6d7 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: