summaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-23 16:42:48 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-23 16:42:48 +0100
commit09a949fdf2b2e500084c814db74b02b1dc5a7b89 (patch)
tree7d88081cbfb69aa30ce683803150eeeedcbf9839 /src/libserver
parent43ce13764ceb1afbb504ca1d9e802f0f4aaafcca (diff)
downloadrspamd-09a949fdf2b2e500084c814db74b02b1dc5a7b89.tar.gz
rspamd-09a949fdf2b2e500084c814db74b02b1dc5a7b89.zip
[Project] Make various API functions public
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/cfg_file.h3
-rw-r--r--src/libserver/cfg_utils.c27
2 files changed, 10 insertions, 20 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 19c0c86c9..74949e283 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -637,10 +637,11 @@ const gchar * rspamd_action_to_str_alt (enum rspamd_action_type action);
* @param err error pointer
* @return
*/
+struct rspamd_radix_map_helper;
gboolean rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
const ucl_object_t *obj,
const gchar *description,
- radix_compressed_t **target,
+ struct rspamd_radix_map_helper **target,
GError **err);
#define msg_err_config(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 10503dc21..69dc3577e 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -21,6 +21,7 @@
#include "filter.h"
#include "lua/lua_common.h"
#include "map.h"
+#include "map_helpers.h"
#include "map_private.h"
#include "dynamic_cfg.h"
#include "utlist.h"
@@ -1768,7 +1769,7 @@ gboolean
rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
const ucl_object_t *obj,
const gchar *description,
- radix_compressed_t **target,
+ struct rspamd_radix_map_helper **target,
GError **err)
{
ucl_type_t type;
@@ -1796,12 +1797,8 @@ rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
}
else {
/* Just a list */
- if (!radix_add_generic_iplist (str, target, TRUE)) {
- g_set_error (err, g_quark_from_static_string ("rspamd-config"),
- EINVAL, "bad map definition %s for %s", str,
- ucl_object_key (obj));
- return FALSE;
- }
+ *target = rspamd_map_helper_new_radix (NULL);
+ rspamd_map_helper_insert_radix (*target, str, "");
}
break;
case UCL_OBJECT:
@@ -1821,19 +1818,11 @@ rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
while ((cur = ucl_object_iterate_safe (it, true)) != NULL) {
str = ucl_object_tostring (cur);
- if (str == NULL || !radix_add_generic_iplist (str, target, TRUE)) {
- g_set_error (err, g_quark_from_static_string ("rspamd-config"),
- EINVAL, "bad map element %s for %s", str,
- ucl_object_key (obj));
-
- if (*target) {
- radix_destroy_compressed (*target);
- }
-
- ucl_object_iterate_free (it);
-
- return FALSE;
+ if (!*target) {
+ *target = rspamd_map_helper_new_radix (NULL);
}
+
+ rspamd_map_helper_insert_radix (*target, str, "");
}
ucl_object_iterate_free (it);