diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-12-30 15:15:03 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-04 13:27:54 +0100 |
commit | bbcc701ee7360c39d34aed33381803d44dc5da9f (patch) | |
tree | a78eeeba6a3053f8e9e14503ac2e1ac53db796b9 /src/libsystemd/sd-bus/bus-control.c | |
parent | calenderspec: when normalizing, flush out UTC timezone (diff) | |
download | systemd-bbcc701ee7360c39d34aed33381803d44dc5da9f.tar.gz systemd-bbcc701ee7360c39d34aed33381803d44dc5da9f.tar.bz2 systemd-bbcc701ee7360c39d34aed33381803d44dc5da9f.zip |
tree-wide: use {pid,uid,gid}_is_valid() where appropriate
Also, drop UID/GID validity checks from getpeercred() as the kernel will
never pass us invalid UID/GID on userns, but the overflow UID/GID
instead. Add a comment about this.
Diffstat (limited to 'src/libsystemd/sd-bus/bus-control.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-control.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 12478e7cc..ffe0af2ce 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -571,17 +571,17 @@ static int bus_get_owner_creds_dbus1(sd_bus *bus, uint64_t mask, sd_bus_creds ** return -ENOMEM; if (bus->ucred_valid) { - if (bus->ucred.pid > 0) { + if (pid_is_valid(bus->ucred.pid)) { pid = c->pid = bus->ucred.pid; c->mask |= SD_BUS_CREDS_PID & mask; } - if (bus->ucred.uid != UID_INVALID) { + if (uid_is_valid(bus->ucred.uid)) { c->euid = bus->ucred.uid; c->mask |= SD_BUS_CREDS_EUID & mask; } - if (bus->ucred.gid != GID_INVALID) { + if (gid_is_valid(bus->ucred.gid)) { c->egid = bus->ucred.gid; c->mask |= SD_BUS_CREDS_EGID & mask; } |