Blame SOURCES/0013-local-display-factory-ensure-non-seat0-codepath-does.patch

400dab
From 299a0981f4e9fc02716d64abf5e5e692e2ad2951 Mon Sep 17 00:00:00 2001
400dab
From: Ray Strode <rstrode@redhat.com>
400dab
Date: Fri, 3 Aug 2018 16:50:36 -0400
400dab
Subject: [PATCH 13/51] local-display-factory: ensure non-seat0 codepath
400dab
 doesn't affect seat0
400dab
400dab
create_display currently bails in some cases if any display is running
400dab
on the seat.  That's the right thing to do on seats other than seat0,
400dab
but wrong for seat0 (which an have multiple sessions at the same
400dab
time).
400dab
400dab
To ensure we never hit the case for seat0, add a call to check if
400dab
the passed seat is multi-session capable.
400dab
---
400dab
 daemon/gdm-local-display-factory.c | 2 +-
400dab
 1 file changed, 1 insertion(+), 1 deletion(-)
400dab
400dab
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
400dab
index 0e454c880..7f7735ca1 100644
400dab
--- a/daemon/gdm-local-display-factory.c
400dab
+++ b/daemon/gdm-local-display-factory.c
400dab
@@ -373,61 +373,61 @@ lookup_by_seat_id (const char *id,
400dab
 }
400dab
 
400dab
 static GdmDisplay *
400dab
 create_display (GdmLocalDisplayFactory *factory,
400dab
                 const char             *seat_id,
400dab
                 const char             *session_type,
400dab
                 gboolean                initial)
400dab
 {
400dab
         GdmDisplayStore *store;
400dab
         GdmDisplay      *display = NULL;
400dab
         char            *active_session_id = NULL;
400dab
         int              ret;
400dab
 
400dab
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
400dab
 
400dab
         ret = sd_seat_get_active (seat_id, &active_session_id, NULL);
400dab
 
400dab
         if (ret == 0) {
400dab
                 char *login_session_id = NULL;
400dab
 
400dab
                 /* If we already have a login window, switch to it */
400dab
                 if (gdm_get_login_window_session_id (seat_id, &login_session_id)) {
400dab
                         if (g_strcmp0 (active_session_id, login_session_id) != 0) {
400dab
                                 gdm_activate_session_by_id (factory->priv->connection, seat_id, login_session_id);
400dab
                         }
400dab
                         g_clear_pointer (&login_session_id, g_free);
400dab
                         g_clear_pointer (&active_session_id, g_free);
400dab
                         return NULL;
400dab
                 }
400dab
                 g_clear_pointer (&active_session_id, g_free);
400dab
-        } else {
400dab
+        } else if (!sd_seat_can_multi_session (seat_id)) {
400dab
                 /* Ensure we don't create the same display more than once */
400dab
                 display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);
400dab
 
400dab
                 if (display != NULL) {
400dab
                         return NULL;
400dab
                 }
400dab
         }
400dab
 
400dab
         g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
400dab
 
400dab
 #ifdef ENABLE_USER_DISPLAY_SERVER
400dab
         if (g_strcmp0 (seat_id, "seat0") == 0) {
400dab
                 display = gdm_local_display_new ();
400dab
                 if (session_type != NULL) {
400dab
                         g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
400dab
                 }
400dab
         }
400dab
 #endif
400dab
 
400dab
         if (display == NULL) {
400dab
                 guint32 num;
400dab
 
400dab
                 num = take_next_display_number (factory);
400dab
 
400dab
                 display = gdm_legacy_display_new (num);
400dab
         }
400dab
 
400dab
         g_object_set (display, "seat-id", seat_id, NULL);
400dab
         g_object_set (display, "is-initial", initial, NULL);
400dab
 
400dab
-- 
400dab
2.27.0
400dab