]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix rspamadm configdump -m
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jun 2018 09:39:50 +0000 (10:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jun 2018 09:39:50 +0000 (10:39 +0100)
src/rspamadm/configdump.c
src/rspamadm/confighelp.c
src/rspamadm/control.c
src/rspamadm/fuzzy_convert.c
src/rspamadm/rspamadm.c
src/rspamadm/rspamadm.h
src/rspamadm/stat_convert.c

index cd9f6d378db4a8f73e349379aa70e8f448889680..8e26ef0af91507b6bb43e320d2bd566773e311f0 100644 (file)
@@ -308,7 +308,8 @@ rspamadm_configdump (gint argc, gchar **argv, const struct rspamadm_command *cmd
                                        argc,
                                        argv,
                                        cfg->rcl_obj,
-                                       "plugins_stats");
+                                       "plugins_stats",
+                                       FALSE);
 
                        lua_close (L);
 
index c77cb609164cd94f5e46b786b484b1afd61eb0ba..f4c5176ac65a0c2f698b234394075e0356ed466b 100644 (file)
@@ -110,7 +110,8 @@ rspamadm_confighelp_show (struct rspamd_config *cfg, gint argc, gchar **argv,
                                argc,
                                argv,
                                obj,
-                               "confighelp");
+                               "confighelp",
+                               TRUE);
 
                rspamd_fstring_free (out);
                return;
index 4d7806b84abad9ba20360eab3bf8c23590d0821a..6d2849cc7897846244bebf4a6078c988fc4a8a18 100644 (file)
@@ -137,7 +137,8 @@ rspamd_control_finish_handler (struct rspamd_http_connection *conn,
                                                cbdata->argc,
                                                cbdata->argv,
                                                obj,
-                                               "fuzzy_stat");
+                                               "fuzzy_stat",
+                                               TRUE);
 
                                rspamd_fstring_free (out);
                                ucl_object_unref (obj);
index 7671678dcc6f2fac9633eb7d8e381a37f55d9d55..1c5620730a804b86871732209a2ab25211d1eeca 100644 (file)
@@ -135,7 +135,8 @@ rspamadm_fuzzyconvert (gint argc, gchar **argv, const struct rspamadm_command *c
                        argc,
                        argv,
                        obj,
-                       "fuzzy_convert");
+                       "fuzzy_convert",
+                       TRUE);
 
        ucl_object_unref (obj);
 }
index 2e5359133b79aebd05e803cdf107a5a4a41ec3b9..45a9171ed918ea955c86d74957d42c760fda63d1 100644 (file)
@@ -206,7 +206,9 @@ rspamadm_parse_ucl_var (const gchar *option_name,
 
 gboolean
 rspamadm_execute_lua_ucl_subr (gpointer pL, gint argc, gchar **argv,
-               const ucl_object_t *res, const gchar *script_name)
+                                                          const ucl_object_t *res,
+                                                          const gchar *script_name,
+                                                          gboolean rspamadm_subcommand)
 {
        lua_State *L = pL;
        gint err_idx, i, ret;
@@ -219,8 +221,14 @@ rspamadm_execute_lua_ucl_subr (gpointer pL, gint argc, gchar **argv,
 
        /* Init internal rspamadm routines */
 
-       rspamd_snprintf (str, sizeof (str), "return require \"%s.%s\"", "rspamadm",
-                       script_name);
+       if (rspamadm_subcommand) {
+               rspamd_snprintf (str, sizeof (str), "return require \"%s.%s\"", "rspamadm",
+                               script_name);
+       }
+       else {
+               rspamd_snprintf (str, sizeof (str), "return require \"%s\"",
+                               script_name);
+       }
 
        if (luaL_dostring (L, str) != 0) {
                msg_err ("cannot execute lua script %s: %s",
index 3d9799dd5820cc6562f1f81a044a854652042a2f..02ecb2f479526ed08fb74f3c0421c867d898add3 100644 (file)
@@ -57,6 +57,7 @@ void rspamadm_fill_lua_commands (lua_State *L, GPtrArray *dest);
 
 gboolean rspamadm_execute_lua_ucl_subr (gpointer L, gint argc, gchar **argv,
                                                                                const ucl_object_t *res,
-                                                                               const gchar *script_name);
+                                                                               const gchar *script_name,
+                                                                               gboolean rspamadm_subcommand);
 
 #endif
index ef17194b0fb7bac05f72aa8aa6a58a4ef4ebef82..1dde4114d6f1fbbf91f80bf0aef3d0ff591a31b8 100644 (file)
@@ -251,7 +251,8 @@ rspamadm_statconvert (gint argc, gchar **argv, const struct rspamadm_command *cm
                        argc,
                        argv,
                        obj,
-                       "stat_convert");
+                       "stat_convert",
+                       TRUE);
 
        ucl_object_unref (obj);
 }