diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-06 18:25:15 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-06 18:25:15 +0100 |
commit | d9c16b50a4f7607cb5f4887fcc3c988f7c28d181 (patch) | |
tree | 4284c8de0a956a30ed70f92c65e24b9da0df5115 /src/libserver | |
parent | 54becee5b29dfc2cbda278a7f016fa62eceb996a (diff) | |
download | rspamd-d9c16b50a4f7607cb5f4887fcc3c988f7c28d181.tar.gz rspamd-d9c16b50a4f7607cb5f4887fcc3c988f7c28d181.zip |
Add conditional enabling of modules.
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/cfg_rcl.c | 11 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 13 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index ef2644dd9..bc60bfc66 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -795,7 +795,7 @@ rspamd_rcl_add_module_path (struct rspamd_config *cfg, struct stat st; struct script_module *cur_mod; glob_t globbuf; - gchar *pattern; + gchar *pattern, *ext_pos; size_t len; guint i; @@ -823,6 +823,15 @@ rspamd_rcl_add_module_path (struct rspamd_config *cfg, sizeof (struct script_module)); cur_mod->path = rspamd_mempool_strdup (cfg->cfg_pool, globbuf.gl_pathv[i]); + cur_mod->name = g_path_get_basename (cur_mod->path); + rspamd_mempool_add_destructor (cfg->cfg_pool, g_free, + cur_mod->name); + ext_pos = strstr (cur_mod->name, ".lua"); + + if (ext_pos != NULL) { + *ext_pos = '\0'; + } + cfg->script_modules = g_list_prepend (cfg->script_modules, cur_mod); } diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 96beb0621..1fe7d1483 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -1059,15 +1059,8 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, conf = ucl_object_find_key (cfg->rcl_obj, module_name); if (conf == NULL) { - if (is_c) { - msg_info ("internal module %s is enabled but has not configured", - module_name); - } - else { - msg_info ("lua module %s is disabled as it has not configured", - module_name); - return FALSE; - } + msg_info ("%s module %s is enabled but has not been configured", + is_c ? "internal" : "lua", module_name); } else { enabled = ucl_object_find_key (conf, "enabled"); @@ -1087,7 +1080,7 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, if (gr) { if (gr->disabled) { msg_info ("%s module %s is disabled in the configuration as " - "its group is disabled", + "its group has been disabled", is_c ? "internal" : "lua", module_name); return FALSE; } |