File gdm-not-run-with-bogus-DISPLAY-XAUTHORITY.patch of Package gdm.7833

From 5dd631c9d5dbb1dc8e548c3dc6a21ef656f44944 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 4 Jan 2018 11:09:55 -0500
Subject: [PATCH 1/5] common: don't run scripts with bogus DISPLAY and
 XAUTHORITY

DISPLAY and XAUTHORITY might not be set if we're starting the
X server as part of the session.

In that case we should ensure the variables aren't set in the
environment of the gdm session scripts.

This commit fixes that.

https://bugzilla.gnome.org/show_bug.cgi?id=792150
---
 common/gdm-common.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/gdm-common.c b/common/gdm-common.c
index 31fc810a..c4fc7073 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -594,8 +594,13 @@ gdm_get_script_environment (const char *username,
         }
 
         /* Runs as root */
-        g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (display_x11_authority_file));
-        g_hash_table_insert (hash, g_strdup ("DISPLAY"), g_strdup (display_name));
+        if (display_x11_authority_file) {
+                g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (display_x11_authority_file));
+        }
+
+        if (display_name) {
+                g_hash_table_insert (hash, g_strdup ("DISPLAY"), g_strdup (display_name));
+        }
         g_hash_table_insert (hash, g_strdup ("PATH"), g_strdup (GDM_SESSION_DEFAULT_PATH));
         g_hash_table_insert (hash, g_strdup ("RUNNING_UNDER_GDM"), g_strdup ("true"));
 
-- 
2.12.3
openSUSE Build Service is sponsored by