[gdm] common: don't run scripts with bogus DISPLAY and XAUTHORITY



commit 5dd631c9d5dbb1dc8e548c3dc6a21ef656f44944
Author: Ray Strode <rstrode redhat com>
Date:   Thu Jan 4 11:09:55 2018 -0500

    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 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/common/gdm-common.c b/common/gdm-common.c
index 31fc810..c4fc707 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"));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]