commit ed6360a: [Minor] Explicitly disallow to set settings on top of other settings

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Sep 2 09:56:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-02 10:51:59 +0100
URL: https://github.com/rspamd/rspamd/commit/ed6360a904f8082f4048332640e5f09ca9989854 (HEAD -> master)

[Minor] Explicitly disallow to set settings on top of other settings

---
 src/lua/lua_task.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index eabbb2609..b095de8e7 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -5661,6 +5661,13 @@ lua_task_set_settings (lua_State *L)
 
 	if (settings != NULL && task != NULL) {
 
+		if (task->settings) {
+			/* Do not allow to set settings on top of the existing ones */
+			ucl_object_unref (settings);
+
+			return luaL_error (L, "invalid invocation: settings has been already set");
+		}
+
 		metric_elt = ucl_object_lookup (settings, DEFAULT_METRIC);
 
 		if (metric_elt) {


More information about the Commits mailing list