diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-06-09 04:09:03 -0600 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-06-20 18:40:45 -0600 |
commit | 33338d43e0e83329a7c46807e096b8148e19aff7 (patch) | |
tree | 62eb9c0de87a2ef9ff66f0b79909429019dd0aae /src/se/leap/openvpn | |
parent | 9a9823f7e5bf0e46e360ba327ac6514ecd4bb320 (diff) |
Quite basic staring and stopping of VPN
Diffstat (limited to 'src/se/leap/openvpn')
-rw-r--r-- | src/se/leap/openvpn/LaunchVPN.java | 4 | ||||
-rw-r--r-- | src/se/leap/openvpn/VpnProfile.java | 21 |
2 files changed, 16 insertions, 9 deletions
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+="<ca>\n"+ConfigHelper.getStringFromSharedPref(ConfigHelper.MAIN_CERT_KEY)+"\n</ca>\n"; + cfg+="<key>\n"+ConfigHelper.getStringFromSharedPref(ConfigHelper.KEY_KEY)+"\n</key>\n"; + cfg+="<cert>\n"+ConfigHelper.getStringFromSharedPref(ConfigHelper.CERT_KEY)+"\n</cert>\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) |