diff options
author | Parménides GV <parmegv@sdf.org> | 2014-11-22 11:54:39 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2014-11-22 11:54:39 +0100 |
commit | 8b272e8db92051ef9824d8552f47a3207e365a5a (patch) | |
tree | d494d77cb0b037e84bc35ad38950726440f29e0e /app/src/debug | |
parent | ecc30090447deaa65dc848147b6a60fd8eae4862 (diff) | |
parent | 36bcdb277a5ff49813834cbf6fe7550f471e680f (diff) |
Merge branch 'bug/JSON-error-when-updating-client-certificate-#6364' into develop
Diffstat (limited to 'app/src/debug')
-rw-r--r-- | app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java index 804e4b27..52645631 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -161,7 +161,15 @@ public class ProviderAPI extends IntentService { final ResultReceiver receiver = command.getParcelableExtra(RECEIVER_KEY); String action = command.getAction(); Bundle parameters = command.getBundleExtra(PARAMETERS); - setting_up_provider = true; + if(provider_api_url == null) { + try { + JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, "no provider")); + provider_api_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION); + } catch (JSONException e) { + } + } + + setting_up_provider = true; if(action.equalsIgnoreCase(SET_UP_PROVIDER)) { Bundle result = setUpProvider(parameters); @@ -281,7 +289,7 @@ public class ProviderAPI extends IntentService { LeapSRPSession client = new LeapSRPSession(username, password); byte[] A = client.exponential(); - + JSONObject step_result = sendAToSRPServer(provider_api_url, username, new BigInteger(1, A).toString(16)); try { String salt = step_result.getString(LeapSRPSession.SALT); @@ -915,6 +923,7 @@ public class ProviderAPI extends IntentService { boolean danger_on = preferences.getBoolean(ProviderItem.DANGER_ON, false); + String cert_string = downloadWithProviderCA(new_cert_string_url.toString(), danger_on); if(cert_string.isEmpty() || ConfigHelper.checkErroneousDownload(cert_string)) @@ -931,7 +940,7 @@ public class ProviderAPI extends IntentService { return false; } } - + private boolean loadCertificate(String cert_string) { try { // API returns concatenated cert & key. Split them for OpenVPN options |