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

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