
from twisted.protocols import postfix

from leap.mx.alias_resolver import AliasResolverFactory


class LEAPPostFixTCPMapserverAccess(postfix.PostfixTCPMapServer):
    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)


class CheckRecipientAccessFactory(AliasResolverFactory):
    protocol = LEAPPostFixTCPMapserverAccess


from twisted.protocols import postfix

from leap.mx.alias_resolver import AliasResolverFactory


class LEAPPostFixTCPMapserverAccess(postfix.PostfixTCPMapServer):
    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"))


class CheckRecipientAccessFactory(AliasResolverFactory):
    protocol = LEAPPostFixTCPMapserverAccess

Fix return codes for check recipient
Fix return codes for check recipient

  
  from twisted.protocols import postfix
  
  from leap.mx.alias_resolver import AliasResolverFactory
  
  
  class LEAPPostFixTCPMapserverAccess(postfix.PostfixTCPMapServer):
      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("NOT FOUND SORRY"))
+             self.sendCode(500, postfix.quote("REJECT"))
          else:
+             self.sendCode(200, postfix.quote("OK"))
-             # We do not send the value in this case
-             self.sendCode(200)
  
  
  class CheckRecipientAccessFactory(AliasResolverFactory):
      protocol = LEAPPostFixTCPMapserverAccess
  
Fix return codes for check recipient
## Code Before:

from twisted.protocols import postfix

from leap.mx.alias_resolver import AliasResolverFactory


class LEAPPostFixTCPMapserverAccess(postfix.PostfixTCPMapServer):
    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)


class CheckRecipientAccessFactory(AliasResolverFactory):
    protocol = LEAPPostFixTCPMapserverAccess

## Instruction:
Fix return codes for check recipient
## Code After:

from twisted.protocols import postfix

from leap.mx.alias_resolver import AliasResolverFactory


class LEAPPostFixTCPMapserverAccess(postfix.PostfixTCPMapServer):
    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"))


class CheckRecipientAccessFactory(AliasResolverFactory):
    protocol = LEAPPostFixTCPMapserverAccess
