summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-25 13:21:23 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-25 14:28:34 +0100
commit0258159049d5b381c6097533a69a1b29c3ba7ce2 (patch)
tree6402f484b4e23e5c7dcd8d57010572cd9c16c56d /src/libsystemd/sd-bus/bus-control.c
parent2e9efd22ce0099c3b4d35898d70f8fc706c8a66c (diff)
sd-bus: add supplementary groups list to creds object
Diffstat (limited to 'src/libsystemd/sd-bus/bus-control.c')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 0027ad36c4..23fb0e7003 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -500,7 +500,7 @@ static int bus_populate_creds_from_items(sd_bus *bus,
case KDBUS_ITEM_CMDLINE:
if (mask & SD_BUS_CREDS_CMDLINE) {
- c->cmdline_size = item->size - KDBUS_ITEM_HEADER_SIZE;
+ c->cmdline_size = item->size - offsetof(struct kdbus_item, data);
c->cmdline = memdup(item->data, c->cmdline_size);
if (!c->cmdline)
return -ENOMEM;
@@ -578,7 +578,7 @@ static int bus_populate_creds_from_items(sd_bus *bus,
break;
case KDBUS_ITEM_CONN_DESCRIPTION:
- if ((mask & SD_BUS_CREDS_DESCRIPTION)) {
+ if (mask & SD_BUS_CREDS_DESCRIPTION) {
c->description = strdup(item->str);
if (!c->description)
return -ENOMEM;
@@ -586,6 +586,26 @@ static int bus_populate_creds_from_items(sd_bus *bus,
c->mask |= SD_BUS_CREDS_DESCRIPTION;
}
break;
+
+ case KDBUS_ITEM_AUXGROUPS:
+ if (mask & SD_BUS_CREDS_SUPPLEMENTARY_GIDS) {
+ size_t i, n;
+ uid_t *u;
+
+ n = (item->size - offsetof(struct kdbus_item, data64)) / sizeof(uint64_t);
+ u = new(uid_t, n);
+ if (!u)
+ return -ENOMEM;
+
+ for (i = 0; i < n; i++)
+ u[i] = (uid_t) item->data64[i];
+
+ c->supplementary_gids = u;
+ c->n_supplementary_gids = n;
+
+ c->mask |= SD_BUS_CREDS_SUPPLEMENTARY_GIDS;
+ }
+ break;
}
}