commit 69bdbf36c99e6c02dae511a0e4bc540c818944d6
Author: Hans Petter Jansson <hpj@cl.no>
Date:   Fri Feb 5 23:39:16 2010 +0100

    Patch 46: gdm-show-pam-info-in-dialog.patch

Index: gdm-2.24.0/daemon/gdm-session-worker.c
===================================================================
--- gdm-2.24.0.orig/daemon/gdm-session-worker.c
+++ gdm-2.24.0/daemon/gdm-session-worker.c
@@ -126,6 +126,7 @@ struct GdmSessionWorkerPrivate
         GHashTable       *environment;
         guint32           cancelled : 1;
         guint32           timed_out : 1;
+        guint32           discard_messages : 1;
         guint             state_change_idle_id;
 
         char             *server_address;
@@ -834,21 +835,26 @@ gdm_session_worker_process_pam_message (
 
         utf8_msg = convert_to_utf8 (query->msg);
 
-        worker->priv->cancelled = FALSE;
-        worker->priv->timed_out = FALSE;
+        if (worker->priv->cancelled || worker->priv->timed_out) {
+                worker->priv->discard_messages = TRUE;
+                worker->priv->cancelled = FALSE;
+                worker->priv->timed_out = FALSE;
+        }
 
         user_answer = NULL;
         res = FALSE;
         switch (query->msg_style) {
         case PAM_PROMPT_ECHO_ON:
+                worker->priv->discard_messages = FALSE;
                 res = gdm_session_worker_ask_question (worker, utf8_msg, &user_answer);
                 break;
         case PAM_PROMPT_ECHO_OFF:
+                worker->priv->discard_messages = FALSE;
                 res = gdm_session_worker_ask_for_secret (worker, utf8_msg, &user_answer);
                 break;
         case PAM_TEXT_INFO:
                 g_warning ("%s: PAM_TEXT_INFO: %s", __func__, utf8_msg);
-                res = gdm_session_worker_report_info (worker, utf8_msg);
+                res = gdm_session_worker_report_problem (worker, utf8_msg);
                 break;
         case PAM_ERROR_MSG:
                 res = gdm_session_worker_report_problem (worker, utf8_msg);
@@ -860,6 +866,11 @@ gdm_session_worker_process_pam_message (
 
         if (worker->priv->timed_out) {
                 send_dbus_void_method (worker->priv->connection, "CancelPendingQuery");
+
+                g_free (user_answer);
+                user_answer = NULL;
+
+                worker->priv->discard_messages = TRUE;
                 worker->priv->timed_out = FALSE;
         }
 
@@ -2186,10 +2197,19 @@ do_authenticate (GdmSessionWorker *worke
                                                     worker->priv->password_is_required,
                                                     &error);
         if (! res) {
-                g_debug ("GdmSessionWorker: Unable to verify user");
-                send_dbus_string_method (worker->priv->connection,
-                                         "AuthenticationFailed",
-                                         error->message);
+                if (worker->priv->discard_messages) {
+                        /* Hack to avoid timeout "problem" being reported and displayed in a dialog */
+                        g_debug ("GdmSessionWorker: User verification timed out");
+                        send_dbus_string_method (worker->priv->connection,
+                                                 "AuthenticationFailed",
+                                                 "__pam_reset__");
+                } else {
+                        g_debug ("GdmSessionWorker: Unable to verify user");
+                        send_dbus_string_method (worker->priv->connection,
+                                                 "AuthenticationFailed",
+                                                 error->message);
+                }
+
                 g_error_free (error);
                 return;
         }
Index: gdm-2.24.0/daemon/gdm-simple-slave.c
===================================================================
--- gdm-2.24.0.orig/daemon/gdm-simple-slave.c
+++ gdm-2.24.0/daemon/gdm-simple-slave.c
@@ -251,8 +251,11 @@ on_session_authentication_failed (GdmSes
                                   GdmSimpleSlave *slave)
 {
         if (slave->priv->greeter_server != NULL) {
-                gdm_greeter_server_problem (slave->priv->greeter_server,
-                                          message != NULL ? message :  _("Unable to authenticate user"));
+                /* Hack to avoid timeout "problem" being reported and displayed in a dialog */
+                if (!(message != NULL && !strcmp (message, "__pam_reset__"))) {
+                        gdm_greeter_server_problem (slave->priv->greeter_server,
+                                                    message != NULL ? message : _("Unable to authenticate user"));
+                }
         }
         destroy_session (slave);
         queue_greeter_reset (slave);
Index: gdm-2.24.0/gui/simple-greeter/gdm-greeter-login-window.c
===================================================================
--- gdm-2.24.0.orig/gui/simple-greeter/gdm-greeter-login-window.c
+++ gdm-2.24.0/gui/simple-greeter/gdm-greeter-login-window.c
@@ -862,9 +862,69 @@ gdm_greeter_login_window_problem (GdmGre
 
         g_debug ("GdmGreeterLoginWindow: problem: %s", text);
 
+        _gdm_greeter_login_window_set_interactive (login_window, FALSE);
+
+        GtkWidget *dialog;
+        GtkWidget *dialog_vbox;
+        GtkWidget *dialog_action_area;
+        GtkWidget *hbox;
+        GtkWidget *vbox;
+        GtkWidget *label;
+        GtkWidget *button;
+        GtkWidget *image;
+        gchar     *title;
+        gchar     *msg;
+
+        dialog = gtk_dialog_new ();
+
+        gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+        gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+        gtk_window_set_title (GTK_WINDOW (dialog), "");
+
+        dialog_vbox = GTK_DIALOG (dialog)->vbox;
+        gtk_box_set_spacing (GTK_BOX (dialog_vbox), 12);
+
+        hbox = gtk_hbox_new (FALSE, 12);
+        gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox, FALSE, FALSE, 0);
+        gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+        gtk_widget_show (hbox);
+
+        image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
+	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+        gtk_widget_show (image);
+
+        vbox = gtk_vbox_new (FALSE, 6);
+        gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+        gtk_widget_show (vbox);
+
+        title = g_strconcat ("<b>", text, "</b>", NULL);
+        label = gtk_label_new (title);
+        gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+        gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+        gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+        gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+        gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+        gtk_widget_show (label);
+        g_free (title);
+
+        button = gtk_button_new_from_stock (GTK_STOCK_OK);
+        gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK);
+        GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+        gtk_widget_show (button);
+
+        gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (login_window));
+
+        gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+                                        GTK_RESPONSE_OK);
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+
         set_message (GDM_GREETER_LOGIN_WINDOW (login_window), text);
         gdk_window_beep (GTK_WIDGET (login_window)->window);
 
+        _gdm_greeter_login_window_set_interactive (login_window, TRUE);
+
         return TRUE;
 }
 
