]> source.dussan.org Git - rspamd.git/commitdiff
Fix unknown symbols registration.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Oct 2015 15:13:39 +0000 (16:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Oct 2015 15:13:39 +0000 (16:13 +0100)
src/libserver/cfg_rcl.c
src/libserver/symbols_cache.c

index fcfbb716b3b232ced9be5f1608fcb0c2a1d5ebd8..596fff74a7be58ac994d4964c99adcc911c0a131 100644 (file)
@@ -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) {
index 5e72eb97c37ff01e932dda46578e0709ae39404b..927e84cd55a619d31d4441c687484bba3c4af5c6 100644 (file)
@@ -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;