aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 16:13:39 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 16:13:39 +0100
commitd3a00149e41f959408ac487f8428204693cdd79a (patch)
tree7e7bf0b6a9d3a3e5892c8c47332f4e5fd16207ed /src
parentd4f429d3e398f43361ba00d6d36f022e6e9ab01a (diff)
downloadrspamd-d3a00149e41f959408ac487f8428204693cdd79a.tar.gz
rspamd-d3a00149e41f959408ac487f8428204693cdd79a.zip
Fix unknown symbols registration.
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_rcl.c4
-rw-r--r--src/libserver/symbols_cache.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index fcfbb716b..596fff74a 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -426,6 +426,10 @@ rspamd_rcl_metric_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
return FALSE;
}
+ if (metric->unknown_weight > 0) {
+ metric->accept_unknown_symbols = TRUE;
+ }
+
/* Handle actions */
val = ucl_object_find_key (obj, "actions");
if (val != NULL) {
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index 5e72eb97c..927e84cd5 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -749,8 +749,9 @@ rspamd_symbols_cache_validate_cb (gpointer k, gpointer v, gpointer ud)
/* Check whether this item is skipped */
skipped = !ghost;
- if ((item->type & SYMBOL_TYPE_NORMAL) && cache->cfg &&
- g_hash_table_lookup (cache->cfg->metrics_symbols, item->symbol) == NULL) {
+ if ((item->type & (SYMBOL_TYPE_NORMAL|SYMBOL_TYPE_VIRTUAL|SYMBOL_TYPE_COMPOSITE))
+ && cache->cfg
+ && g_hash_table_lookup (cache->cfg->metrics_symbols, item->symbol) == NULL) {
cur = g_list_first (cache->cfg->metrics_list);
while (cur) {
m = cur->data;
@@ -759,7 +760,7 @@ rspamd_symbols_cache_validate_cb (gpointer k, gpointer v, gpointer ud)
GList *mlist;
skipped = FALSE;
- item->weight = item->weight * (m->unknown_weight);
+ item->weight = m->unknown_weight;
s = rspamd_mempool_alloc0 (cache->static_pool,
sizeof (*s));
s->name = item->symbol;