commit 23bc820: [Minor] Allow workers to have any attributes (needed by fuzzy)

Vsevolod Stakhov vsevolod at rspamd.com
Thu Aug 17 11:49:21 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-08-17 12:00:48 +0100
URL: https://github.com/rspamd/rspamd/commit/23bc82085c7dc90cb7fffb5e5363647eb5b9b39b

[Minor] Allow workers to have any attributes (needed by fuzzy)

---
 src/fuzzy_storage.c       | 8 ++++----
 src/libserver/cfg_rcl.cxx | 3 ++-
 src/rspamd.h              | 1 +
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 0110ed8c2..21c5c271e 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2023 Vsevolod Stakhov
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -61,7 +61,7 @@ worker_t fuzzy_worker = {
 	"fuzzy",     /* Name */
 	init_fuzzy,  /* Init function */
 	start_fuzzy, /* Start function */
-	RSPAMD_WORKER_HAS_SOCKET,
+	RSPAMD_WORKER_HAS_SOCKET | RSPAMD_WORKER_NO_STRICT_CONFIG,
 	RSPAMD_WORKER_SOCKET_UDP, /* UDP socket */
 	RSPAMD_WORKER_VER         /* Version info */
 };
diff --git a/src/libserver/cfg_rcl.cxx b/src/libserver/cfg_rcl.cxx
index 196c15e57..cfa8b0f67 100644
--- a/src/libserver/cfg_rcl.cxx
+++ b/src/libserver/cfg_rcl.cxx
@@ -810,7 +810,8 @@ rspamd_rcl_worker_handler(rspamd_mempool_t *pool, const ucl_object_t *obj,
 					}
 				}
 			}
-			else if (known_worker_attributes.find(std::string_view{ucl_object_key(cur)}) == known_worker_attributes.end()) {
+			else if (!(wrk->worker->flags & RSPAMD_WORKER_NO_STRICT_CONFIG) &&
+					 known_worker_attributes.find(std::string_view{ucl_object_key(cur)}) == known_worker_attributes.end()) {
 				msg_warn_config("unknown worker attribute: %s; worker type: %s", ucl_object_key(cur), worker_type);
 			}
 		}
diff --git a/src/rspamd.h b/src/rspamd.h
index 8c92e1818..523ea79c3 100644
--- a/src/rspamd.h
+++ b/src/rspamd.h
@@ -68,6 +68,7 @@ enum rspamd_worker_flags {
 	RSPAMD_WORKER_CONTROLLER = (1 << 6),
 	RSPAMD_WORKER_NO_TERMINATE_DELAY = (1 << 7),
 	RSPAMD_WORKER_OLD_CONFIG = (1 << 8),
+	RSPAMD_WORKER_NO_STRICT_CONFIG = (1 << 9),
 };
 
 struct rspamd_worker_accept_event {


More information about the Commits mailing list