diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-04 15:49:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-04 15:49:45 +0000 |
commit | 27ccaaa8c7021eae7816474423209296bb9146a9 (patch) | |
tree | 506d524ba244967b2ebd9fcc1a451203295e7b4c /src/lua | |
parent | 9d6e312a8e9cc0fa23d7304cb296be4b0f51dc96 (diff) | |
download | rspamd-27ccaaa8c7021eae7816474423209296bb9146a9.tar.gz rspamd-27ccaaa8c7021eae7816474423209296bb9146a9.zip |
Pre filters should actually skip processing
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 7acedb153..6e644b0da 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -101,6 +101,7 @@ LUA_FUNCTION_DEF (task, insert_result); * - `add header`: add spam header * - `rewrite subject`: rewrite subject to spam subject * - `greylist`: greylist message + * - `accept` or `no action`: whitelist message * @param {rspamd_action or string} action a numeric or string action value * @param {string} description optional descripton @example @@ -812,16 +813,16 @@ lua_task_set_pre_result (lua_State * L) else if (lua_type (L, 2) == LUA_TSTRING) { rspamd_action_from_str (lua_tostring (L, 2), &action); } - if (action < (gint)task->pre_result.action && - action < METRIC_ACTION_MAX && - action >= METRIC_ACTION_REJECT) { + if (action < METRIC_ACTION_MAX && action >= METRIC_ACTION_REJECT) { /* We also need to set the default metric to that result */ mres = rspamd_create_metric_result (task, DEFAULT_METRIC); if (mres != NULL) { mres->score = mres->metric->actions[action].score; mres->action = action; } + task->pre_result.action = action; + if (lua_gettop (L) >= 3) { action_str = rspamd_mempool_strdup (task->task_pool, luaL_checkstring (L, 3)); @@ -834,6 +835,12 @@ lua_task_set_pre_result (lua_State * L) msg_info_task ("<%s>: set pre-result to %s: '%s'", task->message_id, rspamd_action_to_str (action), task->pre_result.str); + + /* Don't classify or filter message if pre-filter sets results */ + task->processed_stages |= (RSPAMD_TASK_STAGE_FILTERS | + RSPAMD_TASK_STAGE_CLASSIFIERS | + RSPAMD_TASK_STAGE_CLASSIFIERS_PRE | + RSPAMD_TASK_STAGE_CLASSIFIERS_POST); } } return 0; |