diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-19 13:17:40 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-19 13:25:58 +0000 |
commit | c4a0536e2b3622cb953e8b6ad2be53c723512bae (patch) | |
tree | 0b2ee8f84e3b3884fb0e2edddf39e91c0619d877 /src/libserver | |
parent | 9b8324626a4b23abc350e4b518e74dbcee85a428 (diff) | |
download | rspamd-c4a0536e2b3622cb953e8b6ad2be53c723512bae.tar.gz rspamd-c4a0536e2b3622cb953e8b6ad2be53c723512bae.zip |
[Minor] Allow to reset score of an action
Issue: 2088
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/cfg_rcl.c | 24 |
1 files 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 <glob.h> #endif +#include <math.h> + 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, |