]> source.dussan.org Git - rspamd.git/commitdiff
Fix settings for actions other than reject
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 25 Aug 2015 17:14:36 +0000 (18:14 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 25 Aug 2015 17:14:36 +0000 (18:14 +0100)
src/libmime/filter.c
src/libserver/cfg_utils.c
src/libserver/protocol.c

index 4d8e15e482f6ca7256d844de6a8d81d4caaabe80..c24f42f3507d194545a9b7a450269cab8ad336ec 100644 (file)
@@ -372,13 +372,17 @@ get_specific_action_score (const ucl_object_t *metric,
                struct metric_action *action)
 {
        const ucl_object_t *act, *sact;
+       const gchar *act_name;
        double score;
 
        if (metric) {
                act = ucl_object_find_key (metric, "actions");
                if (act) {
-                       sact = ucl_object_find_key (act, rspamd_action_to_str (action->action));
+                       act_name = rspamd_action_to_str (action->action);
+                       sact = ucl_object_find_key (act, act_name);
                        if (sact != NULL && ucl_object_todouble_safe (sact, &score)) {
+                               msg_debug ("found override score %.2f for action %s in settings",
+                                               score, act_name);
                                return score;
                        }
                }
index ecdd28a91a9560275549170338a7bc39f4712f15..7246ab4a1dead8540b68d9defcafff48e2053b82 100644 (file)
@@ -552,6 +552,7 @@ rspamd_config_new_metric (struct rspamd_config *cfg, struct metric *c,
 
                for (i = METRIC_ACTION_REJECT; i < METRIC_ACTION_MAX; i++) {
                        c->actions[i].score = -1.0;
+                       c->actions[i].action = i;
                }
 
                c->subject = SPAM_SUBJECT;
index 162f75f401b0d816b48713f33def9659bd61d73c..3ee2def4de83b3c087a86556a08b5135cde8a4ea 100644 (file)
@@ -866,15 +866,9 @@ rspamd_metric_result_ucl (struct rspamd_task *task,
        gchar action_char;
 
        m = mres->metric;
+       mres->action = rspamd_check_action_metric (task, mres->score,
+                                       &required_score, m);
 
-       /* XXX: handle settings */
-       if (mres->action == METRIC_ACTION_MAX) {
-               mres->action = rspamd_check_action_metric (task, mres->score,
-                               &required_score, m);
-       }
-       else {
-               required_score = mres->metric->actions[mres->action].score;
-       }
        action = mres->action;
        is_spam = (action == METRIC_ACTION_REJECT);