[SSSD] [PATCH] Retry system bus connection once messagebus is up

Jakub Hrozek jhrozek at redhat.com
Wed Jul 2 08:36:28 UTC 2014


On Tue, Jul 01, 2014 at 10:34:11AM +0200, Pavel Březina wrote:
> On 06/25/2014 01:32 PM, Jakub Hrozek wrote:
> >Hi,
> >
> >the attached (unpolished, see my question below) patches fix
> >https://fedorahosted.org/sssd/ticket/2360
> >also known as:
> >https://bugzilla.redhat.com/show_bug.cgi?id=1110369
> >
> >Let me explain the problem first -- if SSSD starts before messagebus is
> >up, the InfoPipe responder fails to start and doesn't retry, so the
> >system bus service is simply not there.
> >
> >A simple solution would be to start messagebus before SSSD. But I don't
> >think that is a robust solution, because the messagebus configuration
> >can reference user names, which the SSSD provides. So at the time
> >messagebus is up, the identities should be resolvable -- which means the
> >NSS responder and the back ends must be up.
> >
> >The attached patches take advantage of bus activation messagebus
> >provides. If the interface InfoPipe provides is not registered on the
> >bus when requested, messagebus signals the sssd, which tells the IFP
> >responder to retry the system bus connection.
> 
> The patches looks good to me. Do you also plan error counter so we can fail
> if we can't establish the connection for a longer time?

No, currently the IFP responder only tries once and if it fails, it
doesn't retry until the bus activation.

> 
> >
> >Currently, the WIP patches use sss_debuglevel which sends HUP to the
> >sssd process, but I think USR2 (aka "go online") would be better. So the
> >final patch version would include a helper binary that would do nothing
> >but singal the monitor..
> 
> >I have one question to discuss though.. is it OK to use signals for the
> >IPC? An alternative might be to let IFP spawn a client socket and implement
> >only a single 'command' to retry the connection. But that seems like an
> >overkill to me. The disadvantage of the signal is that it's also used to
> >reset the online status so in theory there might be some timeouts in the
> >offline case, though.
> 
> I think semantics of "go online" signal is exactly what we want here. We can
> also send USR2 directly to the ifp responder to avoid possible timeouts.

I think so too, but I was thinking about the following scenario:
    1) sssd_nss, sssd_pam and sssd_be start up early. Network is not yet
      up
    2) some service started after sssd resolves a sssd user. sssd tries
      to connect, which might take some time depending on the conditions
      and eventually sssd goes offline
    3) messagebus starts up, resets the offline status
    4) another service does 2) all over again
    ....
    N) network is finally up

But I think this won't be a problem at least in the general case because
most services user local UNIX users anyway and even if sssd was queried,
the timeouts during boot would be quite fast because /etc/resolv.conf
would be empty before NM/dhcpd starts.

> 
> >In the 1.13 timeframe, we will be implementing socket-based activation.
> >I think it would be nice to make the IFP responder bus-activated as part
> >of that effort. But in the traditional schema where monitor manages all
> >the processes, the changes to make InfoPipe bus-activated instead of
> >managed by the monitor would be too invasive (I've tried to do that
> >yesterday..)
> 
> I agree.

I will start a separate thread also with #2351 in mind.

New patches are attached, this time I consider them ready for review, so
I'll remove the RFC tag.
-------------- next part --------------
>From 5487a67d48bb5224482a8bfaa7cfa6c1e6794185 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 24 Jun 2014 13:54:36 +0200
Subject: [PATCH 1/7] BUILD: dbusintrospectdir is not used anymore

We fprintf the introspection data on demand rather than printing an XML
file. The directory specification can be removed.
---
 Makefile.am | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1c423fc6d40754852a9775dc72016703e398f17c..bd8de4f785450c7c80f3946d223f32b836777e9c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -44,7 +44,6 @@ endif
 sssdconfdir = $(sysconfdir)/sssd
 sssddatadir = $(datadir)/sssd
 sssdapiplugindir = $(sssddatadir)/sssd.api.d
