]> source.dussan.org Git - rspamd.git/commitdiff
Fix modules defined by direct path.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 1 Sep 2015 13:37:44 +0000 (14:37 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 1 Sep 2015 13:37:44 +0000 (14:37 +0100)
src/libserver/cfg_rcl.c

index ec6e1f7eb018b33c92effd49cb5ea086b882d0e7..d549b25793926a0fafc6ecfa933b9e63621070ac 100644 (file)
@@ -808,6 +808,15 @@ rspamd_rcl_add_module_path (struct rspamd_config *cfg,
                cur_mod =
                        rspamd_mempool_alloc (cfg->cfg_pool, sizeof (struct script_module));
                cur_mod->path = rspamd_mempool_strdup (cfg->cfg_pool, path);
+               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);
        }