if configure_asn_module() then
local id = rspamd_config:register_symbol({
name = 'ASN_CHECK',
- type = 'prefilter,nostat',
+ type = 'prefilter,nostat,empty',
callback = asn_check,
priority = 8,
- flags = 'empty',
})
if options['symbol'] then
rspamd_config:register_symbol({
['get_value'] = function(task)
return task:get_principal_recipient()
end,
+ need_process = true,
},
['digest'] = {
['get_value'] = function(task)
return task:get_digest()
end,
+ need_process = true,
},
['attachments'] = {
['get_value'] = function(task)
return nil
end,
+ need_process = true,
},
['files'] = {
['get_value'] = function(task)
return nil
end,
+ need_process = true,
},
}
local key_t = {tostring(lua_util.round(100000.0 / bucket.burst))}
local key_keywords = lua_util.str_split(rtype, '_')
local have_user = false
+ local message_processed = false
for _, v in ipairs(key_keywords) do
local ret
-
if keywords[v] and type(keywords[v]['get_value']) == 'function' then
- ret = keywords[v]['get_value'](task)
+ if keywords[v].need_process and not message_processed then
+ lua_util.debugm(N, task, 'process message as %s needs mime elts',
+ v)
+ message_processed = task:process_message()
+ message_processed = true
+ end
+ ret = keywords[v].get_value(task)
end
if not ret then return nil end
if v == 'user' then have_user = true end
local n = 0
for _,bucket in ipairs(v.buckets) do
if v.selector then
+ lua_util.debugm(N, task, 'process message as selectors need mime elts',
+ v)
+ task:process_message()
local selectors = lua_selectors.process_selectors(task, v.selector)
if selectors then
local combined = lua_selectors.combine_selectors(task, selectors, ':')
lua_util.disable_module(N, "redis")
else
local s = {
- type = 'prefilter,nostat',
+ type = 'prefilter,nostat,empty',
name = 'RATELIMIT_CHECK',
priority = 7,
callback = ratelimit_cb,
- flags = 'empty',
}
if settings.symbol then
-- Check limit for a task
local function check_settings(task)
+ local message_processed = false
local function check_specific_setting(rule, matched)
local res = false
local elt = rule.checks[atom]
if elt then
+ if elt.need_process and not message_processed then
+ lua_util.debugm(N, task, 'process message as %s needs mime elts',
+ atom)
+ message_processed = task:process_message()
+ message_processed = true
+ end
+
local input = elt.extract(task)
if not input then return false end
extract = function(task)
return task:get_from(2)
end,
+ need_process = true,
}
end
end
extract = function(task)
return task:get_recipients(2)
end,
+ need_process = true,
}
end
end
return v
end,
extract = extractor_func(k),
+ need_process = true,
}
local skey = process_compound_condition(cond, table_element,
end, values)
end,
extract = sel,
+ need_process = true,
}
local skey = process_compound_condition(cond, 'selector', elt.selector)
lua_util.debugm(N, rspamd_config, 'added selector condition to "%s": %s',