local rspamd_logger = require "rspamd_logger" local function get_raw_header(task, name) return ((task:get_header_full(name) or {})[1] or {})['value'] end rspamd_config:register_symbol{ type = 'postfilter', -- 'callback' n'aurai pas permis task:adjust_result() name = 'REPLYTO_EQ_TO_ADDR_TBIRD_BUG', score = 0, group = 'headers', -- Metric group description = 'Thunderbird ajoute des headers Reply-To incorrects en réponse a des mails ayant un Reply-To (typiquement venant d\'une liste de diffusion). Inhiber REPLYTO_EQ_TO_ADDR dans ce cas.', flags = 'fine', -- fine: symbol is always checked, skip: symbol is always skipped, empty: symbol work for checks with no message callback = function(task) -- N'exécuter ce callback que si REPLYTO_EQ_TO_ADDR a été positionné par /usr/share/rspamd/rules/headers_checks.lua if not task:has_symbol('REPLYTO_EQ_TO_ADDR') then return false end -- Vérifier qu'on est dans le cas où l'utilisateur est authentifié (outgoing mail) local user = task:get_user() rspamd_logger.infox('REPLYTO_EQ_TO_ADDR_TBIRD_BUG user = %1', user) if not user then return false end -- Vérifier que le User-Agent est présent et contient 'Thunderbird' local ua = get_raw_header(task, 'User-Agent') rspamd_logger.infox('REPLYTO_EQ_TO_ADDR_TBIRD_BUG ua = %1', ua) if not ua then return false end local match, match_end = ua:find('Thunderbird') rspamd_logger.infox('REPLYTO_EQ_TO_ADDR_TBIRD_BUG match = %1', match) if not match then return false end -- Marquer le message avec REPLYTO_EQ_TO_ADDR_TBIRD_BUG rspamd_logger.infox('REPLYTO_EQ_TO_ADDR_TBIRD_BUG insert_result(REPLYTO_EQ_TO_ADDR_TBIRD_BUG, 1.0)') task:insert_result('REPLYTO_EQ_TO_ADDR_TBIRD_BUG', 1.0) -- Astuce pour ignorer la règle REPLYTO_EQ_TO_ADDR qui est au milieu d'une forêt de if dans headers_checks.lua) rspamd_logger.infox('REPLYTO_EQ_TO_ADDR_TBIRD_BUG adjust_result(REPLYTO_EQ_TO_ADDR, 0)') task:adjust_result('REPLYTO_EQ_TO_ADDR', 0) end, }