]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] Preserve UNSCORED flag when config defines symbol without score
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 13 Feb 2026 17:18:39 +0000 (17:18 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 13 Feb 2026 17:18:39 +0000 (17:18 +0000)
commit3694f9f3f15d18a8abe7fa528ac344d3df5c3453
treeada7666e6396cfb7d1e1cb2bf31023a362f5e9bb
parent1730580611bcefc689febb2dd48b805caf3f9432
[Fix] Preserve UNSCORED flag when config defines symbol without score

When rspamd_config_add_symbol was called for an existing symbol without
a score (NAN), line 1811 unconditionally replaced all flags, clearing
RSPAMD_SYMBOL_FLAG_UNSCORED. This caused Lua-registered scores to be
ignored: if a symbol appeared in config (e.g. groups.conf) without a
score, the UNSCORED flag was lost, and the Lua score-setting block in
lua_config_register_symbol_from_table was skipped, leaving score at 0.

Now flags are updated correctly in both cases:
- Real score provided: flags fully replaced with UNSCORED cleared
- NAN score: flags updated but UNSCORED preserved from existing symbol

Also initialize score to NAN in lua_config_set_metric_symbol to avoid
passing uninitialized stack garbage to rspamd_config_add_symbol.
src/libserver/cfg_utils.cxx
src/lua/lua_config.c