diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-22 14:56:07 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-22 14:56:37 +0100 |
commit | 98d22d8bd5da4c7aa427c1a62b05c026f7a202f8 (patch) | |
tree | 0a719c4c54e674875b9a314e5baae11715a44626 /src/libserver | |
parent | 75591b77cec803d35447d7636f8719feedd219b7 (diff) | |
download | rspamd-98d22d8bd5da4c7aa427c1a62b05c026f7a202f8.tar.gz rspamd-98d22d8bd5da4c7aa427c1a62b05c026f7a202f8.zip |
[Feature] Rework confighelp to load Lua plugins
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/cfg_rcl.c | 20 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.h | 11 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 2 |
3 files changed, 22 insertions, 11 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index b6adc61a8..ae6657064 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -1029,10 +1029,10 @@ rspamd_rcl_lua_handler (rspamd_mempool_t *pool, const ucl_object_t *obj, return TRUE; } -static gboolean -rspamd_rcl_add_module_path (struct rspamd_config *cfg, - const gchar *path, - GError **err) +gboolean +rspamd_rcl_add_lua_plugins_path (struct rspamd_config *cfg, + const gchar *path, + GError **err) { struct stat st; struct script_module *cur_mod; @@ -1145,16 +1145,16 @@ rspamd_rcl_modules_handler (rspamd_mempool_t *pool, const ucl_object_t *obj, LL_FOREACH (val, cur) { if (ucl_object_tostring_safe (cur, &data)) { - if (!rspamd_rcl_add_module_path (cfg, - rspamd_mempool_strdup (cfg->cfg_pool, data), err)) { + if (!rspamd_rcl_add_lua_plugins_path (cfg, + rspamd_mempool_strdup (cfg->cfg_pool, data), err)) { return FALSE; } } } } else if (ucl_object_tostring_safe (obj, &data)) { - if (!rspamd_rcl_add_module_path (cfg, - rspamd_mempool_strdup (cfg->cfg_pool, data), err)) { + if (!rspamd_rcl_add_lua_plugins_path (cfg, + rspamd_mempool_strdup (cfg->cfg_pool, data), err)) { return FALSE; } } @@ -3869,7 +3869,7 @@ rspamd_rcl_add_doc_from_comments (struct rspamd_config *cfg, ucl_object_t *top_doc, const ucl_object_t *obj, const ucl_object_t *comments, gboolean is_top) { - ucl_object_iter_t it; + ucl_object_iter_t it = NULL; const ucl_object_t *cur, *cmt; ucl_object_t *cur_doc; @@ -3927,7 +3927,7 @@ rspamd_rcl_add_doc_by_example (struct rspamd_config *cfg, top_doc = rspamd_rcl_add_doc_by_path (cfg, root_path, doc_string, doc_name, ucl_object_type (top), NULL, 0, NULL, FALSE); ucl_object_insert_key (top_doc, - ucl_object_fromlstring (example_data, example_len), + ucl_object_fromstring_common (example_data, example_len, 0), "example", 0, false); rspamd_rcl_add_doc_from_comments (cfg, top_doc, top, comments, TRUE); diff --git a/src/libserver/cfg_rcl.h b/src/libserver/cfg_rcl.h index a83e9698f..d1ec26b2b 100644 --- a/src/libserver/cfg_rcl.h +++ b/src/libserver/cfg_rcl.h @@ -446,4 +446,15 @@ ucl_object_t *rspamd_rcl_add_doc_by_example (struct rspamd_config *cfg, const gchar *doc_string, const gchar *doc_name, const gchar *example_data, gsize example_len); + +/** + * Add lua modules path + * @param cfg + * @param path + * @param err + * @return + */ +gboolean rspamd_rcl_add_lua_plugins_path (struct rspamd_config *cfg, + const gchar *path, + GError **err); #endif /* CFG_RCL_H_ */ diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index c97db53fb..e8abcd9e6 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -1376,7 +1376,7 @@ rspamd_init_filters (struct rspamd_config *cfg, bool reconfig) cur = g_list_next (cur); } - return rspamd_init_lua_filters (cfg); + return rspamd_init_lua_filters (cfg, 0); } static void |