summaryrefslogtreecommitdiff
path: root/src/virt-viewer-app.c
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-06-18 14:10:54 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2015-06-19 14:39:48 -0500
commit271c51d8de69c473cf4e76682c8ebd37b46984af (patch)
tree2f7192628999ab258f219e6138f2f0fe2568dc55 /src/virt-viewer-app.c
parent5c0ed8a99f749fd6282032f2c49832d5faa3f88d (diff)
Fix inconsistencies in session auth failures
The spice session implementation can retry authentication on its own, whereas the vnc session needs to tear down the session and re-connect in order to retry a failed authentication. This results in the following inconsistent behavior: VNC session: - emits a 'session-auth-failed' signal when the client does not support a particular authentication type (i.e.: a non-recoverable error) Spice session: - emits a 'session-auth-failed' signal when user enters an incorrect password, and immediately retries auth internally VNC session: - emits a 'session-auth-refused' error when user enters an invalid password (i.e.: a recoverable error) Spice Session: - never emits a 'session-auth-refused' signal Because of these differences, the VirtViewerApp code to handle authentication failures is a bit confusing and difficult to maintain. To fix this issue, make both the spice and VNC sessions emit the same signal when similar errors occur. We use the new session API added in the last commit to determine whether the session supports automatic retries so we know how to handle the signal.
Diffstat (limited to 'src/virt-viewer-app.c')
-rw-r--r--src/virt-viewer-app.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 2bf74f7..36db150 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1488,7 +1488,7 @@ static void virt_viewer_app_cancelled(VirtViewerSession *session,
}
-static void virt_viewer_app_auth_refused(VirtViewerSession *session G_GNUC_UNUSED,
+static void virt_viewer_app_auth_refused(VirtViewerSession *session,
const char *msg,
VirtViewerApp *self)
{
@@ -1496,6 +1496,15 @@ static void virt_viewer_app_auth_refused(VirtViewerSession *session G_GNUC_UNUSE
int ret;
VirtViewerAppPrivate *priv = self->priv;
+ if (virt_viewer_session_can_retry_auth(session)) {
+ virt_viewer_app_simple_message_dialog(self,
+ _("Unable to authenticate with remote desktop server at %s: %s\n"),
+ priv->pretty_address, msg);
+ return;
+ }
+
+ /* if the session implementation cannot retry auth automatically, the
+ * VirtViewerApp needs to schedule a new connection to retry */
dialog = gtk_message_dialog_new(virt_viewer_window_get_window(priv->main_window),
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1515,7 +1524,6 @@ static void virt_viewer_app_auth_refused(VirtViewerSession *session G_GNUC_UNUSE
priv->authretry = FALSE;
}
-
static void virt_viewer_app_auth_failed(VirtViewerSession *session G_GNUC_UNUSED,
const char *msg,
VirtViewerApp *self)