summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/config.py6
-rw-r--r--src/leap/bitmask/vpn/_checks.py1
-rw-r--r--src/leap/bitmask/vpn/autostart.py5
-rw-r--r--src/leap/bitmask/vpn/service.py7
4 files changed, 7 insertions, 12 deletions
diff --git a/src/leap/bitmask/config.py b/src/leap/bitmask/config.py
index 17a20d3f..4fb1ff9b 100644
--- a/src/leap/bitmask/config.py
+++ b/src/leap/bitmask/config.py
@@ -96,8 +96,6 @@ class _ConfigurationSection(object):
return self.config.get(self.section, option, default, boolean)
def set(self, option, value):
- if value is True:
- value = 'true'
- elif value is False:
- value = 'false'
+ if isinstance(value, bool):
+ value = str(value)
return self.config.set(self.section, option, value)
diff --git a/src/leap/bitmask/vpn/_checks.py b/src/leap/bitmask/vpn/_checks.py
index c9e40f57..681f7428 100644
--- a/src/leap/bitmask/vpn/_checks.py
+++ b/src/leap/bitmask/vpn/_checks.py
@@ -62,5 +62,4 @@ def _has_valid_cert(provider):
if datetime.now() > expiry:
log.warn("VPN cert expired for %s" % (provider,))
return False
-
return True
diff --git a/src/leap/bitmask/vpn/autostart.py b/src/leap/bitmask/vpn/autostart.py
index af7b3669..858ea4ab 100644
--- a/src/leap/bitmask/vpn/autostart.py
+++ b/src/leap/bitmask/vpn/autostart.py
@@ -41,8 +41,5 @@ Terminal=false
if IS_MAC:
- def autostart_app_on():
- pass
-
- def autostart_app_off():
+ def autostart_app(status):
pass
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index 0ca0f566..6d273e23 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -216,13 +216,13 @@ class VPNService(HookableService):
status['domain'] = self._read_last()
return status
- def do_check(self, domain=None):
+ def do_check(self, domain=None, timeout=1):
"""Check whether the VPN Service is properly configured,
and can be started. This returns info about the helpers being
installed, a polkit agent being present, and optionally a valid
certificate present for a domain."""
hashelpers = helpers.check()
- privcheck = helpers.privcheck(timeout=5)
+ privcheck = helpers.privcheck(timeout=1)
ret = {'installed': hashelpers, 'privcheck': privcheck}
if not privcheck:
if IS_LINUX:
@@ -323,7 +323,8 @@ class VPNService(HookableService):
key_path = cert_path
anonvpn = self._has_anonvpn(provider)
- if not os.path.isfile(cert_path):
+ ready = self.do_check(provider_id).get('vpn_ready', False)
+ if not ready:
yield self._maybe_get_anon_cert(anonvpn, provider_id)
if not os.path.isfile(ca_path):