From c4a0536e2b3622cb953e8b6ad2be53c723512bae Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 19 Mar 2018 13:17:40 +0000 Subject: [PATCH] [Minor] Allow to reset score of an action Issue: 2088 --- src/libserver/cfg_rcl.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index a01f42ea6..08c7c7868 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -38,6 +38,8 @@ #include #endif +#include + struct rspamd_rcl_default_handler_data { struct rspamd_rcl_struct_parser pd; gchar *key; @@ -450,16 +452,22 @@ rspamd_rcl_actions_handler (rspamd_mempool_t *pool, const ucl_object_t *obj, continue; } else { - if (!ucl_object_todouble_safe (cur, &action_score)) { - g_set_error (err, - CFG_RCL_ERROR, - EINVAL, - "invalid action definition: '%s'", - ucl_object_key (cur)); - ucl_object_iterate_free (it); + if (ucl_object_type (cur) == UCL_NULL) { + action_score = NAN; + } + else { + if (!ucl_object_todouble_safe (cur, &action_score)) { + g_set_error (err, + CFG_RCL_ERROR, + EINVAL, + "invalid action definition: '%s'", + ucl_object_key (cur)); + ucl_object_iterate_free (it); - return FALSE; + return FALSE; + } } + rspamd_config_set_action_score (cfg, ucl_object_key (cur), action_score, -- 2.39.5