diff options
Diffstat (limited to 'src/leap/bitmask/provider')
-rw-r--r-- | src/leap/bitmask/provider/providerbootstrapper.py | 41 | ||||
-rw-r--r-- | src/leap/bitmask/provider/tests/test_providerbootstrapper.py | 3 |
2 files changed, 29 insertions, 15 deletions
diff --git a/src/leap/bitmask/provider/providerbootstrapper.py b/src/leap/bitmask/provider/providerbootstrapper.py index 8eefb9d9..efba29f9 100644 --- a/src/leap/bitmask/provider/providerbootstrapper.py +++ b/src/leap/bitmask/provider/providerbootstrapper.py @@ -225,8 +225,9 @@ class ProviderBootstrapper(AbstractBootstrapper): if flags.APP_VERSION_CHECK: # TODO split if not provider.supports_client(min_client_version): - self._signaler.signal( - self._signaler.prov_unsupported_client) + if self._signaler is not None: + self._signaler.signal( + self._signaler.prov_unsupported_client) raise UnsupportedClientVersionError() provider_definition, mtime = get_content(res) @@ -248,7 +249,9 @@ class ProviderBootstrapper(AbstractBootstrapper): 'Found: {1}.').format(api_supported, api_version) logger.error(error) - self._signaler.signal(self._signaler.prov_unsupported_api) + if self._signaler is not None: + self._signaler.signal( + self._signaler.prov_unsupported_api) raise UnsupportedProviderAPI(error) def run_provider_select_checks(self, domain, download_if_needed=False): @@ -267,12 +270,18 @@ class ProviderBootstrapper(AbstractBootstrapper): self._domain = ProviderConfig.sanitize_path_component(domain) self._download_if_needed = download_if_needed + name_resolution = None + https_connection = None + down_provider_info = None + if self._signaler is not None: + name_resolution = self._signaler.prov_name_resolution + https_connection = self._signaler.prov_https_connection + down_provider_info = self._signaler.prov_download_provider_info + cb_chain = [ - (self._check_name_resolution, - self._signaler.prov_name_resolution), - (self._check_https, self._signaler.prov_https_connection), - (self._download_provider_info, - self._signaler.prov_download_provider_info) + (self._check_name_resolution, name_resolution), + (self._check_https, https_connection), + (self._download_provider_info, down_provider_info) ] return self.addCallbackChain(cb_chain) @@ -398,12 +407,18 @@ class ProviderBootstrapper(AbstractBootstrapper): self._provider_config = provider_config self._download_if_needed = download_if_needed + download_ca_cert = None + check_ca_fingerprint = None + check_api_certificate = None + if self._signaler is not None: + download_ca_cert = self._signaler.prov_download_ca_cert + check_ca_fingerprint = self._signaler.prov_check_ca_fingerprint + check_api_certificate = self._signaler.prov_check_api_certificate + cb_chain = [ - (self._download_ca_cert, self._signaler.prov_download_ca_cert), - (self._check_ca_fingerprint, - self._signaler.prov_check_ca_fingerprint), - (self._check_api_certificate, - self._signaler.prov_check_api_certificate) + (self._download_ca_cert, download_ca_cert), + (self._check_ca_fingerprint, check_ca_fingerprint), + (self._check_api_certificate, check_api_certificate) ] return self.addCallbackChain(cb_chain) diff --git a/src/leap/bitmask/provider/tests/test_providerbootstrapper.py b/src/leap/bitmask/provider/tests/test_providerbootstrapper.py index 6cf3e469..e694e456 100644 --- a/src/leap/bitmask/provider/tests/test_providerbootstrapper.py +++ b/src/leap/bitmask/provider/tests/test_providerbootstrapper.py @@ -38,7 +38,6 @@ from requests.models import Response from leap.bitmask import provider from leap.bitmask import util -from leap.bitmask.backend import Signaler from leap.bitmask.config.providerconfig import ProviderConfig from leap.bitmask.crypto.tests import fake_provider from leap.bitmask.provider.providerbootstrapper import ProviderBootstrapper @@ -51,7 +50,7 @@ from leap.common.testing.https_server import where class ProviderBootstrapperTest(BaseLeapTest): def setUp(self): - self.pb = ProviderBootstrapper(Signaler()) + self.pb = ProviderBootstrapper() def tearDown(self): pass |