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

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