aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/chartable.c16
-rw-r--r--src/plugins/custom/ipmark/ipmark.c10
-rw-r--r--src/plugins/custom/regmark/regmark.c10
-rw-r--r--src/plugins/dkim_check.c34
-rw-r--r--src/plugins/fuzzy_check.c34
-rw-r--r--src/plugins/regexp.c16
-rw-r--r--src/plugins/spf.c24
-rw-r--r--src/plugins/surbl.c38
8 files changed, 91 insertions, 91 deletions
diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c
index e33052063..c40f3e8e2 100644
--- a/src/plugins/chartable.c
+++ b/src/plugins/chartable.c
@@ -41,9 +41,9 @@
#define DEFAULT_THRESHOLD 0.1
/* Initialization */
-gint chartable_module_init (struct config_file *cfg, struct module_ctx **ctx);
-gint chartable_module_config (struct config_file *cfg);
-gint chartable_module_reconfig (struct config_file *cfg);
+gint chartable_module_init (struct rspamd_config *cfg, struct module_ctx **ctx);
+gint chartable_module_config (struct rspamd_config *cfg);
+gint chartable_module_reconfig (struct rspamd_config *cfg);
module_t chartable_module = {
"chartable",
@@ -66,7 +66,7 @@ static gint chartable_mime_filter (struct rspamd_task *task
static void chartable_symbol_callback (struct rspamd_task *task, void *unused);
gint
-chartable_module_init (struct config_file *cfg, struct module_ctx **ctx)
+chartable_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
chartable_module_ctx = g_malloc (sizeof (struct chartable_ctx));
@@ -80,18 +80,18 @@ chartable_module_init (struct config_file *cfg, struct module_ctx **ctx)
gint
-chartable_module_config (struct config_file *cfg)
+chartable_module_config (struct rspamd_config *cfg)
{
const ucl_object_t *value;
gint res = TRUE;
- if ((value = get_module_opt (cfg, "chartable", "symbol")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "chartable", "symbol")) != NULL) {
chartable_module_ctx->symbol = ucl_obj_tostring (value);
}
else {
chartable_module_ctx->symbol = DEFAULT_SYMBOL;
}
- if ((value = get_module_opt (cfg, "chartable", "threshold")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "chartable", "threshold")) != NULL) {
if (!ucl_obj_todouble_safe (value, &chartable_module_ctx->threshold)) {
msg_warn ("invalid numeric value");
chartable_module_ctx->threshold = DEFAULT_THRESHOLD;
@@ -107,7 +107,7 @@ chartable_module_config (struct config_file *cfg)
}
gint
-chartable_module_reconfig (struct config_file *cfg)
+chartable_module_reconfig (struct rspamd_config *cfg)
{
rspamd_mempool_delete (chartable_module_ctx->chartable_pool);
chartable_module_ctx->chartable_pool = rspamd_mempool_new (1024);
diff --git a/src/plugins/custom/ipmark/ipmark.c b/src/plugins/custom/ipmark/ipmark.c
index a40a94582..1b4eb7f6c 100644
--- a/src/plugins/custom/ipmark/ipmark.c
+++ b/src/plugins/custom/ipmark/ipmark.c
@@ -47,7 +47,7 @@ enum ipmark_command {
};
/* Exported functions */
-void module_init (struct config_file *cfg);
+void module_init (struct rspamd_config *cfg);
void* before_connect (void);
gboolean parse_line (const char *line, size_t len, char **output, void *user_data);
void after_connect (char **output, char **log_line, void *user_data);
@@ -60,10 +60,10 @@ static radix_tree_t *radix = NULL;
/* Implementation */
char *
-get_module_opt (struct config_file *cfg, char *module_name, char *opt_name)
+rspamd_config_get_module_opt (struct rspamd_config *cfg, char *module_name, char *opt_name)
{
GList *cur_opt;
- struct module_opt *cur;
+ struct rspamd_module_opt *cur;
cur_opt = g_hash_table_lookup (cfg->modules_opts, module_name);
if (cur_opt == NULL) {
@@ -216,11 +216,11 @@ write_radix_file (void)
}
void
-module_init (struct config_file *cfg)
+module_init (struct rspamd_config *cfg)
{
char *value;
- if (cfg && (value = get_module_opt (cfg, "ipmark", "file")) != NULL) {
+ if (cfg && (value = rspamd_config_get_module_opt (cfg, "ipmark", "file")) != NULL) {
filename = g_strdup (value);
}
diff --git a/src/plugins/custom/regmark/regmark.c b/src/plugins/custom/regmark/regmark.c
index 35901f9aa..6b3374f67 100644
--- a/src/plugins/custom/regmark/regmark.c
+++ b/src/plugins/custom/regmark/regmark.c
@@ -54,7 +54,7 @@
#define MAX_LEVELS 32
/* Exported functions */
-void module_init (struct config_file *cfg);
+void module_init (struct rspamd_config *cfg);
void* before_connect (void);
gboolean parse_line (const char *line, size_t len, char **output, void *user_data);
void after_connect (char **output, char **log_line, void *user_data);
@@ -67,10 +67,10 @@ static prefix_tree_t *tree = NULL;
/* Implementation */
char *
-get_module_opt (struct config_file *cfg, char *module_name, char *opt_name)
+rspamd_config_get_module_opt (struct rspamd_config *cfg, char *module_name, char *opt_name)
{
GList *cur_opt;
- struct module_opt *cur;
+ struct rspamd_module_opt *cur;
cur_opt = g_hash_table_lookup (cfg->modules_opts, module_name);
if (cur_opt == NULL) {
@@ -89,11 +89,11 @@ get_module_opt (struct config_file *cfg, char *module_name, char *opt_name)
}
void
-module_init (struct config_file *cfg)
+module_init (struct rspamd_config *cfg)
{
char *value;
- if (cfg && (value = get_module_opt (cfg, "ipmark", "file")) != NULL) {
+ if (cfg && (value = rspamd_config_get_module_opt (cfg, "ipmark", "file")) != NULL) {
filename = g_strdup (value);
}
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index ac12c0909..073fc890d 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -75,9 +75,9 @@ static struct dkim_ctx *dkim_module_ctx = NULL;
static void dkim_symbol_callback (struct rspamd_task *task, void *unused);
/* Initialization */
-gint dkim_module_init (struct config_file *cfg, struct module_ctx **ctx);
-gint dkim_module_config (struct config_file *cfg);
-gint dkim_module_reconfig (struct config_file *cfg);
+gint dkim_module_init (struct rspamd_config *cfg, struct module_ctx **ctx);
+gint dkim_module_config (struct rspamd_config *cfg);
+gint dkim_module_reconfig (struct rspamd_config *cfg);
module_t dkim_module = {
"dkim",
@@ -87,7 +87,7 @@ module_t dkim_module = {
};
gint
-dkim_module_init (struct config_file *cfg, struct module_ctx **ctx)
+dkim_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
dkim_module_ctx = g_malloc0 (sizeof (struct dkim_ctx));
@@ -99,7 +99,7 @@ dkim_module_init (struct config_file *cfg, struct module_ctx **ctx)
}
gint
-dkim_module_config (struct config_file *cfg)
+dkim_module_config (struct rspamd_config *cfg)
{
const ucl_object_t *value;
gint res = TRUE;
@@ -108,50 +108,50 @@ dkim_module_config (struct config_file *cfg)
dkim_module_ctx->whitelist_ip = radix_tree_create ();
- if ((value = get_module_opt (cfg, "dkim", "symbol_reject")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "symbol_reject")) != NULL) {
dkim_module_ctx->symbol_reject = ucl_obj_tostring (value);
}
else {
dkim_module_ctx->symbol_reject = DEFAULT_SYMBOL_REJECT;
}
- if ((value = get_module_opt (cfg, "dkim", "symbol_tempfail")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "symbol_tempfail")) != NULL) {
dkim_module_ctx->symbol_tempfail = ucl_obj_tostring (value);
}
else {
dkim_module_ctx->symbol_tempfail = DEFAULT_SYMBOL_TEMPFAIL;
}
- if ((value = get_module_opt (cfg, "dkim", "symbol_allow")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "symbol_allow")) != NULL) {
dkim_module_ctx->symbol_allow = ucl_obj_tostring (value);
}
else {
dkim_module_ctx->symbol_allow = DEFAULT_SYMBOL_ALLOW;
}
- if ((value = get_module_opt (cfg, "dkim", "dkim_cache_size")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "dkim_cache_size")) != NULL) {
cache_size = ucl_obj_toint (value);
}
else {
cache_size = DEFAULT_CACHE_SIZE;
}
- if ((value = get_module_opt (cfg, "dkim", "dkim_cache_expire")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "dkim_cache_expire")) != NULL) {
cache_expire = ucl_obj_todouble (value);
}
else {
cache_expire = DEFAULT_CACHE_MAXAGE;
}
- if ((value = get_module_opt (cfg, "dkim", "time_jitter")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "time_jitter")) != NULL) {
dkim_module_ctx->time_jitter = ucl_obj_todouble (value);
}
else {
dkim_module_ctx->time_jitter = DEFAULT_TIME_JITTER;
}
- if ((value = get_module_opt (cfg, "dkim", "whitelist")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "whitelist")) != NULL) {
if (! add_map (cfg, ucl_obj_tostring (value),
"DKIM whitelist", read_radix_list, fin_radix_list,
(void **)&dkim_module_ctx->whitelist_ip)) {
msg_warn ("cannot load whitelist from %s", ucl_obj_tostring (value));
}
}
- if ((value = get_module_opt (cfg, "dkim", "domains")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "domains")) != NULL) {
if (! add_map (cfg, ucl_obj_tostring (value),
"DKIM domains", read_kv_list, fin_kv_list,
(void **)&dkim_module_ctx->dkim_domains)) {
@@ -161,19 +161,19 @@ dkim_module_config (struct config_file *cfg)
got_trusted = TRUE;
}
}
- if ((value = get_module_opt (cfg, "dkim", "strict_multiplier")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "strict_multiplier")) != NULL) {
dkim_module_ctx->strict_multiplier = ucl_obj_toint (value);
}
else {
dkim_module_ctx->strict_multiplier = 1;
}
- if ((value = get_module_opt (cfg, "dkim", "trusted_only")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "trusted_only")) != NULL) {
dkim_module_ctx->trusted_only = ucl_obj_toboolean (value);
}
else {
dkim_module_ctx->trusted_only = FALSE;
}
- if ((value = get_module_opt (cfg, "dkim", "skip_multi")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "dkim", "skip_multi")) != NULL) {
dkim_module_ctx->skip_multi = ucl_obj_toboolean (value);
}
else {
@@ -201,7 +201,7 @@ dkim_module_config (struct config_file *cfg)
}
gint
-dkim_module_reconfig (struct config_file *cfg)
+dkim_module_reconfig (struct rspamd_config *cfg)
{
rspamd_mempool_delete (dkim_module_ctx->dkim_pool);
radix_tree_free (dkim_module_ctx->whitelist_ip);
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 4f7a4c3d7..5dfd1881a 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -135,9 +135,9 @@ static gboolean fuzzy_delete_handler (gchar **args,
struct controller_session *session);
/* Initialization */
-gint fuzzy_check_module_init (struct config_file *cfg, struct module_ctx **ctx);
-gint fuzzy_check_module_config (struct config_file *cfg);
-gint fuzzy_check_module_reconfig (struct config_file *cfg);
+gint fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx);
+gint fuzzy_check_module_config (struct rspamd_config *cfg);
+gint fuzzy_check_module_reconfig (struct rspamd_config *cfg);
module_t fuzzy_check_module = {
"fuzzy_check",
@@ -147,7 +147,7 @@ module_t fuzzy_check_module = {
};
static void
-parse_flags (struct fuzzy_rule *rule, struct config_file *cfg, const ucl_object_t *val)
+parse_flags (struct fuzzy_rule *rule, struct rspamd_config *cfg, const ucl_object_t *val)
{
const ucl_object_t *elt;
struct fuzzy_mapping *map;
@@ -255,7 +255,7 @@ parse_servers_string (struct fuzzy_rule *rule, const gchar *str)
g_strstrip (strvec[i]);
cur = &rule->servers[rule->servers_num];
- if (parse_host_port (fuzzy_module_ctx->fuzzy_pool, strvec[i], &cur->addr, &cur->port)) {
+ if (rspamd_parse_host_port (fuzzy_module_ctx->fuzzy_pool, strvec[i], &cur->addr, &cur->port)) {
if (cur->port == 0) {
cur->port = DEFAULT_PORT;
}
@@ -323,7 +323,7 @@ fuzzy_rule_new (const char *default_symbol, rspamd_mempool_t *pool)
}
static gint
-fuzzy_parse_rule (struct config_file *cfg, const ucl_object_t *obj)
+fuzzy_parse_rule (struct rspamd_config *cfg, const ucl_object_t *obj)
{
const ucl_object_t *value, *cur;
struct fuzzy_rule *rule;
@@ -388,7 +388,7 @@ fuzzy_parse_rule (struct config_file *cfg, const ucl_object_t *obj)
}
gint
-fuzzy_check_module_init (struct config_file *cfg, struct module_ctx **ctx)
+fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
fuzzy_module_ctx = g_malloc0 (sizeof (struct fuzzy_ctx));
@@ -400,50 +400,50 @@ fuzzy_check_module_init (struct config_file *cfg, struct module_ctx **ctx)
}
gint
-fuzzy_check_module_config (struct config_file *cfg)
+fuzzy_check_module_config (struct rspamd_config *cfg)
{
const ucl_object_t *value, *cur;
gint res = TRUE;
- if ((value = get_module_opt (cfg, "fuzzy_check", "symbol")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "symbol")) != NULL) {
fuzzy_module_ctx->default_symbol = ucl_obj_tostring (value);
}
else {
fuzzy_module_ctx->default_symbol = DEFAULT_SYMBOL;
}
- if ((value = get_module_opt (cfg, "fuzzy_check", "min_length")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "min_length")) != NULL) {
fuzzy_module_ctx->min_hash_len = ucl_obj_toint (value);
}
else {
fuzzy_module_ctx->min_hash_len = 0;
}
- if ((value = get_module_opt (cfg, "fuzzy_check", "min_bytes")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "min_bytes")) != NULL) {
fuzzy_module_ctx->min_bytes = ucl_obj_toint (value);
}
else {
fuzzy_module_ctx->min_bytes = 0;
}
- if ((value = get_module_opt (cfg, "fuzzy_check", "min_height")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "min_height")) != NULL) {
fuzzy_module_ctx->min_height = ucl_obj_toint (value);
}
else {
fuzzy_module_ctx->min_height = 0;
}
- if ((value = get_module_opt (cfg, "fuzzy_check", "min_width")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "min_width")) != NULL) {
fuzzy_module_ctx->min_width = ucl_obj_toint (value);
}
else {
fuzzy_module_ctx->min_width = 0;
}
- if ((value = get_module_opt (cfg, "fuzzy_check", "timeout")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "timeout")) != NULL) {
fuzzy_module_ctx->io_timeout = ucl_obj_todouble (value) * 1000;
}
else {
fuzzy_module_ctx->io_timeout = DEFAULT_IO_TIMEOUT;
}
- if ((value = get_module_opt (cfg, "fuzzy_check", "whitelist")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "whitelist")) != NULL) {
fuzzy_module_ctx->whitelist = radix_tree_create ();
if (!add_map (cfg, ucl_obj_tostring (value),
"Fuzzy whitelist", read_radix_list, fin_radix_list,
@@ -455,7 +455,7 @@ fuzzy_check_module_config (struct config_file *cfg)
fuzzy_module_ctx->whitelist = NULL;
}
- if ((value = get_module_opt (cfg, "fuzzy_check", "rule")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "fuzzy_check", "rule")) != NULL) {
LL_FOREACH (value, cur) {
if (fuzzy_parse_rule (cfg, cur) == -1) {
return -1;
@@ -478,7 +478,7 @@ fuzzy_check_module_config (struct config_file *cfg)
}
gint
-fuzzy_check_module_reconfig (struct config_file *cfg)
+fuzzy_check_module_reconfig (struct rspamd_config *cfg)
{
rspamd_mempool_delete (fuzzy_module_ctx->fuzzy_pool);
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index ddc03db38..55ea910bd 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -68,7 +68,7 @@ struct regexp_json_buf {
gchar *buf;
gchar *pos;
size_t buflen;
- struct config_file *cfg;
+ struct rspamd_config *cfg;
};
/* Lua regexp module for checking rspamd regexps */
@@ -99,9 +99,9 @@ static void process_regexp_item (struct rspamd_task *task, vo
/* Initialization */
-gint regexp_module_init (struct config_file *cfg, struct module_ctx **ctx);
-gint regexp_module_config (struct config_file *cfg);
-gint regexp_module_reconfig (struct config_file *cfg);
+gint regexp_module_init (struct rspamd_config *cfg, struct module_ctx **ctx);
+gint regexp_module_config (struct rspamd_config *cfg);
+gint regexp_module_reconfig (struct rspamd_config *cfg);
module_t regexp_module = {
"regexp",
@@ -505,7 +505,7 @@ json_regexp_fin_cb (rspamd_mempool_t * pool, struct map_cb_data *data)
/* Init function */
gint
-regexp_module_init (struct config_file *cfg, struct module_ctx **ctx)
+regexp_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
regexp_module_ctx = g_malloc (sizeof (struct regexp_ctx));
@@ -537,7 +537,7 @@ regexp_module_init (struct config_file *cfg, struct module_ctx **ctx)
* SYMBOL:statfile:weight
*/
void
-parse_autolearn_param (const gchar *param, const gchar *value, struct config_file *cfg)
+parse_autolearn_param (const gchar *param, const gchar *value, struct rspamd_config *cfg)
{
struct autolearn_data *d;
gchar *p;
@@ -564,7 +564,7 @@ parse_autolearn_param (const gchar *param, const gchar *value, struct config_fil
}
gint
-regexp_module_config (struct config_file *cfg)
+regexp_module_config (struct rspamd_config *cfg)
{
struct regexp_module_item *cur_item;
const ucl_object_t *sec, *value;
@@ -629,7 +629,7 @@ regexp_module_config (struct config_file *cfg)
}
gint
-regexp_module_reconfig (struct config_file *cfg)
+regexp_module_reconfig (struct rspamd_config *cfg)
{
rspamd_mempool_delete (regexp_module_ctx->regexp_pool);
regexp_module_ctx->regexp_pool = rspamd_mempool_new (rspamd_mempool_suggest_size ());
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index 19aaa44e5..32558f3a1 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -66,9 +66,9 @@ static GList * spf_record_copy (GList *addrs);
static void spf_record_destroy (gpointer list);
/* Initialization */
-gint spf_module_init (struct config_file *cfg, struct module_ctx **ctx);
-gint spf_module_config (struct config_file *cfg);
-gint spf_module_reconfig (struct config_file *cfg);
+gint spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx);
+gint spf_module_config (struct rspamd_config *cfg);
+gint spf_module_reconfig (struct rspamd_config *cfg);
module_t spf_module = {
"spf",
@@ -78,7 +78,7 @@ module_t spf_module = {
};
gint
-spf_module_init (struct config_file *cfg, struct module_ctx **ctx)
+spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
spf_module_ctx = g_malloc (sizeof (struct spf_ctx));
@@ -91,7 +91,7 @@ spf_module_init (struct config_file *cfg, struct module_ctx **ctx)
gint
-spf_module_config (struct config_file *cfg)
+spf_module_config (struct rspamd_config *cfg)
{
const ucl_object_t *value;
gint res = TRUE;
@@ -99,37 +99,37 @@ spf_module_config (struct config_file *cfg)
spf_module_ctx->whitelist_ip = radix_tree_create ();
- if ((value = get_module_opt (cfg, "spf", "symbol_fail")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "spf", "symbol_fail")) != NULL) {
spf_module_ctx->symbol_fail = ucl_obj_tostring (value);
}
else {
spf_module_ctx->symbol_fail = DEFAULT_SYMBOL_FAIL;
}
- if ((value = get_module_opt (cfg, "spf", "symbol_softfail")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "spf", "symbol_softfail")) != NULL) {
spf_module_ctx->symbol_softfail = ucl_obj_tostring (value);
}
else {
spf_module_ctx->symbol_softfail = DEFAULT_SYMBOL_SOFTFAIL;
}
- if ((value = get_module_opt (cfg, "spf", "symbol_allow")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "spf", "symbol_allow")) != NULL) {
spf_module_ctx->symbol_allow = ucl_obj_tostring (value);
}
else {
spf_module_ctx->symbol_allow = DEFAULT_SYMBOL_ALLOW;
}
- if ((value = get_module_opt (cfg, "spf", "spf_cache_size")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "spf", "spf_cache_size")) != NULL) {
cache_size = ucl_obj_toint (value);
}
else {
cache_size = DEFAULT_CACHE_SIZE;
}
- if ((value = get_module_opt (cfg, "spf", "spf_cache_expire")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "spf", "spf_cache_expire")) != NULL) {
cache_expire = ucl_obj_toint (value);
}
else {
cache_expire = DEFAULT_CACHE_MAXAGE;
}
- if ((value = get_module_opt (cfg, "spf", "whitelist")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "spf", "whitelist")) != NULL) {
if (! add_map (cfg, ucl_obj_tostring (value),
"SPF whitelist", read_radix_list, fin_radix_list,
(void **)&spf_module_ctx->whitelist_ip)) {
@@ -148,7 +148,7 @@ spf_module_config (struct config_file *cfg)
}
gint
-spf_module_reconfig (struct config_file *cfg)
+spf_module_reconfig (struct rspamd_config *cfg)
{
rspamd_mempool_delete (spf_module_ctx->spf_pool);
radix_tree_free (spf_module_ctx->whitelist_ip);
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 59c13b450..41873e15d 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -74,9 +74,9 @@ surbl_error_quark (void)
}
/* Initialization */
-gint surbl_module_init (struct config_file *cfg, struct module_ctx **ctx);
-gint surbl_module_config (struct config_file *cfg);
-gint surbl_module_reconfig (struct config_file *cfg);
+gint surbl_module_init (struct rspamd_config *cfg, struct module_ctx **ctx);
+gint surbl_module_config (struct rspamd_config *cfg);
+gint surbl_module_reconfig (struct rspamd_config *cfg);
module_t surbl_module = {
"surbl",
@@ -207,7 +207,7 @@ fin_redirectors_list (rspamd_mempool_t * pool, struct map_cb_data *data)
}
gint
-surbl_module_init (struct config_file *cfg, struct module_ctx **ctx)
+surbl_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
{
surbl_module_ctx = g_malloc (sizeof (struct surbl_ctx));
@@ -241,7 +241,7 @@ surbl_module_init (struct config_file *cfg, struct module_ctx **ctx)
* Register virtual symbols for suffixes with bit wildcard
*/
static void
-register_bit_symbols (struct config_file *cfg, struct suffix_item *suffix)
+register_bit_symbols (struct rspamd_config *cfg, struct suffix_item *suffix)
{
GList *cur;
struct surbl_bit_item *bit;
@@ -261,7 +261,7 @@ register_bit_symbols (struct config_file *cfg, struct suffix_item *suffix)
}
gint
-surbl_module_config (struct config_file *cfg)
+surbl_module_config (struct rspamd_config *cfg)
{
GList *cur_opt;
struct suffix_item *new_suffix, *cur_suffix = NULL;
@@ -274,7 +274,7 @@ surbl_module_config (struct config_file *cfg)
gint i, idx;
- if ((value = get_module_opt (cfg, "surbl", "redirector")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "redirector")) != NULL) {
i = 0;
LL_FOREACH (value, cur) {
i ++;
@@ -285,7 +285,7 @@ surbl_module_config (struct config_file *cfg)
LL_FOREACH (value, cur) {
redir_val = ucl_obj_tostring (cur);
surbl_module_ctx->redirectors[idx].up.priority = 100;
- if (! parse_host_port_priority (surbl_module_ctx->surbl_pool,
+ if (! rspamd_parse_host_port_priority (surbl_module_ctx->surbl_pool,
redir_val, &surbl_module_ctx->redirectors[idx].addr,
&surbl_module_ctx->redirectors[idx].port,
&surbl_module_ctx->redirectors[idx].up.priority)) {
@@ -304,50 +304,50 @@ surbl_module_config (struct config_file *cfg)
surbl_module_ctx->redirectors_number = idx;
surbl_module_ctx->use_redirector = (surbl_module_ctx->redirectors_number != 0);
}
- if ((value = get_module_opt (cfg, "surbl", "redirector_symbol")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "redirector_symbol")) != NULL) {
surbl_module_ctx->redirector_symbol = ucl_obj_tostring (value);
register_virtual_symbol (&cfg->cache, surbl_module_ctx->redirector_symbol, 1.0);
}
else {
surbl_module_ctx->redirector_symbol = NULL;
}
- if ((value = get_module_opt (cfg, "surbl", "weight")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "weight")) != NULL) {
surbl_module_ctx->weight = ucl_obj_toint (value);
}
else {
surbl_module_ctx->weight = DEFAULT_SURBL_WEIGHT;
}
- if ((value = get_module_opt (cfg, "surbl", "url_expire")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "url_expire")) != NULL) {
surbl_module_ctx->url_expire = ucl_obj_todouble (value);
}
else {
surbl_module_ctx->url_expire = DEFAULT_SURBL_URL_EXPIRE;
}
- if ((value = get_module_opt (cfg, "surbl", "redirector_connect_timeout")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "redirector_connect_timeout")) != NULL) {
surbl_module_ctx->connect_timeout = ucl_obj_todouble (value);
}
else {
surbl_module_ctx->connect_timeout = DEFAULT_REDIRECTOR_CONNECT_TIMEOUT;
}
- if ((value = get_module_opt (cfg, "surbl", "redirector_read_timeout")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "redirector_read_timeout")) != NULL) {
surbl_module_ctx->read_timeout = ucl_obj_todouble (value);
}
else {
surbl_module_ctx->read_timeout = DEFAULT_REDIRECTOR_READ_TIMEOUT;
}
- if ((value = get_module_opt (cfg, "surbl", "redirector_hosts_map")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "redirector_hosts_map")) != NULL) {
add_map (cfg, ucl_obj_tostring (value),
"SURBL redirectors list", read_redirectors_list, fin_redirectors_list,
(void **)&surbl_module_ctx->redirector_hosts);
}
- if ((value = get_module_opt (cfg, "surbl", "max_urls")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "max_urls")) != NULL) {
surbl_module_ctx->max_urls = ucl_obj_toint (value);
}
else {
surbl_module_ctx->max_urls = DEFAULT_SURBL_MAX_URLS;
}
- if ((value = get_module_opt (cfg, "surbl", "exceptions")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "exceptions")) != NULL) {
if (add_map (cfg, ucl_obj_tostring (value),
"SURBL exceptions list", read_exceptions_list, fin_exceptions_list,
(void **)&surbl_module_ctx->exceptions)) {
@@ -355,7 +355,7 @@ surbl_module_config (struct config_file *cfg)
ucl_obj_tostring (value) + sizeof ("file://") - 1);
}
}
- if ((value = get_module_opt (cfg, "surbl", "whitelist")) != NULL) {
+ if ((value = rspamd_config_get_module_opt (cfg, "surbl", "whitelist")) != NULL) {
if (add_map (cfg, ucl_obj_tostring (value),
"SURBL whitelist", read_host_list, fin_host_list,
(void **)&surbl_module_ctx->whitelist)) {
@@ -364,7 +364,7 @@ surbl_module_config (struct config_file *cfg)
}
}
- value = get_module_opt (cfg, "surbl", "rule");
+ value = rspamd_config_get_module_opt (cfg, "surbl", "rule");
if (value != NULL && value->type == UCL_OBJECT) {
LL_FOREACH (value, cur_rule) {
cur = ucl_obj_get_key (cur_rule, "suffix");
@@ -439,7 +439,7 @@ surbl_module_config (struct config_file *cfg)
}
gint
-surbl_module_reconfig (struct config_file *cfg)
+surbl_module_reconfig (struct rspamd_config *cfg)
{
/* Delete pool and objects */
rspamd_mempool_delete (surbl_module_ctx->surbl_pool);