summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-03-18 16:52:05 +0100
committerArne Schwabe <arne@rfc2549.org>2013-03-18 16:52:05 +0100
commit978d2e56bd24707ae4d45514215846031773cf7a (patch)
tree66ff24bf6777067770ee9ea66a8ea8819ffeb2a8 /src
parentcfb57240a604319c6934681e638c3bdac4619693 (diff)
Catch broken ifconfig lines
--HG-- extra : rebase_source : b48fec6d90c7df2cb3dbdcff66e6403eeb134667
Diffstat (limited to 'src')
-rw-r--r--src/de/blinkt/openvpn/core/ConfigParser.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/de/blinkt/openvpn/core/ConfigParser.java b/src/de/blinkt/openvpn/core/ConfigParser.java
index 9faebfb6..3c3b37a9 100644
--- a/src/de/blinkt/openvpn/core/ConfigParser.java
+++ b/src/de/blinkt/openvpn/core/ConfigParser.java
@@ -398,8 +398,13 @@ public class ConfigParser {
Vector<String> ifconfig = getOption("ifconfig", 2, 2);
if(ifconfig!=null) {
- CIDRIP cidr = new CIDRIP(ifconfig.get(1), ifconfig.get(2));
- np.mIPv4Address=cidr.toString();
+ try {
+ CIDRIP cidr = new CIDRIP(ifconfig.get(1), ifconfig.get(2));
+ np.mIPv4Address=cidr.toString();
+ } catch (NumberFormatException nfe) {
+ throw new ConfigParseError("Could not pase ifconfig IP address: " + nfe.getLocalizedMessage());
+ }
+
}
if(getOption("remote-random-hostname", 0, 0)!=null)
@@ -441,7 +446,7 @@ public class ConfigParser {
np.mAuthenticationType = VpnProfile.TYPE_KEYSTORE;
noauthtypeset=false;
}
-
+
Vector<String> compatnames = getOption("compat-names",1,2);
Vector<String> nonameremapping = getOption("no-name-remapping",1,1);
@@ -450,12 +455,12 @@ public class ConfigParser {
np.mRemoteCN = tlsremote.get(1);
np.mCheckRemoteCN=true;
np.mX509AuthType = VpnProfile.X509_VERIFY_TLSREMOTE;
-
+
if((compatnames!=null && compatnames.size() > 2) ||
(nonameremapping!=null))
np.mX509AuthType = VpnProfile.X509_VERIFY_TLSREMOTE_COMPAT_NOREMAPPING;
}
-
+
Vector<String> verifyx509name = getOption("verify-x509-name",1,2);
if(verifyx509name!=null){
np.mRemoteCN = verifyx509name.get(1);
@@ -470,7 +475,7 @@ public class ConfigParser {
} else {
np.mX509AuthType = VpnProfile.X509_VERIFY_TLSREMOTE_DN;
}
-
+
}