summaryrefslogtreecommitdiffstats
path: root/src/responder
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-04-23 03:02:30 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-05-23 11:53:40 +0200
commit38255f8baeea7f570307c9d82d0f9b9b5c475788 (patch)
treeab1183b2f42f0ab3ed02bcf94e28bf9dece0c21c /src/responder
parent0d8fbc2cb822b4fef90588ca368ceb883b8379f2 (diff)
downloadsssd-38255f8baeea7f570307c9d82d0f9b9b5c475788.tar.gz
sssd-38255f8baeea7f570307c9d82d0f9b9b5c475788.tar.xz
sssd-38255f8baeea7f570307c9d82d0f9b9b5c475788.zip
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. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/responder')
-rw-r--r--src/responder/ifp/ifpsrv.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index b221ced70..c6a50623a 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,