From 5afd0bbafaa82bcd05e963c1da9fd65e60db711d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 17 Jan 2017 14:04:58 +0000 Subject: [PATCH] [Fix] Fix reload and hyperscan ready event MFH: true --- src/hs_helper.c | 3 ++- src/libserver/rspamd_control.c | 4 +++- src/libserver/rspamd_control.h | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/hs_helper.c b/src/hs_helper.c index f4f3bed88..4cfd5cbc4 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -210,7 +210,8 @@ rspamd_rs_compile (struct hs_helper_ctx *ctx, struct rspamd_worker *worker, } srv_cmd.type = RSPAMD_SRV_HYPERSCAN_LOADED; - srv_cmd.cmd.hs_loaded.cache_dir = ctx->hs_dir; + rspamd_strlcpy (srv_cmd.cmd.hs_loaded.cache_dir, ctx->hs_dir, + sizeof (srv_cmd.cmd.hs_loaded.cache_dir)); srv_cmd.cmd.hs_loaded.forced = forced; rspamd_srv_send_command (worker, ctx->ev_base, &srv_cmd, -1, NULL, NULL); diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c index d680c35b1..592e3dbc1 100644 --- a/src/libserver/rspamd_control.c +++ b/src/libserver/rspamd_control.c @@ -810,7 +810,9 @@ rspamd_srv_handler (gint fd, short what, gpointer ud) * We assume that cache dir is shared at the same address for all * workers */ - wcmd.cmd.hs_loaded.cache_dir = cmd.cmd.hs_loaded.cache_dir; + rspamd_strlcpy (wcmd.cmd.hs_loaded.cache_dir, + cmd.cmd.hs_loaded.cache_dir, + sizeof (wcmd.cmd.hs_loaded.cache_dir)); wcmd.cmd.hs_loaded.forced = cmd.cmd.hs_loaded.forced; rspamd_control_broadcast_cmd (srv, &wcmd, rfd, rspamd_control_hs_io_handler, NULL); diff --git a/src/libserver/rspamd_control.h b/src/libserver/rspamd_control.h index fd24b856b..c7a60ef58 100644 --- a/src/libserver/rspamd_control.h +++ b/src/libserver/rspamd_control.h @@ -44,7 +44,7 @@ enum rspamd_srv_type { enum rspamd_log_pipe_type { RSPAMD_LOG_PIPE_SYMBOLS = 0, }; - +#define CONTROL_PATHLEN 400 struct rspamd_control_command { enum rspamd_control_type type; union { @@ -61,7 +61,7 @@ struct rspamd_control_command { guint unused; } recompile; struct { - gpointer cache_dir; + gchar cache_dir[CONTROL_PATHLEN]; gboolean forced; } hs_loaded; struct { @@ -112,6 +112,7 @@ struct rspamd_control_reply { }; #define PAIR_ID_LEN 16 + struct rspamd_srv_command { enum rspamd_srv_type type; guint64 id; @@ -122,7 +123,7 @@ struct rspamd_srv_command { guint pair_num; } spair; struct { - gpointer cache_dir; + gchar cache_dir[CONTROL_PATHLEN]; gboolean forced; } hs_loaded; struct { -- 2.39.5