]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Also allow to set objects to null for disabling
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 30 Mar 2022 20:15:00 +0000 (21:15 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 30 Mar 2022 20:15:00 +0000 (21:15 +0100)
src/rspamd_proxy.c

index d875c0efe4faee59b6cb107a99b7cafccafc4ed2..937a6af895564e73d7c3ebe3c88dad7c4dbaaa97 100644 (file)
@@ -334,6 +334,12 @@ rspamd_proxy_parse_upstream (rspamd_mempool_t *pool,
                return FALSE;
        }
 
+       if (ucl_object_type (obj) != UCL_NULL) {
+               msg_info_pool_check("upstream %s is disabled by setting it to NULL",
+                               ucl_object_key (obj));
+               return TRUE;
+       }
+
        if (!rspamd_config_is_enabled_from_ucl (pool, obj)) {
                /* Upstream is valid but disabled */
                msg_info_pool_check("upstream %s is disabled",
@@ -499,6 +505,12 @@ rspamd_proxy_parse_mirror (rspamd_mempool_t *pool,
        ctx = pd->user_struct;
        L = ctx->lua_state;
 
+       if (ucl_object_type (obj) != UCL_NULL) {
+               msg_info_pool_check("mirror %s is disabled by setting it to NULL",
+                               ucl_object_key (obj));
+               return TRUE;
+       }
+
        if (ucl_object_type (obj) != UCL_OBJECT) {
                g_set_error (err, rspamd_proxy_quark (), 100,
                                "mirror option must be an object");
@@ -508,7 +520,7 @@ rspamd_proxy_parse_mirror (rspamd_mempool_t *pool,
 
        if (!rspamd_config_is_enabled_from_ucl (pool, obj)) {
                /* Upstream is valid but disabled */
-               msg_info_pool_check("upstream %s is disabled",
+               msg_info_pool_check("mirror %s is disabled",
                                ucl_object_lookup (obj, "name") ?
                                ucl_object_tostring(ucl_object_lookup (obj, "name")) :
                                ucl_object_key (obj));