From 50753b46784b0cd76dcba3bacb2bf9da5d6ed3a2 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 21 Jul 2023 12:24:45 +0200 Subject: [PATCH] Make central spamfilters require an 'id', and ignore for non-central. At least for now... --- src/modules/tkl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/tkl.c b/src/modules/tkl.c index 027b9aabb..d748ea956 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -521,6 +521,13 @@ int tkl_config_test_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type, int *e config_warn("*****************"); } + if (central_spamfilter && !has_id) + { + config_error("%s:%i: central spamfilter encountered without 'id', rejected.", + ce->file->filename, ce->line_number); + errors++; + } + if (central_spamfilter && errors) { ce->bad = 1; @@ -617,6 +624,8 @@ int tkl_config_run_spamfilter(ConfigFile *cf, ConfigEntry *ce, int type) lower_ban_action_to_maximum(action, iConf.central_spamfilter_limit_ban_action); if (iConf.central_spamfilter_limit_ban_time && (bantime > iConf.central_spamfilter_limit_ban_time)) bantime = iConf.central_spamfilter_limit_ban_time; + } else { + id = NULL; } if (match) @@ -2732,6 +2741,7 @@ TKL *_tkl_add_spamfilter(int type, const char *id, unsigned short target, BanAct safe_strdup(tkl->ptr.spamfilter->tkl_reason, tkl_reason); tkl->ptr.spamfilter->except = except; tkl->ptr.spamfilter->tkl_duration = tkl_duration; + safe_strdup(tkl->ptr.spamfilter->id, id); if (tkl->ptr.spamfilter->target & SPAMF_USER) loop.do_bancheck_spamf_user = 1;