mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
63 lines
2.1 KiB
Diff
63 lines
2.1 KiB
Diff
patch "rspamadm control" command so it reads control_socket from config
|
|
instead of defaulting to /var/lib/rspamd/rspamd.sock
|
|
Submitted to upstream here: https://github.com/rspamd/rspamd/pull/3373
|
|
|
|
diff -Nurp a/src/rspamadm/control.c b/src/rspamadm/control.c
|
|
--- a/src/rspamadm/control.c 2023-08-03 13:56:19.000000000 +0000
|
|
+++ b/src/rspamadm/control.c 2023-08-03 21:36:41.409576833 +0000
|
|
@@ -14,7 +14,10 @@
|
|
* limitations under the License.
|
|
*/
|
|
#include "config.h"
|
|
+#include "rspamd.h"
|
|
#include "rspamadm.h"
|
|
+#include "cfg_file.h"
|
|
+#include "cfg_rcl.h"
|
|
#include "cryptobox.h"
|
|
#include "printf.h"
|
|
#include "libserver/http/http_connection.h"
|
|
@@ -25,7 +28,12 @@
|
|
#include "libutil/util.h"
|
|
#include "lua/lua_common.h"
|
|
|
|
-static char *control_path = RSPAMD_DBDIR "/rspamd.sock";
|
|
+extern struct rspamd_main *rspamd_main;
|
|
+/* Defined in modules.c */
|
|
+extern module_t *modules[];
|
|
+extern worker_t *workers[];
|
|
+
|
|
+static gchar *control_path = NULL;
|
|
static gboolean json = FALSE;
|
|
static gboolean ucl = TRUE;
|
|
static gboolean compact = FALSE;
|
|
@@ -75,7 +83,7 @@ rspamadm_control_help(gboolean full_help
|
|
"-c: output compacted json\n"
|
|
"-j: output linted json\n"
|
|
"-u: output ucl (default)\n"
|
|
- "-s: use the following socket instead of " RSPAMD_DBDIR "/rspamd.sock\n"
|
|
+ "-s: use the following socket instead of configured one\n"
|
|
"-t: set IO timeout (1.0 seconds default)\n"
|
|
"--help: shows available options and commands\n\n"
|
|
"Supported commands:\n"
|
|
@@ -170,6 +178,20 @@ rspamadm_control(gint argc, gchar **argv
|
|
struct rspamd_http_message *msg;
|
|
rspamd_inet_addr_t *addr;
|
|
static struct rspamadm_control_cbdata cbdata;
|
|
+ struct rspamd_config *cfg = rspamd_main->cfg;
|
|
+
|
|
+ cfg->compiled_modules = modules;
|
|
+ cfg->compiled_workers = workers;
|
|
+ cfg->cfg_name = FIXED_CONFIG_FILE;
|
|
+
|
|
+ if (!rspamd_config_read (cfg, cfg->cfg_name, NULL, rspamd_main,
|
|
+ ucl_vars, FALSE, lua_env)) {
|
|
+ control_path = RSPAMD_DBDIR "/rspamd.sock";
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ control_path = cfg->control_socket_path;
|
|
+ }
|
|
|
|
context = g_option_context_new(
|
|
"control - manage rspamd main control interface");
|