File gdm-add-runtime-option-to-disable-starting-X-server-as-u.patch of Package gdm.11221
From a19b51ad9e446948ba60c359641f6c4c14fec1da Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb@suse.com>
Date: Fri, 26 Jan 2018 10:49:18 +0100
Subject: [PATCH] Add runtime option to disable starting X server as user
If the environmental variable GDM_DISABLE_USER_DISPLAY_SERVER is defined, the
X server will be started under root. The same way as if gdm was built with
--disable-user-display-server option.
This allows system to run X server under root if and only-if necessary.
---
daemon/gdm-local-display-factory.c | 10 ++++++----
daemon/gdm-session.c | 13 +++++++++----
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index b29f5ac5..7c687cf6 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -207,8 +207,11 @@ gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *fact
g_debug ("GdmLocalDisplayFactory: Creating transient display");
#ifdef ENABLE_USER_DISPLAY_SERVER
- display = gdm_local_display_new ();
-#else
+ if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL) {
+ display = gdm_local_display_new ();
+ }
+#endif
+
if (display == NULL) {
guint32 num;
@@ -216,7 +219,6 @@ gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *fact
display = gdm_legacy_display_new (num);
}
-#endif
g_object_set (display,
"seat-id", "seat0",
@@ -369,7 +371,7 @@ create_display (GdmLocalDisplayFactory *factory,
g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
#ifdef ENABLE_USER_DISPLAY_SERVER
- if (g_strcmp0 (seat_id, "seat0") == 0) {
+ if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL && g_strcmp0 (seat_id, "seat0") == 0) {
display = gdm_local_display_new ();
if (session_type != NULL) {
g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 610ebcd0..cb37ed4e 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -360,7 +360,11 @@ get_system_session_dirs (GdmSession *self)
#ifdef ENABLE_WAYLAND_SUPPORT
if (!self->priv->ignore_wayland) {
#ifdef ENABLE_USER_DISPLAY_SERVER
- g_array_prepend_val (search_array, wayland_search_dir);
+ if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL) {
+ g_array_prepend_val (search_array, wayland_search_dir);
+ } else {
+ g_array_append_val (search_array, wayland_search_dir);
+ }
#else
g_array_append_val (search_array, wayland_search_dir);
#endif
@@ -3147,8 +3151,10 @@ gdm_session_get_display_mode (GdmSession *self)
* right now. It will die with an error if logind devices
* are paused when handed out.
*/
- return GDM_SESSION_DISPLAY_MODE_NEW_VT;
-#else
+ if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL) {
+ return GDM_SESSION_DISPLAY_MODE_NEW_VT;
+ }
+#endif
#ifdef ENABLE_WAYLAND_SUPPORT
/* Wayland sessions are for now assumed to run in a
@@ -3159,7 +3165,6 @@ gdm_session_get_display_mode (GdmSession *self)
}
#endif
return GDM_SESSION_DISPLAY_MODE_REUSE_VT;
-#endif
}
void
--
2.13.6