-dbusintrospectdir = $(datarootdir)/sssd/introspect
 dbuspolicydir = $(sysconfdir)/dbus-1/system.d
 localedir = @localedir@
 nsslibdir = @nsslibdir@
@@ -348,7 +347,6 @@ AM_CPPFLAGS = \
     -DVARDIR=\"$(localstatedir)\" \
     -DSHLIBEXT=\"$(SHLIBEXT)\" \
     -DSSSD_LIBEXEC_PATH=\"$(sssdlibexecdir)\" \
-    -DSSSD_INTROSPECT_PATH=\"$(dbusintrospectdir)\" \
     -DSSSD_CONF_DIR=\"$(sssdconfdir)\" \
     -DSSS_NSS_MCACHE_DIR=\"$(mcpath)\" \
     -DSSS_NSS_SOCKET_NAME=\"$(pipepath)/nss\" \
@@ -2523,7 +2521,6 @@ installsssddirs::
     $(DESTDIR)$(mandir) \
     $(DESTDIR)$(pluginpath) \
     $(DESTDIR)$(libdir)/ldb \
-    $(DESTDIR)$(dbusintrospectdir) \
     $(DESTDIR)$(dbuspolicydir) \
     $(DESTDIR)$(pipepath)/private \
     $(DESTDIR)$(sssdlibdir) \
-- 
1.9.3

-------------- next part --------------
>From 5c2107ab5ca18a05375e167b989b0311efdd15f4 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 24 Jun 2014 14:24:42 +0200
Subject: [PATCH 2/7] IFP: Fix DEBUG messages

The DEBUG messages in the IFP responder predated Nikolai's mass-patches
and were not converted correctly.
---
 src/responder/ifp/ifpsrv.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index 8613504b45168a830b0dcda35c6f457676a961b4..5dc5652b69e725881486dd9e85482e53ef3bb332 100644
--- a/src/responder/ifp/ifpsrv.c
+++ b/src/responder/ifp/ifpsrv.c
@@ -190,7 +190,8 @@ sysbus_init(TALLOC_CTX *mem_ctx,
     conn = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error);
     if (conn == NULL) {
         DEBUG(SSSDBG_CRIT_FAILURE,
-              ("Failed to connect to D-BUS system bus.\n"));
+              "Failed to connect to D-BUS system bus: [%s]\n",
+              dbus_error.message);
         ret = EIO;
         goto fail;
     }
@@ -203,7 +204,8 @@ sysbus_init(TALLOC_CTX *mem_ctx,
     if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
         /* We were unable to register on the system bus */
         DEBUG(SSSDBG_CRIT_FAILURE,
-              ("Unable to request name on the system bus.\n"));
+              "Unable to request name on the system bus: [%s]\n",
+              dbus_error.message);
         ret = EIO;
         goto fail;
     }
@@ -306,7 +308,7 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
                             CONFDB_IFP_CONF_ENTRY, CONFDB_SERVICE_ALLOWED_UIDS,
                             DEFAULT_ALLOWED_UIDS, &uid_str);
     if (ret != EOK) {
-        DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to get allowed UIDs.\n"));
+        DEBUG(SSSDBG_FATAL_FAILURE, "Failed to get allowed UIDs.\n");
         goto fail;
     }
 
@@ -315,7 +317,7 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
                                   &ifp_ctx->rctx->allowed_uids);
     talloc_free(uid_str);
     if (ret != EOK) {
-        DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to set allowed UIDs.\n"));
+        DEBUG(SSSDBG_FATAL_FAILURE, "Failed to set allowed UIDs.\n");
         goto fail;
     }
 
@@ -329,7 +331,7 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
 
     ret = sss_ncache_init(rctx, &ifp_ctx->ncache);
     if (ret != EOK) {
-        DEBUG(SSSDBG_CRIT_FAILURE, ("fatal error initializing negcache\n"));
+        DEBUG(SSSDBG_CRIT_FAILURE, "fatal error initializing negcache\n");
         goto fail;
     }
 
