[SSSD] [PATCH] IFP: Support multiple interfaces on sysbus

Jakub Hrozek jhrozek at redhat.com
Wed May 21 20:57:49 UTC 2014


The InfoPipe code in master only supports a single interface per
responder, which obviously doesn't play well with our grand plans.

Pavel, I know you have different plans with multiple interfaces for the
public SBUS interfaces, but are you OK with pushing this patch to 1.12
and continuing with improvements later on? If so, please file a ticket
with some description so that we don't forget. Thanks!
-------------- next part --------------
>From ba4bebf404804453f77641b5c2b64a168a3f97ee Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 23 Apr 2014 03:02:30 +0200
Subject: [PATCH] IFP: Support multiple interfaces on sysbus

Instead of passing just one interface with the functions, we need to
support multiple interfaces for the InfoPipe and export them all on the
sysbus.
---
 src/responder/ifp/ifpsrv.c | 47 ++++++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index b221ced7047115fcf4439f85cc02793a3d01f274..c6a50623a4d5ce87b9cc27c001734b88bbf32743 100644
--- a/src/responder/ifp/ifpsrv.c
+++ b/src/responder/ifp/ifpsrv.c
@@ -70,6 +70,16 @@ struct infopipe_iface ifp_iface = {
     .GetUserGroups = ifp_user_get_groups,
 };
 
+struct sysbus_iface {
+    const char *path;
+    struct sbus_vtable *iface_vtable;
+};
+
+static struct sysbus_iface ifp_ifaces[] = {
+    { INFOPIPE_PATH, &ifp_iface.vtable },
+    { NULL, NULL },
+};
+
 struct sss_cmd_table *get_ifp_cmds(void)
 {
     static struct sss_cmd_table ifp_cmds[] = {
@@ -110,8 +120,7 @@ static errno_t
 sysbus_init(TALLOC_CTX *mem_ctx,
             struct tevent_context *ev,
             const char *dbus_name,
-            const char *dbus_path,
-            struct sbus_vtable *iface_vtable,
+            struct sysbus_iface *sysbus_ifaces,
             void *pvt,
             struct sysbus_ctx **sysbus)
 {
@@ -119,6 +128,7 @@ sysbus_init(TALLOC_CTX *mem_ctx,
     DBusConnection *conn = NULL;
     struct sysbus_ctx *system_bus = NULL;
     struct sbus_interface *sif;
+    int i;
     errno_t ret;
 
     system_bus = talloc_zero(mem_ctx, struct sysbus_ctx);
@@ -162,21 +172,23 @@ sysbus_init(TALLOC_CTX *mem_ctx,
         goto fail;
     }
 
-    sif = sbus_new_interface(system_bus->conn,
-                             dbus_path,
-                             iface_vtable,
-                             pvt);
-    if (sif == NULL) {
-        DEBUG(SSSDBG_CRIT_FAILURE,
-              "Could not add the sbus interface\n");
-        goto fail;
-    }
+    for (i = 0; sysbus_ifaces[i].path != NULL; i++) {
+        sif = sbus_new_interface(system_bus->conn,
+                                 sysbus_ifaces[i].path,
+                                 sysbus_ifaces[i].iface_vtable,
+                                 pvt);
+        if (sif == NULL) {
+            DEBUG(SSSDBG_CRIT_FAILURE,
+                  "Could not add the sbus interface\n");
+            goto fail;
+        }
 
-    ret = sbus_conn_add_interface(system_bus->conn, sif);
-    if (ret != EOK) {
-        DEBUG(SSSDBG_CRIT_FAILURE,
-              "Could not add the interface\n");
-        goto fail;
+        ret = sbus_conn_add_interface(system_bus->conn, sif);
+        if (ret != EOK) {
+            DEBUG(SSSDBG_CRIT_FAILURE,
+                  "Could not add the interface\n");
+            goto fail;
+        }
     }
 
     *sysbus = system_bus;
@@ -308,8 +320,7 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
     /* Connect to the D-BUS system bus and set up methods */
     ret = sysbus_init(ifp_ctx, ifp_ctx->rctx->ev,
                       INFOPIPE_IFACE,
-                      INFOPIPE_PATH,
-                      &ifp_iface.vtable,
+                      ifp_ifaces,
                       ifp_ctx, &ifp_ctx->sysbus);
     if (ret != EOK) {
         DEBUG(SSSDBG_CRIT_FAILURE,
-- 
1.9.0



More information about the sssd-devel mailing list