File gdm-xauthlocalhostname.patch of Package gdm

Index: daemon/gdm-display-access-file.c
===================================================================
--- daemon/gdm-display-access-file.c.orig
+++ daemon/gdm-display-access-file.c
@@ -440,11 +440,15 @@ _get_auth_info_for_display (GdmDisplayAc
         if (is_local) {
                 char localhost[HOST_NAME_MAX + 1] = "";
                 *family = FamilyLocal;
+#if 0
                 if (gethostname (localhost, HOST_NAME_MAX) == 0) {
                         *address = g_strdup (localhost);
                 } else {
+#endif
                         *address = g_strdup ("localhost");
+#if 0
                 }
+#endif
         } else {
                 *family = FamilyWild;
                 gdm_display_get_remote_hostname (display, address, NULL);
Index: daemon/gdm-session-direct.c
===================================================================
--- daemon/gdm-session-direct.c.orig
+++ daemon/gdm-session-direct.c
@@ -2119,6 +2119,12 @@ setup_session_environment (GdmSessionDir
         }
 
 
+        if (session_direct->priv->display_is_local) {
+                gdm_session_direct_set_environment_variable (session,
+                                                             "XAUTHLOCALHOSTNAME",
+                                                             "localhost");
+        }
+
         /* FIXME: We do this here and in the session worker.  We should consolidate
          * somehow.
          */
Index: daemon/gdm-slave.c
===================================================================
--- daemon/gdm-slave.c.orig
+++ daemon/gdm-slave.c
@@ -234,6 +234,10 @@ get_script_environment (GdmSlave   *slav
                 g_hash_table_insert (hash, g_strdup ("REMOTE_HOST"), g_strdup (slave->priv->display_hostname));
         }
 
+        if (slave->priv->display_is_local) {
+                g_hash_table_insert (hash, g_strdup ("XAUTHLOCALHOSTNAME"), g_strdup ("localhost"));
+        }
+
         /* Runs as root */
         g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (slave->priv->display_x11_authority_file));
         g_hash_table_insert (hash, g_strdup ("DISPLAY"), g_strdup (slave->priv->display_name));
@@ -483,6 +487,7 @@ gdm_slave_connect_to_x11_display (GdmSla
 
         g_setenv ("DISPLAY", slave->priv->display_name, TRUE);
         g_setenv ("XAUTHORITY", slave->priv->display_x11_authority_file, TRUE);
+        g_setenv ("XAUTHLOCALHOSTNAME", "localhost", TRUE);
 
         sigemptyset (&mask);
         sigaddset (&mask, SIGCHLD);
Index: daemon/gdm-welcome-session.c
===================================================================
--- daemon/gdm-welcome-session.c.orig
+++ daemon/gdm-welcome-session.c
@@ -435,6 +435,11 @@ get_welcome_environment (GdmWelcomeSessi
                 g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id));
         }
 
+        if (welcome_session->priv->x11_display_is_local) {
+                g_hash_table_remove (hash, "XAUTHLOCALHOSTNAME");
+                g_hash_table_insert (hash, g_strdup ("XAUTHLOCALHOSTNAME"), g_strdup ("localhost"));
+        }
+
         g_hash_table_insert (hash, g_strdup ("PATH"), g_strdup (g_getenv ("PATH")));

         g_hash_table_insert (hash, g_strdup ("RUNNING_UNDER_GDM"), g_strdup ("true"));