[gdm/multi-stack: 39/50] Return a different error code for "service won't work" than "auth failed"



commit deb082b332648fccf0fa3436a9d656f682a6e1ce
Author: Ray Strode <rstrode redhat com>
Date:   Wed Oct 28 16:05:14 2009 -0400

    Return a different error code for "service won't work" than "auth failed"
    
    If we bubble it up to the greeter then we should be able to have
    a more sensible UI when e.g. fingerprinting isn't enabled.

 daemon/gdm-session-worker.c |   12 ++++++++++--
 daemon/gdm-session-worker.h |    1 +
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index b07a939..72fdfa8 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1291,7 +1291,7 @@ gdm_session_worker_initialize_pam (GdmSessionWorker *worker,
                  */
                 g_set_error (error,
                              GDM_SESSION_WORKER_ERROR,
-                             GDM_SESSION_WORKER_ERROR_AUTHENTICATING,
+                             GDM_SESSION_WORKER_ERROR_SERVICE_UNAVAILABLE,
                              _("error initiating conversation with authentication system - %s"),
                              error_code == PAM_ABORT? _("general failure") :
                              error_code == PAM_BUF_ERR? _("out of memory") :
@@ -1403,7 +1403,15 @@ gdm_session_worker_authenticate_user (GdmSessionWorker *worker,
         /* blocking call, does the actual conversation */
         error_code = pam_authenticate (worker->priv->pam_handle, authentication_flags);
 
-        if (error_code != PAM_SUCCESS) {
+        if (error_code == PAM_AUTHINFO_UNAVAIL) {
+                g_debug ("GdmSessionWorker: authentication service unavailable");
+
+                g_set_error (error,
+                             GDM_SESSION_WORKER_ERROR,
+                             GDM_SESSION_WORKER_ERROR_SERVICE_UNAVAILABLE,
+                             "%s", pam_strerror (worker->priv->pam_handle, error_code));
+                goto out;
+        } else if (error_code != PAM_SUCCESS) {
                 g_debug ("GdmSessionWorker: authentication returned %d: %s", error_code, pam_strerror (worker->priv->pam_handle, error_code));
 
                 /*
diff --git a/daemon/gdm-session-worker.h b/daemon/gdm-session-worker.h
index ee5465a..b1c8285 100644
--- a/daemon/gdm-session-worker.h
+++ b/daemon/gdm-session-worker.h
@@ -41,6 +41,7 @@ typedef enum _GdmSessionWorkerError {
         GDM_SESSION_WORKER_ERROR_OPENING_MESSAGE_PIPE,
         GDM_SESSION_WORKER_ERROR_COMMUNICATING,
         GDM_SESSION_WORKER_ERROR_WORKER_DIED,
+        GDM_SESSION_WORKER_ERROR_SERVICE_UNAVAILABLE,
         GDM_SESSION_WORKER_ERROR_AUTHENTICATING,
         GDM_SESSION_WORKER_ERROR_AUTHORIZING,
         GDM_SESSION_WORKER_ERROR_OPENING_LOG_FILE,



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