From 05b34a3daca7afa635e99816b04922eb46bdb799 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Mon, 13 Feb 2017 14:59:48 +0200 Subject: [PATCH] [Feature] Add FROM_NAME_EXCESS_SPACE rule --- rules/misc.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rules/misc.lua b/rules/misc.lua index df9377101..9127f68c9 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -487,6 +487,10 @@ local check_from_id = rspamd_config:register_callback_symbol('CHECK_FROM', 1.0, if match then task:insert_result('FROM_NAME_HAS_TITLE', 1.0, n:sub(match, match_end-1)) end + -- Check for excess spaces + if n:find('%s%s') then + task:insert_result('FROM_NAME_EXCESS_SPACE', 1.0) + end end if (envfrom and from and envfrom[1] and from[1] and envfrom[1].addr:lower() == from[1].addr:lower()) @@ -514,6 +518,8 @@ rspamd_config:register_virtual_symbol('FROM_DN_EQ_ADDR', 1.0, check_from_id) rspamd_config:set_metric_symbol('FROM_DN_EQ_ADDR', 1.0, 'From header display name is the same as the address') rspamd_config:register_virtual_symbol('FROM_HAS_DN', 1.0, check_from_id) rspamd_config:set_metric_symbol('FROM_HAS_DN', 0, 'From header has a display name') +rspamd_config:register_virtual_symbol('FROM_NAME_EXCESS_SPACE', 1.0, check_from_id) +rspamd_config:set_metric_symbol('FROM_NAME_EXCESS_SPACE', 1.0, 'From header display name contains excess whitespace') rspamd_config:register_virtual_symbol('FROM_NAME_HAS_TITLE', 1.0, check_from_id) rspamd_config:set_metric_symbol('FROM_NAME_HAS_TITLE', 1.0, 'From header display name has a title (Mr/Mrs/Dr)') rspamd_config:register_virtual_symbol('FROM_EQ_ENVFROM', 1.0, check_from_id) -- 2.39.5