gboolean strict_protocol_headers; /**< strictly check protocol headers */
gboolean check_all_filters; /**< check all filters */
gboolean allow_raw_input; /**< scan messages with invalid mime */
+ gboolean disable_hyperscan; /**< disable hyperscan usage */
gsize max_diff; /**< maximum diff size for text parts */
rspamd_rcl_parse_struct_integer,
G_STRUCT_OFFSET (struct rspamd_config, history_rows),
RSPAMD_CL_FLAG_UINT);
+ rspamd_rcl_add_default_handler (sub,
+ "disable_hyperscan",
+ rspamd_rcl_parse_struct_boolean,
+ G_STRUCT_OFFSET (struct rspamd_config, disable_hyperscan),
+ 0);
/* New DNS configuration */
ssub = rspamd_rcl_add_section (&sub->subsections, "dns", NULL, NULL,
#include "ref.h"
#include "libserver/url.h"
#include "libserver/task.h"
+#include "libserver/cfg_file.h"
#include "libutil/util.h"
#ifdef WITH_HYPERSCAN
#include "hs.h"
guint max_re_data;
gchar hash[rspamd_cryptobox_HASHBYTES + 1];
#ifdef WITH_HYPERSCAN
+ gboolean disable_hyperscan;
hs_platform_info_t plt;
#endif
};
}
void
-rspamd_re_cache_init (struct rspamd_re_cache *cache)
+rspamd_re_cache_init (struct rspamd_re_cache *cache, struct rspamd_config *cfg)
{
guint i, fl;
GHashTableIter it;
const gchar *platform = "generic";
rspamd_fstring_t *features = rspamd_fstring_new ();
+ cache->disable_hyperscan = cfg->disable_hyperscan;
+
g_assert (hs_populate_platform (&cache->plt) == HS_SUCCESS);
/* Now decode what we do have */
#else
struct rspamd_re_hyperscan_cbdata cbdata;
- if (elt->match_type == RSPAMD_RE_CACHE_PCRE) {
+ if (rt->cache->disable_hyperscan || elt->match_type == RSPAMD_RE_CACHE_PCRE) {
ret = rspamd_re_cache_process_pcre (rt, re, in, len, is_raw);
setbit (rt->checked, re_id);
rt->results[re_id] = ret;
break;
}
- rspamd_re_cache_finish_class (rt, re_class);
+ if (!rt->cache->disable_hyperscan) {
+ rspamd_re_cache_finish_class (rt, re_class);
+ }
return ret;
}
struct rspamd_re_cache;
struct rspamd_re_runtime;
struct rspamd_task;
+struct rspamd_config;
enum rspamd_re_type {
RSPAMD_RE_HEADER,
/**
* Initialize and optimize re cache structure
*/
-void rspamd_re_cache_init (struct rspamd_re_cache *cache);
+void rspamd_re_cache_init (struct rspamd_re_cache *cache,
+ struct rspamd_config *cfg);
/**
* Get runtime data for a cache