chiark / gitweb /
bus: use EUID over UID and fix unix-creds
authorDavid Herrmann <dh.herrmann@gmail.com>
Sun, 18 Jan 2015 12:55:55 +0000 (13:55 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sun, 18 Jan 2015 12:55:55 +0000 (13:55 +0100)
commit05bae4a60c32e29797597979cee2f3684eb3bc1e
treec1cebeb8436dcb8edf59454af1c8176610d26212
parente23f4bb525991c5908be0d0e7f8374c964d9996c
bus: use EUID over UID and fix unix-creds

Whenever a process performs an action on an object, the kernel uses the
EUID of the process to do permission checks and to apply on any newly
created objects. The UID of a process is only used if someone *ELSE* acts
on the process. That is, the UID of a process defines who owns the
process, the EUID defines what privileges are used by this process when
performing an action.

Process limits, on the other hand, are always applied to the real UID, not
the effective UID. This is, because a process has a user object linked,
which always corresponds to its UID. A process never has a user object
linked for its EUID. Thus, accounting (and limits) is always done on the
real UID.

This commit fixes all sd-bus users to use the EUID when performing
privilege checks and alike. Furthermore, it fixes unix-creds to be parsed
as EUID, not UID (as the kernel always takes the EUID on UDS). Anyone
using UID (eg., to do user-accounting) has to fall back to the EUID as UDS
does not transmit the UID.
src/bus-proxyd/driver.c
src/bus-proxyd/proxy.c
src/bus-proxyd/stdio-bridge.c
src/core/selinux-access.c
src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-message.c
src/libsystemd/sd-bus/busctl.c
src/login/logind-dbus.c
src/login/logind-session-dbus.c