summaryrefslogtreecommitdiff
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
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.
-rw-r--r--src/virt-viewer-app.c12
-rw-r--r--src/virt-viewer-session-spice.c2
2 files changed, 11 insertions, 3 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)
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index ec6ffa5..9976291 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -617,7 +617,7 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel,
}
if (self->priv->pass_try > 0)
- g_signal_emit_by_name(session, "session-auth-failed",
+ g_signal_emit_by_name(session, "session-auth-refused",
error != NULL ? error->message : _("Invalid password"));
self->priv->pass_try++;