summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Piasek <dagger@gentoo.org>2009-08-24 14:11:40 +0000
committerRobert Piasek <dagger@gentoo.org>2009-08-24 14:11:40 +0000
commit9fe6bb387eec1de0c195bb9049f3472cf52a546a (patch)
treed0ea4732070d307c4ae8b9efde9b6e7ed5539619 /net-misc/networkmanager-openvpn/files
parent* bump (diff)
downloadgentoo-2-9fe6bb387eec1de0c195bb9049f3472cf52a546a.tar.gz
gentoo-2-9fe6bb387eec1de0c195bb9049f3472cf52a546a.tar.bz2
gentoo-2-9fe6bb387eec1de0c195bb9049f3472cf52a546a.zip
Fixes bug #282428. Thanks for patrakov@gmail.com for providing link
to upstream patch (Portage version: 2.1.6.13/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/networkmanager-openvpn/files')
-rw-r--r--net-misc/networkmanager-openvpn/files/networkmanager-openvpn-0.7.1-glibc2.10.fix.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/net-misc/networkmanager-openvpn/files/networkmanager-openvpn-0.7.1-glibc2.10.fix.patch b/net-misc/networkmanager-openvpn/files/networkmanager-openvpn-0.7.1-glibc2.10.fix.patch
new file mode 100644
index 000000000000..f630476a1648
--- /dev/null
+++ b/net-misc/networkmanager-openvpn/files/networkmanager-openvpn-0.7.1-glibc2.10.fix.patch
@@ -0,0 +1,119 @@
+From 27192957d887915a23f186a34c3bb85af3faba3a Mon Sep 17 00:00:00 2001
+From: Dan Williams <dcbw@redhat.com>
+Date: Tue, 14 Jul 2009 10:51:33 +0000
+Subject: don't use sscanf
+
+besides the fact that for some reason sscanf wasn't working, it's evil
+and confusing, and we don't even need to use it. Also add the ability
+to set OPENVPN_DEBUG to get more info out of openvpn.
+---
+diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
+index 346df20..6cde642 100644
+--- a/src/nm-openvpn-service.c
++++ b/src/nm-openvpn-service.c
+@@ -287,6 +287,35 @@ ovpn_quote_string (const char *unquoted)
+ return quoted;
+ }
+
++/* sscanf is evil, and since we can't use glib regexp stuff since it's still
++ * too new for some distros, do a simple match here.
++ */
++static char *
++get_detail (const char *input, const char *prefix)
++{
++ char *ret = NULL;
++ guint32 i = 0;
++ const char *p, *start;
++
++ g_return_val_if_fail (prefix != NULL, NULL);
++
++ if (!g_str_has_prefix (input, prefix))
++ return NULL;
++
++ /* Grab characters until the next ' */
++ p = start = input + strlen (prefix);
++ while (*p) {
++ if (*p == '\'') {
++ ret = g_malloc0 (i + 1);
++ strncpy (ret, start, i);
++ break;
++ }
++ p++, i++;
++ }
++
++ return ret;
++}
++
+ static gboolean
+ handle_management_socket (NMVPNPlugin *plugin,
+ GIOChannel *source,
+@@ -295,7 +324,7 @@ handle_management_socket (NMVPNPlugin *plugin,
+ {
+ NMOpenvpnPluginIOData *io_data = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin)->io_data;
+ gboolean again = TRUE;
+- char *str = NULL, *auth, *buf;
++ char *str = NULL, *auth = NULL, *buf;
+ gsize written;
+
+ if (!(condition & G_IO_IN))
+@@ -307,7 +336,8 @@ handle_management_socket (NMVPNPlugin *plugin,
+ if (strlen (str) < 1)
+ goto out;
+
+- if (sscanf (str, ">PASSWORD:Need '%a[^']'", &auth) > 0) {
++ auth = get_detail (str, ">PASSWORD:Need '");
++ if (auth) {
+ if (strcmp (auth, "Auth") == 0) {
+ if (io_data->username != NULL && io_data->password != NULL) {
+ char *quser, *qpass;
+@@ -351,8 +381,11 @@ handle_management_socket (NMVPNPlugin *plugin,
+ *out_failure = NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED;
+ again = FALSE;
+ }
+- free (auth);
+- } else if (sscanf (str, ">PASSWORD:Verification Failed: '%a[^']'", &auth) > 0) {
++ g_free (auth);
++ }
++
++ auth = get_detail (str, ">PASSWORD:Verification Failed: '");
++ if (auth) {
+ if (!strcmp (auth, "Auth"))
+ nm_warning ("Password verification failed");
+ else if (!strcmp (auth, "Private Key"))
+@@ -360,7 +393,7 @@ handle_management_socket (NMVPNPlugin *plugin,
+ else
+ nm_warning ("Unknown verification failed: %s", auth);
+
+- free (auth);
++ g_free (auth);
+
+ if (out_failure)
+ *out_failure = NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED;
+@@ -688,6 +721,7 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
+ add_openvpn_arg (args, "--auth");
+ add_openvpn_arg (args, auth);
+ }
++ add_openvpn_arg (args, "--auth-nocache");
+
+ /* TA */
+ tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TA);
+@@ -700,9 +734,14 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
+ add_openvpn_arg (args, tmp);
+ }
+
+- /* Syslog */
+- add_openvpn_arg (args, "--syslog");
+- add_openvpn_arg (args, "nm-openvpn");
++ if (getenv ("OPENVPN_DEBUG")) {
++ add_openvpn_arg (args, "--verb");
++ add_openvpn_arg (args, "10");
++ } else {
++ /* Syslog */
++ add_openvpn_arg (args, "--syslog");
++ add_openvpn_arg (args, "nm-openvpn");
++ }
+
+ /* Punch script security in the face; this option was added to OpenVPN 2.1-rc9
+ * and defaults to disallowing any scripts, a behavior change from previous
+--
+cgit v0.8.2