diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-10-23 18:51:09 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2015-10-26 11:08:19 +0100 |
commit | ac80e77f6e45a3b688238e1fbf5b8baba98b58b4 (patch) | |
tree | 8342db37ddfd5092dd3e3353657d08190ab9855b /client | |
parent | d236257299344207736086400960b0add2c1200b (diff) | |
download | gvfs-ac80e77f6e45a3b688238e1fbf5b8baba98b58b4.tar.gz |
Accept XDG_RUNTIME_DIR/bus as a valid D-Bus session/user bus
These checks for DBUS_SESSION_BUS_ADDRESS were added to solve
https://bugzilla.gnome.org/show_bug.cgi?id=526454,
in which non-X11-session processes (for example a system service),
or processes under su or similar inside an X11 session, could cause
a dbus-daemon to be autolaunched via dbus-launch. If there was no
X11 display to represent the lifetime of a session, the dbus-daemon
would potentially run forever, causing a "leaked" process;
additionally, other uses of D-Bus by the same uid would start more
dbus-daemons.
This becomes potentially problematic on systems with the "user bus"
model introduced in dbus 1.10: libdbus, GDBus and sd-bus will now
all try the per-uid socket XDG_RUNTIME_DIR/bus before attempting
autolaunch, so if those are known to be the only implementations in
use on a "legacy-free" system, setting DBUS_SESSION_BUS_ADDRESS is
unnecessary. Check for that socket before giving up.
XDG_RUNTIME_DIR/bus as implemented by dbus 1.10 with systemd avoids
several of the down sides of autolaunching: it will never start more
than one session bus per uid, and the socket and bus will automatically
be cleaned up when the corresponding "systemd --user" exits.
https://bugzilla.gnome.org/show_bug.cgi?id=756420
Diffstat (limited to 'client')
-rw-r--r-- | client/gdaemonvfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c index caf846a5..8a91570f 100644 --- a/client/gdaemonvfs.c +++ b/client/gdaemonvfs.c @@ -40,6 +40,7 @@ #include <glib/gi18n-lib.h> #include <glib/gstdio.h> #include <gvfsdbus.h> +#include "gvfsutils.h" typedef struct { char *type; @@ -1501,7 +1502,7 @@ g_io_module_load (GIOModule *module) * without spawning private dbus instances. * See bug 526454. */ - if (g_getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) + if (!gvfs_have_session_bus ()) return; /* Make this module resident so that we ground the common |