struct rspamd_config *cfg;
const gchar *default_symbol;
guint32 min_hash_len;
- radix_tree_t *whitelist;
+ radix_compressed_t *whitelist;
guint32 min_bytes;
guint32 min_height;
guint32 min_width;
if ((value =
rspamd_config_get_module_opt (cfg, "fuzzy_check",
"whitelist")) != NULL) {
- fuzzy_module_ctx->whitelist = radix_tree_create ();
+ fuzzy_module_ctx->whitelist = radix_create_compressed ();
if (!add_map (cfg, ucl_obj_tostring (value),
"Fuzzy whitelist", read_radix_list, fin_radix_list,
(void **)&fuzzy_module_ctx->whitelist)) {
- msg_err ("cannot add whitelist '%s'", ucl_obj_tostring (value));
+ rspamd_config_parse_ip_list (ucl_obj_tostring (value),
+ &fuzzy_module_ctx->whitelist);
}
}
else {
GList *cur;
/* Check whitelist */
- if (fuzzy_module_ctx->whitelist && task->from_addr.af == AF_INET) {
- if (radix32tree_find (fuzzy_module_ctx->whitelist,
- ntohl (task->from_addr.addr.s4.sin_addr.s_addr)) !=
- RADIX_NO_VALUE) {
+ if (fuzzy_module_ctx->whitelist) {
+ if (radix_find_compressed_addr (fuzzy_module_ctx->whitelist,
+ &task->from_addr) != RADIX_NO_VALUE) {
msg_info ("<%s>, address %s is whitelisted, skip fuzzy check",
task->message_id,
rspamd_inet_address_to_string (&task->from_addr));
const gchar *symbol_allow;
rspamd_mempool_t *spf_pool;
- radix_tree_t *whitelist_ip;
+ radix_compressed_t *whitelist_ip;
rspamd_lru_hash_t *spf_hash;
};
gint res = TRUE;
guint cache_size, cache_expire;
- spf_module_ctx->whitelist_ip = radix_tree_create ();
+ spf_module_ctx->whitelist_ip = radix_create_compressed ();
if ((value =
rspamd_config_get_module_opt (cfg, "spf", "symbol_fail")) != NULL) {
if (!add_map (cfg, ucl_obj_tostring (value),
"SPF whitelist", read_radix_list, fin_radix_list,
(void **)&spf_module_ctx->whitelist_ip)) {
- msg_warn ("cannot load whitelist from %s", value);
+ rspamd_config_parse_ip_list (ucl_obj_tostring (value),
+ &spf_module_ctx->whitelist_ip);
}
}
spf_module_reconfig (struct rspamd_config *cfg)
{
rspamd_mempool_delete (spf_module_ctx->spf_pool);
- radix_tree_free (spf_module_ctx->whitelist_ip);
+ radix_destroy_compressed (spf_module_ctx->whitelist_ip);
memset (spf_module_ctx, 0, sizeof (*spf_module_ctx));
spf_module_ctx->spf_pool = rspamd_mempool_new (
rspamd_mempool_suggest_size ());
gchar *domain;
GList *l;
- if (task->from_addr.af != AF_UNIX) {
+ if (radix_find_compressed_addr (spf_module_ctx->whitelist_ip,
+ &task->from_addr) == RADIX_NO_VALUE) {
domain = get_spf_domain (task);
if (domain) {
if ((l =