summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/EIP.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIP.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
index cf4dc9bf..46f91781 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -56,6 +56,7 @@ import de.blinkt.openvpn.core.VpnStatus;
import de.blinkt.openvpn.core.connection.Connection;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.base.OnBootReceiver;
+import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.base.models.ProviderObservable;
import se.leap.bitmaskclient.base.utils.PreferenceHelper;
@@ -242,6 +243,12 @@ public final class EIP extends JobIntentService implements Observer {
return;
}
+ if (shouldUpdateVPNCertificate()) {
+ Provider p = ProviderObservable.getInstance().getCurrentProvider();
+ p.setShouldUpdateVpnCertificate(true);
+ ProviderObservable.getInstance().updateProvider(p);
+ }
+
GatewaysManager gatewaysManager = new GatewaysManager(getApplicationContext());
if (gatewaysManager.isEmpty()) {
setErrorResult(result, warning_client_parsing_error_gateways, null);
@@ -267,6 +274,12 @@ public final class EIP extends JobIntentService implements Observer {
Gateway gateway = gatewaysManager.select(0);
Bundle result = new Bundle();
+ if (shouldUpdateVPNCertificate()) {
+ Provider p = ProviderObservable.getInstance().getCurrentProvider();
+ p.setShouldUpdateVpnCertificate(true);
+ ProviderObservable.getInstance().updateProvider(p);
+ }
+
launchActiveGateway(gateway, 0, result);
if (result.containsKey(BROADCAST_RESULT_KEY) && !result.getBoolean(BROADCAST_RESULT_KEY)){
VpnStatus.logWarning("ALWAYS-ON VPN: " + getString(R.string.no_vpn_profiles_defined));
@@ -415,6 +428,12 @@ public final class EIP extends JobIntentService implements Observer {
return validator.isValid();
}
+ private boolean shouldUpdateVPNCertificate() {
+ VpnCertificateValidator validator = new VpnCertificateValidator(preferences.getString(PROVIDER_VPN_CERTIFICATE, ""));
+ return validator.shouldBeUpdated();
+ }
+
+
/**
* helper function to add error to result bundle
*