local exports = {}
local known_ids = {}
-local on_load_added = false
+local post_init_added = false
local function register_settings_cb()
for _,set in pairs(known_ids) do
}
end
- if not on_load_added then
- rspamd_config:add_on_load(register_settings_cb)
- on_load_added = true
+ if not post_init_added then
+ rspamd_config:add_post_init(register_settings_cb)
+ post_init_added = true
end
return numeric_id
if (!item->enabled ||
(RSPAMD_TASK_IS_EMPTY (task) && !(item->type & SYMBOL_TYPE_EMPTY)) ||
(item->type & SYMBOL_TYPE_MIME_ONLY && !RSPAMD_TASK_IS_MIME(task))) {
+
+ if (!item->enabled) {
+ msg_debug_cache_task ("skipping check of %s as it is permanently disabled",
+ item->symbol);
+ }
+ else {
+ msg_debug_cache_task ("skipping check of %s as it cannot be "
+ "executed for this task type",
+ item->symbol);
+ }
+
return FALSE;
}
}
if (!(item->type & SYMBOL_TYPE_EXPLICIT_DISABLE)) {
- if (item->allowed_ids.st[0] != 0 &&
+ if (item->allowed_ids.st[0] == 0 ||
!rspamd_symcache_check_id_list (&item->allowed_ids,
id)) {
msg_debug_cache_task ("deny execution of %s as it is not listed "
SET_START_BIT (checkpoint, dyn_item);
if (!rspamd_symcache_is_item_allowed (task, item)) {
- msg_debug_cache_task ("disable execution of symbol %s", item->symbol);
check = FALSE;
}
else if (item->specific.normal.condition_cb != -1) {
check = lua_toboolean (L, -1);
lua_pop (L, 1);
}
+
+ if (!check) {
+ msg_debug_cache_task ("skipping check of %s as its start condition is false",
+ item->symbol);
+ }
}
if (check) {
return FALSE;
}
else {
- msg_debug_cache_task ("skipping check of %s as its start condition is false",
- item->symbol);
SET_FINISH_BIT (checkpoint, dyn_item);
}
/* Static part */
while (ls->st[cnt] != 0) {
cnt ++;
-
- g_assert (cnt < G_N_ELEMENTS (ls->st));
}
-
if (cnt < G_N_ELEMENTS (ls->st)) {
ls->st[cnt] = id;
}
while (g_hash_table_iter_next (&it, &k, &v)) {
lua_pushstring (L, k);
- lua_rawseti (L, -1, i);
+ lua_rawseti (L, -2, i);
i ++;
}
}