const guint *ids;
guint nids = 0;
+ msg_debug_cache ("check id propagation for dependency %s from %s",
+ it->symbol, dit->symbol);
ids = rspamd_symcache_get_allowed_settings_ids (cache, dit->symbol, &nids);
/* TODO: merge? */
struct cache_dependency *rdep;
if (dep->id >= 0) {
+ msg_debug_cache ("process real dependency %s on %s", it->symbol, dep->sym);
dit = rspamd_symcache_find_filter (cache, dep->sym, true);
}
if (dep->vid >= 0) {
/* Case of the virtual symbol that depends on another (maybe virtual) symbol */
vdit = rspamd_symcache_find_filter (cache, dep->sym, false);
+ msg_debug_cache ("process virtual dependency %s(%d) on %s(%d)", it->symbol,
+ dep->vid, vdit->symbol, vdit->id);
}
else {
vdit = dit;
else {
msg_debug_cache ("delayed between %s(%d:%d) -> %s", ddep->from,
it->id, vit->id, ddep->to);
- rspamd_symcache_add_dependency (cache, it->id, ddep->to, vit->id);
+ rspamd_symcache_add_dependency (cache, it->id, ddep->to, vit != it ?
+ vit->id : -1);
}
cur = g_list_next (cur);
}
}
+ /* Special case for virtual symbols */
+ PTR_ARRAY_FOREACH (cache->virtual, i, it) {
+
+ PTR_ARRAY_FOREACH (it->deps, j, dep) {
+ rspamd_symcache_process_dep (cache, it, dep);
+ }
+ }
+
g_ptr_array_sort_with_data (cache->prefilters_empty, prefilters_cmp, cache);
g_ptr_array_sort_with_data (cache->prefilters, prefilters_cmp, cache);
g_ptr_array_sort_with_data (cache->postfilters, postfilters_cmp, cache);
g_assert (id_from >= 0 && id_from < (gint)cache->items_by_id->len);
- source = g_ptr_array_index (cache->items_by_id, id_from);
+ source = (struct rspamd_symcache_item *)g_ptr_array_index (cache->items_by_id, id_from);
dep = rspamd_mempool_alloc (cache->static_pool, sizeof (*dep));
dep->id = id_from;
dep->sym = rspamd_mempool_strdup (cache->static_pool, to);
dep->vid = -1;
g_ptr_array_add (source->deps, dep);
- if (id_from != virtual_id_from) {
+ if (virtual_id_from >= 0) {
+ g_assert (virtual_id_from < (gint)cache->virtual->len);
/* We need that for settings id propagation */
- vsource = g_ptr_array_index (cache->items_by_id, virtual_id_from);
+ vsource = (struct rspamd_symcache_item *)
+ g_ptr_array_index (cache->virtual, virtual_id_from);
dep = rspamd_mempool_alloc (cache->static_pool, sizeof (*dep));
- dep->vid = id_from;
+ dep->vid = virtual_id_from;
dep->id = -1;
dep->sym = rspamd_mempool_strdup (cache->static_pool, to);
/* Will be filled later */
ids = rspamd_process_id_list (allowed_ids, &nids);
if (nids > 0) {
+ GString *dbg = g_string_new ("");
+
+ for (guint i = 0; i < nids; i ++) {
+ rspamd_printf_gstring (dbg, "%ud,", ids[i]);
+ }
+
+ dbg->len --;
+
+ msg_debug_config ("allowed ids for %s are: %v", name, dbg);
+ g_string_free (dbg, TRUE);
+
rspamd_symcache_set_allowed_settings_ids (cfg->cache, name,
ids, nids);
ids = rspamd_process_id_list (forbidden_ids, &nids);
if (nids > 0) {
+ GString *dbg = g_string_new ("");
+
+ for (guint i = 0; i < nids; i ++) {
+ rspamd_printf_gstring (dbg, "%ud,", ids[i]);
+ }
+
+ dbg->len --;
+
+ msg_debug_config ("forbidden ids for %s are: %v", name, dbg);
+ g_string_free (dbg, TRUE);
+
rspamd_symcache_set_forbidden_settings_ids (cfg->cache, name,
ids, nids);
if (child_id > 0 && parent != NULL) {
rspamd_symcache_add_dependency (cfg->cache, child_id, parent,
- child_id);
+ -1);
}
}
else {
1,
1);
rspamd_symcache_add_dependency (cfg->cache, cb_id,
- SURBL_REDIRECTOR_CALLBACK, cb_id);
+ SURBL_REDIRECTOR_CALLBACK, -1);
/* Failure symbol */
g_string_append (sym, "_FAIL");
rspamd_symcache_add_symbol (cfg->cache, sym->str,
if (cur_suffix->options & SURBL_OPTION_CHECKDKIM) {
rspamd_symcache_add_dependency (cfg->cache,
- cur_suffix->callback_id, "DKIM_TRACE", cur_suffix->callback_id);
+ cur_suffix->callback_id, "DKIM_TRACE", -1);
}
cur_opt = g_list_next (cur_opt);