def _cbGot(self, value): """ Return a code and message depending on the result of the factory's get(). If there's no pgp public key for the user, we currently return a temporary failure saying that the user account is disabled. For more info, see: http://www.postfix.org/access.5.html :param value: The uuid and public key. :type value: list """ uuid, pubkey = value if uuid is None: self.sendCode( TCP_MAP_CODE_PERMANENT_FAILURE, postfix.quote("REJECT")) elif pubkey is None: self.sendCode( TCP_MAP_CODE_TEMPORARY_FAILURE, postfix.quote("4.7.13 NO PUBKEY FOUND")) else: self.sendCode( TCP_MAP_CODE_SUCCESS, postfix.quote("OK"))
def _cbGot(self, value): # For more info, see: # http://www.postfix.org/tcp_table.5.html # http://www.postfix.org/access.5.html if value is None: self.sendCode(500, postfix.quote("REJECT")) else: self.sendCode(200, postfix.quote("OK"))
def testData(self): for entry in self.data: raw = entry[0] quoted = entry[1:] self.assertEquals(postfix.quote(raw), quoted[0]) for q in quoted: self.assertEquals(postfix.unquote(q), raw)
def testData(self): for entry in self.data: raw = entry[0] quoted = entry[1:] self.assertEqual(postfix.quote(raw), quoted[0]) for q in quoted: self.assertEqual(postfix.unquote(q), raw)
def _cbGot(self, user_data): """ Return a code and message depending on the result of the factory's get(). :param user_data: The user's uuid and pgp public key. :type user_data: list """ uuid, _ = user_data if uuid is None: self.sendCode(TCP_MAP_CODE_PERMANENT_FAILURE, postfix.quote("NOT FOUND SRY")) else: # properly encode uuid, otherwise twisted complains when replying if isinstance(uuid, unicode): uuid = uuid.encode("utf8") self.sendCode(TCP_MAP_CODE_SUCCESS, postfix.quote(uuid))
def _cbGot(self, user_data): """ Return a code and message depending on the result of the factory's get(). :param user_data: The user's uuid and pgp public key. :type user_data: list """ uuid, _ = user_data if uuid is None: self.sendCode( TCP_MAP_CODE_PERMANENT_FAILURE, postfix.quote("NOT FOUND SRY")) else: # properly encode uuid, otherwise twisted complains when replying if isinstance(uuid, unicode): uuid = uuid.encode("utf8") self.sendCode( TCP_MAP_CODE_SUCCESS, postfix.quote(uuid))
def _cbGot(self, value): if value is None: self.sendCode(500, postfix.quote("NOT FOUND SRY")) else: self.sendCode(200, postfix.quote(value))
def _cbGot(self, value): if value is None: self.sendCode(500, postfix.quote("NOT FOUND SORRY")) else: # We do not send the value in this case self.sendCode(200)