summaryrefslogtreecommitdiff
path: root/src/leap/mx/check_recipient_access.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2015-04-15 12:48:34 -0300
committerdrebs <drebs@leap.se>2015-04-16 11:53:13 -0300
commit527d7d4a67f859a3315812b100b2c58fd0eeded6 (patch)
treeb51959b18ec0053f9ed448cec9bd8c1bc98eb607 /src/leap/mx/check_recipient_access.py
parent14ef3dcce18240b756415fefa2a56936f96a12e9 (diff)
[bug] return uuid as result of alias resolver
This fixes a bug introduced on b0ef529cc882a96903597fb5279919969fa286c3, when the alias resolver was modified to return the user's address instead of the uuid. In order to fix this, I had to revert one of the changes made by the commit above, which is to don't make use of reduced view for the uuid query. The pgp public key query remains reduced, as implemented in the commit above. We also refactor the code a bit to allow for log messages specific to each of tcp map's sublasses. Related: #6858.
Diffstat (limited to 'src/leap/mx/check_recipient_access.py')
-rw-r--r--src/leap/mx/check_recipient_access.py35
1 files changed, 5 insertions, 30 deletions
diff --git a/src/leap/mx/check_recipient_access.py b/src/leap/mx/check_recipient_access.py
index 3b61fe8..9f79dfe 100644
--- a/src/leap/mx/check_recipient_access.py
+++ b/src/leap/mx/check_recipient_access.py
@@ -23,7 +23,6 @@ Test this with postmap -v -q "foo" tcp:localhost:2244
"""
from twisted.protocols import postfix
-from twisted.internet import defer
from leap.mx.tcp_map import LEAPPostfixTCPMapServerFactory
from leap.mx.tcp_map import TCP_MAP_CODE_SUCCESS
@@ -50,8 +49,8 @@ class LEAPPostFixTCPMapAccessServer(postfix.PostfixTCPMapServer):
:param value: The uuid and public key.
:type value: list
"""
- address, pubkey = value
- if address is None:
+ uuid, pubkey = value
+ if uuid is None:
self.sendCode(
TCP_MAP_CODE_PERMANENT_FAILURE,
postfix.quote("REJECT"))
@@ -75,31 +74,7 @@ class CheckRecipientAccessFactory(LEAPPostfixTCPMapServerFactory):
protocol = LEAPPostFixTCPMapAccessServer
- def _getPubKey(self, address):
- """
- Look up PGP public key based on email address.
-
- :param address: The email address.
- :type address: str
-
- :return: A deferred that is fired with the address and the public key, if
- each of them exists.
- :rtype: DeferredList
- """
- if not address:
- return defer.succeed([None, None])
- return defer.gatherResults([
- defer.succeed(address),
- self._cdb.getPubKey(address),
- ])
-
- def get(self, key):
- """
- Look up uuid and PGP public key based on key.
+ @property
+ def _query_message(self):
+ return "Checking recipient access for"
- :param key: The lookup key.
- :type key: str
- """
- d = LEAPPostfixTCPMapServerFactory.get(self, key)
- d.addCallback(self._getPubKey)
- return d