From 491548856632c22c179aa47c90df7afd44c75cd2 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 13 Mar 2018 12:42:37 +0200 Subject: [PATCH] [Fix] Fix various modules in case of empty message --- src/plugins/lua/asn.lua | 4 +++- src/plugins/lua/clickhouse.lua | 3 ++- src/plugins/lua/elastic.lua | 3 ++- src/plugins/lua/force_actions.lua | 2 ++ src/plugins/lua/greylist.lua | 6 ++++-- src/plugins/lua/history_redis.lua | 1 + src/plugins/lua/ip_score.lua | 4 +++- src/plugins/lua/metadata_exporter.lua | 3 ++- src/plugins/lua/milter_headers.lua | 3 ++- src/plugins/lua/mx_check.lua | 1 + src/plugins/lua/settings.lua | 6 ++++-- 11 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/plugins/lua/asn.lua b/src/plugins/lua/asn.lua index a125b99c1..3e84a3824 100644 --- a/src/plugins/lua/asn.lua +++ b/src/plugins/lua/asn.lua @@ -108,12 +108,14 @@ if configure_asn_module() then type = 'prefilter,nostat', callback = asn_check, priority = 5, + flags = 'empty', }) if options['symbol'] then rspamd_config:register_symbol({ name = options['symbol'], parent = id, - type = 'virtual' + type = 'virtual', + flags = 'empty', }) end else diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua index 9ef951e43..16b987df6 100644 --- a/src/plugins/lua/clickhouse.lua +++ b/src/plugins/lua/clickhouse.lua @@ -678,7 +678,8 @@ if opts then name = 'CLICKHOUSE_COLLECT', type = 'idempotent', callback = clickhouse_collect, - priority = 10 + priority = 10, + flags = 'empty', }) rspamd_config:register_finish_script(function(task) if nrows > 0 then diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua index c033b547a..3c7830de6 100644 --- a/src/plugins/lua/elastic.lua +++ b/src/plugins/lua/elastic.lua @@ -414,7 +414,8 @@ if redis_params and opts then name = 'ELASTIC_COLLECT', type = 'idempotent', callback = elastic_collect, - priority = 10 + priority = 10, + flags = 'empty', }) rspamd_config:add_on_load(function(cfg, ev_base,worker) diff --git a/src/plugins/lua/force_actions.lua b/src/plugins/lua/force_actions.lua index 1d99ce52b..ca960a2e4 100644 --- a/src/plugins/lua/force_actions.lua +++ b/src/plugins/lua/force_actions.lua @@ -118,6 +118,7 @@ local function configure_module() type = 'normal', name = name, callback = cb, + flags = 'empty', }) for _, a in ipairs(atoms) do rspamd_config:register_dependency(id, a) @@ -150,6 +151,7 @@ local function configure_module() end t.name = 'FORCE_ACTION_' .. name t.callback = cb + t.flags = 'empty' local id = rspamd_config:register_symbol(t) if t.type == 'normal' then for _, a in ipairs(atoms) do diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua index 91e6185f3..a555fcfc8 100644 --- a/src/plugins/lua/greylist.lua +++ b/src/plugins/lua/greylist.lua @@ -424,13 +424,15 @@ if opts then name = 'GREYLIST_SAVE', type = 'postfilter', callback = greylist_set, - priority = 6 + priority = 6, + flags = 'empty', }) rspamd_config:register_symbol({ name = 'GREYLIST_CHECK', type = 'prefilter', callback = greylist_check, - priority = 6 + priority = 6, + flags = 'empty', }) end end diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index 06f7ec90c..c8f2b6ee6 100644 --- a/src/plugins/lua/history_redis.lua +++ b/src/plugins/lua/history_redis.lua @@ -232,6 +232,7 @@ if opts then name = 'HISTORY_SAVE', type = 'idempotent', callback = history_save, + flags = 'empty', priority = 150 }) rspamd_plugins['history'] = { diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua index 7a5477556..083556066 100644 --- a/src/plugins/lua/ip_score.lua +++ b/src/plugins/lua/ip_score.lua @@ -384,12 +384,14 @@ if redis_params then type = 'postfilter,nostat', priority = 5, callback = ip_score_set, + flags = 'empty', }) rspamd_config:register_symbol({ name = options['symbol'], callback = ip_score_check, group = 'reputation', - score = 2.0 + score = 2.0, + flags = 'empty', }) else rspamd_lua_utils.disable_module(N, "redis") diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index d2d12cad5..3569650ab 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -700,6 +700,7 @@ for k, r in pairs(settings.rules) do name = 'EXPORT_METADATA_' .. k, type = 'postfilter,idempotent', callback = gen_exporter(r), - priority = 10 + priority = 10, + flags = 'empty', }) end diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index 176597b60..f5f8fe604 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -530,5 +530,6 @@ rspamd_config:register_symbol({ name = 'MILTER_HEADERS', type = 'postfilter,idempotent', callback = milter_headers, - priority = 10 + priority = 10, + flags = 'empty', }) diff --git a/src/plugins/lua/mx_check.lua b/src/plugins/lua/mx_check.lua index b30f1293b..61d1cd1b8 100644 --- a/src/plugins/lua/mx_check.lua +++ b/src/plugins/lua/mx_check.lua @@ -281,6 +281,7 @@ if opts then name = settings.symbol_bad_mx, type = 'normal', callback = mx_check, + flags = 'empty', }) rspamd_config:register_symbol({ name = settings.symbol_no_mx, diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index d35c91adf..13647c480 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -716,7 +716,8 @@ if redis_section then name = 'REDIS_SETTINGS' .. tostring(id), type = 'prefilter,nostat', callback = gen_redis_callback(h, id), - priority = 10 + priority = 10, + flags = 'empty', }) end, redis_key_handlers) end @@ -736,5 +737,6 @@ rspamd_config:register_symbol({ name = 'SETTINGS_CHECK', type = 'prefilter,nostat', callback = check_settings, - priority = 10 + priority = 10, + flags = 'empty', }) -- 2.39.5