[gdm] manager: handle autologin directly
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] manager: handle autologin directly
- Date: Wed, 18 Feb 2015 22:42:14 +0000 (UTC)
commit 998af1e4dea53822151bb0bc4adac2dbbca9a4e8
Author: Ray Strode <rstrode redhat com>
Date: Tue Feb 10 16:42:53 2015 -0500
manager: handle autologin directly
Right now we call a "set_up_greeter_session" method on the display
object to to find out the autologin username. This is weird because
there's no greeter session when performing an autologin. Also, the
display delegates to the slave, and we want to get rid of the slave.
Furthermore, the manager handles most of the autologin implementation
already, it's just the "get the username" part (which is always "root"),
that it delegates.
This commit changes the manager to just handle the autologin process
completely by itself.
https://bugzilla.gnome.org/show_bug.cgi?id=744764
daemon/gdm-manager.c | 29 +++++++++++++++++++++++++++--
daemon/gdm-simple-slave.c | 19 +------------------
2 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 112ce71..fa3563e 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1244,14 +1244,36 @@ manager_interface_init (GdmDBusManagerIface *interface)
interface->handle_open_reauthentication_channel = gdm_manager_handle_open_reauthentication_channel;
}
+static gboolean
+display_should_autologin (GdmManager *manager,
+ GdmDisplay *display)
+{
+ gboolean enabled = FALSE;
+ int delay = 0;
+
+ if (g_file_test (GDM_RAN_ONCE_MARKER_FILE, G_FILE_TEST_EXISTS)) {
+ return FALSE;
+ }
+
+ gdm_display_get_timed_login_details (display, &enabled, NULL, &delay, NULL);
+ return enabled && delay == 0;
+}
+
static void
set_up_greeter_session (GdmManager *manager,
GdmDisplay *display)
{
char *allowed_user;
struct passwd *passwd_entry;
+ gboolean will_autologin;
- gdm_display_set_up_greeter_session (display, &allowed_user);
+ will_autologin = display_should_autologin (manager, display);
+
+ if (!will_autologin) {
+ gdm_display_set_up_greeter_session (display, &allowed_user);
+ } else {
+ allowed_user = g_strdup ("root");
+ }
if (!gdm_get_pwent_for_name (allowed_user, &passwd_entry)) {
g_warning ("GdmManager: couldn't look up username %s",
@@ -1264,7 +1286,10 @@ set_up_greeter_session (GdmManager *manager,
create_seed_session_for_display (manager, display, passwd_entry->pw_uid);
g_free (allowed_user);
- gdm_display_start_greeter_session (display);
+ if (!will_autologin) {
+ gdm_display_start_greeter_session (display);
+ }
+
touch_ran_once_marker_file (manager);
}
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index 6cedb52..28ee5bb 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -585,21 +585,6 @@ start_initial_setup (GdmSimpleSlave *slave)
}
static gboolean
-wants_autologin (GdmSimpleSlave *slave)
-{
- gboolean enabled = FALSE;
- int delay = 0;
- /* FIXME: handle wait-for-go */
-
- if (g_file_test (GDM_RAN_ONCE_MARKER_FILE, G_FILE_TEST_EXISTS)) {
- return FALSE;
- }
-
- gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &enabled, NULL, &delay);
- return enabled && delay == 0;
-}
-
-static gboolean
wants_initial_setup (GdmSimpleSlave *slave)
{
gboolean enabled = FALSE;
@@ -640,8 +625,6 @@ gdm_simple_slave_set_up_greeter_session (GdmSlave *slave,
if (wants_initial_setup (self)) {
*username = g_strdup (INITIAL_SETUP_USERNAME);
- } else if (wants_autologin (self)) {
- *username = g_strdup ("root");
} else {
*username = g_strdup (GDM_USERNAME);
}
@@ -682,7 +665,7 @@ gdm_simple_slave_start_greeter_session (GdmSlave *slave)
{
if (wants_initial_setup (GDM_SIMPLE_SLAVE (slave))) {
start_initial_setup (GDM_SIMPLE_SLAVE (slave));
- } else if (!wants_autologin (GDM_SIMPLE_SLAVE (slave))) {
+ } else {
start_greeter (GDM_SIMPLE_SLAVE (slave));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]