]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Remove dynamic modules support: never used
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 23 Dec 2016 00:05:28 +0000 (00:05 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 23 Dec 2016 00:05:28 +0000 (00:05 +0000)
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c
src/libserver/worker_util.c
src/rspamd.h
utils/content_type_bench.c
utils/mime_tool.c

index 88b8cea4c3ca6c274836fd4eaaf82ffc299e6260..80bf86f03d323936660fbec32124c00b6658f71c 100644 (file)
@@ -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                                                              */
index 1919160c98856a360efeb48d84378c7fcc32796b..97dd966a9d7d2bd251217f8992e43cf9577f1223 100644 (file)
@@ -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);
index 8fe971454c9a917899f7b5bea67b21db43e2b2f8..fe8f2ef8a51ce33444b47bb7106c0dbf84add64f 100644 (file)
@@ -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 */
index 8bdc626fd1c0ed0ef0968db4e0aa5ee98348ffc0..3d6e32d759650de98cbc27e50a0a1f4dab24faa7 100644 (file)
@@ -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;
 }
 
index cc9519ca38665b0955aeebd017e997f37fd2b874..bb7285dff56d1fa2910849a04683d83d4a891a5f 100644 (file)
@@ -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
index 20eebf9276140322884e3be7eb66ee55b444fb70..e2f26a8ac76fc1179574c7467b9777b33f1faf49 100644 (file)
@@ -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);
                }
 
index cdbd4c04e19288ceb6a51c6bcb21f9f8f4111b0e..34035ab61a77239947b941566a9f4b38899ed7fc 100644 (file)
@@ -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]) {