From: Vsevolod Stakhov Date: Tue, 1 Sep 2015 13:37:44 +0000 (+0100) Subject: Fix modules defined by direct path. X-Git-Tag: 1.0.0~115 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8d7e8ec7590cd4f25626f788827f71e51b7777f2;p=rspamd.git Fix modules defined by direct path. --- diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index ec6e1f7eb..d549b2579 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -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); }