summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-01-22 21:14:48 +0100
committerKali Kaneko <kali@leap.se>2018-01-25 01:19:18 +0100
commit7e05218519b1306a838a3fccfe342b8260af5b75 (patch)
tree4b0f859885be87f9c7ea9b79ee0740b22a8be414 /src/leap/bitmask
parent2d72f6eb4b220c8dfa3c64b2f6b82365791f0424 (diff)
[bug] several fixes after review
Diffstat (limited to 'src/leap/bitmask')
-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):