From d9da6f037b5b34540152d716568e86c7dddcbf92 Mon Sep 17 00:00:00 2001 From: Thomas Oettli Date: Tue, 3 Sep 2019 15:55:41 +0200 Subject: [PATCH] Quarantine regex matches headers case insensitive --- README.md | 2 +- docs/pyquarantine.conf.example | 2 +- pyquarantine/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e842379..de46df0 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ The following configuration options are mandatory in the global section: ### Quarantine sections The following configuration options are mandatory in each quarantine section: * **regex** - Regular expression to filter e-mail headers. + Case insensitive regular expression to filter e-mail headers. * **quarantine_type** One of the quarantine-types described below. * **action** diff --git a/docs/pyquarantine.conf.example b/docs/pyquarantine.conf.example index b13c8bb..c52d82d 100644 --- a/docs/pyquarantine.conf.example +++ b/docs/pyquarantine.conf.example @@ -38,7 +38,7 @@ preferred_quarantine_action = last ignore_hosts = 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 # Option: regex -# Notes: Set the regular expression to match against email headers. +# Notes: Set the case insensitive regular expression to match against email headers. # If the regex matches any of the email headers, the email # will be processed by this quarantine. # Values: [ REGEX ] diff --git a/pyquarantine/__init__.py b/pyquarantine/__init__.py index db8837d..3d74815 100644 --- a/pyquarantine/__init__.py +++ b/pyquarantine/__init__.py @@ -357,7 +357,7 @@ def generate_milter_config(configtest=False, config_files=[]): # pre-compile regex logger.debug("{}: compiling regex '{}'".format(quarantine_name, config["regex"])) - config["regex_compiled"] = re.compile(config["regex"], re.MULTILINE + re.DOTALL) + config["regex_compiled"] = re.compile(config["regex"], re.MULTILINE + re.DOTALL + re.IGNORECASE) # create quarantine instance quarantine_type = config["quarantine_type"].lower()