aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-28 10:21:21 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-28 10:21:21 +0000
commit186683c8e84b52a8c6657cdb21585af8f1f92323 (patch)
tree7946124971bc2ffa66a0c42599db036c4f442497
parent3a1e6a2f3c41a165d87a92ff397c0f6e062fa3f7 (diff)
downloadrspamd-186683c8e84b52a8c6657cdb21585af8f1f92323.tar.gz
rspamd-186683c8e84b52a8c6657cdb21585af8f1f92323.zip
[Minor] Another hack for classifiers
-rw-r--r--src/libserver/symbols_cache.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index bbaffa400..237fa38b8 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -916,10 +916,12 @@ rspamd_symbols_cache_add_symbol (struct symbols_cache *cache,
g_ptr_array_add (cache->composites, item);
}
else if (item->type & SYMBOL_TYPE_CLASSIFIER) {
- /* Treat it as virtual */
- item->id = cache->virtual->len;
+ /* Treat it as normal symbol to allow enable/disable */
+ item->id = cache->filters->len;
+ g_ptr_array_add (cache->filters, item);
+ item->specific.normal.func = NULL;
+ item->specific.normal.user_data = NULL;
item->specific.normal.condition_cb = -1;
- g_ptr_array_add (cache->virtual, item);
}
else {
/* Require parent */
@@ -1334,8 +1336,12 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task,
lua_State *L;
gboolean check = TRUE;
- g_assert (!item->is_virtual);
+ if (item->type & SYMBOL_TYPE_CLASSIFIER) {
+ /* Classifiers are special :( */
+ return TRUE;
+ }
+ g_assert (!item->is_virtual);
g_assert (item->specific.normal.func != NULL);
if (CHECK_START_BIT (checkpoint, item)) {
/*