From 25e87d740e07ab9ade259fbc57d038337b79b66f Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 9 May 2012 23:17:23 +0200 Subject: small fixed --- src/de/blinkt/openvpn/VpnProfile.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 26cf50bd..c18575da 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -92,8 +92,10 @@ public class VpnProfile implements Serializable{ public String mVerb="1"; - public static String openVpnEscape(String unescape) { - String escapedString = unescape.replace("\\", "\\\\"); + public static String openVpnEscape(String unescaped) { + if(unescaped==null) + return null; + String escapedString = unescaped.replace("\\", "\\\\"); escapedString = escapedString.replace("\"","\\\""); escapedString = escapedString.replace("\n","\\n"); return '"' + escapedString + '"'; @@ -343,8 +345,8 @@ public class VpnProfile implements Serializable{ Vector args = new Vector(); // Add fixed paramenters - //args.add(cacheDir.getAbsolutePath() +"/" +"openvpn"); - args.add(cacheDir.getAbsolutePath() +"/" +"minivpn"); + //args.add("/data/data/de.blinkt.openvpn/lib/openvpn"); + args.add(cacheDir.getAbsolutePath() +"/" +"openvpn"); args.add("--config"); args.add(cacheDir.getAbsolutePath() + "/" + OVPNCONFIGFILE); -- cgit v1.2.3 From e652cd62a450aa4bb284d717a1f0bd1b1d1b86a2 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 9 May 2012 23:58:37 +0200 Subject: add cipher option --- src/de/blinkt/openvpn/Settings_Authentication.java | 13 +++++++++++++ src/de/blinkt/openvpn/VpnProfile.java | 11 +++++++++++ 2 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/de/blinkt/openvpn/Settings_Authentication.java b/src/de/blinkt/openvpn/Settings_Authentication.java index 57d99417..6d21ca6a 100644 --- a/src/de/blinkt/openvpn/Settings_Authentication.java +++ b/src/de/blinkt/openvpn/Settings_Authentication.java @@ -24,6 +24,7 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre private ListPreference mTLSAuthDirection; private Preference mTLSAuthFile; private SwitchPreference mUseTLSAuth; + private EditTextPreference mCipher; @Override public void onCreate(Bundle savedInstanceState) { @@ -45,6 +46,8 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre mProfile = ProfileManager.get(profileUUID); mTLSAuthFile.setOnPreferenceClickListener(this); + mCipher =(EditTextPreference) findPreference("cipher"); + loadSettings(); } @@ -59,6 +62,8 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre mUseTLSAuth.setChecked(mProfile.mUseTLSAuth); mTLSAuthFile.setSummary(mProfile.mTLSAuthFilename); mTLSAuthDirection.setValue(mProfile.mTLSAuthDirection); + mCipher.setText(mProfile.mCipher); + onPreferenceChange(mCipher, mProfile.mCipher); } private void saveSettings() { @@ -76,6 +81,12 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre mProfile.mTLSAuthDirection=null; else mProfile.mTLSAuthDirection = mTLSAuthDirection.getValue().toString(); + + if(mCipher.getText()==null) + mProfile.mCipher=null; + else + mProfile.mCipher = mCipher.getText(); + } @Override @@ -91,6 +102,8 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre preference.setSummary(mProfile.mServerName); else preference.setSummary((String)newValue); + } else if (preference == mCipher) { + preference.setSummary((CharSequence) newValue); } return true; } diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index c18575da..1b855f5d 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -90,6 +90,7 @@ public class VpnProfile implements Serializable{ public boolean mUseCustomConfig=false; public String mCustomConfigOptions=""; public String mVerb="1"; + public String mCipher=""; public static String openVpnEscape(String unescaped) { @@ -271,6 +272,9 @@ public class VpnProfile implements Serializable{ cfg += "remote-cert-tls server\n"; + if(nonNull(mCipher)){ + cfg += "cipher " + mCipher + "\n"; + } // Obscure Settings dialog @@ -293,6 +297,13 @@ public class VpnProfile implements Serializable{ return cfg; } + private boolean nonNull(String val) { + if(val == null || val.equals("")) + return false; + else + return true; + } + private Collection getCustomRoutes() { Vector cidrRoutes=new Vector(); if(mCustomRoutes==null) { -- cgit v1.2.3 From cc7f23dcefea2e255dcfe0f38031a3840288aafa Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 10 May 2012 00:56:14 +0200 Subject: Version 0.5.1 --- src/de/blinkt/openvpn/Settings_Authentication.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/de/blinkt/openvpn/Settings_Authentication.java b/src/de/blinkt/openvpn/Settings_Authentication.java index 6d21ca6a..4124783b 100644 --- a/src/de/blinkt/openvpn/Settings_Authentication.java +++ b/src/de/blinkt/openvpn/Settings_Authentication.java @@ -46,7 +46,8 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre mProfile = ProfileManager.get(profileUUID); mTLSAuthFile.setOnPreferenceClickListener(this); - mCipher =(EditTextPreference) findPreference("cipher"); + mCipher =(EditTextPreference) findPreference("cipher"); + mCipher.setOnPreferenceChangeListener(this); loadSettings(); -- cgit v1.2.3