From: Timo Sirainen Date: Tue, 2 May 2023 13:18:11 +0000 (+0300) Subject: config: Escape wildcard characters in written event filters X-Git-Tag: 2.4.0~2085 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6340e65a7b0e8c823d102d49a39fb16574edaeee;p=thirdparty%2Fdovecot%2Fcore.git config: Escape wildcard characters in written event filters protocol and local_name are now compared as exact strings rather than wildcards. --- diff --git a/src/config/config-dump-full.c b/src/config/config-dump-full.c index 3fb2802e5f..0273813df2 100644 --- a/src/config/config-dump-full.c +++ b/src/config/config-dump-full.c @@ -3,6 +3,7 @@ #include "lib.h" #include "str.h" #include "strescape.h" +#include "wildcard-match.h" #include "safe-mkstemp.h" #include "ostream.h" #include "config-parser.h" @@ -74,13 +75,18 @@ config_dump_full_append_filter(string_t *str, unsigned int prefix_len = str_len(str); if (filter->service != NULL) { - if (filter->service[0] != '!') - str_printfa(str, "protocol=\"%s\" AND ", str_escape(filter->service)); - else - str_printfa(str, "NOT protocol=\"%s\" AND ", str_escape(filter->service + 1)); + if (filter->service[0] != '!') { + str_printfa(str, "protocol=\"%s\" AND ", + wildcard_str_escape(filter->service)); + } else { + str_printfa(str, "NOT protocol=\"%s\" AND ", + wildcard_str_escape(filter->service + 1)); + } + } + if (filter->local_name != NULL) { + str_printfa(str, "local_name=\"%s\" AND ", + wildcard_str_escape(filter->local_name)); } - if (filter->local_name != NULL) - str_printfa(str, "local_name=\"%s\" AND ", str_escape(filter->local_name)); if (filter->local_bits > 0) { str_printfa(str, "local_ip=\"%s/%u\" AND ", net_ip2addr(&filter->local_net),