@@ -337,7 +339,7 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
                             CONFDB_IFP_CONF_ENTRY, CONFDB_IFP_USER_ATTR_LIST,
                             NULL, &attr_list_str);
     if (ret != EOK) {
-        DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to get allowed UIDs.\n"));
+        DEBUG(SSSDBG_FATAL_FAILURE, "Failed to get allowed UIDs.\n");
         goto fail;
     }
 
@@ -345,7 +347,7 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
     talloc_free(attr_list_str);
     if (ifp_ctx->user_whitelist == NULL) {
         DEBUG(SSSDBG_FATAL_FAILURE,
-              ("Failed to parse the allowed attribute list\n"));
+              "Failed to parse the allowed attribute list\n");
         goto fail;
     }
 
-- 
1.9.3

-------------- next part --------------
>From e9d55b0da86372e0b688c3cf24959be05e8c35f6 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 24 Jun 2014 14:28:51 +0200
Subject: [PATCH 3/7] IFP: Return a specific value on failure connecting to the
 system bus

We need to treat the failure to connect to the system bus as non-fatal.
In this commit, we introduce a special error code and only print a DEBUG
message when this error code is returned from the startup function.
---
 src/responder/ifp/ifpsrv.c | 8 ++++++--
 src/util/util_errors.c     | 1 +
 src/util/util_errors.h     | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index 5dc5652b69e725881486dd9e85482e53ef3bb332..9014c3e8565d9f591e0805b2792c13c9ed6790ad 100644
--- a/src/responder/ifp/ifpsrv.c
+++ b/src/responder/ifp/ifpsrv.c
@@ -192,7 +192,7 @@ sysbus_init(TALLOC_CTX *mem_ctx,
         DEBUG(SSSDBG_CRIT_FAILURE,
               "Failed to connect to D-BUS system bus: [%s]\n",
               dbus_error.message);
-        ret = EIO;
+        ret = ERR_NO_SYSBUS;
         goto fail;
     }
     dbus_connection_set_exit_on_disconnect(conn, FALSE);
@@ -372,7 +372,11 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
                       INFOPIPE_IFACE,
                       ifp_ifaces,
                       ifp_ctx, &ifp_ctx->sysbus);
