}
-- Weak: BOUNCE can fire on sender pattern alone; subject match is an independent path
-rspamd_config:register_dependency('BOUNCE', 'SUBJ_BOUNCE_WORDS', true)
+rspamd_config:register_dependency('BOUNCE', 'SUBJ_BOUNCE_WORDS')
}
-- Weak: only one sub-check (REPLYTO_EMAIL_HAS_TITLE) needs FROM_NAME_HAS_TITLE
-rspamd_config:register_dependency('CHECK_REPLYTO', 'CHECK_FROM', true)
+rspamd_config:register_dependency('CHECK_REPLYTO', 'CHECK_FROM')
local check_mime_id = rspamd_config:register_symbol {
name = 'CHECK_MIME',
* @param cache
* @param from
* @param to
- * @param weak if TRUE, disabling the dependency does not cascade-disable the dependent
+ * @param hard if TRUE, disabling the dependency cascade-disables the dependent
*/
void rspamd_symcache_add_delayed_dependency(struct rspamd_symcache *cache,
const char *from, const char *to,
- gboolean weak);
+ gboolean hard);
/**
* Get abstract callback data for a symbol (or its parent symbol)
void rspamd_symcache_add_delayed_dependency(struct rspamd_symcache *cache,
const char *from, const char *to,
- gboolean weak)
+ gboolean hard)
{
auto *real_cache = C_API_SYMCACHE(cache);
- real_cache->add_delayed_dependency(from, to, weak);
+ real_cache->add_delayed_dependency(from, to, hard);
}
const char *
if (!disabled_ids.contains(real_source->id)) {
msg_debug_cache("delayed %sbetween %s(%d:%d) -> %s",
- delayed_dep.weak ? "weak " : "",
+ delayed_dep.hard ? "weak " : "",
delayed_dep.from.data(),
real_source->id, virt_source->id,
delayed_dep.to.data());
add_dependency(real_source->id, delayed_dep.to, real_destination->id,
virt_source != real_source ? virt_source->id : -1,
- delayed_dep.weak);
+ delayed_dep.hard);
}
else {
msg_debug_cache("no delayed between %s(%d:%d) -> %s; %s is disabled",
return it->second;
}
-auto symcache::add_dependency(int id_from, std::string_view to, int id_to, int virtual_id_from, bool weak) -> void
+auto symcache::add_dependency(int id_from, std::string_view to, int id_to, int virtual_id_from, bool hard) -> void
{
g_assert(id_from >= 0 && id_from < (int) items_by_id.size());
g_assert(id_to >= 0 && id_to < (int) items_by_id.size());
if (!source->deps.contains(id_to)) {
msg_debug_cache("add %sdependency %s(%d) -> %s(%d)",
- weak ? "weak " : "",
+ hard ? "hard " : "",
source->symbol.c_str(), source->id, to.data(), dest->id);
source->deps.emplace(id_to, cache_dependency{dest.get(),
std::string(to),
- -1, weak});
+ -1, hard});
}
else {
msg_debug_cache("duplicate dependency %s -> %s",
if (!vsource->deps.contains(id_to)) {
msg_debug_cache("add virtual %sdependency %s -> %s",
- weak ? "weak " : "",
+ hard ? "hard " : "",
vsource->symbol.c_str(), to.data());
vsource->deps.emplace(id_to, cache_dependency{dest.get(),
std::string(to),
- virtual_id_from, weak});
+ virtual_id_from, hard});
}
else {
msg_debug_cache("duplicate virtual dependency %s -> %s",
struct delayed_cache_dependency {
std::string from;
std::string to;
- bool weak;
+ bool hard;
- delayed_cache_dependency(std::string_view _from, std::string_view _to, bool _weak = false)
- : from(_from), to(_to), weak(_weak)
+ delayed_cache_dependency(std::string_view _from, std::string_view _to, bool _hard = false)
+ : from(_from), to(_to), hard(_hard)
{
}
};
* @param virtual_id_from
* @return
*/
- auto add_dependency(int id_from, std::string_view to, int id_to, int virtual_id_from, bool weak = false) -> void;
+ auto add_dependency(int id_from, std::string_view to, int id_to, int virtual_id_from, bool hard = false) -> void;
/**
* Add a delayed dependency between symbols that will be resolved on the init stage
* @param from
* @param to
*/
- auto add_delayed_dependency(std::string_view from, std::string_view to, bool weak = false) -> void
+ auto add_delayed_dependency(std::string_view from, std::string_view to, bool hard = false) -> void
{
if (!delayed_deps) {
delayed_deps = std::make_unique<std::vector<delayed_cache_dependency>>();
}
- delayed_deps->emplace_back(from, to, weak);
+ delayed_deps->emplace_back(from, to, hard);
}
/**
cache_item *item; /* Real dependency */
std::string sym; /* Symbolic dep name */
int virtual_source_id; /* Virtual source */
- bool weak; /* Weak dep: don't cascade-disable when dep is disabled */
+ bool hard; /* Hard dep: cascade-disable dependent when dep is disabled by settings */
public:
/* Default piecewise constructor */
- explicit cache_dependency(cache_item *_item, std::string _sym, int _vid, bool _weak = false)
- : item(_item), sym(std::move(_sym)), virtual_source_id(_vid), weak(_weak)
+ explicit cache_dependency(cache_item *_item, std::string _sym, int _vid, bool _hard = false)
+ : item(_item), sym(std::move(_sym)), virtual_source_id(_vid), hard(_hard)
{
}
};
if (dep_dyn_item->status == cache_item_status::disabled) {
/* Dependency was disabled by settings */
- if (!dep.weak) {
+ if (dep.hard) {
/* Hard dependency disabled: cascade-disable this item */
dyn_item->status = cache_item_status::disabled;
msg_debug_cache_task_lambda("cascade disable %d(%s) because hard dependency "
dest_id, dep.sym.c_str());
return true; /* Item is "done" (disabled) */
}
- /* Weak dependency disabled: proceed without it */
- msg_debug_cache_task_lambda("weak dependency %d(%s) for symbol %d(%s) is "
- "disabled, proceeding",
+ /* Normal (weak) dependency disabled: proceed without it (backward compat) */
+ msg_debug_cache_task_lambda("dependency %d(%s) for symbol %d(%s) is "
+ "disabled, proceeding (not a hard dep)",
dest_id, dep.sym.c_str(), item->id, item->symbol.c_str());
continue;
}
}
else if (dep_dyn_item->status == cache_item_status::disabled) {
/* Dep was cascade-disabled during recursive check */
- if (!dep.weak) {
+ if (dep.hard) {
dyn_item->status = cache_item_status::disabled;
msg_debug_cache_task_lambda("cascade disable %d(%s) because hard dependency "
"%d(%s) was cascade-disabled",
else {
child = luaL_checkstring(L, 2);
parent = luaL_checkstring(L, 3);
- gboolean weak = FALSE;
+ /* Optional 4th arg: true = hard dep (cascade-disable when dep disabled) */
+ gboolean hard = FALSE;
if (lua_isboolean(L, 4)) {
- weak = lua_toboolean(L, 4);
+ hard = lua_toboolean(L, 4);
}
if (child != NULL && parent != NULL) {
rspamd_symcache_add_delayed_dependency(cfg->cache, child,
- parent, weak);
+ parent, hard);
}
}
})
-- Weak deps: ARC verification works without SPF/DKIM, just less info in AAR header
-rspamd_config:register_dependency('ARC_CHECK', 'SPF_CHECK', true)
-rspamd_config:register_dependency('ARC_CHECK', 'DKIM_CHECK', true)
+rspamd_config:register_dependency('ARC_CHECK', 'SPF_CHECK')
+rspamd_config:register_dependency('ARC_CHECK', 'DKIM_CHECK')
local function arc_sign_seal(task, params, header)
local arc_seals = task:cache_get('arc-seals')
rspamd_config:register_symbol(sym_reg_tbl)
-- Add weak dependency on DKIM checks (signing works without it, just loses R_DKIM_REJECT suppression)
-rspamd_config:register_dependency(settings['symbol'], 'DKIM_CHECK', true)
+rspamd_config:register_dependency(settings['symbol'], 'DKIM_CHECK')
})
-- Weak deps: DMARC falls back to DKIM-only or SPF-only alignment if the other is absent
-rspamd_config:register_dependency('DMARC_CHECK', settings.symbols['spf_allow_symbol'], true)
-rspamd_config:register_dependency('DMARC_CHECK', settings.symbols['dkim_allow_symbol'], true)
+rspamd_config:register_dependency('DMARC_CHECK', settings.symbols['spf_allow_symbol'])
+rspamd_config:register_dependency('DMARC_CHECK', settings.symbols['dkim_allow_symbol'])
-- DMARC munging support
if settings.munging then
rspamd_config:register_dependency('DMARC_MUNGED', 'DMARC_CHECK')
-- Weak: signing works without munging, just ensures proper header rewrite order
- rspamd_config:register_dependency('DKIM_SIGNED', 'DMARC_MUNGED', true)
- rspamd_config:register_dependency('ARC_SIGNED', 'DMARC_MUNGED', true)
+ rspamd_config:register_dependency('DKIM_SIGNED', 'DMARC_MUNGED')
+ rspamd_config:register_dependency('ARC_SIGNED', 'DMARC_MUNGED')
rspamd_logger.infox(rspamd_config, 'enabled DMARC munging')
end
settings['symbol_missing_mid']))
-- Weak: reads R_DKIM_ALLOW options but works without them
- rspamd_config:register_dependency('KNOWN_MID_CALLBACK', 'DKIM_CHECK', true)
+ rspamd_config:register_dependency('KNOWN_MID_CALLBACK', 'DKIM_CHECK')
else
rspamd_logger.infox(rspamd_config, 'source is not a valid map definition, disabling module')
lua_util.disable_module(N, "config")
if rbl.dkim then
-- Weak: RBL has other query sources; DKIM-domain queries just won't happen
- rspamd_config:register_dependency(check_sym, 'DKIM_CHECK', true)
+ rspamd_config:register_dependency(check_sym, 'DKIM_CHECK')
end
if rbl.require_symbols then
return true, 'hard_dep'
end
})
-rspamd_config:register_dependency('MERGE_HARD_DEP', 'MERGE_TEST_BASIC')
+rspamd_config:register_dependency('MERGE_HARD_DEP', 'MERGE_TEST_BASIC', true)
--- Symbol with a WEAK dependency on MERGE_TEST_BASIC
+-- Symbol with a WEAK (default) dependency on MERGE_TEST_BASIC
rspamd_config:register_symbol({
name = 'MERGE_WEAK_DEP',
score = 1.0,
return true, 'weak_dep'
end
})
-rspamd_config:register_dependency('MERGE_WEAK_DEP', 'MERGE_TEST_BASIC', true)
+rspamd_config:register_dependency('MERGE_WEAK_DEP', 'MERGE_TEST_BASIC')
-- Symbol in a separate group for group enable/disable tests
rspamd_config:register_symbol({