[gdm/wip/gdm-vt-switch-fixes: 2/6] manager: rework how autologin is figured out
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/gdm-vt-switch-fixes: 2/6] manager: rework how autologin is figured out
- Date: Tue, 25 Sep 2018 18:55:43 +0000 (UTC)
commit c5c5bf1f7d63a9976ad91e488eafde1e5a0deac6
Author: Ray Strode <rstrode redhat com>
Date: Tue Sep 25 10:59:37 2018 -0400
manager: rework how autologin is figured out
At the moment we decide whether or not to perform autologin, by
looking at if the display is the initial VT display and if autologin
hasn't been started before.
That isn't going to work in the future when autologin is started
on a non-initial vt.
This commit changes GDM to instead check if the seat is seat0, and
if autologin hasn't run before, before deciding to do autologin.
daemon/gdm-manager.c | 46 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 11 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 20a9ba7d..ea328381 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -78,6 +78,7 @@ struct GdmManagerPrivate
#ifdef HAVE_LIBXDMCP
GdmXdmcpDisplayFactory *xdmcp_factory;
#endif
+ GdmDisplay *automatic_login_display;
GList *user_sessions;
GHashTable *transient_sessions;
GHashTable *open_reauthentication_requests;
@@ -92,7 +93,7 @@ struct GdmManagerPrivate
#ifdef WITH_PLYMOUTH
guint plymouth_is_running : 1;
#endif
- guint ran_once : 1;
+ guint did_automatic_login : 1;
};
enum {
@@ -1380,13 +1381,20 @@ set_up_session (GdmManager *manager,
ActUserManager *user_manager;
ActUser *user;
gboolean loaded;
- gboolean is_initial_display = FALSE;
+ gboolean seat_can_autologin = FALSE, seat_did_autologin = FALSE;
gboolean autologin_enabled = FALSE;
+ g_autofree char *seat_id = NULL;
char *username = NULL;
- g_object_get (G_OBJECT (display), "is-initial", &is_initial_display, NULL);
+ g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL);
+
+ if (g_strcmp0 (seat_id, "seat0") == 0)
+ seat_can_autologin = TRUE;
+
+ if (manager->priv->did_automatic_login || manager->priv->automatic_login_display != NULL)
+ seat_did_autologin = TRUE;
- if (!manager->priv->ran_once && is_initial_display)
+ if (seat_can_autologin && !seat_did_autologin)
autologin_enabled = get_automatic_login_details (manager, &username);
if (!autologin_enabled) {
@@ -1477,8 +1485,18 @@ on_display_status_changed (GdmDisplay *display,
}
#endif
- if (!doing_initial_setup && (status == GDM_DISPLAY_FINISHED || g_strcmp0
(session_type, "x11") == 0)) {
- manager->priv->ran_once = TRUE;
+ if (display == manager->priv->automatic_login_display) {
+ g_clear_weak_pointer (&manager->priv->automatic_login_display);
+
+ manager->priv->did_automatic_login = TRUE;
+
+#ifdef ENABLE_WAYLAND_SUPPORT
+ if (g_strcmp0 (session_type, "wayland") != 0 && status ==
GDM_DISPLAY_FAILED) {
+ /* we're going to fall back to X11, so try to autologin again
+ */
+ manager->priv->did_automatic_login = FALSE;
+ }
+#endif
}
break;
default:
@@ -1661,17 +1679,21 @@ on_start_user_session (StartUserSessionOperation *operation)
g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
create_user_session_for_display (operation->manager, display, allowed_uid);
+ /* Give the user session a new display object for bookkeeping purposes */
+ create_display_for_user_session (operation->manager,
+ operation->session,
+ session_id);
+
+
if (g_strcmp0 (operation->service_name, "gdm-autologin") == 0) {
/* remove the unused prepared greeter display since we're not going
* to have a greeter */
gdm_display_store_remove (self->priv->display_store, display);
g_object_unref (display);
- }
- /* Give the user session a new display object for bookkeeping purposes */
- create_display_for_user_session (operation->manager,
- operation->session,
- session_id);
+ self->priv->automatic_login_display = g_object_get_data (G_OBJECT
(operation->session), "gdm-display");
+ g_object_add_weak_pointer (G_OBJECT (display), (gpointer *)
&self->priv->automatic_login_display);
+ }
}
start_user_session (operation->manager, operation);
@@ -2565,6 +2587,8 @@ gdm_manager_dispose (GObject *object)
g_return_if_fail (manager->priv != NULL);
+ g_clear_weak_pointer (&manager->priv->automatic_login_display);
+
#ifdef HAVE_LIBXDMCP
g_clear_object (&manager->priv->xdmcp_factory);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]