gdm r6782 - in trunk: . daemon
- From: halfline svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r6782 - in trunk: . daemon
- Date: Mon, 16 Mar 2009 20:18:46 +0000 (UTC)
Author: halfline
Date: Mon Mar 16 20:18:46 2009
New Revision: 6782
URL: http://svn.gnome.org/viewvc/gdm?rev=6782&view=rev
Log:
2009-03-16 Ray Strode <rstrode redhat com>
Give greeter and slave access to display
independent of hostname.
* daemon/gdm-slave.c
(gdm_slave_connect_to_x11_display):
XSetAuthorization before XOpenDisplay so
that the slave can connect even if hostname
changes. Call XAddHosts after XOpenDisplay
so that clients run by the slave and the
greeter can connect even if the hostname
changes.
Modified:
trunk/ChangeLog
trunk/daemon/gdm-slave.c
Modified: trunk/daemon/gdm-slave.c
==============================================================================
--- trunk/daemon/gdm-slave.c (original)
+++ trunk/daemon/gdm-slave.c Mon Mar 16 20:18:46 2009
@@ -88,6 +88,8 @@
char *parent_display_name;
char *parent_display_x11_authority_file;
+ GArray *display_x11_cookie;
+
DBusGProxy *display_proxy;
DBusGConnection *connection;
};
@@ -377,6 +379,12 @@
sigaddset (&mask, SIGCHLD);
sigprocmask (SIG_BLOCK, &mask, &omask);
+ /* Give slave access to the display independent of current hostname */
+ XSetAuthorization ("MIT-MAGIC-COOKIE-1",
+ strlen ("MIT-MAGIC-COOKIE-1"),
+ slave->priv->display_x11_cookie->data,
+ slave->priv->display_x11_cookie->len);
+
slave->priv->server_display = XOpenDisplay (slave->priv->display_name);
sigprocmask (SIG_SETMASK, &omask, NULL);
@@ -386,8 +394,35 @@
g_warning ("Unable to connect to display %s", slave->priv->display_name);
ret = FALSE;
} else {
+ XHostAddress host_entries[2] = {
+ { FamilyServerInterpreted },
+ { FamilyServerInterpreted }
+ };
+ XServerInterpretedAddress si_entries[2];
+
g_debug ("GdmSlave: Connected to display %s", slave->priv->display_name);
ret = TRUE;
+
+ /* Give programs run by the slave and greeter access to the display
+ * independent of current hostname
+ */
+ si_entries[0].type = "localuser";
+ si_entries[0].typelength = strlen ("localuser");
+ si_entries[1].type = "localuser";
+ si_entries[1].typelength = strlen ("localuser");
+
+ si_entries[0].value = "root";
+ si_entries[0].valuelength = strlen ("root");
+ si_entries[1].value = GDM_USERNAME;
+ si_entries[1].valuelength = strlen (GDM_USERNAME);
+
+ host_entries[0].address = (char *) &si_entries[0];
+ host_entries[0].length = sizeof (XServerInterpretedAddress);
+ host_entries[1].address = (char *) &si_entries[1];
+ host_entries[1].length = sizeof (XServerInterpretedAddress);
+
+ XAddHosts (slave->priv->server_display, host_entries,
+ G_N_ELEMENTS (host_entries));
}
return ret;
@@ -567,6 +602,25 @@
error = NULL;
res = dbus_g_proxy_call (slave->priv->display_proxy,
+ "GetX11Cookie",
+ &error,
+ G_TYPE_INVALID,
+ dbus_g_type_get_collection ("GArray", G_TYPE_CHAR),
+ &slave->priv->display_x11_cookie,
+ G_TYPE_INVALID);
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to get value: %s", error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to get value");
+ }
+
+ return FALSE;
+ }
+
+ error = NULL;
+ res = dbus_g_proxy_call (slave->priv->display_proxy,
"GetX11AuthorityFile",
&error,
G_TYPE_INVALID,
@@ -1403,6 +1457,7 @@
g_free (slave->priv->display_x11_authority_file);
g_free (slave->priv->parent_display_name);
g_free (slave->priv->parent_display_x11_authority_file);
+ g_array_free (slave->priv->display_x11_cookie, TRUE);
G_OBJECT_CLASS (gdm_slave_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]