Create DBus sockets with proper permissions so that the greeter can access

them (from upstream).
This commit is contained in:
ajacoutot 2012-10-16 15:53:30 +00:00
parent 019959e213
commit 1843bb20ee
2 changed files with 94 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.137 2012/10/16 07:02:58 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.138 2012/10/16 15:53:30 ajacoutot Exp $
SHARED_ONLY= Yes
@ -6,6 +6,7 @@ COMMENT= GNOME display manager
GNOME_PROJECT= gdm
GNOME_VERSION= 3.6.1
REVISION= 0
HOMEPAGE= http://projects.gnome.org/gdm/

View File

@ -0,0 +1,92 @@
$OpenBSD: patch-daemon_gdm-dbus-util_c,v 1.1 2012/10/16 15:53:30 ajacoutot Exp $
From 0b5e101580761d060343b484b78caf5923b38dc6 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 16 Oct 2012 14:32:00 +0000
Subject: gdm-dbus-util: make socket world accessible
From f6d6a664e1591d0485c52907caf5f4d0b612b504 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 16 Oct 2012 14:53:08 +0000
Subject: gdm-dbus-util: don't try to generate abstract socket address ourselves
--- daemon/gdm-dbus-util.c.orig Thu Oct 4 00:03:41 2012
+++ daemon/gdm-dbus-util.c Tue Oct 16 17:29:33 2012
@@ -19,6 +19,9 @@
*/
#include "gdm-dbus-util.h"
+#include <string.h>
+
+#include <glib/gstdio.h>
#include <gio/gunixsocketaddress.h>
/* a subset of org.freedesktop.DBus interface, to be used by internal servers */
@@ -68,57 +71,34 @@ handle_connection (GDBusServer *server,
return FALSE;
}
-/* Note: Use abstract sockets like dbus does by default on Linux. Abstract
- * sockets are only available on Linux.
- */
-static char *
-generate_address (void)
-{
- char *path;
-
- if (g_unix_socket_address_abstract_names_supported ()) {
- int i;
- char tmp[9];
-
- for (i = 0; i < 8; i++) {
- if (g_random_int_range (0, 2) == 0) {
- tmp[i] = g_random_int_range ('a', 'z' + 1);
- } else {
- tmp[i] = g_random_int_range ('A', 'Z' + 1);
- }
- }
- tmp[8] = '\0';
-
- path = g_strdup_printf ("unix:abstract=/tmp/gdm-greeter-%s", tmp);
- } else {
- path = g_strdup ("unix:tmpdir=/tmp");
- }
-
- return path;
-}
-
GDBusServer *
gdm_dbus_setup_private_server (GDBusAuthObserver *observer,
GError **error)
{
- char *address, *guid;
+ char *guid;
+ const char *client_address;
GDBusServer *server;
- address = generate_address ();
guid = g_dbus_generate_guid ();
- server = g_dbus_server_new_sync (address,
+ server = g_dbus_server_new_sync ("unix:tmpdir=/tmp",
G_DBUS_SERVER_FLAGS_NONE,
guid,
observer,
NULL,
error);
+ 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;