[vinagre] Improve FreeRDP authentication failure handling
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vinagre] Improve FreeRDP authentication failure handling
- Date: Wed, 27 Jul 2016 12:21:26 +0000 (UTC)
commit d7b4f88943e8615d252d27e1efc58cb64a9e1821
Author: Michał Kępień <michal kepien nask pl>
Date: Wed Jul 27 13:19:52 2016 +0100
Improve FreeRDP authentication failure handling
The issue is caused by changes introduced by 60dea27. When the RDP
server refuses TCP connections on the specified port, freerdp_connect()
causes freerdp_get_last_error() to return 0x2000c. Due to the way the
do-while loop is constructed in open_freerdp(), this effectively causes
freerdp_connect() to be called in an infinite loop, which quickly
results in a SIGSEGV as FreeRDP does not seem to handle eventfd
creation failures nicely (these are caused by exceeding the per-process
limit of open file descriptors).
As the error string for error 0x2000c is "protocol security negotiation
or connection failure", to at least allow refused connections to be
handled gracefully, some limit should be enforced on the number of loop
iterations inside open_freerdp().
https://bugzilla.gnome.org/show_bug.cgi?id=769217
plugins/rdp/vinagre-rdp-tab.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/plugins/rdp/vinagre-rdp-tab.c b/plugins/rdp/vinagre-rdp-tab.c
index 5bbfca0..476071c 100644
--- a/plugins/rdp/vinagre-rdp-tab.c
+++ b/plugins/rdp/vinagre-rdp-tab.c
@@ -1187,8 +1187,8 @@ open_freerdp (VinagreRdpTab *rdp_tab)
VinagreTab *tab = VINAGRE_TAB (rdp_tab);
GtkWindow *window = GTK_WINDOW (vinagre_tab_get_window (tab));
gboolean success = TRUE;
- gboolean authentication_error = FALSE;
gboolean cancelled = FALSE;
+ guint authentication_errors = 0;
priv->events = g_queue_new ();
@@ -1197,14 +1197,12 @@ open_freerdp (VinagreRdpTab *rdp_tab)
do
{
- authentication_error = FALSE;
-
/* Run FreeRDP session */
success = freerdp_connect (priv->freerdp_session);
if (!success)
{
- authentication_error = freerdp_get_last_error (priv->freerdp_session->context) == 0x20009 ||
- freerdp_get_last_error (priv->freerdp_session->context) == 0x2000c;
+ authentication_errors += freerdp_get_last_error (priv->freerdp_session->context) == 0x20009 ||
+ freerdp_get_last_error (priv->freerdp_session->context) == 0x2000c;
cancelled = freerdp_get_last_error (priv->freerdp_session->context) == 0x2000b;
@@ -1212,7 +1210,7 @@ open_freerdp (VinagreRdpTab *rdp_tab)
init_freerdp (rdp_tab);
}
}
- while (!success && authentication_error);
+ while (!success && authentication_errors < 3);
if (!success)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]