[gdm] worker: Properly detect the error code from setting PAM_TTY



commit 7c34b11869261870d3fba1ccb4d5471e43d3dbba
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Feb 14 16:13:16 2014 -0500

    worker: Properly detect the error code from setting PAM_TTY
    
    Without this, we'll look at the error code for the last set if we have
    an empty TTY, rather than the one for the current set.

 daemon/gdm-session-worker.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 380e0f6..a664ebd 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1105,18 +1105,18 @@ gdm_session_worker_initialize_pam (GdmSessionWorker *worker,
         pam_tty = _get_tty_for_pam (x11_display_name, display_device);
         if (pam_tty != NULL && pam_tty[0] != '\0') {
                 error_code = pam_set_item (worker->priv->pam_handle, PAM_TTY, pam_tty);
-        }
 
-        if (error_code != PAM_SUCCESS) {
-                g_debug ("error informing authentication system of user's console %s: %s",
-                         pam_tty,
-                         pam_strerror (worker->priv->pam_handle, error_code));
-                g_free (pam_tty);
-                g_set_error (error,
-                             GDM_SESSION_WORKER_ERROR,
-                             GDM_SESSION_WORKER_ERROR_AUTHENTICATING,
-                             "%s", "");
-                goto out;
+                if (error_code != PAM_SUCCESS) {
+                        g_debug ("error informing authentication system of user's console %s: %s",
+                                 pam_tty,
+                                 pam_strerror (worker->priv->pam_handle, error_code));
+                        g_free (pam_tty);
+                        g_set_error (error,
+                                     GDM_SESSION_WORKER_ERROR,
+                                     GDM_SESSION_WORKER_ERROR_AUTHENTICATING,
+                                     "%s", "");
+                        goto out;
+                }
         }
         g_free (pam_tty);
 


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