summaryrefslogtreecommitdiff
path: root/monitor/proxy
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-10-23 18:51:09 +0100
committerOndrej Holy <oholy@redhat.com>2015-10-26 11:08:19 +0100
commitac80e77f6e45a3b688238e1fbf5b8baba98b58b4 (patch)
tree8342db37ddfd5092dd3e3353657d08190ab9855b /monitor/proxy
parentd236257299344207736086400960b0add2c1200b (diff)
downloadgvfs-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 'monitor/proxy')
-rw-r--r--monitor/proxy/gproxyvolumemonitor.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/monitor/proxy/gproxyvolumemonitor.c b/monitor/proxy/gproxyvolumemonitor.c
index a7466f0e..d2585464 100644
--- a/monitor/proxy/gproxyvolumemonitor.c
+++ b/monitor/proxy/gproxyvolumemonitor.c
@@ -45,6 +45,7 @@
#include "gvfsmonitorimpl.h"
#include "gvfsdbus.h"
#include "gvfsdaemonprotocol.h"
+#include "gvfsutils.h"
G_LOCK_DEFINE_STATIC(proxy_vm);
@@ -1412,7 +1413,7 @@ g_proxy_volume_monitor_setup_session_bus_connection (void)
* without spawning private dbus instances.
* See bug 526454.
*/
- if (g_getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
+ if (!gvfs_have_session_bus ())
return FALSE;
if (the_volume_monitors == NULL)