1 |
dagger 09/08/24 14:11:41 |
2 |
|
3 |
Added: networkmanager-openvpn-0.7.1-glibc2.10.fix.patch |
4 |
Log: |
5 |
Fixes bug #282428. Thanks for patrakov@×××××.com for providing link |
6 |
to upstream patch |
7 |
(Portage version: 2.1.6.13/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 net-misc/networkmanager-openvpn/files/networkmanager-openvpn-0.7.1-glibc2.10.fix.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/networkmanager-openvpn/files/networkmanager-openvpn-0.7.1-glibc2.10.fix.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/networkmanager-openvpn/files/networkmanager-openvpn-0.7.1-glibc2.10.fix.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: networkmanager-openvpn-0.7.1-glibc2.10.fix.patch |
16 |
=================================================================== |
17 |
From 27192957d887915a23f186a34c3bb85af3faba3a Mon Sep 17 00:00:00 2001 |
18 |
From: Dan Williams <dcbw@××××××.com> |
19 |
Date: Tue, 14 Jul 2009 10:51:33 +0000 |
20 |
Subject: don't use sscanf |
21 |
|
22 |
besides the fact that for some reason sscanf wasn't working, it's evil |
23 |
and confusing, and we don't even need to use it. Also add the ability |
24 |
to set OPENVPN_DEBUG to get more info out of openvpn. |
25 |
--- |
26 |
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c |
27 |
index 346df20..6cde642 100644 |
28 |
--- a/src/nm-openvpn-service.c |
29 |
+++ b/src/nm-openvpn-service.c |
30 |
@@ -287,6 +287,35 @@ ovpn_quote_string (const char *unquoted) |
31 |
return quoted; |
32 |
} |
33 |
|
34 |
+/* sscanf is evil, and since we can't use glib regexp stuff since it's still |
35 |
+ * too new for some distros, do a simple match here. |
36 |
+ */ |
37 |
+static char * |
38 |
+get_detail (const char *input, const char *prefix) |
39 |
+{ |
40 |
+ char *ret = NULL; |
41 |
+ guint32 i = 0; |
42 |
+ const char *p, *start; |
43 |
+ |
44 |
+ g_return_val_if_fail (prefix != NULL, NULL); |
45 |
+ |
46 |
+ if (!g_str_has_prefix (input, prefix)) |
47 |
+ return NULL; |
48 |
+ |
49 |
+ /* Grab characters until the next ' */ |
50 |
+ p = start = input + strlen (prefix); |
51 |
+ while (*p) { |
52 |
+ if (*p == '\'') { |
53 |
+ ret = g_malloc0 (i + 1); |
54 |
+ strncpy (ret, start, i); |
55 |
+ break; |
56 |
+ } |
57 |
+ p++, i++; |
58 |
+ } |
59 |
+ |
60 |
+ return ret; |
61 |
+} |
62 |
+ |
63 |
static gboolean |
64 |
handle_management_socket (NMVPNPlugin *plugin, |
65 |
GIOChannel *source, |
66 |
@@ -295,7 +324,7 @@ handle_management_socket (NMVPNPlugin *plugin, |
67 |
{ |
68 |
NMOpenvpnPluginIOData *io_data = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin)->io_data; |
69 |
gboolean again = TRUE; |
70 |
- char *str = NULL, *auth, *buf; |
71 |
+ char *str = NULL, *auth = NULL, *buf; |
72 |
gsize written; |
73 |
|
74 |
if (!(condition & G_IO_IN)) |
75 |
@@ -307,7 +336,8 @@ handle_management_socket (NMVPNPlugin *plugin, |
76 |
if (strlen (str) < 1) |
77 |
goto out; |
78 |
|
79 |
- if (sscanf (str, ">PASSWORD:Need '%a[^']'", &auth) > 0) { |
80 |
+ auth = get_detail (str, ">PASSWORD:Need '"); |
81 |
+ if (auth) { |
82 |
if (strcmp (auth, "Auth") == 0) { |
83 |
if (io_data->username != NULL && io_data->password != NULL) { |
84 |
char *quser, *qpass; |
85 |
@@ -351,8 +381,11 @@ handle_management_socket (NMVPNPlugin *plugin, |
86 |
*out_failure = NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED; |
87 |
again = FALSE; |
88 |
} |
89 |
- free (auth); |
90 |
- } else if (sscanf (str, ">PASSWORD:Verification Failed: '%a[^']'", &auth) > 0) { |
91 |
+ g_free (auth); |
92 |
+ } |
93 |
+ |
94 |
+ auth = get_detail (str, ">PASSWORD:Verification Failed: '"); |
95 |
+ if (auth) { |
96 |
if (!strcmp (auth, "Auth")) |
97 |
nm_warning ("Password verification failed"); |
98 |
else if (!strcmp (auth, "Private Key")) |
99 |
@@ -360,7 +393,7 @@ handle_management_socket (NMVPNPlugin *plugin, |
100 |
else |
101 |
nm_warning ("Unknown verification failed: %s", auth); |
102 |
|
103 |
- free (auth); |
104 |
+ g_free (auth); |
105 |
|
106 |
if (out_failure) |
107 |
*out_failure = NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED; |
108 |
@@ -688,6 +721,7 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin, |
109 |
add_openvpn_arg (args, "--auth"); |
110 |
add_openvpn_arg (args, auth); |
111 |
} |
112 |
+ add_openvpn_arg (args, "--auth-nocache"); |
113 |
|
114 |
/* TA */ |
115 |
tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TA); |
116 |
@@ -700,9 +734,14 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin, |
117 |
add_openvpn_arg (args, tmp); |
118 |
} |
119 |
|
120 |
- /* Syslog */ |
121 |
- add_openvpn_arg (args, "--syslog"); |
122 |
- add_openvpn_arg (args, "nm-openvpn"); |
123 |
+ if (getenv ("OPENVPN_DEBUG")) { |
124 |
+ add_openvpn_arg (args, "--verb"); |
125 |
+ add_openvpn_arg (args, "10"); |
126 |
+ } else { |
127 |
+ /* Syslog */ |
128 |
+ add_openvpn_arg (args, "--syslog"); |
129 |
+ add_openvpn_arg (args, "nm-openvpn"); |
130 |
+ } |
131 |
|
132 |
/* Punch script security in the face; this option was added to OpenVPN 2.1-rc9 |
133 |
* and defaults to disallowing any scripts, a behavior change from previous |
134 |
-- |
135 |
cgit v0.8.2 |