[gdm/wip/fix-pam-group: 5/5] session-worker: don't set PAM_TTY to bogus value on failure



commit 4efc03430ff1d6806591899d8b0645b257d341e9
Author: Ray Strode <rstrode redhat com>
Date:   Tue Aug 7 15:33:25 2018 -0400

    session-worker: don't set PAM_TTY to bogus value on failure
    
    At the moment we set PAM_TTY to a bogus value if we're unable
    to read the current VT.
    
    This commit adds an error check for that case.

 daemon/gdm-session-worker.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index d211cdb1..bcddc948 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1220,9 +1220,10 @@ gdm_session_worker_initialize_pam (GdmSessionWorker   *worker,
 
         /* Temporarily set PAM_TTY with the currently active VT (login screen) 
            PAM_TTY will be reset with the users VT right before the user session is opened */
-        ensure_login_vt (worker);
-        g_snprintf (tty_string, 256, "/dev/tty%d", worker->priv->login_vt);
-        pam_set_item (worker->priv->pam_handle, PAM_TTY, tty_string);
+        if (ensure_login_vt (worker)) {
+                g_snprintf (tty_string, 256, "/dev/tty%d", worker->priv->login_vt);
+                pam_set_item (worker->priv->pam_handle, PAM_TTY, tty_string);
+        }
         if (!display_is_local)
                 worker->priv->password_is_required = TRUE;
 


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