Re: [OpenVPN] [PATCH] Fix handling of multiple "--remote" gateways and optional [port] [proto] parameters (bug 712710,712720)



I've simplified and squashed the patches for bug #712710 and #712720.

Please pull from:

  git://iam.tj/network-manager-openvpn.git gnome712710.720

Fix incorrect handling of spaces as separators in "remote" gateway setting and split each gateway into
constituent space-separated arguments.

This allows the complete openvpn "--remote" syntax to be used: "remote a.b.c.d 443 tcp,e.f.g.h 1194 udp"

Signed-off-by: TJ <gnome iam tj>

 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 8589b57..cb53a2c 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -905,11 +905,16 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
        tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_REMOTE);
        if (tmp && strlen (tmp)) {
-               char *tok;
-               while ((tok = strsep((char**)&tmp, " ,")) != NULL) {
+               char *tok, *tok2;
+               while ((tok = strsep((char**)&tmp, ",")) != NULL) {
                        if (strlen(tok)) {
                                add_openvpn_arg (args, "--remote");
                                add_openvpn_arg (args, tok);
+                               tmp2 = strdup(tok);
+                               while ((tok2 = strsep((char **)&tmp2, " ")) != NULL) {
+                                       add_openvpn_arg (args, tok2);
+                               }
+                               free((void *)tmp2);
                        }
                }
        }
-- 
1.8.1.2.433.g9808ce0.dirty



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]