aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-23 00:05:28 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-23 00:05:28 +0000
commit61da4a2111a7cea09b9cd0d2780f6dc439ea4f62 (patch)
tree5a247c8ed7b4cf648fcce7535af888b68c21c82a
parent7bf934ec685f615509df5295b6d521607a036373 (diff)
downloadrspamd-61da4a2111a7cea09b9cd0d2780f6dc439ea4f62.tar.gz
rspamd-61da4a2111a7cea09b9cd0d2780f6dc439ea4f62.zip
[Minor] Remove dynamic modules support: never used
-rw-r--r--src/libserver/cfg_file.h2
-rw-r--r--src/libserver/cfg_rcl.c47
-rw-r--r--src/libserver/cfg_utils.c49
-rw-r--r--src/libserver/worker_util.c21
-rw-r--r--src/rspamd.h14
-rw-r--r--utils/content_type_bench.c2
-rw-r--r--utils/mime_tool.c1
7 files changed, 3 insertions, 133 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 88b8cea4c..80bf86f03 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -410,8 +410,6 @@ struct rspamd_config {
GList *classify_headers; /**< list of headers using for statistics */
struct module_s **compiled_modules; /**< list of compiled C modules */
struct worker_s **compiled_workers; /**< list of compiled C modules */
- GList *dynamic_modules; /**< list of dynamic C modules */
- GList *dynamic_workers; /**< list of dynamic C modules */
struct rspamd_config_post_load_script *finish_callbacks; /**< list of callbacks called on worker's termination */
struct rspamd_log_format *log_format; /**< parsed log format */
gchar *log_format_str; /**< raw log format string */
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 1919160c9..97dd966a9 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -551,11 +551,9 @@ rspamd_rcl_worker_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val, *cur, *cur_obj;
- struct rspamd_dynamic_worker *dyn_wrk;
- worker_t *dyn_ctx;
ucl_object_t *robj;
ucl_object_iter_t it = NULL;
- const gchar *worker_type, *worker_bind, *lib_path;
+ const gchar *worker_type, *worker_bind;
struct rspamd_config *cfg = ud;
GQuark qtype;
struct rspamd_worker_conf *wrk;
@@ -566,49 +564,6 @@ rspamd_rcl_worker_handler (rspamd_mempool_t *pool, const ucl_object_t *obj,
g_assert (key != NULL);
worker_type = key;
- val = ucl_object_lookup_any (obj, "module", "load", NULL);
-
- if (val != NULL && ucl_object_tostring_safe (val, &lib_path)) {
-
- if (!g_module_supported ()) {
- msg_err_config ("modules are not supported, so load of %s is impossible",
- worker_type);
-
- return FALSE;
- }
-
- dyn_wrk = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*dyn_wrk));
- dyn_wrk->lib = g_module_open (lib_path, G_MODULE_BIND_LAZY);
-
- if (dyn_wrk->lib == NULL) {
- msg_err_config ("cannot load %s at %s: %s", worker_type,
- lib_path, strerror (errno));
-
- return FALSE;
- }
-
- if (!g_module_symbol (dyn_wrk->lib, "rspamd_dyn_worker",
- (gpointer *)&dyn_ctx)) {
- msg_err_config ("cannot load %s at %s: missing entry point",
- worker_type,
- lib_path);
- g_module_close (dyn_wrk->lib);
-
- return FALSE;
- }
-
- if (!rspamd_check_worker (cfg, dyn_ctx)) {
- g_module_close (dyn_wrk->lib);
-
- return FALSE;
- }
-
- memcpy (&dyn_wrk->wrk, dyn_ctx, sizeof (dyn_wrk->wrk));
- dyn_wrk->path = lib_path;
- dyn_wrk->type = g_quark_from_static_string (worker_type);
- cfg->dynamic_workers = g_list_prepend (cfg->dynamic_workers, dyn_wrk);
- }
-
qtype = g_quark_try_string (worker_type);
if (qtype != 0) {
wrk = rspamd_config_new_worker (cfg, NULL);
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 8fe971454..fe8f2ef8a 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -187,10 +187,7 @@ rspamd_config_new (void)
void
rspamd_config_free (struct rspamd_config *cfg)
{
- struct rspamd_dynamic_module *dyn_mod;
- struct rspamd_dynamic_worker *dyn_wrk;
struct rspamd_config_post_load_script *sc, *sctmp;
- GList *cur;
rspamd_map_remove_all (cfg);
ucl_object_unref (cfg->rcl_obj);
@@ -214,28 +211,6 @@ rspamd_config_free (struct rspamd_config *cfg)
g_free (cfg->checksum);
}
- /* Unload dynamic workers/modules */
- cur = g_list_first (cfg->dynamic_modules);
- while (cur) {
- dyn_mod = cur->data;
-
- if (dyn_mod->lib) {
- g_module_close (dyn_mod->lib);
- }
-
- cur = g_list_next (cur);
- }
- cur = g_list_first (cfg->dynamic_workers);
- while (cur) {
- dyn_wrk = cur->data;
-
- if (dyn_wrk->lib) {
- g_module_close (dyn_wrk->lib);
- }
-
- cur = g_list_next (cur);
- }
-
DL_FOREACH_SAFE (cfg->finish_callbacks, sc, sctmp) {
luaL_unref (cfg->lua_state, LUA_REGISTRYINDEX, sc->cbref);
g_slice_free1 (sizeof (*sc), sc);
@@ -1336,7 +1311,6 @@ rspamd_init_filters (struct rspamd_config *cfg, bool reconfig)
{
GList *cur;
module_t *mod, **pmod;
- struct rspamd_dynamic_module *dyn_mod;
struct module_ctx *mod_ctx;
/* Init all compiled modules */
@@ -1355,29 +1329,6 @@ rspamd_init_filters (struct rspamd_config *cfg, bool reconfig)
}
}
}
-
- cur = g_list_first (cfg->dynamic_modules);
-
- while (cur) {
- dyn_mod = cur->data;
-
- if (dyn_mod->lib) {
- mod = &dyn_mod->mod;
-
- if (rspamd_check_module (cfg, mod)) {
- mod_ctx = g_slice_alloc0 (sizeof (struct module_ctx));
-
- if (mod->module_init_func (cfg, &mod_ctx) == 0) {
- g_hash_table_insert (cfg->c_modules,
- (gpointer) mod->name,
- mod_ctx);
- mod_ctx->mod = mod;
- }
- }
- }
-
- cur = g_list_next (cur);
- }
}
/* Now check what's enabled */
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 8bdc626fd..3d6e32d75 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -52,9 +52,7 @@
worker_t *
rspamd_get_worker_by_type (struct rspamd_config *cfg, GQuark type)
{
- worker_t **pwrk, *wrk;
- struct rspamd_dynamic_worker *dyn_wrk;
- GList *cur;
+ worker_t **pwrk;
pwrk = cfg->compiled_workers;
while (pwrk && *pwrk) {
@@ -67,23 +65,6 @@ rspamd_get_worker_by_type (struct rspamd_config *cfg, GQuark type)
pwrk++;
}
- cur = g_list_first (cfg->dynamic_workers);
- while (cur) {
- dyn_wrk = cur->data;
-
- if (dyn_wrk->lib) {
- wrk = &dyn_wrk->wrk;
-
- if (rspamd_check_worker (cfg, wrk)) {
- if (g_quark_from_string (wrk->name) == type) {
- return wrk;
- }
- }
- }
-
- cur = g_list_next (cur);
- }
-
return NULL;
}
diff --git a/src/rspamd.h b/src/rspamd.h
index cc9519ca3..bb7285dff 100644
--- a/src/rspamd.h
+++ b/src/rspamd.h
@@ -191,20 +191,6 @@ typedef struct worker_s {
const gchar *rspamd_features;
} worker_t;
-struct rspamd_dynamic_module {
- module_t mod;
- GModule *lib;
- const gchar *path;
- GQuark type;
-};
-
-struct rspamd_dynamic_worker {
- worker_t wrk;
- GModule *lib;
- GQuark type;
- const gchar *path;
-};
-
/**
* Check if loaded worker is compatible with rspamd
* @param cfg
diff --git a/utils/content_type_bench.c b/utils/content_type_bench.c
index 20eebf927..e2f26a8ac 100644
--- a/utils/content_type_bench.c
+++ b/utils/content_type_bench.c
@@ -71,7 +71,7 @@ rspamd_process_file (const gchar *fname, gint mode)
t2 = rspamd_get_virtual_ticks ();
}
else {
- rspamd_fprintf ("gmime is no longer supported\n");
+ rspamd_fprintf (stderr, "gmime is no longer supported\n");
exit (EXIT_FAILURE);
}
diff --git a/utils/mime_tool.c b/utils/mime_tool.c
index cdbd4c04e..34035ab61 100644
--- a/utils/mime_tool.c
+++ b/utils/mime_tool.c
@@ -231,7 +231,6 @@ main (int argc, char **argv)
g_set_printerr_handler (rspamd_glib_printerr_function);
rspamd_config_post_load (cfg,
RSPAMD_CONFIG_INIT_LIBS|RSPAMD_CONFIG_INIT_URL|RSPAMD_CONFIG_INIT_NO_TLD);
- g_mime_init (0);
for (i = start; i < argc; i ++) {
if (argv[i]) {