Add support for unix:runtime=yes as an address mode
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 8 Jan 2015 14:48:59 +0000 (14:48 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 24 Feb 2015 11:14:46 +0000 (11:14 +0000)
commite3f117e7610b0e0a91dfe5bff7bf2e217c129a86
tree1126d495a584e95dc00e2017521affa63239e436
parentf6a2b907ec528968f8ef3936be422b346d745d09
Add support for unix:runtime=yes as an address mode

This is not used by default, but can be configured by OS builders (or
regression-test environments) if desired.

If used, this listens on $XDG_RUNTIME_DIR/bus, or fails if $XDG_RUNTIME_DIR
is not set. Fallback behaviour is unnecessary, because it is already
possible to use a string of semicolon-separated addresses like
<listen>unix:runtime=yes;unix:tmpdir=/tmp</listen>, resulting in
listening on either $XDG_RUNTIME_DIR/bus or /tmp/something.

We use a non-abstract socket here, because that is desirable for
use with Linux containers: abstract sockets are attached to the
network namespace, whereas non-abstract sockets are part of the
filesystem and can be bind-mounted between domains if necessary.
The major advantage of abstract sockets is that they do not need
cleanup, but the specification of XDG_RUNTIME_DIR guarantees to
provide cleanup anyway.

Based on prior work by Simon McVittie, Colin Walters and Alexander
Larsson.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61303
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
dbus/dbus-server-unix.c
doc/dbus-specification.xml