[network-manager-openconnect/NM_0_8] Implement proper cancellation now that libopenconnect supports it (cherry picked from commit e4dc523
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openconnect/NM_0_8] Implement proper cancellation now that libopenconnect supports it (cherry picked from commit e4dc523
- Date: Wed, 20 Jun 2012 15:37:24 +0000 (UTC)
commit 44a607ec08159b1c7ce0a3cbce4c3fdbf96f9d6c
Author: David Woodhouse <David Woodhouse intel com>
Date: Sat May 12 20:36:51 2012 -0700
Implement proper cancellation now that libopenconnect supports it
(cherry picked from commit e4dc523828691207f97da3c767d9791500aff3bf)
Conflicts:
auth-dialog/main.c
auth-dialog/main.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 249dfe2..dd1a61d 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1,7 +1,7 @@
/*
* OpenConnect (SSL + DTLS) VPN client
*
- * Copyright  2008-2010 Intel Corporation.
+ * Copyright  2008-2012 Intel Corporation.
*
* Authors: Jussi Kukkonen <jku linux intel com>
* David Woodhouse <dwmw2 infradead org>
@@ -40,6 +40,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <glib-unix.h>
#include "auth-dlg-settings.h"
@@ -93,6 +94,7 @@ typedef struct auth_ui_data {
int retval;
int cookie_retval;
+ int cancel_pipes[2];
gboolean cancelled; /* fully cancel the whole challenge-response series */
gboolean getting_cookie;
@@ -1204,9 +1206,13 @@ static gboolean cookie_obtained(auth_ui_data *ui_data)
static gpointer obtain_cookie (auth_ui_data *ui_data)
{
int ret;
+ char cancelbuf;
ret = openconnect_obtain_cookie(ui_data->vpninfo);
+ /* Suck out the poison */
+ while (read(ui_data->cancel_pipes[0], &cancelbuf, 1) == 1)
+ ;
ui_data->cookie_retval = ret;
g_idle_add ((GSourceFunc)cookie_obtained, ui_data);
@@ -1229,6 +1235,7 @@ static void connect_host(auth_ui_data *ui_data)
ssl_box_clear(ui_data);
gtk_widget_show(ui_data->getting_form_label);
+ gtk_widget_set_sensitive (ui_data->cancel_button, TRUE);
/* reset ssl context.
* TODO: this is probably not the way to go... */
@@ -1277,6 +1284,8 @@ static void dialog_response (GtkDialog *dialog, int response, auth_ui_data *ui_d
{
switch (response) {
case AUTH_DIALOG_RESPONSE_CANCEL:
+ write(ui_data->cancel_pipes[1], "x", 1);
+ /* Fall through... */
case AUTH_DIALOG_RESPONSE_LOGIN:
ssl_box_clear(ui_data);
if (ui_data->getting_cookie)
@@ -1439,11 +1448,19 @@ static auth_ui_data *init_ui_data (char *vpn_name)
ui_data->form_shown_changed = g_cond_new();
ui_data->cert_response_changed = g_cond_new();
ui_data->vpn_name = vpn_name;
+ pipe(ui_data->cancel_pipes);
+ g_unix_set_fd_nonblocking(ui_data->cancel_pipes[0], TRUE, NULL);
+ g_unix_set_fd_nonblocking(ui_data->cancel_pipes[1], TRUE, NULL);
ui_data->vpninfo = (void *)openconnect_vpninfo_new("OpenConnect VPN Agent (NetworkManager)",
validate_peer_cert, write_new_config,
nm_process_auth_form, write_progress);
+#if OPENCONNECT_API_VERSION_MAJOR > 1 || (OPENCONNECT_API_VERSION_MAJOR == 1 && OPENCONNECT_API_VERSION_MINOR >= 4)
+
+ openconnect_set_cancel_fd (ui_data->vpninfo, ui_data->cancel_pipes[0]);
+#endif
+
#if 0
ui_data->vpninfo->proxy_factory = px_proxy_factory_new();
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]