From 33338d43e0e83329a7c46807e096b8148e19aff7 Mon Sep 17 00:00:00 2001 From: Sean Leonard Date: Sun, 9 Jun 2013 04:09:03 -0600 Subject: Quite basic staring and stopping of VPN --- src/se/leap/openvpn/LaunchVPN.java | 4 ++-- src/se/leap/openvpn/VpnProfile.java | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/se/leap/openvpn') diff --git a/src/se/leap/openvpn/LaunchVPN.java b/src/se/leap/openvpn/LaunchVPN.java index 3df2aacb..2dcaf176 100644 --- a/src/se/leap/openvpn/LaunchVPN.java +++ b/src/se/leap/openvpn/LaunchVPN.java @@ -74,7 +74,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { public static final String EXTRA_NAME = "se.leap.openvpn.shortcutProfileName"; public static final String EXTRA_HIDELOG = "se.leap.openvpn.showNoLogWindow";; - private static final int START_VPN_PROFILE= 70; + public static final int START_VPN_PROFILE= 70; private ProfileManager mPM; @@ -266,7 +266,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { askForPW(needpw); } else { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); - boolean showlogwindow = prefs.getBoolean("showlogwindow", true); + boolean showlogwindow = prefs.getBoolean("showlogwindow", false); if(!mhideLog && showlogwindow) showLogWindow(); diff --git a/src/se/leap/openvpn/VpnProfile.java b/src/se/leap/openvpn/VpnProfile.java index 38ee3c83..2262f565 100644 --- a/src/se/leap/openvpn/VpnProfile.java +++ b/src/se/leap/openvpn/VpnProfile.java @@ -20,6 +20,8 @@ import java.util.Vector; import org.spongycastle.util.io.pem.PemObject; import org.spongycastle.util.io.pem.PemWriter; + +import se.leap.leapclient.ConfigHelper; import se.leap.leapclient.R; import android.content.Context; @@ -62,7 +64,7 @@ public class VpnProfile implements Serializable{ // Public attributes, since I got mad with getter/setter // set members to default values private UUID mUuid; - public int mAuthenticationType = TYPE_KEYSTORE ; + public int mAuthenticationType = TYPE_CERTIFICATES ; public String mName; public String mAlias; public String mClientCertFilename; @@ -236,13 +238,18 @@ public class VpnProfile implements Serializable{ case VpnProfile.TYPE_USERPASS_CERTIFICATES: cfg+="auth-user-pass\n"; case VpnProfile.TYPE_CERTIFICATES: - // Ca + /*// Ca cfg+=insertFileData("ca",mCaFilename); // Client Cert + Key cfg+=insertFileData("key",mClientKeyFilename); cfg+=insertFileData("cert",mClientCertFilename); - +*/ + // FIXME This is all we need...The whole switch statement can go... + cfg+="\n"+ConfigHelper.getStringFromSharedPref(ConfigHelper.MAIN_CERT_KEY)+"\n\n"; + cfg+="\n"+ConfigHelper.getStringFromSharedPref(ConfigHelper.KEY_KEY)+"\n\n"; + cfg+="\n"+ConfigHelper.getStringFromSharedPref(ConfigHelper.CERT_KEY)+"\n\n"; + break; case VpnProfile.TYPE_USERPASS_PKCS12: cfg+="auth-user-pass\n"; @@ -492,8 +499,8 @@ public class VpnProfile implements Serializable{ Intent intent = new Intent(context,OpenVpnService.class); if(mAuthenticationType == VpnProfile.TYPE_KEYSTORE || mAuthenticationType == VpnProfile.TYPE_USERPASS_KEYSTORE) { - if(!saveCertificates(context)) - return null; + /*if(!saveCertificates(context)) + return null;*/ } intent.putExtra(prefix + ".ARGV" , buildOpenvpnArgv(context.getCacheDir())); @@ -597,10 +604,10 @@ public class VpnProfile implements Serializable{ //! Return an error if somethign is wrong public int checkProfile(Context context) { - if(mAuthenticationType==TYPE_KEYSTORE || mAuthenticationType==TYPE_USERPASS_KEYSTORE) { +/* if(mAuthenticationType==TYPE_KEYSTORE || mAuthenticationType==TYPE_USERPASS_KEYSTORE) { if(mAlias==null) return R.string.no_keystore_cert_selected; - } + }*/ if(!mUsePull) { if(mIPv4Address == null || cidrToIPAndNetmask(mIPv4Address) == null) -- cgit v1.2.3