From 978d2e56bd24707ae4d45514215846031773cf7a Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 18 Mar 2013 16:52:05 +0100 Subject: Catch broken ifconfig lines --HG-- extra : rebase_source : b48fec6d90c7df2cb3dbdcff66e6403eeb134667 --- src/de/blinkt/openvpn/core/ConfigParser.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/de') 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 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 compatnames = getOption("compat-names",1,2); Vector 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 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; } - + } -- cgit v1.2.3