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

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