diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-05 13:13:59 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-05 13:13:59 +0000 |
commit | b9d38aa0978e89c981d9d12785b51c6b01b42a88 (patch) | |
tree | ca7eef87ef7685c80ea2d87d52f90c64a60c0fbe /src | |
parent | 5b8fcdbc7947633efbfce1f461da3379d8ff6de8 (diff) | |
download | rspamd-b9d38aa0978e89c981d9d12785b51c6b01b42a88.tar.gz rspamd-b9d38aa0978e89c981d9d12785b51c6b01b42a88.zip |
[Fix] Deal with unknown weight
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/cfg_file.h | 2 | ||||
-rw-r--r-- | src/libserver/symbols_cache.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index 412cd4bb0..f724a82c8 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -279,8 +279,6 @@ struct rspamd_config { #ifdef WITH_GPERF_TOOLS gchar *profile_path; #endif - - gboolean accept_unknown_symbols; /**< if true unknown symbols are registered here */ gdouble unknown_weight; /**< weight of unknown symbols */ gdouble grow_factor; /**< grow factor for metric */ GHashTable *symbols; /**< weights of symbols in metric */ diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 9b8fba25b..719f8aabd 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -1030,7 +1030,7 @@ rspamd_symbols_cache_validate_cb (gpointer k, gpointer v, gpointer ud) (SYMBOL_TYPE_NORMAL|SYMBOL_TYPE_VIRTUAL|SYMBOL_TYPE_COMPOSITE|SYMBOL_TYPE_CLASSIFIER)) && g_hash_table_lookup (cfg->symbols, item->symbol) == NULL) { - if (cfg->accept_unknown_symbols) { + if (cfg->unknown_weight != 0) { skipped = FALSE; item->st->weight = cfg->unknown_weight; @@ -1043,14 +1043,17 @@ rspamd_symbols_cache_validate_cb (gpointer k, gpointer v, gpointer ud) msg_info_cache ("adding unknown symbol %s", item->symbol); ghost = FALSE; } + else { + skipped = TRUE; + } } else { skipped = FALSE; } - if (skipped) { + if (!ghost && skipped) { item->type |= SYMBOL_TYPE_SKIPPED; - msg_warn_cache ("symbol %s is not registered in any metric, so skip its check", + msg_warn_cache ("symbol %s has no score registered, skip its check", item->symbol); } |