From: Vsevolod Stakhov Date: Thu, 5 Feb 2026 08:58:53 +0000 (+0000) Subject: [Fix] re_cache: Respect disable_hyperscan option in loading functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b485097dec75580eabc958497427dc09183f5ee;p=thirdparty%2Frspamd.git [Fix] re_cache: Respect disable_hyperscan option in loading functions Add checks for disable_hyperscan at the start of hyperscan loading functions to prevent database loading when the option is set. Previously, hyperscan databases would still be loaded even with disable_hyperscan = true, causing unnecessary I/O and memory usage. --- diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index da76182936..fc3e1e956a 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -3187,6 +3187,10 @@ rspamd_re_cache_load_hyperscan(struct rspamd_re_cache *cache, unsigned int total_classes, total_loaded = 0, total_regexps = 0; GString *missing_classes = NULL; + if (cache->disable_hyperscan) { + return RSPAMD_HYPERSCAN_UNSUPPORTED; + } + total_classes = g_hash_table_size(cache->re_classes); g_hash_table_iter_init(&it, cache->re_classes); @@ -3662,6 +3666,11 @@ void rspamd_re_cache_load_hyperscan_scoped_async(struct rspamd_re_cache *cache_h return; } + /* Check if hyperscan is disabled */ + if (cache_head->disable_hyperscan) { + return; + } + /* All file operations go through Lua backend */ g_assert(rspamd_hs_cache_has_lua_backend());