From 329fd07f3ab99b42c8d4253e8f9d0fea89c049fb Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Thu, 6 Jan 2022 18:02:29 +0100 Subject: [PATCH] Revert set::spamfilter::utf8-support from yesterday. This will be for a later release, needs more thought and work. --- configure | 16 ++++++++-------- configure.ac | 2 +- doc/RELEASE-NOTES.md | 21 +-------------------- include/dynconf.h | 1 - src/conf.c | 7 ------- src/match.c | 9 ++------- src/modules/stats.c | 1 - 7 files changed, 12 insertions(+), 45 deletions(-) diff --git a/configure b/configure index c71ad41c3..aba702782 100755 --- a/configure +++ b/configure @@ -7392,12 +7392,12 @@ if test -n "$PCRE2_CFLAGS"; then pkg_cv_PCRE2_CFLAGS="$PCRE2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.36\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.36") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.34\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.34") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PCRE2_CFLAGS=`$PKG_CONFIG --cflags "libpcre2-8 >= 10.36" 2>/dev/null` + pkg_cv_PCRE2_CFLAGS=`$PKG_CONFIG --cflags "libpcre2-8 >= 10.34" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -7409,12 +7409,12 @@ if test -n "$PCRE2_LIBS"; then pkg_cv_PCRE2_LIBS="$PCRE2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.36\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.36") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.34\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.34") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PCRE2_LIBS=`$PKG_CONFIG --libs "libpcre2-8 >= 10.36" 2>/dev/null` + pkg_cv_PCRE2_LIBS=`$PKG_CONFIG --libs "libpcre2-8 >= 10.34" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -7435,9 +7435,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PCRE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre2-8 >= 10.36" 2>&1` + PCRE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre2-8 >= 10.34" 2>&1` else - PCRE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre2-8 >= 10.36" 2>&1` + PCRE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre2-8 >= 10.34" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PCRE2_PKG_ERRORS" >&5 diff --git a/configure.ac b/configure.ac index 6306ed935..f8d9704cc 100644 --- a/configure.ac +++ b/configure.ac @@ -578,7 +578,7 @@ export PATH_SEPARATOR dnl Use system pcre2 when available, unless --without-system-pcre2. has_system_pcre2="no" AS_IF([test "x$with_system_pcre2" = "xyes"],[ -PKG_CHECK_MODULES([PCRE2], libpcre2-8 >= 10.36,[has_system_pcre2=yes +PKG_CHECK_MODULES([PCRE2], libpcre2-8 >= 10.34,[has_system_pcre2=yes AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libpcre2*])],[has_system_pcre2=no])]) AS_IF([test "$has_system_pcre2" = "no"], [ diff --git a/doc/RELEASE-NOTES.md b/doc/RELEASE-NOTES.md index 79e56ae49..216501cb6 100644 --- a/doc/RELEASE-NOTES.md +++ b/doc/RELEASE-NOTES.md @@ -28,28 +28,9 @@ Enhancements: now an `unrealircdctl.exe` that can be used to do similar things to what you can do on *NIX. Supported operations are: `rehash`, `reloadtls`, `mkpasswd`, `gencloak` and `spkifp`. -* New experimental [Spamfilter](https://www.unrealircd.org/docs/Spamfilter) - support for UTF8. You need to `set { spamfilter { utf8-support yes; } }` - * Case insensitive matches work better. For example, with extended - Latin, a spamfilter on `ę` now also matches `Ę`. - * Other PCRE2 features such as [\p](https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC5) - are now available. For example you can now set a spamfilter with the regex - `\p{Arabic}` to block all Arabic script, or `\p{Cyrillic}` to - block all Cyrillic script (such as Russian). - Please do use these new tools with care. Blocking an entire language - or script is quite a drastic measure. - * These new features require the PCRE2 10.36 regex library. Most people - will have a lower version of PCRE2 on the system, so then UnrealIRCd - will fallback to using the UnrealIRCd-shipped-library (10.39). - The downside to that is that compiling during `./Config` may take - a little longer than usual. - * As said, this is an experimental feature. In the past there have been - issues with it, causing a hanging ircd or matchin too much or too little. - If you try this new utf8-support for spamfilter, let us know if it - works well for you or not. * New option [set::server-notice-show-event](https://www.unrealircd.org/docs/Set_block#set::server-notice-show-event) which can be set to `no` to hide the event information (eg `connect.LOCAL_CLIENT_CONNECT`) - in server notices. This can be overriden per-oper in the + in server notices. This can be overridden per-oper in the [Oper block](https://www.unrealircd.org/docs/Oper_block) via oper::server-notice-show-event. * Support for IRC over UNIX sockets (on the same machine), if you specify a listen::file instead of ip/port. This probably won't be used much, but diff --git a/include/dynconf.h b/include/dynconf.h index 2903288a0..54b1c160c 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -128,7 +128,6 @@ struct Configuration { long spamfilter_detectslow_warn; long spamfilter_detectslow_fatal; int spamfilter_stop_on_first_match; - int spamfilter_utf8_support; int maxbans; int maxbanlength; int watch_away_notification; diff --git a/src/conf.c b/src/conf.c index 5cbf7570c..eb50d7cf2 100644 --- a/src/conf.c +++ b/src/conf.c @@ -7666,10 +7666,6 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) { tempiConf.spamfilter_stop_on_first_match = config_checkval(cepp->value, CFG_YESNO); } - else if (!strcmp(cepp->name, "utf8-support")) - { - tempiConf.spamfilter_utf8_support = config_checkval(cepp->value, CFG_YESNO); - } } } else if (!strcmp(cep->name, "default-bantime")) @@ -8796,9 +8792,6 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) if (!strcmp(cepp->name, "stop-on-first-match")) { } else - if (!strcmp(cepp->name, "utf8-support")) - { - } else { config_error_unknown(cepp->file->filename, cepp->line_number, "set::spamfilter", diff --git a/src/match.c b/src/match.c index 6659238eb..ca361b0de 100644 --- a/src/match.c +++ b/src/match.c @@ -405,13 +405,8 @@ Match *unreal_create_match(MatchType type, const char *str, char **error) int options = 0; char buf2[512]; - options = PCRE2_CASELESS; - - if (iConf.spamfilter_utf8_support) - options |= PCRE2_MATCH_INVALID_UTF; - else - options |= PCRE2_NEVER_UTF|PCRE2_NEVER_UCP; - + options = PCRE2_CASELESS|PCRE2_NEVER_UTF|PCRE2_NEVER_UCP; + m->ext.pcre2_expr = pcre2_compile(str, PCRE2_ZERO_TERMINATED, options, &errorcode, &erroroffset, NULL); if (m->ext.pcre2_expr == NULL) { diff --git a/src/modules/stats.c b/src/modules/stats.c index 3131bc457..bb14cee24 100644 --- a/src/modules/stats.c +++ b/src/modules/stats.c @@ -917,7 +917,6 @@ int stats_set(Client *client, const char *para) sendtxtnumeric(client, "spamfilter::virus-help-channel: %s", SPAMFILTER_VIRUSCHAN); if (SPAMFILTER_EXCEPT) sendtxtnumeric(client, "spamfilter::except: %s", SPAMFILTER_EXCEPT); - sendtxtnumeric(client, "spamfilter::utf8-support: %s", iConf.spamfilter_utf8_support ? "yes" : "no"); sendtxtnumeric(client, "check-target-nick-bans: %s", CHECK_TARGET_NICK_BANS ? "yes" : "no"); sendtxtnumeric(client, "plaintext-policy::user: %s", policy_valtostr(iConf.plaintext_policy_user)); sendtxtnumeric(client, "plaintext-policy::oper: %s", policy_valtostr(iConf.plaintext_policy_oper));