]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-bus: derive uid from cgroup if possible 1160/head
authorDavid Herrmann <dh.herrmann@gmail.com>
Sat, 5 Sep 2015 15:54:30 +0000 (17:54 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sat, 5 Sep 2015 16:07:53 +0000 (18:07 +0200)
commit64ce4ad758f43029ea020afdacddad55fffa174d
tree385c30f66a5ce68aed6a1e0d6305713a687c6272
parent17258f5f27dd3dd57c36f2805e0a0c27a1aeabba
sd-bus: derive uid from cgroup if possible

Whenever we run in a user context, sd_bus_{default_user,open_user}() and
friends should always connect to the user-bus of the current context,
instead of deriving the uid from getuid(). This allows us running
programs via sudo/su, without the nasty side-effect of accidentally
connecting to the root user-bus.

This patch enforces the idea of making su/sudo *not* opening sessions by
default. That is, all they do is raising privileges, but keeping
everything set as before. You can still use su/sudo to open real sessions
by requesting a login-session (or loading pam_systemd otherwise).
However, in this case XDG_RUNTIME_DIR= will not be set (as usual in these
cases), hence, you will not be able to connect to *any* user-bus.

Long story short: With this patch applied, both:
        - ./busctl --user
        - sudo ./busctl --user
..will successfully connect to the user-bus of the local user.

Fixes #390.
src/libsystemd/sd-bus/sd-bus.c