summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-07-12 14:01:29 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2017-07-14 14:29:41 +0200
commitf7a3e1b4ce2ba114449edb03d1eb3e9719e5d821 (patch)
tree7647a15c02bfed62987080b5cd5ff031d1c5a533
parentb5470367a74fb09fb30dc56fe6a22254fe25d18e (diff)
[bug] handle 503 responses from nyckserver
This can be produced by errors fetching keys from the server. - Resolves: #8971
-rw-r--r--docs/changelog.rst1
-rw-r--r--src/leap/bitmask/keymanager/__init__.py10
-rw-r--r--src/leap/bitmask/keymanager/nicknym.py7
3 files changed, 13 insertions, 5 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 27484843..cf38716c 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -32,6 +32,7 @@ Bugfixes
- `#8868 <https://0xacab.org/leap/bitmask-dev/issues/8868>`_: can't upload generated key with bitmask
- `#8832 <https://0xacab.org/leap/bitmask-dev/issues/8832>`_: don't allow putting non-private keys for the keyring address
- `#8901 <https://0xacab.org/leap/bitmask-dev/issues/8901>`_: use gpg1 binary if present
+- `#8971 <https://0xacab.org/leap/bitmask-dev/issues/8971>`_: handle 502 replies from nicknym
Misc
~~~~
diff --git a/src/leap/bitmask/keymanager/__init__.py b/src/leap/bitmask/keymanager/__init__.py
index 2dd0d336..bc0c2185 100644
--- a/src/leap/bitmask/keymanager/__init__.py
+++ b/src/leap/bitmask/keymanager/__init__.py
@@ -214,10 +214,12 @@ class KeyManager(object):
if (domain == _get_domain(self._nickserver_uri)):
validation_level = ValidationLevels.Provider_Trust
- yield self.put_raw_key(
- server_keys[self.OPENPGP_KEY],
- address=address,
- validation=validation_level)
+ yield self.put_raw_key(
+ server_keys[self.OPENPGP_KEY],
+ address=address,
+ validation=validation_level)
+ else:
+ raise KeyNotFound("No openpgp key found")
def get_key(self, address, private=False, fetch_remote=True):
"""
diff --git a/src/leap/bitmask/keymanager/nicknym.py b/src/leap/bitmask/keymanager/nicknym.py
index b585d112..cbc4e25d 100644
--- a/src/leap/bitmask/keymanager/nicknym.py
+++ b/src/leap/bitmask/keymanager/nicknym.py
@@ -22,7 +22,7 @@ import urllib
from twisted.internet import defer
from twisted.logger import Logger
from twisted.web import client
-from twisted.web._responses import NOT_FOUND, SERVICE_UNAVAILABLE
+from twisted.web._responses import NOT_FOUND, SERVICE_UNAVAILABLE, BAD_GATEWAY
from leap.bitmask.keymanager.errors import KeyNotFound
from leap.common.check import leap_assert
@@ -146,6 +146,11 @@ class Nicknym(object):
'Request: %s' % (response.code, uri)
self.log.warn(message)
raise KeyNotFound(message), None, sys.exc_info()[2]
+ if response.code == BAD_GATEWAY:
+ message = ' %s: Bad gateway. Request: %s. Response: %s' \
+ % (response.code, uri, response)
+ self.log.warn(message)
+ raise KeyNotFound(message), None, sys.exc_info()[2]
return response
d = self._async_client_pinned.request(str(uri), 'GET',