struct stat st;
struct script_module *cur_mod;
glob_t globbuf;
- gchar *pattern;
+ gchar *pattern, *ext_pos;
size_t len;
guint i;
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);
}
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");
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;
}
while (cur) {
module = cur->data;
if (module->path) {
+ if (!rspamd_config_is_module_enabled (cfg, module->name)) {
+ cur = g_list_next (cur);
+ continue;
+ }
+
if (luaL_loadfile (L, module->path) != 0) {
msg_info ("load of %s failed: %s", module->path,
lua_tostring (L, -1));
const ucl_object_t *value;
gint res = TRUE;
+ if (!rspamd_config_is_module_enabled (cfg, "chartable")) {
+ return TRUE;
+ }
+
if ((value =
rspamd_config_get_module_opt (cfg, "chartable", "symbol")) != NULL) {
chartable_module_ctx->symbol = ucl_obj_tostring (value);
guint cache_size, cache_expire;
gboolean got_trusted = FALSE;
+ if (!rspamd_config_is_module_enabled (cfg, "dkim")) {
+ return TRUE;
+ }
+
dkim_module_ctx->whitelist_ip = radix_create_compressed ();
if ((value =
const ucl_object_t *value, *cur;
gint res = TRUE, cb_id;
+ if (!rspamd_config_is_module_enabled (cfg, "fuzzy_check")) {
+ return TRUE;
+ }
+
if ((value =
rspamd_config_get_module_opt (cfg, "fuzzy_check", "symbol")) != NULL) {
fuzzy_module_ctx->default_symbol = ucl_obj_tostring (value);
ucl_object_iter_t it = NULL;
gint res = TRUE;
+ if (!rspamd_config_is_module_enabled (cfg, "regexp")) {
+ return TRUE;
+ }
+
sec = ucl_object_find_key (cfg->rcl_obj, "regexp");
if (sec == NULL) {
msg_err ("regexp module enabled, but no rules are defined");
gint res = TRUE, cb_id;
guint cache_size, cache_expire;
+ if (!rspamd_config_is_module_enabled (cfg, "spf")) {
+ return TRUE;
+ }
+
spf_module_ctx->whitelist_ip = radix_create_compressed ();
if ((value =
gint cb_id;
gboolean has_subsymbols;
+ if (!rspamd_config_is_module_enabled (cfg, "surbl")) {
+ return TRUE;
+ }
+
if ((value =
rspamd_config_get_module_opt (cfg, "surbl", "redirector")) != NULL) {
surbl_module_ctx->redirectors = rspamd_upstreams_create ();