[gdm] daemon,greeter: login after PAM has had time to talk to user



commit 29020f729640983f5604f90b2a8a792f26b1d33e
Author: Ray Strode <rstrode redhat com>
Date:   Wed May 18 16:11:32 2011 -0400

    daemon,greeter: login after PAM has had time to talk to user
    
    The greeter currently gives the go ahead for the session to start
    as soon as the user has been authorized.  Then the slave quickly
    runs through the remaining hoops and the greeter gets promptly
    killed.
    
    This commit changes the logic so that the slave doesn't get the
    go ahead to start the session until all the hoops have been
    run through, and potential messages have been queued, and displayed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=583856

 daemon/gdm-greeter-server.c                   |    6 +-
 daemon/gdm-simple-slave.c                     |   52 ++++++++++++------------
 gui/simple-greeter/gdm-greeter-client.c       |   18 ++++----
 gui/simple-greeter/gdm-greeter-client.h       |    2 +-
 gui/simple-greeter/gdm-greeter-login-window.c |    4 +-
 gui/simple-greeter/gdm-greeter-login-window.h |    2 +-
 gui/simple-greeter/gdm-greeter-session.c      |   12 +++---
 7 files changed, 48 insertions(+), 48 deletions(-)
---
diff --git a/daemon/gdm-greeter-server.c b/daemon/gdm-greeter-server.c
index 6a021d1..1fe3aa2 100644
--- a/daemon/gdm-greeter-server.c
+++ b/daemon/gdm-greeter-server.c
@@ -289,9 +289,9 @@ gdm_greeter_server_request_timed_login (GdmGreeterServer *greeter_server,
 }
 
 void
-gdm_greeter_server_user_authorized (GdmGreeterServer *greeter_server)
+gdm_greeter_server_session_opened (GdmGreeterServer *greeter_server)
 {
-        send_dbus_void_signal (greeter_server, "UserAuthorized");
+        send_dbus_void_signal (greeter_server, "SessionOpened");
 }
 
 /* Note: Use abstract sockets like dbus does by default on Linux. Abstract
@@ -732,7 +732,7 @@ do_introspect (DBusConnection *connection,
                                "    </signal>\n"
                                "    <signal name=\"AuthenticationFailed\">\n"
                                "    </signal>\n"
-                               "    <signal name=\"UserAuthorized\">\n"
+                               "    <signal name=\"SessionOpened\">\n"
                                "    </signal>\n"
                                "  </interface>\n");
 
diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c
index ddf7a63..1feef46 100644
--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -106,6 +106,7 @@ G_DEFINE_TYPE (GdmSimpleSlave, gdm_simple_slave, GDM_TYPE_SLAVE)
 static void create_new_session (GdmSimpleSlave *slave);
 static void destroy_session    (GdmSimpleSlave *slave);
 static void start_greeter      (GdmSimpleSlave *slave);
+static void queue_start_session (GdmSimpleSlave *slave);
 
 static void
 on_session_started (GdmSession       *session,
@@ -359,28 +360,11 @@ on_session_authentication_failed (GdmSession     *session,
 }
 
 static void
-gdm_simple_slave_accredit_when_ready (GdmSimpleSlave *slave)
+gdm_simple_slave_start_session_when_ready (GdmSimpleSlave *slave)
 {
         if (slave->priv->start_session_when_ready) {
-                char *ssid;
-                char *username;
-                int   cred_flag;
-
                 slave->priv->waiting_to_start_session = FALSE;
-
-                username = gdm_session_direct_get_username (slave->priv->session);
-
-                ssid = gdm_slave_get_primary_session_id_for_user (GDM_SLAVE (slave), username);
-                if (ssid != NULL && ssid [0] != '\0') {
-                        /* FIXME: we don't yet support refresh */
-                        cred_flag = GDM_SESSION_CRED_ESTABLISH;
-                } else {
-                        cred_flag = GDM_SESSION_CRED_ESTABLISH;
-                }
-                g_free (ssid);
-                g_free (username);
-
-                gdm_session_accredit (GDM_SESSION (slave->priv->session), cred_flag);
+                queue_start_session (slave);
         } else {
                 slave->priv->waiting_to_start_session = TRUE;
         }
