diff options
Diffstat (limited to 'net-misc/networkmanager-openconnect/files/0.9.10.0/0025-Support-libopenconnect.so.4.patch')
-rw-r--r-- | net-misc/networkmanager-openconnect/files/0.9.10.0/0025-Support-libopenconnect.so.4.patch | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/net-misc/networkmanager-openconnect/files/0.9.10.0/0025-Support-libopenconnect.so.4.patch b/net-misc/networkmanager-openconnect/files/0.9.10.0/0025-Support-libopenconnect.so.4.patch new file mode 100644 index 000000000000..ed366702b1ce --- /dev/null +++ b/net-misc/networkmanager-openconnect/files/0.9.10.0/0025-Support-libopenconnect.so.4.patch @@ -0,0 +1,127 @@ +From 58944a3ef9c92f7afa07cbb539d062e1956bafc0 Mon Sep 17 00:00:00 2001 +From: David Woodhouse <David.Woodhouse@intel.com> +Date: Thu, 30 Oct 2014 23:09:14 +0000 +Subject: [PATCH 25/34] Support libopenconnect.so.4 + +--- + auth-dialog/main.c | 38 ++++++++++++++++++++++++++------------ + 1 file changed, 26 insertions(+), 12 deletions(-) + +diff --git a/auth-dialog/main.c b/auth-dialog/main.c +index 7171247..8285bf4 100644 +--- a/auth-dialog/main.c ++++ b/auth-dialog/main.c +@@ -89,6 +89,21 @@ + #define OC_FORM_RESULT_NEWGROUP 2 + #endif + ++#if OPENCONNECT_CHECK_VER(4,0) ++#define dup_option_value(opt) g_strdup((opt)->_value); ++#define OC3DUP(x) (x) ++#define write_config_const const ++#else ++#define dup_option_value(opt) g_strdup((opt)->value); ++#define openconnect_set_option_value(opt, val) do { \ ++ struct oc_form_opt *_o = (opt); \ ++ free(_o->value); _o->value = g_strdup(val); \ ++ } while (0) ++#define openconnect_free_cert_info(v, x) free(x) ++#define OC3DUP(x) g_strdup(x) ++#define write_config_const /* */ ++#endif ++ + #ifdef OPENCONNECT_OPENSSL + #include <openssl/ssl.h> + #include <openssl/bio.h> +@@ -712,7 +727,7 @@ static gboolean ui_form (struct oc_auth_form *form) + data->entry_text = g_strdup (find_form_answer(ui_data->secrets, + form, opt)); + if (!data->entry_text) +- data->entry_text = g_strdup (opt->value); ++ data->entry_text = dup_option_value(opt); + } else { + GHashTable *attrs; + +@@ -776,8 +791,7 @@ static gboolean set_initial_authgroup (auth_ui_data *ui_data, struct oc_auth_for + for (i = 0; i < sopt->nr_choices; i++) { + struct oc_choice *ch = FORMCHOICE(sopt, i); + if (!strcmp(saved_group, ch->name) && i != AUTHGROUP_SELECTION(form)) { +- free(opt->value); +- opt->value = g_strdup(saved_group); ++ openconnect_set_option_value(opt, saved_group); + return TRUE; + } + } +@@ -823,7 +837,7 @@ static int nm_process_auth_form (void *cbdata, struct oc_auth_form *form) + g_cancellable_cancel(data->cancel); + + if (data->entry_text) { +- data->opt->value = g_strdup (data->entry_text); ++ openconnect_set_option_value(data->opt, data->entry_text); + + if (data->opt->type == OC_FORM_OPT_TEXT || + data->opt->type == OC_FORM_OPT_SELECT) { +@@ -932,7 +946,7 @@ static gboolean user_validate_cert(cert_data *data) + text = gtk_text_view_new(); + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); + gtk_text_buffer_set_text(buffer, details, -1); +- free(details); ++ openconnect_free_cert_info(data->ui_data->vpninfo, details); + gtk_text_view_set_editable(GTK_TEXT_VIEW(text), 0); + gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text), FALSE); + gtk_container_add(GTK_CONTAINER(scroll), text); +@@ -1166,7 +1180,7 @@ static int get_config (GHashTable *options, GHashTable *secrets, + + cafile = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_CACERT); + if (cafile) +- openconnect_set_cafile(vpninfo, g_strdup (cafile)); ++ openconnect_set_cafile(vpninfo, OC3DUP (cafile)); + + csd = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_CSD_ENABLE); + if (csd && !strcmp(csd, "yes")) { +@@ -1176,16 +1190,16 @@ static int get_config (GHashTable *options, GHashTable *secrets, + if (csd_wrapper && !csd_wrapper[0]) + csd_wrapper = NULL; + +- openconnect_setup_csd(vpninfo, getuid(), 1, g_strdup (csd_wrapper)); ++ openconnect_setup_csd(vpninfo, getuid(), 1, OC3DUP (csd_wrapper)); + } + + proxy = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_PROXY); +- if (proxy && proxy[0] && openconnect_set_http_proxy(vpninfo, g_strdup (proxy))) ++ if (proxy && proxy[0] && openconnect_set_http_proxy(vpninfo, OC3DUP (proxy))) + return -EINVAL; + + cert = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_USERCERT); + sslkey = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_PRIVKEY); +- openconnect_set_client_cert (vpninfo, g_strdup (cert), g_strdup (sslkey)); ++ openconnect_set_client_cert (vpninfo, OC3DUP (cert), OC3DUP (sslkey)); + + pem_passphrase_fsid = g_hash_table_lookup (options, + NM_OPENCONNECT_KEY_PEM_PASSPHRASE_FSID); +@@ -1245,7 +1259,7 @@ static int update_token(void *cbdata, const char *tok) + } + #endif + +-static int write_new_config(void *cbdata, char *buf, int buflen) ++static int write_new_config(void *cbdata, write_config_const char *buf, int buflen) + { + auth_ui_data *ui_data = cbdata; + g_hash_table_insert (ui_data->secrets, g_strdup ("xmlconfig"), +@@ -1472,11 +1486,11 @@ static void connect_host(auth_ui_data *ui_data) + if (openconnect_parse_url(ui_data->vpninfo, host->hostaddress)) { + fprintf(stderr, "Failed to parse server URL '%s'\n", + host->hostaddress); +- openconnect_set_hostname (ui_data->vpninfo, g_strdup(host->hostaddress)); ++ openconnect_set_hostname (ui_data->vpninfo, OC3DUP (host->hostaddress)); + } + + if (!openconnect_get_urlpath(ui_data->vpninfo) && host->usergroup) +- openconnect_set_urlpath(ui_data->vpninfo, g_strdup(host->usergroup)); ++ openconnect_set_urlpath(ui_data->vpninfo, OC3DUP (host->usergroup)); + + + g_hash_table_insert (ui_data->success_secrets, g_strdup("lasthost"), +-- +2.2.0 + |