diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-10-22 17:04:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-10-22 17:04:20 +0100 |
commit | b7a0873dac545a79778133152a9b6d9b4e47cc42 (patch) | |
tree | d389696b986920f8e8f66df01519f6f6d55a02b5 /src/plugins | |
parent | 41e269801406c374a041da0fd0c6b4eff6ba4f3d (diff) | |
download | rspamd-b7a0873dac545a79778133152a9b6d9b4e47cc42.tar.gz rspamd-b7a0873dac545a79778133152a9b6d9b4e47cc42.zip |
Replace RCL to UCL from libucl to avoid duplicity in the code.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/chartable.c | 6 | ||||
-rw-r--r-- | src/plugins/dkim_check.c | 28 | ||||
-rw-r--r-- | src/plugins/fuzzy_check.c | 46 | ||||
-rw-r--r-- | src/plugins/regexp.c | 40 | ||||
-rw-r--r-- | src/plugins/spf.c | 14 | ||||
-rw-r--r-- | src/plugins/surbl.c | 50 |
6 files changed, 92 insertions, 92 deletions
diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index a140c5893..69197dfd6 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -86,17 +86,17 @@ chartable_module_init (struct config_file *cfg, struct module_ctx **ctx) gint chartable_module_config (struct config_file *cfg) { - rspamd_cl_object_t *value; + ucl_object_t *value; gint res = TRUE; if ((value = get_module_opt (cfg, "chartable", "symbol")) != NULL) { - chartable_module_ctx->symbol = rspamd_cl_obj_tostring (value); + 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 (!rspamd_cl_obj_todouble_safe (value, &chartable_module_ctx->threshold)) { + if (!ucl_obj_todouble_safe (value, &chartable_module_ctx->threshold)) { msg_warn ("invalid numeric value"); chartable_module_ctx->threshold = DEFAULT_THRESHOLD; } diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c index 7ae11631c..8e3fa4c23 100644 --- a/src/plugins/dkim_check.c +++ b/src/plugins/dkim_check.c @@ -114,7 +114,7 @@ dkim_module_init (struct config_file *cfg, struct module_ctx **ctx) gint dkim_module_config (struct config_file *cfg) { - rspamd_cl_object_t *value; + ucl_object_t *value; gint res = TRUE; guint cache_size, cache_expire; gboolean got_trusted = FALSE; @@ -122,72 +122,72 @@ 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) { - dkim_module_ctx->symbol_reject = rspamd_cl_obj_tostring (value); + 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) { - dkim_module_ctx->symbol_tempfail = rspamd_cl_obj_tostring (value); + 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) { - dkim_module_ctx->symbol_allow = rspamd_cl_obj_tostring (value); + 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) { - cache_size = rspamd_cl_obj_toint (value); + cache_size = ucl_obj_toint (value); } else { cache_size = DEFAULT_CACHE_SIZE; } if ((value = get_module_opt (cfg, "dkim", "dkim_cache_expire")) != NULL) { - cache_expire = rspamd_cl_obj_todouble (value); + cache_expire = ucl_obj_todouble (value); } else { cache_expire = DEFAULT_CACHE_MAXAGE; } if ((value = get_module_opt (cfg, "dkim", "time_jitter")) != NULL) { - dkim_module_ctx->time_jitter = rspamd_cl_obj_todouble (value); + 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 (! add_map (cfg, rspamd_cl_obj_tostring (value), + 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", rspamd_cl_obj_tostring (value)); + msg_warn ("cannot load whitelist from %s", ucl_obj_tostring (value)); } } if ((value = get_module_opt (cfg, "dkim", "domains")) != NULL) { - if (! add_map (cfg, rspamd_cl_obj_tostring (value), + if (! add_map (cfg, ucl_obj_tostring (value), "DKIM domains", read_kv_list, fin_kv_list, (void **)&dkim_module_ctx->dkim_domains)) { - msg_warn ("cannot load dkim domains list from %s", rspamd_cl_obj_tostring (value)); + msg_warn ("cannot load dkim domains list from %s", ucl_obj_tostring (value)); } else { got_trusted = TRUE; } } if ((value = get_module_opt (cfg, "dkim", "strict_multiplier")) != NULL) { - dkim_module_ctx->strict_multiplier = rspamd_cl_obj_toint (value); + 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) { - dkim_module_ctx->trusted_only = rspamd_cl_obj_toboolean (value); + 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) { - dkim_module_ctx->skip_multi = rspamd_cl_obj_toboolean (value); + dkim_module_ctx->skip_multi = ucl_obj_toboolean (value); } else { dkim_module_ctx->skip_multi = FALSE; diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 4a900d4db..60549b849 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -186,24 +186,24 @@ parse_flags_string_old (struct config_file *cfg, const gchar *str) } static void -parse_flags_string (struct config_file *cfg, rspamd_cl_object_t *val) +parse_flags_string (struct config_file *cfg, ucl_object_t *val) { - rspamd_cl_object_t *elt; + ucl_object_t *elt; struct fuzzy_mapping *map; - if (val->type == RSPAMD_CL_STRING) { - parse_flags_string_old (cfg, rspamd_cl_obj_tostring (val)); + if (val->type == UCL_STRING) { + parse_flags_string_old (cfg, ucl_obj_tostring (val)); } - else if (val->type == RSPAMD_CL_OBJECT) { - elt = rspamd_cl_obj_get_key (val, "symbol"); + else if (val->type == UCL_OBJECT) { + elt = ucl_obj_get_key (val, "symbol"); if (elt != NULL) { map = memory_pool_alloc (fuzzy_module_ctx->fuzzy_pool, sizeof (struct fuzzy_mapping)); - map->symbol = rspamd_cl_obj_tostring (elt); - elt = rspamd_cl_obj_get_key (val, "flag"); - if (elt != NULL && rspamd_cl_obj_toint_safe (elt, &map->fuzzy_flag)) { - elt = rspamd_cl_obj_get_key (val, "weight"); + map->symbol = ucl_obj_tostring (elt); + elt = ucl_obj_get_key (val, "flag"); + if (elt != NULL && ucl_obj_toint_safe (elt, &map->fuzzy_flag)) { + elt = ucl_obj_get_key (val, "weight"); if (elt != NULL) { - map->weight = rspamd_cl_obj_todouble (elt); + map->weight = ucl_obj_todouble (elt); } else { map->weight = fuzzy_module_ctx->max_score; @@ -377,64 +377,64 @@ fuzzy_check_module_init (struct config_file *cfg, struct module_ctx **ctx) gint fuzzy_check_module_config (struct config_file *cfg) { - rspamd_cl_object_t *value, *cur; + ucl_object_t *value, *cur; gint res = TRUE; if ((value = get_module_opt (cfg, "fuzzy_check", "symbol")) != NULL) { - fuzzy_module_ctx->symbol = rspamd_cl_obj_tostring (value); + fuzzy_module_ctx->symbol = ucl_obj_tostring (value); } else { fuzzy_module_ctx->symbol = DEFAULT_SYMBOL; } if ((value = get_module_opt (cfg, "fuzzy_check", "max_score")) != NULL) { - fuzzy_module_ctx->max_score = rspamd_cl_obj_todouble (value); + fuzzy_module_ctx->max_score = ucl_obj_todouble (value); } else { fuzzy_module_ctx->max_score = 0.; } if ((value = get_module_opt (cfg, "fuzzy_check", "min_length")) != NULL) { - fuzzy_module_ctx->min_hash_len = rspamd_cl_obj_toint (value); + 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) { - fuzzy_module_ctx->min_bytes = rspamd_cl_obj_toint (value); + 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) { - fuzzy_module_ctx->min_height = rspamd_cl_obj_toint (value); + 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) { - fuzzy_module_ctx->min_width = rspamd_cl_obj_toint (value); + 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) { - fuzzy_module_ctx->io_timeout = rspamd_cl_obj_todouble (value) * 1000; + 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", "mime_types")) != NULL) { LL_FOREACH (value, cur) { - fuzzy_module_ctx->mime_types = parse_mime_types (rspamd_cl_obj_tostring (cur)); + fuzzy_module_ctx->mime_types = parse_mime_types (ucl_obj_tostring (cur)); } } if ((value = get_module_opt (cfg, "fuzzy_check", "whitelist")) != NULL) { fuzzy_module_ctx->whitelist = radix_tree_create (); - if (!add_map (cfg, rspamd_cl_obj_tostring (value), + 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'", rspamd_cl_obj_tostring (value)); + msg_err ("cannot add whitelist '%s'", ucl_obj_tostring (value)); } } else { @@ -443,7 +443,7 @@ fuzzy_check_module_config (struct config_file *cfg) if ((value = get_module_opt (cfg, "fuzzy_check", "servers")) != NULL) { LL_FOREACH (value, cur) { - parse_servers_string (rspamd_cl_obj_tostring (cur)); + parse_servers_string (ucl_obj_tostring (cur)); } } if ((value = get_module_opt (cfg, "fuzzy_check", "fuzzy_map")) != NULL) { diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index f3eadfa45..a1c4fa049 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -44,7 +44,7 @@ struct regexp_module_item { struct expression *expr; - gchar *symbol; + const gchar *symbol; guint32 avg_time; gpointer lua_function; }; @@ -574,12 +574,12 @@ gint regexp_module_config (struct config_file *cfg) { struct regexp_module_item *cur_item; - rspamd_cl_object_t *sec, *value, *tmp; + ucl_object_t *sec, *value, *tmp; gint res = TRUE; struct regexp_json_buf *jb, **pjb; - HASH_FIND_STR (cfg->rcl_obj, "regexp", sec); + sec = ucl_object_find_key (cfg->rcl_obj, "regexp"); if (sec == NULL) { msg_err ("regexp module enabled, but no rules are defined"); return TRUE; @@ -590,44 +590,44 @@ regexp_module_config (struct config_file *cfg) regexp_module_ctx->workers = NULL; HASH_ITER (hh, sec, value, tmp) { - if (g_ascii_strncasecmp (value->key, "autolearn", sizeof ("autolearn") - 1) == 0) { - parse_autolearn_param (value->key, rspamd_cl_obj_tostring (value), cfg); + if (g_ascii_strncasecmp (ucl_object_key (value), "autolearn", sizeof ("autolearn") - 1) == 0) { + parse_autolearn_param (ucl_object_key (value), ucl_obj_tostring (value), cfg); } - else if (g_ascii_strncasecmp (value->key, "dynamic_rules", sizeof ("dynamic_rules") - 1) == 0) { + else if (g_ascii_strncasecmp (ucl_object_key (value), "dynamic_rules", sizeof ("dynamic_rules") - 1) == 0) { jb = g_malloc (sizeof (struct regexp_json_buf)); pjb = g_malloc (sizeof (struct regexp_json_buf *)); jb->buf = NULL; jb->cfg = cfg; *pjb = jb; - if (!add_map (cfg, rspamd_cl_obj_tostring (value), + if (!add_map (cfg, ucl_obj_tostring (value), "Dynamic regexp rules", json_regexp_read_cb, json_regexp_fin_cb, (void **)pjb)) { - msg_err ("cannot add map %s", rspamd_cl_obj_tostring (value)); + msg_err ("cannot add map %s", ucl_obj_tostring (value)); } } - else if (g_ascii_strncasecmp (value->key, "max_size", sizeof ("max_size") - 1) == 0) { - regexp_module_ctx->max_size = rspamd_cl_obj_toint (value); + else if (g_ascii_strncasecmp (ucl_object_key (value), "max_size", sizeof ("max_size") - 1) == 0) { + regexp_module_ctx->max_size = ucl_obj_toint (value); } - else if (g_ascii_strncasecmp (value->key, "max_threads", sizeof ("max_threads") - 1) == 0) { - regexp_module_ctx->max_threads = rspamd_cl_obj_toint (value); + else if (g_ascii_strncasecmp (ucl_object_key (value), "max_threads", sizeof ("max_threads") - 1) == 0) { + regexp_module_ctx->max_threads = ucl_obj_toint (value); } - else if (value->type == RSPAMD_CL_STRING) { + else if (value->type == UCL_STRING) { cur_item = memory_pool_alloc0 (regexp_module_ctx->regexp_pool, sizeof (struct regexp_module_item)); - cur_item->symbol = value->key; - if (!read_regexp_expression (regexp_module_ctx->regexp_pool, cur_item, value->key, - rspamd_cl_obj_tostring (value), cfg->raw_mode)) { + cur_item->symbol = ucl_object_key (value); + if (!read_regexp_expression (regexp_module_ctx->regexp_pool, cur_item, ucl_object_key (value), + ucl_obj_tostring (value), cfg->raw_mode)) { res = FALSE; } register_symbol (&cfg->cache, cur_item->symbol, 1, process_regexp_item, cur_item); } - else if (value->type == RSPAMD_CL_USERDATA) { + else if (value->type == UCL_USERDATA) { cur_item = memory_pool_alloc0 (regexp_module_ctx->regexp_pool, sizeof (struct regexp_module_item)); - cur_item->symbol = value->key; + cur_item->symbol = ucl_object_key (value); cur_item->lua_function = value->value.ud; register_symbol (&cfg->cache, cur_item->symbol, 1, process_regexp_item, cur_item); } else { - msg_warn ("unknown type of attribute %s for regexp module", value->key); + msg_warn ("unknown type of attribute %s for regexp module", ucl_object_key (value)); } } @@ -1112,7 +1112,7 @@ optimize_regexp_expression (struct expression **e, GQueue * stack, gboolean res) } static gboolean -process_regexp_expression (struct expression *expr, gchar *symbol, struct worker_task *task, +process_regexp_expression (struct expression *expr, const gchar *symbol, struct worker_task *task, const gchar *additional, struct lua_locked_state *nL) { GQueue *stack; diff --git a/src/plugins/spf.c b/src/plugins/spf.c index 254190961..cf1fbb180 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -101,44 +101,44 @@ spf_module_init (struct config_file *cfg, struct module_ctx **ctx) gint spf_module_config (struct config_file *cfg) { - rspamd_cl_object_t *value; + ucl_object_t *value; gint res = TRUE; guint cache_size, cache_expire; spf_module_ctx->whitelist_ip = radix_tree_create (); if ((value = get_module_opt (cfg, "spf", "symbol_fail")) != NULL) { - spf_module_ctx->symbol_fail = rspamd_cl_obj_tostring (value); + 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) { - spf_module_ctx->symbol_softfail = rspamd_cl_obj_tostring (value); + 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) { - spf_module_ctx->symbol_allow = rspamd_cl_obj_tostring (value); + 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) { - cache_size = rspamd_cl_obj_toint (value); + cache_size = ucl_obj_toint (value); } else { cache_size = DEFAULT_CACHE_SIZE; } if ((value = get_module_opt (cfg, "spf", "spf_cache_expire")) != NULL) { - cache_expire = rspamd_cl_obj_toint (value); + cache_expire = ucl_obj_toint (value); } else { cache_expire = DEFAULT_CACHE_MAXAGE; } if ((value = get_module_opt (cfg, "spf", "whitelist")) != NULL) { - if (! add_map (cfg, rspamd_cl_obj_tostring (value), + 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); diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index 8b5121aa8..5d49eccec 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -303,7 +303,7 @@ surbl_module_config (struct config_file *cfg) struct suffix_item *new_suffix, *cur_suffix = NULL; struct surbl_bit_item *new_bit; - rspamd_cl_object_t *value, *cur, *cur_rule, *tmp, *cur_bit; + ucl_object_t *value, *cur, *cur_rule, *tmp, *cur_bit; const gchar *redir_val; guint32 bit; gint i, idx; @@ -318,7 +318,7 @@ surbl_module_config (struct config_file *cfg) i * sizeof (struct redirector_upstream)); idx = 0; LL_FOREACH (value, cur) { - redir_val = rspamd_cl_obj_tostring (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, redir_val, &surbl_module_ctx->redirectors[idx].addr, @@ -340,100 +340,100 @@ surbl_module_config (struct config_file *cfg) surbl_module_ctx->use_redirector = (surbl_module_ctx->redirectors_number != 0); } if ((value = get_module_opt (cfg, "surbl", "redirector_symbol")) != NULL) { - surbl_module_ctx->redirector_symbol = rspamd_cl_obj_tostring (value); + 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) { - surbl_module_ctx->weight = rspamd_cl_obj_toint (value); + 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) { - surbl_module_ctx->url_expire = rspamd_cl_obj_todouble (value); + 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) { - surbl_module_ctx->connect_timeout = rspamd_cl_obj_todouble (value); + 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) { - surbl_module_ctx->read_timeout = rspamd_cl_obj_todouble (value); + 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) { - add_map (cfg, rspamd_cl_obj_tostring (value), + 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) { - surbl_module_ctx->max_urls = rspamd_cl_obj_toint (value); + 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 (add_map (cfg, rspamd_cl_obj_tostring (value), + if (add_map (cfg, ucl_obj_tostring (value), "SURBL exceptions list", read_exceptions_list, fin_exceptions_list, (void **)&surbl_module_ctx->exceptions)) { surbl_module_ctx->tld2_file = memory_pool_strdup (surbl_module_ctx->surbl_pool, - rspamd_cl_obj_tostring (value) + sizeof ("file://") - 1); + ucl_obj_tostring (value) + sizeof ("file://") - 1); } } if ((value = get_module_opt (cfg, "surbl", "whitelist")) != NULL) { - if (add_map (cfg, rspamd_cl_obj_tostring (value), + if (add_map (cfg, ucl_obj_tostring (value), "SURBL whitelist", read_host_list, fin_host_list, (void **)&surbl_module_ctx->whitelist)) { surbl_module_ctx->whitelist_file = memory_pool_strdup (surbl_module_ctx->surbl_pool, - rspamd_cl_obj_tostring (value) + sizeof ("file://") - 1); + ucl_obj_tostring (value) + sizeof ("file://") - 1); } } value = get_module_opt (cfg, "surbl", "rule"); - if (value != NULL && value->type == RSPAMD_CL_OBJECT) { + if (value != NULL && value->type == UCL_OBJECT) { LL_FOREACH (value, cur_rule) { - cur = rspamd_cl_obj_get_key (cur_rule, "suffix"); + cur = ucl_obj_get_key (cur_rule, "suffix"); if (cur == NULL) { msg_err ("surbl rule must have explicit symbol definition"); continue; } new_suffix = memory_pool_alloc (surbl_module_ctx->surbl_pool, sizeof (struct suffix_item)); new_suffix->suffix = memory_pool_strdup (surbl_module_ctx->surbl_pool, - rspamd_cl_obj_tostring (cur)); + ucl_obj_tostring (cur)); new_suffix->options = 0; new_suffix->bits = NULL; - cur = rspamd_cl_obj_get_key (cur_rule, "symbol"); + cur = ucl_obj_get_key (cur_rule, "symbol"); if (cur == NULL) { msg_warn ("surbl rule for suffix %s lacks symbol, using %s as symbol", new_suffix->suffix, DEFAULT_SURBL_SYMBOL); new_suffix->suffix = memory_pool_strdup (surbl_module_ctx->surbl_pool, DEFAULT_SURBL_SYMBOL); } - cur = rspamd_cl_obj_get_key (cur_rule, "options"); - if (cur != NULL && cur->type == RSPAMD_CL_STRING) { - if (strstr (rspamd_cl_obj_tostring (cur), "noip") != NULL) { + cur = ucl_obj_get_key (cur_rule, "options"); + if (cur != NULL && cur->type == UCL_STRING) { + if (strstr (ucl_obj_tostring (cur), "noip") != NULL) { new_suffix->options |= SURBL_OPTION_NOIP; } } - cur = rspamd_cl_obj_get_key (cur_rule, "bits"); - if (cur != NULL && cur->type == RSPAMD_CL_OBJECT) { + cur = ucl_obj_get_key (cur_rule, "bits"); + if (cur != NULL && cur->type == UCL_OBJECT) { HASH_ITER (hh, cur->value.ov, cur_bit, tmp) { - if (cur_bit->key != NULL && cur_bit->type == RSPAMD_CL_INT) { - bit = rspamd_cl_obj_toint (cur_bit); + if (ucl_object_key (cur_bit) != NULL && cur_bit->type == UCL_INT) { + bit = ucl_obj_toint (cur_bit); new_bit = memory_pool_alloc (surbl_module_ctx->surbl_pool, sizeof (struct surbl_bit_item)); new_bit->bit = bit; - new_bit->symbol = memory_pool_strdup (surbl_module_ctx->surbl_pool, cur->key); + new_bit->symbol = memory_pool_strdup (surbl_module_ctx->surbl_pool, ucl_object_key (cur_bit)); msg_debug ("add new bit suffix: %d with symbol: %s", (gint)new_bit->bit, new_bit->symbol); new_suffix->bits = g_list_prepend (new_suffix->bits, new_bit); } |