summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-12-13 03:31:56 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-12-29 03:09:59 +0100
commite763ad3451eecfb2c6c6724ac31e0a2f93d4b266 (patch)
tree8ab171db74791e76d820fc9e0abfa6b2aaaec289 /src/leap/bitmask
parent0e027e6858022589ace11218ce102ce57499e5e6 (diff)
[bug] fix the logout call
if user attempts to logout before the incoming multiservice has an entry, there will be a KeyError raised on the MultiService.getServiceNamed() call, which is improperly reported as a confusing error message in the api return call. by catching the KeyError, we make sure that the logout call can terminate properly.
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/core/mail_services.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index ef333cce..bc85889d 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -545,14 +545,18 @@ class StandardMailService(service.MultiService, HookableService):
check_and_fix_urw_only(cert_path)
def hook_on_bonafide_logout(self, **kw):
- username = kw['username']
- multiservice = self.getServiceNamed('incoming_mail')
- incoming = multiservice.getServiceNamed(username)
- logger.debug(
- 'looking for incoming mail service '
- 'for logout: %s' % username)
- if incoming:
- incoming.stopService()
+ username = kw.get('username', None)
+ if username:
+ multiservice = self.getServiceNamed('incoming_mail')
+ try:
+ incoming = multiservice.getServiceNamed(username)
+ except KeyError:
+ incoming = None
+ if incoming:
+ logger.debug(
+ 'looking for incoming mail service '
+ 'for logout: %s' % username)
+ incoming.stopService()
# commands
@@ -709,6 +713,7 @@ class IncomingMailService(service.MultiService):
# config utilities. should be moved to bonafide
#
+
SERVICES = ('soledad', 'smtp', 'eip')