aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-12 15:13:03 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-12 15:13:03 +0100
commitcdc100b748c784d1c8e55aee647dfed53b6df893 (patch)
treef718c29f9d57fd07e365536c76175b01020d1aec
parent2ca160e852d55eb549f6f78ca7e09cab2b13a0e6 (diff)
downloadrspamd-cdc100b748c784d1c8e55aee647dfed53b6df893.tar.gz
rspamd-cdc100b748c784d1c8e55aee647dfed53b6df893.zip
[Fix] Fix dynamic settings application
Issue: #769 Closes: #769
-rw-r--r--src/libserver/dynamic_cfg.c8
-rw-r--r--src/plugins/lua/dynamic_conf.lua19
2 files changed, 18 insertions, 9 deletions
diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c
index 121158526..584590ed9 100644
--- a/src/libserver/dynamic_cfg.c
+++ b/src/libserver/dynamic_cfg.c
@@ -152,7 +152,6 @@ json_config_read_cb (gchar * chunk,
if (data->cur_data == NULL) {
jb = g_malloc0 (sizeof (*jb));
jb->cfg = pd->cfg;
- jb->buf = pd->buf;
data->cur_data = jb;
}
else {
@@ -161,7 +160,7 @@ json_config_read_cb (gchar * chunk,
if (jb->buf == NULL) {
/* Allocate memory for buffer */
- jb->buf = g_string_sized_new (BUFSIZ);
+ jb->buf = g_string_sized_new (MAX (len, BUFSIZ));
}
g_string_append_len (jb->buf, chunk, len);
@@ -179,6 +178,10 @@ json_config_fin_cb (struct map_cb_data *data)
if (data->prev_data) {
jb = data->prev_data;
/* Clean prev data */
+ if (jb->buf) {
+ g_string_free (jb->buf, TRUE);
+ }
+
g_free (jb);
}
@@ -190,6 +193,7 @@ json_config_fin_cb (struct map_cb_data *data)
msg_err ("no data read");
return;
}
+
if (jb->buf == NULL) {
msg_err ("no data read");
return;
diff --git a/src/plugins/lua/dynamic_conf.lua b/src/plugins/lua/dynamic_conf.lua
index 29f63e90c..ffe1f7e9c 100644
--- a/src/plugins/lua/dynamic_conf.lua
+++ b/src/plugins/lua/dynamic_conf.lua
@@ -319,10 +319,15 @@ local function add_dynamic_action(_, act, score)
return add
end
-if redis_params then
- rspamd_plugins["dynamic_conf"] = {
- add_symbol = add_dynamic_symbol,
- add_action = add_dynamic_action,
- }
- lua_util.disable_module(N, "redis")
-end
+if section then
+ if redis_params then
+ rspamd_plugins["dynamic_conf"] = {
+ add_symbol = add_dynamic_symbol,
+ add_action = add_dynamic_action,
+ }
+ else
+ lua_util.disable_module(N, "redis")
+ end
+else
+ lua_util.disable_module(N, "config")
+end \ No newline at end of file