From de429a63c2138a2c29dc5ca89082559b57061691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 5 Aug 2014 18:00:28 +0200 Subject: Add remote-cert-tls server to openvpn options. --- app/src/main/java/se/leap/bitmaskclient/EIP.java | 39 ++++++++---------------- 1 file changed, 13 insertions(+), 26 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/se/leap/bitmaskclient/EIP.java b/app/src/main/java/se/leap/bitmaskclient/EIP.java index 7b2a6d95..2105c67c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/EIP.java @@ -440,31 +440,10 @@ public final class EIP extends IntentService { this.createVPNProfile(); - setUniqueProfileName(); vpl.addProfile(mVpnProfile); vpl.saveProfile(context, mVpnProfile); vpl.saveProfileList(context); } - - - public String locationAsName() { - try { - return eipDefinition.getJSONObject("locations").getJSONObject(mGateway.getString("location")).getString("name"); - } catch (JSONException e) { - Log.v(TAG,"Couldn't read gateway name for profile creation! Returning original name = " + mName); - e.printStackTrace(); - return (mName != null) ? mName : ""; - } - } - - - /** - * Attempts to create a unique profile name - * based on the location of the gateway. - */ - private void setUniqueProfileName() { - mVpnProfile.mName = mName = locationAsName(); - } /** * Create and attach the VpnProfile to our gateway object @@ -472,17 +451,15 @@ public final class EIP extends IntentService { protected void createVPNProfile(){ try { ConfigParser cp = new ConfigParser(); - Log.d(TAG, configFromEipServiceDotJson()); - Log.d(TAG, caSecretFromSharedPreferences()); - Log.d(TAG, keySecretFromSharedPreferences()); - Log.d(TAG, certSecretFromSharedPreferences()); cp.parseConfig(new StringReader(configFromEipServiceDotJson())); cp.parseConfig(new StringReader(caSecretFromSharedPreferences())); cp.parseConfig(new StringReader(keySecretFromSharedPreferences())); cp.parseConfig(new StringReader(certSecretFromSharedPreferences())); + cp.parseConfig(new StringReader("remote-cert-tls server")); VpnProfile vp = cp.convertProfile(); //vp.mAuthenticationType=VpnProfile.TYPE_STATICKEYS; mVpnProfile = vp; + mVpnProfile.mName = mName = locationAsName(); Log.v(TAG,"Created VPNProfile"); } catch (ConfigParseError e) { // FIXME We didn't get a VpnProfile! Error handling! and log level @@ -612,6 +589,16 @@ public final class EIP extends IntentService { return secret_lines; } - } + + public String locationAsName() { + try { + return eipDefinition.getJSONObject("locations").getJSONObject(mGateway.getString("location")).getString("name"); + } catch (JSONException e) { + Log.v(TAG,"Couldn't read gateway name for profile creation! Returning original name = " + mName); + e.printStackTrace(); + return (mName != null) ? mName : ""; + } + } + } } -- cgit v1.2.3