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