diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-14 12:19:30 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-14 12:19:30 +0100 |
commit | b711239c11939e529bdf3f292754e709522680ed (patch) | |
tree | 4bf24d023f98a546cb6c19d99b348d3e4b2da817 /src/plugins/lua/ratelimit.lua | |
parent | c3c8d4d13302095c558e74f233269a3277de91c3 (diff) | |
download | rspamd-b711239c11939e529bdf3f292754e709522680ed.tar.gz rspamd-b711239c11939e529bdf3f292754e709522680ed.zip |
Revert "[Fix] Fix empty prefilters that require mime structures"
This reverts commit c3c8d4d13302095c558e74f233269a3277de91c3.
Diffstat (limited to 'src/plugins/lua/ratelimit.lua')
-rw-r--r-- | src/plugins/lua/ratelimit.lua | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index dbaffd975..bd77b1ad6 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -396,13 +396,11 @@ local keywords = { ['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) @@ -421,7 +419,6 @@ local keywords = { return nil end, - need_process = true, }, ['files'] = { ['get_value'] = function(task) @@ -441,7 +438,6 @@ local keywords = { return nil end, - need_process = true, }, } @@ -449,18 +445,12 @@ local function gen_rate_key(task, rtype, bucket) 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 - 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) + ret = keywords[v]['get_value'](task) end if not ret then return nil end if v == 'user' then have_user = true end @@ -505,9 +495,6 @@ local function limit_to_prefixes(task, k, v, prefixes) 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, ':') @@ -868,10 +855,11 @@ if opts then lua_util.disable_module(N, "redis") else local s = { - type = 'prefilter,nostat,empty', + type = 'prefilter,nostat', name = 'RATELIMIT_CHECK', priority = 7, callback = ratelimit_cb, + flags = 'empty', } if settings.symbol then |