]> source.dussan.org Git - rspamd.git/commitdiff
Fix overrides for a metric.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 29 Jan 2014 14:08:14 +0000 (14:08 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 29 Jan 2014 14:08:14 +0000 (14:08 +0000)
Fixes #33

src/cfg_rcl.c

index 0301d475ff8de8192573e7dbecbf27d5862d8bbc..aedee7ea344bac4d2645f63120b1f95dca32a29e 100644 (file)
@@ -365,7 +365,7 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj,
                                }
                        }
                }
-               if (!have_actions) {
+               if (new && !have_actions) {
                        g_set_error (err, CFG_RCL_ERROR, EINVAL, "metric %s has no actions", metric_name);
                        return FALSE;
                }
@@ -405,7 +405,7 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj,
                                }
                        }
                }
-               else {
+               else if (new) {
                        g_set_error (err, CFG_RCL_ERROR, EINVAL, "metric %s has no symbols", metric_name);
                        return FALSE;
                }
@@ -422,8 +422,10 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj,
        }
 
        /* Insert the resulting metric */
-       g_hash_table_insert (cfg->metrics, (void *)metric->name, metric);
-       cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric);
+       if (new) {
+               g_hash_table_insert (cfg->metrics, (void *)metric->name, metric);
+               cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric);
+       }
 
        return TRUE;
 }