summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
index 378b6b92..d23b521f 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
@@ -1,7 +1,5 @@
package de.blinkt.openvpn.core;
-import de.blinkt.openvpn.VpnProfile;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
@@ -10,6 +8,8 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Vector;
+import de.blinkt.openvpn.VpnProfile;
+
//! Openvpn Config FIle Parser, probably not 100% accurate but close enough
// And remember, this is valid :)
@@ -31,11 +31,17 @@ public class ConfigParser {
BufferedReader br =new BufferedReader(reader);
+ int lineno=0;
while (true){
String line = br.readLine();
+ lineno++;
if(line==null)
break;
+ if (lineno==1 && (line.startsWith("PK\003\004")
+ || (line.startsWith("PK\007\008"))))
+ throw new ConfigParseError("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
+
// Check for OpenVPN Access Server Meta information
if (line.startsWith("# OVPN_ACCESS_SERVER_")) {
Vector<String> metaarg = parsemeta(line);
@@ -440,8 +446,8 @@ public class ConfigParser {
}
Vector<String> rport = getOption("rport", 1,1);
- if(port!=null){
- np.mServerPort = port.get(1);
+ if(rport!=null){
+ np.mServerPort = rport.get(1);
}
Vector<String> proto = getOption("proto", 1,1);