From 5d797bbbfc489389ad686d3a61897df39da73782 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Nov 14 2012 17:01:26 +0000 Subject: gdm-dbus-util: make socket world accessible On Linux dbus server sockets are world readable and world writable since they're abstract. Access control is handled at client connection time. On platforms that don't support abstract sockets, dbus server sockets are owned by the user that creates them. This disparity in behavior means that GDM greeters can't connect to GDM on platforms that doesn't support abstract sockets (e.g. OpenBSD). This commit changes GDM to perform heuristics to detect the socket address for the non-abstract case and open up its permissions. https://bugzilla.gnome.org/show_bug.cgi?id=685935 (cherry picked from commit 0b5e101580761d060343b484b78caf5923b38dc6) --- diff --git a/daemon/gdm-dbus-util.c b/daemon/gdm-dbus-util.c index c809f56..ef6a127 100644 --- a/daemon/gdm-dbus-util.c +++ b/daemon/gdm-dbus-util.c @@ -19,6 +19,9 @@ */ #include "gdm-dbus-util.h" +#include + +#include #include /* a subset of org.freedesktop.DBus interface, to be used by internal servers */ @@ -102,6 +105,7 @@ gdm_dbus_setup_private_server (GDBusAuthObserver *observer, GError **error) { char *address, *guid; + const char *client_address; GDBusServer *server; address = generate_address (); @@ -113,12 +117,19 @@ gdm_dbus_setup_private_server (GDBusAuthObserver *observer, observer, NULL, error); + g_free (address); + + client_address = g_dbus_server_get_client_address (server); + + if (g_str_has_prefix (client_address, "unix:path=")) { + client_address += strlen("unix:path="); + g_chmod (client_address, 0666); + } g_signal_connect (server, "new-connection", G_CALLBACK (handle_connection), NULL); - g_free (address); g_free (guid); return server;