@@ -390,13 +374,23 @@ static void
 on_session_authorized (GdmSession     *session,
                        GdmSimpleSlave *slave)
 {
-        if (slave->priv->greeter_server != NULL) {
-                gdm_greeter_server_user_authorized (slave->priv->greeter_server);
-                gdm_simple_slave_accredit_when_ready (slave);
+        char *ssid;
+        char *username;
+        int   cred_flag;
+
+        username = gdm_session_direct_get_username (slave->priv->session);
+
+        ssid = gdm_slave_get_primary_session_id_for_user (GDM_SLAVE (slave), username);
+        if (ssid != NULL && ssid [0] != '\0') {
+                /* FIXME: we don't yet support refresh */
+                cred_flag = GDM_SESSION_CRED_ESTABLISH;
         } else {
-                slave->priv->start_session_when_ready = TRUE;
-                gdm_simple_slave_accredit_when_ready (slave);
+                cred_flag = GDM_SESSION_CRED_ESTABLISH;
         }
+        g_free (ssid);
+        g_free (username);
+
+        gdm_session_accredit (GDM_SESSION (slave->priv->session), cred_flag);
 }
 
 static void
@@ -554,7 +548,13 @@ on_session_opened (GdmSession     *session,
         gdm_simple_slave_grant_console_permissions (slave);
 #endif  /* HAVE_LOGINDEVPERM */
 
-        queue_start_session (slave);
+        if (slave->priv->greeter_server != NULL) {
+                gdm_greeter_server_session_opened (slave->priv->greeter_server);
+                gdm_simple_slave_start_session_when_ready (slave);
+        } else {
+                slave->priv->start_session_when_ready = TRUE;
+                gdm_simple_slave_start_session_when_ready (slave);
+        }
 }
 
 static void
@@ -1078,7 +1078,7 @@ on_start_session_when_ready (GdmGreeterServer *session,
         slave->priv->start_session_when_ready = TRUE;
 
         if (slave->priv->waiting_to_start_session) {
-                gdm_simple_slave_accredit_when_ready (slave);
+                gdm_simple_slave_start_session_when_ready (slave);
         }
 }
 
diff --git a/gui/simple-greeter/gdm-greeter-client.c b/gui/simple-greeter/gdm-greeter-client.c
index 10ba236..92622d4 100644
--- a/gui/simple-greeter/gdm-greeter-client.c
+++ b/gui/simple-greeter/gdm-greeter-client.c
@@ -70,7 +70,7 @@ enum {
         DEFAULT_LANGUAGE_NAME_CHANGED,
         DEFAULT_SESSION_NAME_CHANGED,
         TIMED_LOGIN_REQUESTED,
-        USER_AUTHORIZED,
+        SESSION_OPENED,
         LAST_SIGNAL
 };
 
@@ -190,11 +190,11 @@ on_timed_login_requested (GdmGreeterClient *client,
 }
 
 static void
-on_user_authorized (GdmGreeterClient *client,
-                    DBusMessage      *message)
+on_session_opened (GdmGreeterClient *client,
+                   DBusMessage      *message)
 {
         g_signal_emit (client,
-                       gdm_greeter_client_signals[USER_AUTHORIZED],
+                       gdm_greeter_client_signals[SESSION_OPENED],
                        0);
 }
 
@@ -651,8 +651,8 @@ client_dbus_handle_message (DBusConnection *connection,
                 on_default_session_name_changed (client, message);
         } else if (dbus_message_is_signal (message, GREETER_SERVER_DBUS_INTERFACE, "TimedLoginRequested")) {
                 on_timed_login_requested (client, message);
-        } else if (dbus_message_is_signal (message, GREETER_SERVER_DBUS_INTERFACE, "UserAuthorized")) {
-                on_user_authorized (client, message);
+        } else if (dbus_message_is_signal (message, GREETER_SERVER_DBUS_INTERFACE, "SessionOpened")) {
+                on_session_opened (client, message);
         } else {
                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
         }
@@ -941,11 +941,11 @@ gdm_greeter_client_class_init (GdmGreeterClientClass *klass)
                               G_TYPE_NONE,
                               2, G_TYPE_STRING, G_TYPE_INT);
 
