WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-]]--
+]] --
local util = require "rspamd_util"
local ipairs = ipairs
end
-- See if the Display Names match
if (from[1].name and rt[1].name and
- util.strequal_caseless(from[1].name, rt[1].name)) then
+ util.strequal_caseless(from[1].name, rt[1].name)) then
task:insert_result('REPLYTO_DN_EQ_FROM_DN', 1.0)
end
end
if (to and to[1] and to[1].addr:lower() == rt[1].addr:lower()) then
-- Ignore this for mailing-lists and automatic submissions
if (not (task:get_header('List-Unsubscribe') or
- task:get_header('X-To-Get-Off-This-List') or
- task:get_header('X-List') or
- task:get_header('Auto-Submitted')))
+ task:get_header('X-To-Get-Off-This-List') or
+ task:get_header('X-List') or
+ task:get_header('Auto-Submitted')))
then
task:insert_result('REPLYTO_EQ_TO_ADDR', 1.0)
end
rspamd_config.BROKEN_CONTENT_TYPE = {
callback = function(task)
return fun.any(function(p)
- return p:is_broken()
- end,
- task:get_parts())
+ return p:is_broken()
+ end,
+ task:get_parts())
end,
score = 1.5,
group = 'headers',
if (from[1].name == nil or from[1].name == '') then
task:insert_result('FROM_NO_DN', 1.0)
elseif (from[1].name and
- util.strequal_caseless(from[1].name, from[1].addr)) then
+ util.strequal_caseless(from[1].name, from[1].addr)) then
task:insert_result('FROM_DN_EQ_ADDR', 1.0)
elseif (from[1].name and from[1].name ~= '') then
task:insert_result('FROM_HAS_DN', 1.0)
if (util.strequal_caseless(to[1].addr, from[1].addr)) then
task:insert_result('TO_EQ_FROM', 1.0)
elseif (to[1].domain and from[1].domain and
- util.strequal_caseless(to[1].domain, from[1].domain))
+ util.strequal_caseless(to[1].domain, from[1].domain))
then
task:insert_result('TO_DOM_EQ_FROM_DOM', 1.0)
end
for _, toa in ipairs(to) do
-- To: Recipients <noreply@dropbox.com>
if (toa['name'] and (toa['name']:lower() == 'recipient'
- or toa['name']:lower() == 'recipients')) then
+ or toa['name']:lower() == 'recipients')) then
task:insert_result('TO_DN_RECIPIENTS', 1.0)
end
if (toa['name'] and util.strequal_caseless(toa['name'], toa['addr'])) then
if (rcpts) then
for _, rcpt in ipairs(rcpts) do
if (toa and toa['addr'] and rcpt and rcpt['addr'] and
- util.strequal_caseless(rcpt['addr'], toa['addr']))
+ util.strequal_caseless(rcpt['addr'], toa['addr']))
then
to_match_envrcpt = to_match_envrcpt + 1
end
return false;
end
-rspamd_config.INVALID_FROM_8BIT = {
+local invalid_from_8bit = {
callback = function(task)
local from = (task:get_from('mime') or {})[1] or {}
if is_8bit_addr(from) then
group = 'headers'
}
-rspamd_config.INVALID_RCPT_8BIT = {
+local invalid_rcpt_8bit = {
callback = function(task)
local rcpts = task:get_recipients('mime') or {}
return fun.any(function(rcpt)
if rspamd_config:is_mime_utf8() then
-- Disable some of the rules preserving the underlying logic
- rspamd_config.INVALID_FROM_8BIT.condition = function()
+ invalid_from_8bit.condition = function()
return false
end
- rspamd_config.INVALID_RCPT_8BIT.condition = function()
+ invalid_rcpt_8bit.condition = function()
return false
end
end
+rspamd_config.INVALID_FROM_8BIT = invalid_from_8bit
+rspamd_config.INVALID_RCPT_8BIT = invalid_rcpt_8bit
+
rspamd_config.XM_CASE = {
callback = function(task)
return task:has_header('X-mailer', true)