Blob Blame History Raw
From 0b10f4d8e8ef2e6db519a1e5f8884e71c08403d9 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 1 Aug 2016 11:25:47 -0400
Subject: [PATCH] manager: don't try to activate session if session not on seat

If a session is not associated with a seat (because it's remote),
then we shouldn't try to activate the session.  Activating sessions,
really only means anything on seat0 (where it means to change
the active VT).

This prevents premature failure before unlock on XDMCP.
---
 daemon/gdm-manager.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 72ea968..ed9a437 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -851,64 +851,66 @@ get_display_and_details_for_bus_sender (GdmManager       *self,
         }
 out:
         g_free (session_id);
 }
 
 static gboolean
 switch_to_compatible_user_session (GdmManager *manager,
                                    GdmSession *session,
                                    gboolean    fail_if_already_switched)
 {
         gboolean    res;
         gboolean    ret;
         const char *username;
         const char *seat_id;
         const char *ssid_to_activate;
         GdmSession *existing_session;
 
         ret = FALSE;
 
         username = gdm_session_get_username (session);
         seat_id = gdm_session_get_display_seat_id (session);
 
         if (!fail_if_already_switched) {
                 session = NULL;
         }
 
         existing_session = find_session_for_user_on_seat (manager, username, seat_id, session);
 
         if (existing_session != NULL) {
                 ssid_to_activate = gdm_session_get_session_id (existing_session);
-                res = activate_session_id (manager, seat_id, ssid_to_activate);
-                if (! res) {
-                        g_debug ("GdmManager: unable to activate session: %s", ssid_to_activate);
-                        goto out;
+                if (seat_id != NULL) {
+                        res = activate_session_id (manager, seat_id, ssid_to_activate);
+                        if (! res) {
+                                g_debug ("GdmManager: unable to activate session: %s", ssid_to_activate);
+                                goto out;
+                        }
                 }
 
                 res = session_unlock (manager, ssid_to_activate);
                 if (!res) {
                         /* this isn't fatal */
                         g_debug ("GdmManager: unable to unlock session: %s", ssid_to_activate);
                 }
         } else {
                 goto out;
         }
 
         ret = TRUE;
 
  out:
         return ret;
 }
 
 static GdmDisplay *
 get_display_for_user_session (GdmSession *session)
 {
         return g_object_get_data (G_OBJECT (session), "gdm-display");
 }
 
 static GdmSession *
 get_seed_session_for_display (GdmDisplay *display)
 {
         if (display == NULL) {
                 return NULL;
         }
 
-- 
2.7.4