-        gdm_greeter_client_signals[USER_AUTHORIZED] =
-                g_signal_new ("user-authorized",
+        gdm_greeter_client_signals[SESSION_OPENED] =
+                g_signal_new ("session-opened",
                               G_OBJECT_CLASS_TYPE (object_class),
                               G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmGreeterClientClass, user_authorized),
+                              G_STRUCT_OFFSET (GdmGreeterClientClass, session_opened),
                               NULL,
                               NULL,
                               g_cclosure_marshal_VOID__VOID,
diff --git a/gui/simple-greeter/gdm-greeter-client.h b/gui/simple-greeter/gdm-greeter-client.h
index 7938046..9e093cf 100644
--- a/gui/simple-greeter/gdm-greeter-client.h
+++ b/gui/simple-greeter/gdm-greeter-client.h
@@ -68,7 +68,7 @@ typedef struct
         void (* timed_login_requested)   (GdmGreeterClient  *client,
                                           const char        *username,
                                           int                delay);
-        void (* user_authorized)         (GdmGreeterClient  *client);
+        void (* session_opened)          (GdmGreeterClient  *client);
 } GdmGreeterClientClass;
 
 #define GDM_GREETER_CLIENT_ERROR (gdm_greeter_client_error_quark ())
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 4b12582..44e5fd1 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -932,11 +932,11 @@ gdm_greeter_login_window_secret_info_query (GdmGreeterLoginWindow *login_window,
 }
 
 void
-gdm_greeter_login_window_user_authorized (GdmGreeterLoginWindow *login_window)
+gdm_greeter_login_window_session_opened (GdmGreeterLoginWindow *login_window)
 {
         g_return_if_fail (GDM_IS_GREETER_LOGIN_WINDOW (login_window));
 
-        g_debug ("GdmGreeterLoginWindow: user now authorized");
+        g_debug ("GdmGreeterLoginWindow: session now opened");
 
         gdm_greeter_login_window_start_session_when_ready (login_window);
 }
diff --git a/gui/simple-greeter/gdm-greeter-login-window.h b/gui/simple-greeter/gdm-greeter-login-window.h
index c8b1167..f461c8a 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.h
+++ b/gui/simple-greeter/gdm-greeter-login-window.h
@@ -83,7 +83,7 @@ void                gdm_greeter_login_window_set_default_session_name (GdmGreete
 void               gdm_greeter_login_window_request_timed_login (GdmGreeterLoginWindow *login_window,
                                                                  const char            *username,
                                                                  int                    delay);
-void               gdm_greeter_login_window_user_authorized     (GdmGreeterLoginWindow *login_window);
+void               gdm_greeter_login_window_session_opened      (GdmGreeterLoginWindow *login_window);
 
 G_END_DECLS
 
diff --git a/gui/simple-greeter/gdm-greeter-session.c b/gui/simple-greeter/gdm-greeter-session.c
index 7be5acd..05a5b53 100644
--- a/gui/simple-greeter/gdm-greeter-session.c
+++ b/gui/simple-greeter/gdm-greeter-session.c
@@ -177,11 +177,11 @@ on_timed_login_requested (GdmGreeterClient  *client,
 }
 
 static void
-on_user_authorized (GdmGreeterClient  *client,
-                    GdmGreeterSession *session)
+on_session_opened (GdmGreeterClient  *client,
+                   GdmGreeterSession *session)
 {
-        g_debug ("GdmGreeterSession: user authorized");
-        gdm_greeter_login_window_user_authorized (GDM_GREETER_LOGIN_WINDOW (session->priv->login_window));
+        g_debug ("GdmGreeterSession: session opened");
+        gdm_greeter_login_window_session_opened (GDM_GREETER_LOGIN_WINDOW (session->priv->login_window));
 }
 
 static void
@@ -584,8 +584,8 @@ gdm_greeter_session_init (GdmGreeterSession *session)
                           G_CALLBACK (on_timed_login_requested),
                           session);
         g_signal_connect (session->priv->client,
-                          "user-authorized",
-                          G_CALLBACK (on_user_authorized),
+                          "session-opened",
+                          G_CALLBACK (on_session_opened),
                           session);
 
         /* We want to listen for panel mnemonics even if the



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]