Blame SOURCES/0004-manager-make-get_login_window_session_id-fail-if-no-.patch

e0b6b0
From e2e5d2a7d73baa7c24d1f14b276cb653c06dd82f Mon Sep 17 00:00:00 2001
c90517
From: Ray Strode <rstrode@redhat.com>
c90517
Date: Wed, 1 Aug 2018 15:46:11 -0400
e0b6b0
Subject: [PATCH 04/51] manager: make get_login_window_session_id fail if no
c90517
 login screen
c90517
c90517
Right now we oddly succeed from get_login_window_session_id
c90517
if we can't find a login window.
c90517
c90517
None of the caller expect that, so fail instead.
c90517
---
c90517
 daemon/gdm-manager.c | 4 ++--
c90517
 1 file changed, 2 insertions(+), 2 deletions(-)
c90517
c90517
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
c90517
index e44b94373..a9d5628ea 100644
c90517
--- a/daemon/gdm-manager.c
c90517
+++ b/daemon/gdm-manager.c
c90517
@@ -1372,113 +1372,113 @@ maybe_start_pending_initial_login (GdmManager *manager,
c90517
                       NULL);
c90517
 
c90517
         if (g_strcmp0 (greeter_seat_id, user_session_seat_id) == 0) {
c90517
                 start_user_session (manager, operation);
c90517
                 manager->priv->initial_login_operation = NULL;
c90517
         }
c90517
 
c90517
         g_free (greeter_seat_id);
c90517
         g_free (user_session_seat_id);
c90517
 }
c90517
 
c90517
 static gboolean
c90517
 get_login_window_session_id (const char  *seat_id,
c90517
                              char       **session_id)
c90517
 {
c90517
         gboolean   ret;
c90517
         int        res, i;
c90517
         char     **sessions;
c90517
         char      *service_id;
c90517
         char      *service_class;
c90517
         char      *state;
c90517
 
c90517
         res = sd_seat_get_sessions (seat_id, &sessions, NULL, NULL);
c90517
         if (res < 0) {
c90517
                 g_debug ("Failed to determine sessions: %s", strerror (-res));
c90517
                 return FALSE;
c90517
         }
c90517
 
c90517
         if (sessions == NULL || sessions[0] == NULL) {
c90517
                 *session_id = NULL;
c90517
-                ret = TRUE;
c90517
+                ret = FALSE;
c90517
                 goto out;
c90517
         }
c90517
 
c90517
         for (i = 0; sessions[i]; i ++) {
c90517
 
c90517
                 res = sd_session_get_class (sessions[i], &service_class);
c90517
                 if (res < 0) {
c90517
                         g_debug ("failed to determine class of session %s: %s", sessions[i], strerror (-res));
c90517
                         ret = FALSE;
c90517
                         goto out;
c90517
                 }
c90517
 
c90517
                 if (strcmp (service_class, "greeter") != 0) {
c90517
                         free (service_class);
c90517
                         continue;
c90517
                 }
c90517
 
c90517
                 free (service_class);
c90517
 
c90517
                 ret = sd_session_get_state (sessions[i], &state);
c90517
                 if (ret < 0) {
c90517
                         g_debug ("failed to determine state of session %s: %s", sessions[i], strerror (-res));
c90517
                         ret = FALSE;
c90517
                         goto out;
c90517
                 }
c90517
 
c90517
                 if (g_strcmp0 (state, "closing") == 0) {
c90517
                         free (state);
c90517
                         continue;
c90517
                 }
c90517
                 free (state);
c90517
 
c90517
                 res = sd_session_get_service (sessions[i], &service_id);
c90517
                 if (res < 0) {
c90517
                         g_debug ("failed to determine service of session %s: %s", sessions[i], strerror (-res));
c90517
                         ret = FALSE;
c90517
                         goto out;
c90517
                 }
c90517
 
c90517
                 if (strcmp (service_id, "gdm-launch-environment") == 0) {
c90517
                         *session_id = g_strdup (sessions[i]);
c90517
                         ret = TRUE;
c90517
 
c90517
                         free (service_id);
c90517
                         goto out;
c90517
                 }
c90517
 
c90517
                 free (service_id);
c90517
         }
c90517
 
c90517
         *session_id = NULL;
c90517
-        ret = TRUE;
c90517
+        ret = FALSE;
c90517
 
c90517
 out:
c90517
         if (sessions) {
c90517
                 for (i = 0; sessions[i]; i ++) {
c90517
                         free (sessions[i]);
c90517
                 }
c90517
 
c90517
                 free (sessions);
c90517
         }
c90517
 
c90517
         return ret;
c90517
 }
c90517
 
c90517
 static void
c90517
 activate_login_window_session_on_seat (GdmManager *self,
c90517
                                        const char *seat_id)
c90517
 {
c90517
         char *session_id;
c90517
 
c90517
         if (!get_login_window_session_id (seat_id, &session_id)) {
c90517
                 return;
c90517
         }
c90517
 
c90517
         activate_session_id (self, seat_id, session_id);
c90517
 }
c90517
 
c90517
 static void
c90517
 maybe_activate_other_session (GdmManager *self,
c90517
                               GdmDisplay *old_display)
c90517
 {
c90517
-- 
e0b6b0
2.27.0
c90517