commit e96512e: [Minor] Also allow to set objects to null for disabling

Vsevolod Stakhov vsevolod at rspamd.com
Wed Mar 30 20:21:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-03-30 21:15:00 +0100
URL: https://github.com/rspamd/rspamd/commit/e96512e68ba5268c76b2ebbee45d14bee423a6d3 (HEAD -> master)

[Minor] Also allow to set objects to null for disabling

---
 src/rspamd_proxy.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index d875c0efe..937a6af89 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -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));


More information about the Commits mailing list