if (dkim_module_ctx == NULL) {
dkim_module_ctx = g_malloc0 (sizeof (struct dkim_ctx));
- dkim_module_ctx->dkim_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "dkim");
dkim_module_ctx->sign_headers = default_sign_headers;
dkim_module_ctx->sign_condition_ref = -1;
dkim_module_ctx->max_sigs = DEFAULT_MAX_SIGS;
rspamd_config_radix_from_ucl (cfg, value, "DKIM whitelist",
&dkim_module_ctx->whitelist_ip, NULL);
- rspamd_mempool_add_destructor (dkim_module_ctx->dkim_pool,
- (rspamd_mempool_destruct_t)rspamd_map_helper_destroy_radix,
- dkim_module_ctx->whitelist_ip);
-
}
if ((value =
ucl_object_tostring (value));
}
else {
- rspamd_mempool_add_destructor (dkim_module_ctx->dkim_pool,
- (rspamd_mempool_destruct_t)rspamd_map_helper_destroy_hash,
- dkim_module_ctx->dkim_domains);
got_trusted = TRUE;
}
}
ucl_object_tostring (value));
}
else {
- rspamd_mempool_add_destructor (dkim_module_ctx->dkim_pool,
- (rspamd_mempool_destruct_t)rspamd_map_helper_destroy_hash,
- dkim_module_ctx->dkim_domains);
got_trusted = TRUE;
}
}
dkim_module_ctx->sign_condition_ref = luaL_ref (cfg->lua_state,
LUA_REGISTRYINDEX);
rspamd_lua_add_ref_dtor (cfg->lua_state,
- dkim_module_ctx->dkim_pool,
+ cfg->cfg_pool,
dkim_module_ctx->sign_condition_ref);
rspamd_symbols_cache_add_symbol (cfg->cache,
struct module_ctx saved_ctx;
saved_ctx = dkim_module_ctx->ctx;
- rspamd_mempool_delete (dkim_module_ctx->dkim_pool);
if (dkim_module_ctx->dkim_hash) {
rspamd_lru_hash_destroy (dkim_module_ctx->dkim_hash);
memset (dkim_module_ctx, 0, sizeof (*dkim_module_ctx));
dkim_module_ctx->ctx = saved_ctx;
- dkim_module_ctx->dkim_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "dkim");
dkim_module_ctx->sign_headers = default_sign_headers;
dkim_module_ctx->sign_condition_ref = -1;
dkim_module_ctx->max_sigs = DEFAULT_MAX_SIGS;
const gchar *symbol_na;
const gchar *symbol_permfail;
- rspamd_mempool_t *spf_pool;
struct rspamd_radix_map_helper *whitelist_ip;
rspamd_lru_hash_t *spf_hash;
spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
if (spf_module_ctx == NULL) {
- spf_module_ctx = g_malloc (sizeof (struct spf_ctx));
-
- spf_module_ctx->spf_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ spf_module_ctx = g_malloc0 (sizeof (struct spf_ctx));
}
*ctx = (struct module_ctx *)spf_module_ctx;
struct module_ctx saved_ctx;
saved_ctx = spf_module_ctx->ctx;
- rspamd_mempool_delete (spf_module_ctx->spf_pool);
rspamd_lru_hash_destroy (spf_module_ctx->spf_hash);
rspamd_map_helper_destroy_radix (spf_module_ctx->whitelist_ip);
memset (spf_module_ctx, 0, sizeof (*spf_module_ctx));
spf_module_ctx->ctx = saved_ctx;
- spf_module_ctx->spf_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
-
return spf_module_config (cfg);
}
guint max_redirected_urls;
gint redirector_cbid;
struct upstream_list *redirectors;
- rspamd_mempool_t *surbl_pool;
};
struct suffix_item {
surbl_module_ctx->use_redirector = 0;
surbl_module_ctx->suffixes = NULL;
- surbl_module_ctx->surbl_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- NULL);
surbl_module_ctx->redirectors = NULL;
surbl_module_ctx->whitelist = NULL;
continue;
}
- new_suffix = rspamd_mempool_alloc0 (surbl_module_ctx->surbl_pool,
+ new_suffix = rspamd_mempool_alloc0 (cfg->cfg_pool,
sizeof (struct suffix_item));
new_suffix->magic = rspamd_surbl_cb_magic;
new_suffix->suffix = rspamd_mempool_strdup (
- surbl_module_ctx->surbl_pool, ucl_obj_tostring (cur));
+ cfg->cfg_pool, ucl_obj_tostring (cur));
new_suffix->options = 0;
new_suffix->bits = g_array_new (FALSE, FALSE,
sizeof (struct surbl_bit_item));
- rspamd_mempool_add_destructor (surbl_module_ctx->surbl_pool,
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t )rspamd_array_free_hard,
new_suffix->bits);
if (cur == NULL) {
if (ucl_object_key (value)) {
new_suffix->symbol = rspamd_mempool_strdup (
- surbl_module_ctx->surbl_pool,
+ cfg->cfg_pool,
ucl_object_key (value));
}
else {
"surbl rule for suffix %s lacks symbol, using %s as symbol",
new_suffix->suffix, DEFAULT_SURBL_SYMBOL);
new_suffix->symbol = rspamd_mempool_strdup (
- surbl_module_ctx->surbl_pool, DEFAULT_SURBL_SYMBOL);
+ cfg->cfg_pool, DEFAULT_SURBL_SYMBOL);
}
}
else {
new_suffix->symbol = rspamd_mempool_strdup (
- surbl_module_ctx->surbl_pool, ucl_obj_tostring (cur));
+ cfg->cfg_pool, ucl_obj_tostring (cur));
}
cur = ucl_object_lookup (cur_rule, "options");
ucl_object_insert_key (ropts,
ucl_object_fromstring ("nxdomain"),
"rcode", 0, false);
- rspamd_mempool_add_destructor (surbl_module_ctx->surbl_pool,
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t )ucl_object_unref,
ropts);
gchar* p;
bit = ucl_obj_toint (cur_bit);
new_bit = rspamd_mempool_alloc (
- surbl_module_ctx->surbl_pool,
+ cfg->cfg_pool,
sizeof(struct surbl_bit_item));
new_bit->bit = bit;
new_bit->symbol = rspamd_mempool_strdup (
- surbl_module_ctx->surbl_pool,
+ cfg->cfg_pool,
ucl_object_key (cur_bit));
/* Convert to uppercase */
p = new_bit->symbol;
guint32 bit;
new_suffix->ips = g_hash_table_new (g_int_hash, g_int_equal);
- rspamd_mempool_add_destructor (surbl_module_ctx->surbl_pool,
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t )g_hash_table_unref,
new_suffix->ips);
gchar* p;
ip_val = ucl_obj_tostring (cur_bit);
new_bit = rspamd_mempool_alloc (
- surbl_module_ctx->surbl_pool,
+ cfg->cfg_pool,
sizeof(struct surbl_bit_item));
if (inet_pton (AF_INET, ip_val, &bit) != 1) {
msg_err_config ("cannot parse ip %s: %s", ip_val,
}
new_bit->bit = bit;
new_bit->symbol = rspamd_mempool_strdup (
- surbl_module_ctx->surbl_pool,
+ cfg->cfg_pool,
ucl_object_key (cur_bit));
/* Convert to uppercase */
p = new_bit->symbol;
if ((value =
rspamd_config_get_module_opt (cfg, "surbl", "redirector")) != NULL) {
surbl_module_ctx->redirectors = rspamd_upstreams_create (cfg->ups_ctx);
- rspamd_mempool_add_destructor (surbl_module_ctx->surbl_pool,
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t)rspamd_upstreams_destroy,
surbl_module_ctx->redirectors);
LL_FOREACH (value, cur)
}
if (surbl_module_ctx->suffixes != NULL) {
- rspamd_mempool_add_destructor (surbl_module_ctx->surbl_pool,
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t) g_list_free,
surbl_module_ctx->suffixes);
}
gint
surbl_module_reconfig (struct rspamd_config *cfg)
{
- /* Delete pool and objects */
- rspamd_mempool_delete (surbl_module_ctx->surbl_pool);
/* Reinit module */
surbl_module_ctx->use_redirector = 0;
surbl_module_ctx->suffixes = NULL;
- surbl_module_ctx->surbl_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
-
surbl_module_ctx->redirectors = NULL;
surbl_module_ctx->whitelist = NULL;
/* Zero exceptions hashes */
surbl_module_ctx->exceptions = NULL;
- rspamd_mempool_add_destructor (surbl_module_ctx->surbl_pool,
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t) g_list_free,
surbl_module_ctx->suffixes);