Beispiel #1
0
 def __init__(self, socket, config):
     ProtocolHandler.__init__(self, socket, config)
     self.sess = ESMTPPassthroughSession(socket, config)
     try:
         self._att_mgr_cachesize = config.getint('performance',
                                                 'att_mgr_cachesize')
     except Exception:
         self._att_mgr_cachesize = None
Beispiel #2
0
    def __init__(self, sock, config):
        ProtocolHandler.__init__(self, sock, config)

        # Milter can keep the connection and handle several suspect in one session
        self.keep_connection = True

        if not LIMBMILTER_AVAILABLE:
            raise ImportError(
                "libmilter not available, not possible to use MilterHandler")

        try:
            self._att_mgr_cachesize = config.getint('performance',
                                                    'att_mgr_cachesize')
        except Exception:
            self._att_mgr_cachesize = None

        try:
            configstring = config.get('milter', 'milter_mode')
        except Exception:
            configstring = "tags"

        configstring = configstring.lower()

        if not configstring:
            self.logger.debug("milter_mode: setting to default value: 'tags'")
            configstring = "tags"

        if configstring not in ["auto", "readonly", "tags", "replace_demo"]:
            self.logger.warning(
                "milter_mode: '%s' not recognised, resetting to 'tags'" %
                configstring)

        self.enable_mode_manual = ("manual" in configstring)
        self.enable_mode_auto = ("auto" in configstring)
        self.enable_mode_readonly = ("readonly" in configstring)
        self.enable_mode_tags = ("tags" in configstring)
        self.replace_demo = ("replace_demo" in configstring)

        sess_options = 0x00 if self.enable_mode_readonly else lm.SMFIF_ALLOPTS
        self.sess = MilterSession(sock, config, options=sess_options)

        self.logger.info("Milter mode: auto=%s, readonly=%s, tags=%s" %
                         (self.enable_mode_auto, self.enable_mode_readonly,
                          self.enable_mode_tags))

        # options (can be combined into a string): "all" "body" "headers" "from" "to"
        try:
            self.milter_mode_options = config.get('milter',
                                                  'milter_mode_options')
        except Exception:
            self.milter_mode_options = ""

        self.logger.info(
            "Milter config fixed replacements: all=%s, body=%s, headers=%s, from=%s, to=%s"
            % ("all" in self.milter_mode_options, "body"
               in self.milter_mode_options, "headers"
               in self.milter_mode_options, "from"
               in self.milter_mode_options, "to" in self.milter_mode_options))
 def __init__(self,socket,config):
     ProtocolHandler.__init__(self, socket,config)
     self.sess=NCSession(socket,config)
Beispiel #4
0
 def __init__(self, socket, config):
     ProtocolHandler.__init__(self, socket, config)
     self.sess = NCSession(socket, config)
Beispiel #5
0
 def __init__(self, socket, config):
     ProtocolHandler.__init__(self, socket, config)
     self.sess = ESMTPPassthroughSession(socket, config)
 def __init__(self,socket,config):
     ProtocolHandler.__init__(self, socket,config)
     self.sess=ESMTPPassthroughSession(socket,config)