Skip to content

Commit

Permalink
local-display-factory: Create transient display if there is no active…
Browse files Browse the repository at this point in the history
… session

Now that we stop the greeter session when it is no longer necessary,
the following can happen:
1) Log in as user a.
2) User-switch to user b.
3) Log out user b.
4) The logout takes you back to VT1, but there is no greeter session
running.

The problem here is that the create_display() call from
gdm_local_display_factory_sync_seats() does not create a new display
because there already is a display on the seat for user a.

We can detect being on a VT which does not have an active session,
by calling sd_seat_get_active() to get the active session, which will
return an error in this case.

This commit fixes the problem of the user being taken to a black VT1
in the above scenario by starting a transitient display if the
create_display() in gdm_local_display_factory_sync_seats() returns
NULL and sd_seat_get_active() returns -ENODATA.
  • Loading branch information
jwrdegoede committed May 16, 2018
1 parent cb1a1cf commit b170894
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion daemon/gdm-local-display-factory.c
Expand Up @@ -28,6 +28,8 @@
#include <glib-object.h>
#include <gio/gio.h>

#include <systemd/sd-login.h>

#include "gdm-common.h"
#include "gdm-manager.h"
#include "gdm-display-factory.h"
Expand Down Expand Up @@ -461,6 +463,9 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayFactory *factory)
while (g_variant_iter_loop (&iter, "(&so)", &seat, NULL)) {
gboolean is_initial;
const char *session_type = NULL;
char *session_id = NULL;
char *id = NULL;
GdmDisplay *display;

if (g_strcmp0 (seat, "seat0") == 0) {
is_initial = TRUE;
Expand All @@ -470,7 +475,16 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayFactory *factory)
is_initial = FALSE;
}

create_display (factory, seat, session_type, is_initial);
display = create_display (factory, seat, session_type, is_initial);
/*
* If the seat has no active session, start a transient display
* to allow the user to choose one.
*/
if (!display && sd_seat_get_active (seat, &session_id, NULL) == -ENODATA) {
gdm_local_display_factory_create_transient_display (factory, &id, &error);
g_clear_error (&error);
g_free (id);
}
}

g_variant_unref (result);
Expand Down

0 comments on commit b170894

Please sign in to comment.