aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-16 17:27:09 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-16 17:27:09 +0000
commitb53a152e069882acca3127ac591fbe2f15c7911f (patch)
tree18c09767bbc8b1629308f835bc4f729f877275d4 /src/libserver
parentd8c5f3adff9b2b347172ae04577a826d186821ed (diff)
downloadrspamd-b53a152e069882acca3127ac591fbe2f15c7911f.tar.gz
rspamd-b53a152e069882acca3127ac591fbe2f15c7911f.zip
[Minor] Try to deal with squeezed symbols with a special care
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/symbols_cache.c10
-rw-r--r--src/libserver/symbols_cache.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index 5db23bd66..8d63b578b 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -626,7 +626,8 @@ rspamd_symbols_cache_load_items (struct symbols_cache *cache, const gchar *name)
}
}
- if ((item->type & SYMBOL_TYPE_VIRTUAL) && item->parent != -1) {
+ if ((item->type & SYMBOL_TYPE_VIRTUAL) &&
+ !(item->type & SYMBOL_TYPE_SQUEEZED) && item->parent != -1) {
g_assert (item->parent < (gint)cache->items_by_id->len);
parent = g_ptr_array_index (cache->items_by_id, item->parent);
@@ -1077,7 +1078,8 @@ rspamd_symbols_cache_validate_cb (gpointer k, gpointer v, gpointer ud)
item->priority ++;
}
- if ((item->type & SYMBOL_TYPE_VIRTUAL) && item->parent != -1) {
+ if ((item->type & SYMBOL_TYPE_VIRTUAL) &&
+ !(item->type & SYMBOL_TYPE_SQUEEZED) && item->parent != -1) {
g_assert (item->parent < (gint)cache->items_by_id->len);
parent = g_ptr_array_index (cache->items_by_id, item->parent);
@@ -1269,6 +1271,7 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task,
setbit (checkpoint->processed_bits, item->id * 2);
if (!item->enabled ||
+ (item->type & SYMBOL_TYPE_SQUEEZED) ||
(RSPAMD_TASK_IS_EMPTY (task) && !(item->type & SYMBOL_TYPE_EMPTY))) {
check = FALSE;
}
@@ -1942,7 +1945,8 @@ rspamd_symbols_cache_counters_cb (gpointer v, gpointer ud)
ucl_object_insert_key (obj, ucl_object_fromstring (item->symbol),
"symbol", 0, false);
- if ((item->type & SYMBOL_TYPE_VIRTUAL) && item->parent != -1) {
+ if ((item->type & SYMBOL_TYPE_VIRTUAL) &&
+ !(item->type & SYMBOL_TYPE_SQUEEZED) && item->parent != -1) {
g_assert (item->parent < (gint)cbd->cache->items_by_id->len);
parent = g_ptr_array_index (cbd->cache->items_by_id,
item->parent);
diff --git a/src/libserver/symbols_cache.h b/src/libserver/symbols_cache.h
index d959f905e..4e1c10dc5 100644
--- a/src/libserver/symbols_cache.h
+++ b/src/libserver/symbols_cache.h
@@ -42,6 +42,7 @@ enum rspamd_symbol_type {
SYMBOL_TYPE_POSTFILTER = (1 << 10),
SYMBOL_TYPE_NOSTAT = (1 << 11), /* Skip as statistical symbol */
SYMBOL_TYPE_IDEMPOTENT = (1 << 12), /* Symbol cannot change metric */
+ SYMBOL_TYPE_SQUEEZED = (1 << 13), /* Symbol is squeezed inside Lua */
};
/**