diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-25 13:21:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-25 14:28:34 +0100 |
commit | 0258159049d5b381c6097533a69a1b29c3ba7ce2 (patch) | |
tree | 6402f484b4e23e5c7dcd8d57010572cd9c16c56d /src/libsystemd/sd-bus/bus-kernel.c | |
parent | 2e9efd22ce0099c3b4d35898d70f8fc706c8a66c (diff) |
sd-bus: add supplementary groups list to creds object
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 79d29dc119..e66a263c48 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -660,6 +660,29 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { m->creds.mask |= SD_BUS_CREDS_DESCRIPTION & bus->creds_mask; break; + case KDBUS_ITEM_AUXGROUPS: + + if (bus->creds_mask & SD_BUS_CREDS_SUPPLEMENTARY_GIDS) { + size_t i, n; + uid_t *u; + n = (d->size - offsetof(struct kdbus_item, data64)) / sizeof(uint64_t); + u = new(uid_t, n); + if (!u) { + r = -ENOMEM; + goto fail; + } + + for (i = 0; i < n; i++) + u[i] = (uid_t) d->data64[i]; + + m->creds.supplementary_gids = u; + m->creds.n_supplementary_gids = n; + + m->creds.mask |= SD_BUS_CREDS_SUPPLEMENTARY_GIDS; + } + + break; + case KDBUS_ITEM_FDS: case KDBUS_ITEM_SECLABEL: break; @@ -1332,6 +1355,9 @@ int kdbus_translate_attach_flags(uint64_t mask, uint64_t *kdbus_mask) { if (mask & SD_BUS_CREDS_DESCRIPTION) m |= KDBUS_ATTACH_CONN_DESCRIPTION; + if (mask & SD_BUS_CREDS_SUPPLEMENTARY_GIDS) + m |= KDBUS_ATTACH_AUXGROUPS; + *kdbus_mask = m; return 0; } |