summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-02-06 16:36:55 +0100
committerArne Schwabe <arne@rfc2549.org>2014-02-06 16:36:55 +0100
commit062d57b2752ee66537bda74d87cc4c533a08b9ac (patch)
tree67bb62a2113029dbb4b2477556b15c3f94e074bc
parent32bcede9f5f2e30df913b29d0990a3702bb7dad8 (diff)
Fix bugs with the ocnfig parser
-rw-r--r--.hgignore8
-rw-r--r--icsopenvpn.iml77
-rwxr-xr-xres/values/strings.xml1
-rw-r--r--src/de/blinkt/openvpn/activities/ConfigConverter.java9
-rw-r--r--src/de/blinkt/openvpn/core/ConfigParser.java63
5 files changed, 68 insertions, 90 deletions
diff --git a/.hgignore b/.hgignore
index 58634ea3..16816d21 100644
--- a/.hgignore
+++ b/.hgignore
@@ -70,4 +70,10 @@ proguard-project.txt
build.xml
cache.properties
.gradle
-.idea
+
+# User-specific configurations
+.idea/libraries/
+.idea/tasks.xml
+.idea/.name
+*.iml
+
diff --git a/icsopenvpn.iml b/icsopenvpn.iml
deleted file mode 100644
index 866601d3..00000000
--- a/icsopenvpn.iml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="android" name="Android">
- <configuration>
- <option name="SELECTED_BUILD_VARIANT" value="debug" />
- <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
- <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
- <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
- <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
- <option name="ALLOW_USER_CONFIGURATION" value="false" />
- <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/res" />
- <option name="UPDATE_PROPERTY_FILES" value="true" />
- </configuration>
- </facet>
- <facet type="android-gradle" name="Android-Gradle">
- <configuration>
- <option name="GRADLE_PROJECT_PATH" value=":" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/build/classes/debug" />
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" generated="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" generated="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" generated="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" generated="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/build/source/r/test/debug" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test/debug" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test/debug" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/source/rs/test/debug" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/build/res/rs/test/debug" type="java-test-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/assets" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/aidl" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/assets" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/java" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/jni" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/rs" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/res" type="java-test-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" type="java-test-resource" />
- <excludeFolder url="file://$MODULE_DIR$/.gradle" />
- <excludeFolder url="file://$MODULE_DIR$/.hg" />
- <excludeFolder url="file://$MODULE_DIR$/.hgcheck" />
- <excludeFolder url="file://$MODULE_DIR$/.idea" />
- <excludeFolder url="file://$MODULE_DIR$/.settings" />
- <excludeFolder url="file://$MODULE_DIR$/build/apk" />
- <excludeFolder url="file://$MODULE_DIR$/build/assets" />
- <excludeFolder url="file://$MODULE_DIR$/build/bundles" />
- <excludeFolder url="file://$MODULE_DIR$/build/classes" />
- <excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
- <excludeFolder url="file://$MODULE_DIR$/build/incremental" />
- <excludeFolder url="file://$MODULE_DIR$/build/libs" />
- <excludeFolder url="file://$MODULE_DIR$/build/manifests" />
- <excludeFolder url="file://$MODULE_DIR$/build/res" />
- <excludeFolder url="file://$MODULE_DIR$/build/symbols" />
- <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
- </content>
- <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" exported="" name="annotations-12.0" level="project" />
- </component>
-</module>
-
diff --git a/res/values/strings.xml b/res/values/strings.xml
index faa41385..d96f51a0 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -313,4 +313,5 @@
<string name="full_licenses">Full licenses</string>
<string name="blocklocal_summary">Networks directly connected to the local interfaces will not be routed over the VPN. Unchecking this option will redirect all traffic indented for local networks to VPN.</string>
<string name="blocklocal_title">Bypass VPN for local networks</string>
+ <string name="userpw_file">Username/Password file</string>
</resources>
diff --git a/src/de/blinkt/openvpn/activities/ConfigConverter.java b/src/de/blinkt/openvpn/activities/ConfigConverter.java
index 2e24f94f..50253915 100644
--- a/src/de/blinkt/openvpn/activities/ConfigConverter.java
+++ b/src/de/blinkt/openvpn/activities/ConfigConverter.java
@@ -315,15 +315,20 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback
if (mResult!=null)
value = mResult.mPKCS12Filename;
break;
+
+ case USERPW_FILE:
+ titleRes = R.string.userpw_file;
+ return;
+
}
boolean isCert = type == Utils.FileType.CA_CERTIFICATE || type == Utils.FileType.CLIENT_CERTIFICATE;
FileSelectLayout fl = new FileSelectLayout(this,getString(titleRes), isCert);
- fl.setData(value,this);
- fileSelectMap.put(type,fl);
+ fileSelectMap.put(type, fl);
fl.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
((LinearLayout) findViewById(R.id.config_convert_root)).addView(fl, 1);
+ fl.setData(value,this);
int i = getFileLayoutOffset(type);
fl.setCaller(this, i, type);
diff --git a/src/de/blinkt/openvpn/core/ConfigParser.java b/src/de/blinkt/openvpn/core/ConfigParser.java
index 6ce7467f..06acdf98 100644
--- a/src/de/blinkt/openvpn/core/ConfigParser.java
+++ b/src/de/blinkt/openvpn/core/ConfigParser.java
@@ -245,8 +245,19 @@ public class ConfigParser {
"ip-win32",
"management-hold",
"management",
+ "management-client",
+ "management-query-remote",
"management-query-passwords",
+ "management-query-proxy",
+ "management-external-key",
+ "management-forget-disconnect",
+ "management-signal",
+ "management-log-cache",
+ "management-up-down",
+ "management-client-user",
+ "management-client-group",
"pause-exit",
+ "plugin",
"machine-readable-output",
"persist-key",
"register-dns",
@@ -263,6 +274,13 @@ public class ConfigParser {
"topology",
"user",
"win-sys",
+
+ };
+
+ final String[][] ignoreOptionsWithArg =
+ {
+ {"setenv", "IV_GUI_VER"},
+ {"setenv", "IV_OPENVPN_GUI_VERSION"}
};
final String[] connectionOptions = {
@@ -640,10 +658,14 @@ public class ConfigParser {
// removing an item which is not in the map is no error
options.remove(option);
+
+
+
if(options.size()> 0) {
np.mCustomConfigOptions += "# These Options were found in the config file do not map to config settings:\n";
for(Vector<Vector<String>> option:options.values()) {
+
np.mCustomConfigOptions += getOptionStrings(option);
}
@@ -652,18 +674,39 @@ public class ConfigParser {
}
}
- private String getOptionStrings( Vector<Vector<String>> option) {
- String custom="";
- for(Vector<String> optionsline: option) {
- for (String arg : optionsline)
- custom+= VpnProfile.openVpnEscape(arg) + " ";
- custom+="\n";
- }
- return custom;
- }
+
+ boolean ignoreThisOption(Vector<String> option) {
+ for (String[] ignoreOption : ignoreOptionsWithArg) {
+
+ if (option.size() < ignoreOption.length)
+ continue;
+
+ boolean ignore = true;
+ for (int i = 0; i < ignoreOption.length; i++) {
+ if (!ignoreOption[i].equals(option.get(i)))
+ ignore = false;
+ }
+ if (ignore)
+ return true;
+
+ }
+ return false;
+ }
+
+ private String getOptionStrings(Vector<Vector<String>> option) {
+ String custom = "";
+ for (Vector<String> optionsline : option) {
+ if (!ignoreThisOption(optionsline)) {
+ for (String arg : optionsline)
+ custom += VpnProfile.openVpnEscape(arg) + " ";
+ custom += "\n";
+ }
+ }
+ return custom;
+ }
- private void fixup(VpnProfile np) {
+ private void fixup(VpnProfile np) {
if(np.mRemoteCN.equals(np.mServerName)) {
np.mRemoteCN="";
}