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