diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-01-18 19:37:34 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-01-18 19:37:34 +0100 |
commit | 21fce57b26f50381d21a22be4d62a8f6067dc5c9 (patch) | |
tree | 61d8907bd8d06ed9113c5c4412f7222a844e38f6 /src/libsystemd | |
parent | eea0b59193f37fcc9ee227de26d0009e6bdc6d92 (diff) |
bus: fix SD_BUS_CREDS_AUGMENT on kdbus queries
If we set SD_BUS_CREDS_AUGMENT, we *need* the PID from the kernel so we
can lookup further information from /proc. However, we *must* set
SD_BUS_CREDS_PIDS in "mask", otherwise, our creds-collector will never
actually copy the pid into "sd_bus_creds". Fix this, so
SD_BUS_CREDS_AUGMENT works even if SD_BUS_CREDS_PID is not specified by
the caller.
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-bus/bus-control.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 442def7f78..5dd2307f53 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -641,9 +641,6 @@ int bus_get_name_creds_kdbus( memcpy(cmd->items[0].str, name, l); } - cmd->size = size; - cmd->flags = attach_flags_to_kdbus(mask); - /* If augmentation is on, and the bus didn't provide us * the bits we want, then ask for the PID/TID so that we * can read the rest from /proc. */ @@ -655,7 +652,10 @@ int bus_get_name_creds_kdbus( SD_BUS_CREDS_EFFECTIVE_CAPS|SD_BUS_CREDS_PERMITTED_CAPS|SD_BUS_CREDS_INHERITABLE_CAPS|SD_BUS_CREDS_BOUNDING_CAPS| SD_BUS_CREDS_SELINUX_CONTEXT| SD_BUS_CREDS_AUDIT_SESSION_ID|SD_BUS_CREDS_AUDIT_LOGIN_UID))) - cmd->flags |= KDBUS_ATTACH_PIDS; + mask |= SD_BUS_CREDS_PID; + + cmd->size = size; + cmd->flags = attach_flags_to_kdbus(mask); r = ioctl(bus->input_fd, KDBUS_CMD_CONN_INFO, cmd); if (r < 0) @@ -907,8 +907,6 @@ static int bus_get_owner_creds_kdbus(sd_bus *bus, uint64_t mask, sd_bus_creds ** if (!c) return -ENOMEM; - cmd.flags = attach_flags_to_kdbus(mask); - /* If augmentation is on, and the bus doesn't didn't allow us * to get the bits we want, then ask for the PID/TID so that we * can read the rest from /proc. */ @@ -920,7 +918,9 @@ static int bus_get_owner_creds_kdbus(sd_bus *bus, uint64_t mask, sd_bus_creds ** SD_BUS_CREDS_EFFECTIVE_CAPS|SD_BUS_CREDS_PERMITTED_CAPS|SD_BUS_CREDS_INHERITABLE_CAPS|SD_BUS_CREDS_BOUNDING_CAPS| SD_BUS_CREDS_SELINUX_CONTEXT| SD_BUS_CREDS_AUDIT_SESSION_ID|SD_BUS_CREDS_AUDIT_LOGIN_UID))) - cmd.flags |= KDBUS_ATTACH_PIDS; + mask |= SD_BUS_CREDS_PID; + + cmd.flags = attach_flags_to_kdbus(mask); r = ioctl(bus->input_fd, KDBUS_CMD_BUS_CREATOR_INFO, &cmd); if (r < 0) |