Blob Blame History Raw
From 835a81d588648be09c79966cf99e5adba7a555bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
Date: Fri, 2 Aug 2013 16:53:18 +0200
Subject: [PATCH] spice: show an error dialog if password is invalid

Error message should show up when input the wrong password for spice
guests as vnc guests.

https://bugzilla.redhat.com/show_bug.cgi?id=990883
(cherry picked from commit 62f12d4c15333d25e73584dc9e128e201b1a92e2)
---
 src/virt-viewer-session-spice.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 4c52b47..2d59db2 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -53,6 +53,7 @@ struct _VirtViewerSessionSpicePrivate {
     int channel_count;
     int usbredir_channel_count;
     gboolean has_sw_smartcard_reader;
+    guint pass_try;
 };
 
 #define VIRT_VIEWER_SESSION_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_SPICE, VirtViewerSessionSpicePrivate))
@@ -490,6 +491,12 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
         break;
     case SPICE_CHANNEL_ERROR_AUTH:
         DEBUG_LOG("main channel: auth failure (wrong password?)");
+
+        if (self->priv->pass_try > 0)
+            g_signal_emit_by_name(session, "session-auth-failed",
+                                  _("invalid password"));
+        self->priv->pass_try++;
+
         int ret = virt_viewer_auth_collect_credentials(self->priv->main_window,
                                                        "SPICE",
                                                        NULL,