diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-20 15:33:41 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-20 15:33:41 +0100 |
commit | 4f02ece36c8484554d9856b2d28163870375b528 (patch) | |
tree | 79b99d90f59af524fd63ab55f6bea4d7358bebb2 | |
parent | 6f6cc0bf2f27ace6cd773d03148fb41742dab1fc (diff) | |
download | rspamd-4f02ece36c8484554d9856b2d28163870375b528.tar.gz rspamd-4f02ece36c8484554d9856b2d28163870375b528.zip |
[Minor] Merge rmilter reply instead of overwriting it
-rw-r--r-- | src/lua/lua_task.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 68822f348..8445e25ed 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -3520,14 +3520,23 @@ static gint lua_task_set_rmilter_reply (lua_State *L) { struct rspamd_task *task = lua_check_task (L, 1); - ucl_object_t *reply; + ucl_object_t *reply, *prev; reply = ucl_object_lua_import (L, 2); if (reply != NULL && task != NULL) { - rspamd_mempool_set_variable (task->task_pool, - RSPAMD_MEMPOOL_RMILTER_REPLY, - reply, (rspamd_mempool_destruct_t)ucl_object_unref); + prev = rspamd_mempool_get_variable (task->task_pool, + RSPAMD_MEMPOOL_RMILTER_REPLY); + + if (prev) { + ucl_object_merge (prev, reply, false); + ucl_object_unref (reply); + } + else { + rspamd_mempool_set_variable (task->task_pool, + RSPAMD_MEMPOOL_RMILTER_REPLY, + reply, (rspamd_mempool_destruct_t) ucl_object_unref); + } } else { return luaL_error (L, "invalid arguments"); |