[SSSD] [PATCH] BE: Handle SIGUSR2

Jakub Hrozek jhrozek at redhat.com
Sun Aug 10 18:31:02 UTC 2014


On Sun, Aug 10, 2014 at 07:56:24PM +0200, Jakub Hrozek wrote:
> Hi,
> 
> attached is a small patch for an issue I found while working on the
> non-root SSSD.

let's try attaching the patch now..
-------------- next part --------------
>From fc01114b0a0d4f95ac767782280f8cd44731d23a Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Sun, 10 Aug 2014 19:54:25 +0200
Subject: [PATCH] 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.
---
 src/man/sssd.8.xml               |  9 +++++++--
 src/providers/data_provider_be.c | 20 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml
index 0e584cd2648826ff516eb85665fdb8e46c91a4eb..838a1a670e2f8e0ad6c6d63e11c593f5d2fdb0cf 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 mostly useful for testing purposes.
+                        The signal can be sent either to the sssd process
+                        itself or to any sssd_be process directly.
                     </para>
                 </listitem>
             </varlistentry>
@@ -181,6 +184,8 @@
                     <para>
                         Tells the SSSD to go online immediately. This is mostly
                         useful for testing purposes.
+                        The signal can be sent either to the sssd process
+                        itself or to 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 37d1e28c4ca9ae1733496d9bf2b4a955c1896b3a..a8cfab6d766a4868894dc39cdf50d245bbbe7ac8 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:
-- 
1.9.3



More information about the sssd-devel mailing list