aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-29 15:31:44 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-29 15:31:44 +0100
commit48c027506d6cf9496975f405f64f3c143a4c4290 (patch)
treea48c6fc20f755f612947e4db6e455b8a40f20cb3 /src/libserver
parent99caa38084aa41938b98918b9119a288a0aefcf5 (diff)
downloadrspamd-48c027506d6cf9496975f405f64f3c143a4c4290.tar.gz
rspamd-48c027506d6cf9496975f405f64f3c143a4c4290.zip
[Feature] Skip certain symbols from ANN classify
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/cfg_utils.c2
-rw-r--r--src/libserver/symbols_cache.c5
-rw-r--r--src/libserver/symbols_cache.h2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 7bc8994b4..7e410559f 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -1118,7 +1118,7 @@ symbols_classifiers_callback (gpointer key, gpointer value, gpointer ud)
/* Actually, statistics should act like any ordinary symbol */
rspamd_symbols_cache_add_symbol (cfg->cache, key, 0, NULL, NULL,
- SYMBOL_TYPE_CLASSIFIER, -1);
+ SYMBOL_TYPE_CLASSIFIER|SYMBOL_TYPE_NOSTAT, -1);
}
void
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index 46f1b3fc6..1c18c5559 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -730,6 +730,11 @@ rspamd_symbols_cache_add_symbol (struct symbols_cache *cache,
}
}
+ if (type & (SYMBOL_TYPE_CLASSIFIER|SYMBOL_TYPE_CALLBACK|
+ SYMBOL_TYPE_PREFILTER|SYMBOL_TYPE_POSTFILTER)) {
+ type |= SYMBOL_TYPE_NOSTAT;
+ }
+
item = rspamd_mempool_alloc0 (cache->static_pool,
sizeof (struct cache_item));
item->st = rspamd_mempool_alloc0_shared (cache->static_pool,
diff --git a/src/libserver/symbols_cache.h b/src/libserver/symbols_cache.h
index f717b39b9..ade8d95b9 100644
--- a/src/libserver/symbols_cache.h
+++ b/src/libserver/symbols_cache.h
@@ -40,7 +40,7 @@ enum rspamd_symbol_type {
SYMBOL_TYPE_EMPTY = (1 << 8), /* Allow execution on empty tasks */
SYMBOL_TYPE_PREFILTER = (1 << 9),
SYMBOL_TYPE_POSTFILTER = (1 << 10),
- SYMBOL_TYPE_NONSTAT = (1 << 11), /* Skip as statistical symbol */
+ SYMBOL_TYPE_NOSTAT = (1 << 11), /* Skip as statistical symbol */
};
/**