From: Vsevolod Stakhov Date: Fri, 30 Jun 2017 20:53:30 +0000 (+0100) Subject: [Fix] Do not overwrite score when setting pre-action X-Git-Tag: 1.6.2~43 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9d97d3289494e72db53d9d87e722d29ce3996e31;p=rspamd.git [Fix] Do not overwrite score when setting pre-action --- diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 06b699a38..b9d8ad56f 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1210,10 +1210,15 @@ lua_task_set_pre_result (lua_State * L) 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); - if (mres != NULL) { - mres->score = mres->metric->actions[action].score; - mres->action = action; + if (!task->result) { + mres = rspamd_create_metric_result (task); + if (mres != NULL) { + mres->score = mres->metric->actions[action].score; + mres->action = action; + } + } + else { + task->result->action = action; } task->pre_result.action = action;