summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/ConfigParser.java
diff options
context:
space:
mode:
authorarne@gaia.fritz.box <arne@gaia.fritz.box>2012-12-25 23:22:13 +0100
committerarne@gaia.fritz.box <arne@gaia.fritz.box>2012-12-25 23:22:13 +0100
commit3018f292ff635d7ec61b3cd02a1e13659819683f (patch)
tree32de630e310e6055124ee92a0d5788a76f6cd94d /src/de/blinkt/openvpn/ConfigParser.java
parent83dfeaa842bd42840698bdce9a91207a75395b3e (diff)
parent80d073d5fd79e0c57e33e708e6917e9f36c9bebc (diff)
Merge local changes with repository
Diffstat (limited to 'src/de/blinkt/openvpn/ConfigParser.java')
-rw-r--r--src/de/blinkt/openvpn/ConfigParser.java31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java
index 7501ed17..cdec964e 100644
--- a/src/de/blinkt/openvpn/ConfigParser.java
+++ b/src/de/blinkt/openvpn/ConfigParser.java
@@ -2,8 +2,11 @@ package de.blinkt.openvpn;
import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Vector;
//! Openvpn Config FIle Parser, probably not 100% accurate but close enough
@@ -83,7 +86,7 @@ public class ConfigParser {
private boolean space(char c) {
// I really hope nobody is using zero bytes inside his/her config file
// to sperate parameter but here we go:
- return Character.isSpace(c) || c == '\0';
+ return Character.isWhitespace(c) || c == '\0';
}
@@ -228,10 +231,13 @@ public class ConfigParser {
"route-metric",
"route-method",
"status",
+ "script-security",
"show-net-up",
"suppress-timestamps",
"tmp-dir",
+ "tun-ipv6",
"topology",
+ "win-sys",
};
@@ -350,10 +356,12 @@ public class ConfigParser {
Vector<String> proto = getOption("proto", 1,1);
if(proto!=null){
- if(proto.get(1).equals("udp"))
+ if(proto.get(1).equals("udp") || proto.get(1).equals("udp6"))
np.mUseUdp=true;
else if (proto.get(1).equals("tcp-client") ||
- proto.get(1).equals("tcp"))
+ proto.get(1).equals("tcp") ||
+ proto.get(1).equals("tcp6") ||
+ proto.get(1).endsWith("tcp6-client"))
np.mUseUdp=false;
else
throw new ConfigParseError("Unsupported option to --proto " + proto.get(1));
@@ -436,6 +444,21 @@ public class ConfigParser {
if(getOption("persist-tun", 0,0) != null)
np.mPersistTun=true;
+ Vector<String> connectretry = getOption("connect-retry", 1, 1);
+ if(connectretry!=null)
+ np.mConnectRetry =connectretry.get(1);
+
+ Vector<String> connectretrymax = getOption("connect-retry-max", 1, 1);
+ if(connectretrymax!=null)
+ np.mConnectRetryMax =connectretrymax.get(1);
+
+ Vector<Vector<String>> remotetls = getAllOption("remote-cert-tls", 1, 1);
+ if(remotetls!=null)
+ if(remotetls.get(0).get(1).equals("server"))
+ np.mExpectTLSCert=true;
+ else
+ options.put("remotetls",remotetls);
+
Vector<String> authuser = getOption("auth-user-pass",0,1);
if(authuser !=null){
@@ -511,7 +534,7 @@ public class ConfigParser {
for(Vector<String> optionline:args)
if(optionline.size()< (minarg+1) || optionline.size() > maxarg+1) {
- String err = String.format("Option %s has %d parameters, expected between %d and %d",
+ String err = String.format(Locale.getDefault(),"Option %s has %d parameters, expected between %d and %d",
option,optionline.size()-1,minarg,maxarg );
throw new ConfigParseError(err);
}