[Spice-commits] 3 commits - src/spice-channel.c src/spice-widget.c
Pavel Grunt
pgrunt at kemper.freedesktop.org
Mon Mar 27 15:52:37 UTC 2017
src/spice-channel.c | 50 ++++++++++++++++++++++++++++++--------------------
src/spice-widget.c | 2 +-
2 files changed, 31 insertions(+), 21 deletions(-)
New commits:
commit 34be2a39949ebdffd7fdce4a9e6f3ddf1225b86b
Author: snir sheriber <ssheribe at redhat.com>
Date: Sun Feb 26 12:09:18 2017 +0200
authentication: Handle failed spice authentication
Changing the name of the failures handling function (spice
and sasl authentication failures are now treated separately)
and display more suitable spice authentication failure error
message.
Resolves: rhbz#1365736
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 1f618b1..e42e560 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1189,8 +1189,8 @@ static void spice_channel_failed_sasl_authentication(SpiceChannel *channel)
#endif
/* coroutine context */
-static void spice_channel_failed_authentication(SpiceChannel *channel,
- gboolean invalidPassword)
+static void spice_channel_failed_spice_authentication(SpiceChannel *channel,
+ gboolean invalidPassword)
{
SpiceChannelPrivate *c = channel->priv;
@@ -1203,7 +1203,7 @@ static void spice_channel_failed_authentication(SpiceChannel *channel,
g_set_error_literal(&c->error,
SPICE_CLIENT_ERROR,
SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD,
- _("Authentication failed: password is required"));
+ _("Authentication failed: wrong password ?"));
c->event = SPICE_CHANNEL_ERROR_AUTH;
@@ -1242,7 +1242,7 @@ static SpiceChannelEvent spice_channel_send_spice_ticket(SpiceChannel *channel)
if (password == NULL)
password = g_strdup("");
if (strlen(password) > SPICE_MAX_PASSWORD_LENGTH) {
- spice_channel_failed_authentication(channel, TRUE);
+ spice_channel_failed_spice_authentication(channel, TRUE);
ret = SPICE_CHANNEL_ERROR_AUTH;
goto cleanup;
}
@@ -1278,7 +1278,7 @@ static gboolean spice_channel_recv_auth(SpiceChannel *channel)
if (link_res != SPICE_LINK_ERR_OK) {
CHANNEL_DEBUG(channel, "link result: reply %u", link_res);
- spice_channel_failed_authentication(channel, FALSE);
+ spice_channel_failed_spice_authentication(channel, FALSE);
return FALSE;
}
commit 2dc8f0bad6558a944405404a266954fd29fd0fa2
Author: snir sheriber <ssheribe at redhat.com>
Date: Sun Feb 26 12:09:17 2017 +0200
authentication: Handle failed SASL authentication separately
Move SASL authentication failures handling to a separate
function.
Multiple error messages asking for username\password were
removed because they are not necessarily the reason for the
failure (avoiding similar issue as in rhbz#1365736).
Letting the user know about required username\password
should be achieved by setting specific Gerror's error code
and enabling\disabling the username\password fields
accordingly by the application.
diff --git a/src/spice-channel.c b/src/spice-channel.c
index c2e8a01..1f618b1 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1163,28 +1163,38 @@ static int spice_channel_read(SpiceChannel *channel, void *data, size_t length)
return length;
}
+#if HAVE_SASL
/* coroutine context */
-static void spice_channel_failed_authentication(SpiceChannel *channel,
- gboolean invalidPassword)
+static void spice_channel_failed_sasl_authentication(SpiceChannel *channel)
{
SpiceChannelPrivate *c = channel->priv;
+ gint err_code; /* The application should activate the authentication window fields accordingly */
if (c->auth_needs_username && c->auth_needs_password)
- g_set_error_literal(&c->error,
- SPICE_CLIENT_ERROR,
- SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME,
- _("Authentication failed: password and username are required"));
+ err_code = SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD_AND_USERNAME;
else if (c->auth_needs_username)
- g_set_error_literal(&c->error,
- SPICE_CLIENT_ERROR,
- SPICE_CLIENT_ERROR_AUTH_NEEDS_USERNAME,
- _("Authentication failed: username is required"));
- else if (c->auth_needs_password)
- g_set_error_literal(&c->error,
- SPICE_CLIENT_ERROR,
- SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD,
- _("Authentication failed: password is required"));
- else if (invalidPassword)
+ err_code = SPICE_CLIENT_ERROR_AUTH_NEEDS_USERNAME;
+ else
+ err_code = SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD;
+
+ g_set_error_literal(&c->error,
+ SPICE_CLIENT_ERROR,
+ err_code,
+ _("Authentication failed"));
+
+ c->event = SPICE_CHANNEL_ERROR_AUTH;
+
+ c->has_error = TRUE; /* force disconnect */
+}
+#endif
+
+/* coroutine context */
+static void spice_channel_failed_authentication(SpiceChannel *channel,
+ gboolean invalidPassword)
+{
+ SpiceChannelPrivate *c = channel->priv;
+
+ if (invalidPassword)
g_set_error_literal(&c->error,
SPICE_CLIENT_ERROR,
SPICE_CLIENT_ERROR_AUTH_NEEDS_PASSWORD,
@@ -1858,7 +1868,7 @@ error:
if (saslconn)
sasl_dispose(&saslconn);
- spice_channel_failed_authentication(channel, FALSE);
+ spice_channel_failed_sasl_authentication(channel);
ret = FALSE;
cleanup:
commit 721dbe9926c0e35e462595346829d55d7820ea05
Author: Pavel Grunt <pgrunt at redhat.com>
Date: Mon Mar 27 13:36:57 2017 +0200
widget: Always call gtk_widget_show_all
Since spice-gtk 0.32 SpiceDisplay widget internally has changed
from the GtkDrawingArea to a GtkContainer.
Per gtk_widget_show documentation:
"Remember that you have to show the containers containing a widget,
in addition to the widget itself, before it will appear onscreen."
Let's always call gtk_widget_show_all, not just for gtk+ >= 3.16
otherwise you may get a blackscreen with spice-gtk compiled against
an old gtk+ version.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=100251
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 5cc1553..5bbba8f 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -657,10 +657,10 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
"signal::realize", gl_area_realize, display,
NULL);
gtk_stack_add_named(d->stack, area, "gl-area");
- gtk_widget_show_all(widget);
G_GNUC_END_IGNORE_DEPRECATIONS
#endif
#endif
+ gtk_widget_show_all(widget);
g_signal_connect(display, "grab-broken-event", G_CALLBACK(grab_broken), NULL);
g_signal_connect(display, "grab-notify", G_CALLBACK(grab_notify), NULL);
More information about the Spice-commits
mailing list