[gdm/gnome-3-22] daemon: add knob to disable starting X server as user



commit e8a15bd9b06e0a76a02b3bf67059e6f9d7517624
Author: Ray Strode <rstrode redhat com>
Date:   Thu Feb 23 13:46:57 2017 -0500

    daemon: add knob to disable starting X server as user
    
    Some deployments need to be able to turn off running X servers as a
    user for backward compatibility.
    
    This commit adds some #ifdef goop to that end.
    
    Note wayland requires running as the user, so this option, merely
    deprioritizes wayland sessions under X sessions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779338

 configure.ac                       |   10 ++++++++++
 daemon/gdm-local-display-factory.c |   13 ++++++++++++-
 daemon/gdm-session.c               |   17 +++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fbf400e..4af221d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -195,6 +195,16 @@ if test x$enable_split_authentication = xyes; then
   AC_DEFINE(ENABLE_SPLIT_AUTHENTICATION, 1, [Define if split authentication is enabled])
 fi
 
+AC_ARG_ENABLE(user-display-server,
+             AS_HELP_STRING([--enable-user-display-server],
+                             [Enable running X server as user @<:@default=yes@:>@]),,
+              enable_user_display_server=yes)
+AM_CONDITIONAL(ENABLE_USER_DISPLAY_SERVER, test x$user_display_server = xyes)
+
+if test x$enable_user_display_server = xyes; then
+  AC_DEFINE(ENABLE_USER_DISPLAY_SERVER, 1, [Define if user display servers are supported])
+fi
+
 AC_ARG_WITH(default-pam-config,
            AS_HELP_STRING([--with-default-pam-config: One of redhat, openembedded, exherbo, lfs, arch, none 
@<:@default=auto@:>@]))
 dnl If not given, try autodetecting from release files (see NetworkManager source) 
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index cf84439..70987c7 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -206,7 +206,17 @@ 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 (display == NULL) {
+                guint32 num;
+
+                num = take_next_display_number (factory);
+
+                display = gdm_legacy_display_new (num);
+        }
+#endif
 
         g_object_set (display,
                       "seat-id", "seat0"
@@ -358,13 +368,14 @@ 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) {
                 display = gdm_local_display_new ();
                 if (session_type != NULL) {
                         g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
                 }
         }
+#endif
 
         if (display == NULL) {
                 guint32 num;
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 492ce32..70130ac 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -358,7 +358,11 @@ get_system_session_dirs (GdmSession *self)
                 g_array_append_vals (search_array, x_search_dirs, G_N_ELEMENTS (x_search_dirs));
 
 #ifdef ENABLE_WAYLAND_SUPPORT
+#ifdef ENABLE_USER_DISPLAY_SERVER
                 g_array_prepend_val (search_array, wayland_search_dir);
+#else
+                g_array_append_val (search_array, wayland_search_dir);
+#endif
 #endif
         }
 
@@ -3107,6 +3111,7 @@ gdm_session_get_display_mode (GdmSession *self)
                 return GDM_SESSION_DISPLAY_MODE_REUSE_VT;
         }
 
+#ifdef ENABLE_USER_DISPLAY_SERVER
         /* All other cases (wayland login screen, X login screen,
          * wayland user session, X user session) use the NEW_VT
          * display mode.  That display mode means that GDM allocates
@@ -3129,6 +3134,18 @@ gdm_session_get_display_mode (GdmSession *self)
          *   are paused when handed out.
          */
         return GDM_SESSION_DISPLAY_MODE_NEW_VT;
+#else
+
+#ifdef ENABLE_WAYLAND_SUPPORT
+        /* Wayland sessions are for now assumed to run in a
+         * mutter-launch-like environment, so we allocate
+         * a new VT for them. */
+        if (g_strcmp0 (self->priv->session_type, "wayland") == 0) {
+                return GDM_SESSION_DISPLAY_MODE_NEW_VT;
+        }
+#endif
+        return GDM_SESSION_DISPLAY_MODE_REUSE_VT;
+#endif
 }
 
 void


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