]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not overwrite score when setting pre-action
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 30 Jun 2017 20:53:30 +0000 (21:53 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 30 Jun 2017 20:59:47 +0000 (21:59 +0100)
src/lua/lua_task.c

index 06b699a38049b01651e061f0b0f5d10485827c8e..b9d8ad56f3eab8837170bb86ff40d97242de3e11 100644 (file)
@@ -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;