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

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