From de722d9c14a0ce4353d677081b077efe15eb9525 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 9 Oct 2017 00:42:01 +0200 Subject: #8746 fixes client must honor the protocol default specified by the provider --- .../java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java index 0b9c5832..53d81ed3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java @@ -56,7 +56,7 @@ public class VpnConfigGenerator { String key = keys.next().toString(); common_options += key + " "; - for (String word : general_configuration.getString(key).split(" ")) + for (String word : String.valueOf(general_configuration.get(key)).split(" ")) common_options += word + " "; common_options += new_line; @@ -79,7 +79,6 @@ public class VpnConfigGenerator { String ports_keyword = "ports"; String protocol_keyword = "protocols"; String capabilities_keyword = "capabilities"; - String udp = "udp"; try { String ip_address = gateway.getString(ip_address_keyword); @@ -93,9 +92,7 @@ public class VpnConfigGenerator { String protocol = protocols.optString(j); String new_remote = remote_keyword + " " + ip_address + " " + port + " " + protocol + new_line; - port_specific_remotes = protocol.equalsIgnoreCase(udp) ? - port_specific_remotes.replaceFirst(remote_keyword, new_remote + new_line + remote_keyword) : - new_remote; + port_specific_remotes += new_remote; } remotes += port_specific_remotes; } @@ -103,7 +100,9 @@ public class VpnConfigGenerator { // TODO Auto-generated catch block e.printStackTrace(); } - + if (remotes.endsWith(new_line)) { + remotes = remotes.substring(0, remotes.lastIndexOf(new_line)); + } return remotes; } -- cgit v1.2.3