]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Explicitly disallow to set settings on top of other settings
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 2 Sep 2021 09:51:59 +0000 (10:51 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 2 Sep 2021 09:52:52 +0000 (10:52 +0100)
src/lua/lua_task.c

index eabbb26090a617cd9196ffa53c98084c870cb92b..b095de8e7a17e3bbe0d8ef7c9998da4e5ce3e748 100644 (file)
@@ -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) {