diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-12 12:27:40 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-12 12:28:19 +0000 |
commit | a95dc640f911d913224fa7564c1d470325c11f9a (patch) | |
tree | 5752ad4c74969f33a14e26ba61bd7e230491257a /src/libserver/cfg_utils.c | |
parent | 12d5f4a6ec4798d5e91cc81ef2db605d8a0ab855 (diff) | |
download | rspamd-a95dc640f911d913224fa7564c1d470325c11f9a.tar.gz rspamd-a95dc640f911d913224fa7564c1d470325c11f9a.zip |
[Fix] Fix lua symbols scores registration when config does not define scores
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r-- | src/libserver/cfg_utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 9a308a8a4..8486a029f 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -1625,6 +1625,7 @@ rspamd_config_new_symbol (struct rspamd_config *cfg, const gchar *symbol, score = 0.0; /* Also set priority to 0 to allow override by anything */ sym_def->priority = 0; + flags |= RSPAMD_SYMBOL_FLAG_UNSCORED; } else { sym_def->priority = priority; @@ -1725,7 +1726,8 @@ rspamd_config_add_symbol (struct rspamd_config *cfg, } } - if (sym_def->priority > priority) { + if (sym_def->priority > priority && + (isnan(score) || !(sym_def->flags & RSPAMD_SYMBOL_FLAG_UNSCORED))) { msg_debug_config ("symbol %s has been already registered with " "priority %ud, do not override (new priority: %ud)", symbol, @@ -1759,6 +1761,7 @@ rspamd_config_add_symbol (struct rspamd_config *cfg, *sym_def->weight_ptr = score; sym_def->score = score; sym_def->priority = priority; + sym_def->flags &= ~RSPAMD_SYMBOL_FLAG_UNSCORED; } sym_def->flags = flags; |