Blame SOURCES/0024-manager-better-logind-handling.patch

a1b388
From fac23cfa3e8e9fe21563733c0c1b739ddecead8a Mon Sep 17 00:00:00 2001
a1b388
From: Ray Strode <rstrode@redhat.com>
a1b388
Date: Thu, 30 Aug 2018 14:01:55 -0400
a1b388
Subject: [PATCH 24/51] manager: better logind handling
a1b388
a1b388
commit 9ee68d5c8 highlights we've incorrectly
a1b388
used ENOENT instead of ENXIO when checking for
a1b388
non-existing sessions/seats with logind.
a1b388
a1b388
This commit mops up all the other cases.
a1b388
---
a1b388
 daemon/gdm-manager.c | 6 +++---
a1b388
 1 file changed, 3 insertions(+), 3 deletions(-)
a1b388
a1b388
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
a1b388
index 80f60d24c..367a731cc 100644
a1b388
--- a/daemon/gdm-manager.c
a1b388
+++ b/daemon/gdm-manager.c
a1b388
@@ -361,113 +361,113 @@ find_session_for_user_on_seat (GdmManager *manager,
a1b388
                          candidate_username);
a1b388
 
a1b388
                 if (g_strcmp0 (candidate_username, username) == 0 &&
a1b388
                     g_strcmp0 (candidate_seat_id, seat_id) == 0) {
a1b388
                         g_debug ("GdmManager: yes, found session %s", candidate_session_id);
a1b388
                         return candidate_session;
a1b388
                 }
a1b388
 
a1b388
                 g_debug ("GdmManager: no, will not use session %s", candidate_session_id);
a1b388
         }
a1b388
 
a1b388
         g_debug ("GdmManager: no matching sessions found");
a1b388
         return NULL;
a1b388
 }
a1b388
 
a1b388
 static gboolean
a1b388
 is_remote_session (GdmManager  *self,
a1b388
                    const char  *session_id,
a1b388
                    GError     **error)
a1b388
 {
a1b388
         char *seat;
a1b388
         int ret;
a1b388
         gboolean is_remote;
a1b388
 
a1b388
         /* FIXME: The next release of logind is going to have explicit api for
a1b388
          * checking remoteness.
a1b388
          */
a1b388
         seat = NULL;
a1b388
         ret = sd_session_get_seat (session_id, &seat;;
a1b388
 
a1b388
-        if (ret < 0 && ret != -ENOENT) {
a1b388
+        if (ret < 0 && ret != -ENXIO) {
a1b388
                 g_debug ("GdmManager: Error while retrieving seat for session %s: %s",
a1b388
                          session_id, strerror (-ret));
a1b388
         }
a1b388
 
a1b388
         if (seat != NULL) {
a1b388
                 is_remote = FALSE;
a1b388
                 free (seat);
a1b388
         } else {
a1b388
                 is_remote = TRUE;
a1b388
         }
a1b388
 
a1b388
         return is_remote;
a1b388
 }
a1b388
 
a1b388
 static char *
a1b388
 get_seat_id_for_session_id (const char  *session_id,
a1b388
                             GError     **error)
a1b388
 {
a1b388
         int ret;
a1b388
         char *seat, *out_seat;
a1b388
 
a1b388
         seat = NULL;
a1b388
         ret = sd_session_get_seat (session_id, &seat;;
a1b388
 
a1b388
-        if (ret == -ENOENT) {
a1b388
+        if (ret == -ENXIO) {
a1b388
                 out_seat = NULL;
a1b388
         } else if (ret < 0) {
a1b388
                 g_set_error (error,
a1b388
                              GDM_DISPLAY_ERROR,
a1b388
                              GDM_DISPLAY_ERROR_GETTING_SESSION_INFO,
a1b388
                              "Error getting uid for session id %s from systemd: %s",
a1b388
                              session_id,
a1b388
                              g_strerror (-ret));
a1b388
                 out_seat = NULL;
a1b388
         } else {
a1b388
                 out_seat = g_strdup (seat);
a1b388
                 free (seat);
a1b388
         }
a1b388
 
a1b388
         return out_seat;
a1b388
 }
a1b388
 
a1b388
 static char *
a1b388
 get_tty_for_session_id (const char  *session_id,
a1b388
                         GError     **error)
a1b388
 {
a1b388
         int ret;
a1b388
         char *tty, *out_tty;
a1b388
 
a1b388
         ret = sd_session_get_tty (session_id, &tty);
a1b388
 
a1b388
-        if (ret == -ENOENT) {
a1b388
+        if (ret == -ENXIO) {
a1b388
                 out_tty = NULL;
a1b388
         } else if (ret < 0) {
a1b388
                 g_set_error (error,
a1b388
                              GDM_DISPLAY_ERROR,
a1b388
                              GDM_DISPLAY_ERROR_GETTING_SESSION_INFO,
a1b388
                              "Error getting tty for session id %s from systemd: %s",
a1b388
                              session_id,
a1b388
                              g_strerror (-ret));
a1b388
                 out_tty = NULL;
a1b388
         } else {
a1b388
                 out_tty = g_strdup (tty);
a1b388
                 free (tty);
a1b388
         }
a1b388
 
a1b388
         return out_tty;
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 get_display_and_details_for_bus_sender (GdmManager       *self,
a1b388
                                         GDBusConnection  *connection,
a1b388
                                         const char       *sender,
a1b388
                                         GdmDisplay      **out_display,
a1b388
                                         char            **out_seat_id,
a1b388
                                         char            **out_session_id,
a1b388
                                         char            **out_tty,
a1b388
                                         GPid             *out_pid,
a1b388
                                         uid_t            *out_uid,
a1b388
                                         gboolean         *out_is_login_screen,
a1b388
                                         gboolean         *out_is_remote)
a1b388
 {
a1b388
-- 
a1b388
2.27.0
a1b388