summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/core
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-02-11 23:36:48 +0100
committerArne Schwabe <arne@rfc2549.org>2014-02-11 23:36:48 +0100
commitc373af42b1a75b0f23c2f0edbf196dfbb1ef0a0e (patch)
tree1a6957889611f16974de15418ef0257e9f1ba90d /src/de/blinkt/openvpn/core
parent3044e321058be2a7b860a7c10c8efa49afabfcb2 (diff)
Rework and fix config import
Diffstat (limited to 'src/de/blinkt/openvpn/core')
-rw-r--r--src/de/blinkt/openvpn/core/ConfigParser.java28
-rw-r--r--src/de/blinkt/openvpn/core/X509Utils.java6
2 files changed, 26 insertions, 8 deletions
diff --git a/src/de/blinkt/openvpn/core/ConfigParser.java b/src/de/blinkt/openvpn/core/ConfigParser.java
index 06acdf98..22cc5dce 100644
--- a/src/de/blinkt/openvpn/core/ConfigParser.java
+++ b/src/de/blinkt/openvpn/core/ConfigParser.java
@@ -398,10 +398,18 @@ public class ConfigParser {
if(direction!=null)
np.mTLSAuthDirection=direction.get(1);
+ Vector<Vector<String>> defgw = getAllOption("redirect-gateway", 0, 5);
+ if(defgw != null)
+ {
+ np.mUseDefaultRoute=true;
+ checkRedirectParameters(np, defgw);
+ }
- if(getAllOption("redirect-gateway", 0, 5) != null)
- np.mUseDefaultRoute=true;
-
+ Vector<Vector<String>> redirectPrivate = getAllOption("redirect-private",0,5);
+ if (redirectPrivate != null)
+ {
+ checkRedirectParameters(np,redirectPrivate);
+ }
Vector<String> dev =getOption("dev",1,1);
Vector<String> devtype =getOption("dev-type",1,1);
@@ -621,7 +629,17 @@ public class ConfigParser {
return np;
}
- public void useExtraRemotesAsCustom(boolean b) {
+ private void checkRedirectParameters(VpnProfile np, Vector<Vector<String>> defgw) {
+ for (Vector<String> redirect: defgw)
+ for (int i=1;i<redirect.size();i++){
+ if (defgw.get(i).equals("block-local"))
+ np.mAllowLocalLAN=false;
+ else if (defgw.get(i).equals("unblock-local"))
+ np.mAllowLocalLAN=true;
+ }
+ }
+
+ public void useExtraRemotesAsCustom(boolean b) {
this.extraRemotesAsCustom = b;
}
@@ -641,7 +659,7 @@ public class ConfigParser {
static public void useEmbbedUserAuth(VpnProfile np,String inlinedata)
{
- String data = inlinedata.replace(VpnProfile.INLINE_TAG, "");
+ String data = VpnProfile.getEmbeddedContent(inlinedata);
String[] parts = data.split("\n");
if(parts.length >= 2) {
np.mUsername=parts[0];
diff --git a/src/de/blinkt/openvpn/core/X509Utils.java b/src/de/blinkt/openvpn/core/X509Utils.java
index 5781cbf5..da1e4ed5 100644
--- a/src/de/blinkt/openvpn/core/X509Utils.java
+++ b/src/de/blinkt/openvpn/core/X509Utils.java
@@ -25,7 +25,7 @@ public class X509Utils {
InputStream inStream;
- if(certfilename.startsWith(VpnProfile.INLINE_TAG)) {
+ if(VpnProfile.isEmbedded(certfilename)) {
// The java certifcate reader is ... kind of stupid
// It does NOT ignore chars before the --BEGIN ...
int subIndex = certfilename.indexOf("-----BEGIN CERTIFICATE-----");
@@ -45,8 +45,8 @@ public class X509Utils {
Reader inStream;
- if(keyfilename.startsWith(VpnProfile.INLINE_TAG))
- inStream = new StringReader(keyfilename.replace(VpnProfile.INLINE_TAG,""));
+ if(VpnProfile.isEmbedded(keyfilename))
+ inStream = new StringReader(VpnProfile.getEmbeddedContent(keyfilename));
else
inStream = new FileReader(new File(keyfilename));