]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow to disable actions by users settings
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 9 Oct 2018 17:30:35 +0000 (18:30 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 9 Oct 2018 17:30:57 +0000 (18:30 +0100)
src/lua/lua_task.c

index c51881df891ea1fbcd829e21bd609c98510561df..1fb7313c000fc03b40ab7e531a8c3049f170ab5d 100644 (file)
@@ -4136,9 +4136,18 @@ lua_task_set_settings (lua_State *L)
                                                rspamd_action_to_str_alt (i), NULL);
 
                                if (elt) {
-                                       mres->actions_limits[i] = ucl_object_todouble (elt);
-                                       msg_debug_task ("adjusted action %s to %.2f",
-                                                       ucl_object_key (elt), mres->actions_limits[i]);
+
+                                       if (ucl_object_type (elt) == UCL_FLOAT ||
+                                                               ucl_object_type (elt) == UCL_INT) {
+                                               mres->actions_limits[i] = ucl_object_todouble (elt);
+                                               msg_debug_task ("adjusted action %s to %.2f",
+                                                               ucl_object_key (elt), mres->actions_limits[i]);
+                                       }
+                                       else if (ucl_object_type (elt) == UCL_NULL) {
+                                               mres->actions_limits[i] = NAN;
+                                               msg_info_task ("disabled action %s due to settings",
+                                                               ucl_object_key (elt));
+                                       }
                                }
                        }
                }