Provide a special authentication error message for too long passwords. --- Note that this patch depends on a pending patch in spice-common. gtk/spice-channel.c | 18 ++++++++++++++---- gtk/spice-client.h | 2 ++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 4e7d8b7..fbe3ab1 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -1051,7 +1051,8 @@ static void spice_channel_send_spice_ticket(SpiceChannel *channel) } /* coroutine context */ -static void spice_channel_failed_authentication(SpiceChannel *channel) +static void spice_channel_failed_authentication(SpiceChannel *channel, + gboolean invalidPassword) { SpiceChannelPrivate *c = channel->priv; @@ -1060,6 +1061,11 @@ static void spice_channel_failed_authentication(SpiceChannel *channel) SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME, _("Authentication failed: password and username are required")); + else if (invalidPassword) + g_set_error_literal(&c->error, + SPICE_CLIENT_ERROR, + SPICE_CLIENT_ERROR_AUTH_INVALID_PASSWORD, + _("Authentication failed: password is too long")); else g_set_error_literal(&c->error, SPICE_CLIENT_ERROR, @@ -1086,9 +1092,13 @@ static gboolean spice_channel_recv_auth(SpiceChannel *channel) return FALSE; } - if (link_res != SPICE_LINK_ERR_OK) { + if (link_res == SPICE_LINK_ERR_INVALID_PASSWORD) { + CHANNEL_DEBUG(channel, "link result: invalid password"); + spice_channel_failed_authentication(channel, TRUE); + return FALSE; + } if (link_res != SPICE_LINK_ERR_OK) { CHANNEL_DEBUG(channel, "link result: reply %d", link_res); - spice_channel_failed_authentication(channel); + spice_channel_failed_authentication(channel, FALSE); return FALSE; } @@ -1662,7 +1672,7 @@ error: if (saslconn) sasl_dispose(&saslconn); - spice_channel_failed_authentication(channel); + spice_channel_failed_authentication(channel, FALSE); ret = FALSE; cleanup: diff --git a/gtk/spice-client.h b/gtk/spice-client.h index c2474d1..58d1f76 100644 --- a/gtk/spice-client.h +++ b/gtk/spice-client.h @@ -60,6 +60,7 @@ G_BEGIN_DECLS * @SPICE_CLIENT_USB_DEVICE_LOST: usb device disconnected (fatal IO error) * @SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD: password is required * @SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME: password and username are required + * @SPICE_CLIENT_ERROR_AUTH_INVALID_PASSWORD: password is too long * * Error codes returned by spice-client API. */ @@ -70,6 +71,7 @@ typedef enum SPICE_CLIENT_USB_DEVICE_LOST, SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD, SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME, + SPICE_CLIENT_ERROR_AUTH_INVALID_PASSWORD, } SpiceClientError; GQuark spice_client_error_quark(void); -- 2.1.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel