commit 394d0dc: [Minor] Do not blame about missing score

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Sep 12 11:28:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-12 12:25:43 +0100
URL: https://github.com/rspamd/rspamd/commit/394d0dc1b6551862d382f156675d0dd1edf179d5 (HEAD -> master)

[Minor] Do not blame about missing score

---
 src/libserver/cfg_utils.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index bd8595514..59783dd55 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -1562,16 +1562,21 @@ rspamd_config_new_symbol (struct rspamd_config *cfg, const gchar *symbol,
 	score_ptr = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (gdouble));
 
 	if (isnan (score)) {
-		msg_warn_config ("score is not defined for symbol %s, set it to zero",
+		/* In fact, it could be defined later */
+		msg_debug_config ("score is not defined for symbol %s, set it to zero",
 				symbol);
 		score = 0.0;
+		/* Also set priority to 0 to allow override by anything */
+		sym_def->priority = 0;
+	}
+	else {
+		sym_def->priority = priority;
 	}
 
 	*score_ptr = score;
 	sym_def->score = score;
 	sym_def->weight_ptr = score_ptr;
 	sym_def->name = rspamd_mempool_strdup (cfg->cfg_pool, symbol);
-	sym_def->priority = priority;
 	sym_def->flags = flags;
 	sym_def->nshots = nshots;
 	sym_def->groups = g_ptr_array_sized_new (1);


More information about the Commits mailing list