-    if (ret != EOK) {
+    if (ret == ERR_NO_SYSBUS) {
+        DEBUG(SSSDBG_MINOR_FAILURE,
+              "The system bus is not available..\n");
+        /* Explicitly ignore, the D-Bus daemon will start us */
+    } else if (ret != EOK) {
         DEBUG(SSSDBG_CRIT_FAILURE,
               "Failed to connect to the system message bus\n");
         talloc_free(ifp_ctx);
diff --git a/src/util/util_errors.c b/src/util/util_errors.c
index 113567423007cb39d3314ddfad9ba168fddb4f63..aa5693190ce9a73cd9d46a96d0c071e802a0dff2 100644
--- a/src/util/util_errors.c
+++ b/src/util/util_errors.c
@@ -60,6 +60,7 @@ struct err_string error_to_str[] = {
     { "Bus message has no sender" }, /* ERR_SBUS_NO_SENDER */
     { "User/Group SIDs not found" }, /* ERR_NO_SIDS */
     { "Bus method not supported" }, /* ERR_SBUS_NOSUP */
+    { "Cannot connect to system bus" }, /* ERR_NO_SYSBUS */
 };
 
 
diff --git a/src/util/util_errors.h b/src/util/util_errors.h
index b88c7969bea90208ccb61cc1240b181cc0330774..f68409eedba0c6cf5d4883c35b59f68deb1d7a01 100644
--- a/src/util/util_errors.h
+++ b/src/util/util_errors.h
@@ -82,6 +82,7 @@ enum sssd_errors {
     ERR_SBUS_NO_SENDER,
     ERR_NO_SIDS,
     ERR_SBUS_NOSUP,
+    ERR_NO_SYSBUS,
     ERR_LAST            /* ALWAYS LAST */
 };
 
-- 
1.9.3

-------------- next part --------------
>From e2aad265be8ee22e3c8d954ea3281604d9370802 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 25 Jun 2014 12:33:03 +0200
Subject: [PATCH 4/7] 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.
---
 src/monitor/monitor_iface.xml         |  4 ++++
 src/monitor/monitor_iface_generated.c |  7 +++++++
 src/monitor/monitor_iface_generated.h |  2 ++
 src/providers/data_provider_be.c      |  1 +
 src/responder/autofs/autofssrv.c      |  1 +
 src/responder/ifp/ifpsrv.c            | 32 ++++++++++++++++++++++++++++++++
 src/responder/nss/nsssrv.c            |  3 ++-
 src/responder/pac/pacsrv.c            |  1 +
 src/responder/pam/pamsrv.c            |  1 +
 src/responder/ssh/sshsrv.c            |  1 +
 src/responder/sudo/sudosrv.c          |  1 +
 11 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/src/monitor/monitor_iface.xml b/src/monitor/monitor_iface.xml
index 1f61de5b72f92cd335f6c05a9cdbdb315314c640..3d0e67f7147f4f824b6cb367564c756a21256a34 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 ee59242c1bc3b7b30fb5e086a142aedd6be71319..0eee10caefdf137e442e7c658436813d01025035 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 37e4d480b6be4433bc591b6e43195e9278fe3e04..f93f11731043898142cc05ff904a18cbeddc63fd 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 1982b93153637dfbe311c438230f3aa07466c289..dbd48b20d5e730df87884c325d312e95d3061de4 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 9b5aa02dd53772a569da71a79e600dfa2ba5f1ef..bd5aa135a3fb64a020e74a9dd39fa1b67dc76533 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 9014c3e8565d9f591e0805b2792c13c9ed6790ad..be72fbcdedbbaab80bca81dace0a091d09938be9 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,35 @@ 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;
+
+    if (ifp_ctx->sysbus) {
+        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;
+    }
+
+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 1f762cca83083c911e2619263c7d89e267a34d61..84a6b7fedd096a7d4159b7ac6670820c1d8fd941 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 bff15058a2092677441812c73117387afd125600..47a9d1a68fbf1615277af41cef297b4955e7f7c3 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 2823f01a0c15c5c468c5b1177c1c3b2844c25e4c..c0841d2bdbe1a5aa6c5f35ef77c441c5d6103fb1 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 30142ae0d8f57f86c76dd85f25020b599d90bbdf..8aa603d79dddb327606f02d9e7ddf2b18a98e700 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 a70d944a9e06a3236c85aff56c06c39b6888dac0..cafe9da53f0f1833ff2b1abee0801f6197267342 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 = {
-- 
1.9.3

-------------- next part --------------
>From 3aeae7760608af8476d41cc4a4bdb5e08a317dd3 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 25 Jun 2014 12:42:30 +0200
Subject: [PATCH 5/7] MONITOR: Signal InfoPipe to reconnect on SIGUSR2

When the monitor receives SIGUSR2, it also signals the IFP responder to
attempt to reconnect to the system bus using the sysbusReconnect SBUS
method. No action is taken by other responders.
---
 src/monitor/monitor.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 5e6eb37fdbf30c4079b309d98a1b05fdffdf65c7..5feba706af63e579403296329e3275c7ba8c12e9 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -759,6 +759,10 @@ static int service_signal_clear_enum_cache(struct mt_svc *svc)
 {
     return service_signal(svc, MON_CLI_IFACE_CLEARENUMCACHE);
 }
+static int service_signal_sysbus_reconnect(struct mt_svc *svc)
+{
+    return service_signal(svc, MON_CLI_IFACE_SYSBUSRECONNECT);
+}
 
 static int check_domain_ranges(struct sss_domain_info *domains)
 {
@@ -1351,6 +1355,7 @@ static void monitor_hup(struct tevent_context *ev,
         if (!strcmp(SSS_AUTOFS_SBUS_SERVICE_NAME, cur_svc->name)) {
             service_signal_clear_enum_cache(cur_svc);
         }
+
     }
 
 }
@@ -1539,6 +1544,10 @@ static void signal_offline_reset(struct tevent_context *ev,
         if (cur_svc->provider) {
             service_signal_reset_offline(cur_svc);
         }
+
+        if (strcmp(SSS_IFP_SBUS_SERVICE_NAME, cur_svc->name) == 0) {
+            service_signal_sysbus_reconnect(cur_svc);
+        }
     }
     signal_res_init(monitor);
 }
-- 
1.9.3

-------------- next part --------------
>From bf3249a4f9aaff1d03200aebeb64e49a39b046ec Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Fri, 27 Jun 2014 17:24:16 +0200
Subject: [PATCH 6/7] TOOLS: New helper tool sss_signal

A minimal tool whose only purpose is to signal the monitor with
SIGUSR2. The tool will be executed by the system bus in order to provide
system activation, so it's packaged in libexec.
---
 Makefile.am            | 13 ++++++++++++-
 contrib/sssd.spec.in   |  1 +
 src/tools/sss_signal.c | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 src/tools/sss_signal.c

diff --git a/Makefile.am b/Makefile.am
index bd8de4f785450c7c80f3946d223f32b836777e9c..8c21e88f5cfe4b5b909e6c79b9d5bd9b53e42f28 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -107,7 +107,9 @@ sssdlibexec_PROGRAMS = \
     sssd_be \
     krb5_child \
     ldap_child \
-    proxy_child
+    proxy_child \
+    sss_signal \
+    $(NULL)
 if BUILD_SUDO
 sssdlibexec_PROGRAMS += sssd_sudo
 endif
@@ -1046,6 +1048,15 @@ sss_seed_LDADD = \
     $(TOOLS_LIBS) \
     $(SSSD_INTERNAL_LTLIBS)
 
+sss_signal_SOURCES = \
+    src/tools/sss_signal.c \
+    $(SSSD_TOOLS_OBJ) \
+    $(NULL)
+sss_signal_LDADD = \
+    $(TOOLS_LIBS) \
+    $(SSSD_INTERNAL_LTLIBS) \
+    $(NULL)
+
 if BUILD_SUDO
 sss_sudo_cli_SOURCES = \
     src/sss_client/common.c \
diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in
index 2b8bac993954050365ae0937c03ac5f43311d271..86a603925fc6837fab118563d1bd90c6909d4746 100644
--- a/contrib/sssd.spec.in
+++ b/contrib/sssd.spec.in
@@ -605,6 +605,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/sss_ssh_authorizedkeys
 %{_bindir}/sss_ssh_knownhostsproxy
 %{_sbindir}/sss_cache
+%{_libexecdir}/%{servicename}/sss_signal
 
 %dir %{sssdstatedir}
 %dir %{_localstatedir}/cache/krb5rcache
diff --git a/src/tools/sss_signal.c b/src/tools/sss_signal.c
new file mode 100644
index 0000000000000000000000000000000000000000..efddcce3d12bbe270f30ea15af8ab899f4b03dca
--- /dev/null
+++ b/src/tools/sss_signal.c
@@ -0,0 +1,37 @@
+/*
+    Authors:
+        Jakub Hrozek <jhrozek at redhat.com>
+
+    Copyright (C) 2014 Red Hat
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+
+#include "config.h"
+#include "tools/tools_util.h"
+
+int main(int argc, const char **argv)
+{
+    int ret;
+
+    ret = signal_sssd(SIGUSR2);
+    if (ret != EOK) {
+        ERROR("Could not signal SSSD. Is SSSD running?\n");
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}
-- 
1.9.3

-------------- next part --------------
>From 2393df3b7b9410fa96e70de7d1cc13ad15535edd Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 24 Jun 2014 17:03:28 +0200
Subject: [PATCH 7/7] BUILD: Add the DBus service activation

The system bus has the ability to start services on demant. This patch
adds the sysbus service activation file that, currently, only calls the
sss_signal tool to signal the monitor.
---
 Makefile.am                                                | 4 ++++
 configure.ac                                               | 1 +
 contrib/sssd.spec.in                                       | 1 +
 src/responder/ifp/org.freedesktop.sssd.infopipe.service.in | 4 ++++
 4 files changed, 10 insertions(+)
 create mode 100644 src/responder/ifp/org.freedesktop.sssd.infopipe.service.in

diff --git a/Makefile.am b/Makefile.am
index 8c21e88f5cfe4b5b909e6c79b9d5bd9b53e42f28..2b739433c27520d34bdd3027453e7c4ad9837acb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,6 +45,7 @@ sssdconfdir = $(sysconfdir)/sssd
 sssddatadir = $(datadir)/sssd
 sssdapiplugindir = $(sssddatadir)/sssd.api.d
 dbuspolicydir = $(sysconfdir)/dbus-1/system.d
+dbusservicedir = $(datadir)/dbus-1/system-services
 localedir = @localedir@
 nsslibdir = @nsslibdir@
 pamlibdir = @pammoddir@
@@ -916,6 +917,8 @@ sssd_ifp_LDADD = \
     $(SSSD_INTERNAL_LTLIBS)
 dist_dbuspolicy_DATA = \
     src/responder/ifp/org.freedesktop.sssd.infopipe.conf
+dist_dbusservice_DATA = \
+    src/responder/ifp/org.freedesktop.sssd.infopipe.service
 
 if BUILD_CONFIG_LIB
 sssd_ifp_LDADD += libsss_config.la
@@ -2533,6 +2536,7 @@ installsssddirs::
     $(DESTDIR)$(pluginpath) \
     $(DESTDIR)$(libdir)/ldb \
     $(DESTDIR)$(dbuspolicydir) \
+    $(DESTDIR)$(dbusservicedir) \
     $(DESTDIR)$(pipepath)/private \
     $(DESTDIR)$(sssdlibdir) \
     $(DESTDIR)$(pkglibdir) \
diff --git a/configure.ac b/configure.ac
index dcf2494de62be08af2d0ebb25d1ed9f83b4517d5..b184b86a39a5e7c09919aa1d704905aed2524d6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,5 +325,6 @@ AC_CONFIG_FILES([Makefile contrib/sssd.spec src/examples/rwtab src/doxy.config
                  src/lib/sifp/sss_simpleifp.pc
                  src/lib/sifp/sss_simpleifp.doxy
                  src/config/setup.py
+                 src/responder/ifp/org.freedesktop.sssd.infopipe.service
                  src/config/SSSDConfig/__init__.py])
 AC_OUTPUT
diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in
index 86a603925fc6837fab118563d1bd90c6909d4746..fb55002219d65dd6340b84d113a3357ca7b110ba 100644
--- a/contrib/sssd.spec.in
+++ b/contrib/sssd.spec.in
@@ -694,6 +694,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man5/sssd-ifp.5*
 # InfoPipe DBus plumbing
 %{_sysconfdir}/dbus-1/system.d/org.freedesktop.sssd.infopipe.conf
+%{_datadir}/dbus-1/system-services/org.freedesktop.sssd.infopipe.service
 %{_libdir}/%{name}/libsss_config.so
 
 %files -n libsss_simpleifp
diff --git a/src/responder/ifp/org.freedesktop.sssd.infopipe.service.in b/src/responder/ifp/org.freedesktop.sssd.infopipe.service.in
new file mode 100644
index 0000000000000000000000000000000000000000..78208661e3946c8c271c587c8ca5c48752bd109b
--- /dev/null
+++ b/src/responder/ifp/org.freedesktop.sssd.infopipe.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.sssd.infopipe
+Exec=@libexecdir@/sssd/sss_signal
+User=root
-- 
1.9.3



More information about the sssd-devel mailing list