[gdm/gnome-3-22] worker: run PostLogin/PreSession scripts later



commit 7be68258b6d9b51d574311aef7ab3ab35629a939
Author: Ray Strode <rstrode redhat com>
Date:   Mon Apr 18 16:09:08 2016 -0400

    worker: run PostLogin/PreSession scripts later
    
    Right now we run them while the login screen is still up, so
    they have no way of showing UI to the user.
    
    This commit moves them until after the login screen is torn
    down.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779497

 daemon/gdm-session-worker.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index daf8b91..d97b02b 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1856,6 +1856,24 @@ gdm_session_worker_start_session (GdmSessionWorker  *worker,
                 jump_to_vt (worker, worker->priv->session_vt);
         }
 
+        if (!worker->priv->is_program_session && !run_script (worker, GDMCONFDIR "/PostLogin")) {
+                g_set_error (error,
+                             GDM_SESSION_WORKER_ERROR,
+                             GDM_SESSION_WORKER_ERROR_OPENING_SESSION,
+                             "Failed to execute PostLogin script");
+                error_code = PAM_ABORT;
+                goto out;
+        }
+
+        if (!worker->priv->is_program_session && !run_script (worker, GDMCONFDIR "/PreSession")) {
+                g_set_error (error,
+                             GDM_SESSION_WORKER_ERROR,
+                             GDM_SESSION_WORKER_ERROR_OPENING_SESSION,
+                             "Failed to execute PreSession script");
+                error_code = PAM_ABORT;
+                goto out;
+        }
+
         session_pid = fork ();
 
         if (session_pid < 0) {
@@ -2251,14 +2269,6 @@ gdm_session_worker_open_session (GdmSessionWorker  *worker,
                 flags |= PAM_SILENT;
         }
 
-        if (!run_script (worker, GDMCONFDIR "/PostLogin")) {
-                g_set_error (error,
-                             GDM_SESSION_WORKER_ERROR,
-                             GDM_SESSION_WORKER_ERROR_OPENING_SESSION,
-                             "Failed to execute PostLogin script");
-                return FALSE;
-        }
-
         error_code = pam_open_session (worker->priv->pam_handle, flags);
 
         if (error_code != PAM_SUCCESS) {
@@ -2274,14 +2284,6 @@ gdm_session_worker_open_session (GdmSessionWorker  *worker,
 
         session_id = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_ID");
 
-        /* FIXME: should we do something here?
-         * Note that error return status from PreSession script should
-         * be ignored in the case of a X-GDM-BypassXsession session, which can
-         * be checked by calling:
-         * gdm_session_bypasses_xsession (session)
-         */
-        run_script (worker, GDMCONFDIR "/PreSession");
-
         if (session_id != NULL) {
                 g_free (worker->priv->session_id);
                 worker->priv->session_id = session_id;


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