]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: event filter - Allow '?' in filter language tokens
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Thu, 20 May 2021 14:24:35 +0000 (10:24 -0400)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 25 May 2021 10:26:58 +0000 (10:26 +0000)
Without this, it is not possible to use '?' wildcards without quoting the
value.

src/lib/event-filter-lexer.l
src/lib/test-event-filter-parser.c

index ec35a12101d6f1e7024d9f2c8a2d90ffbce892bf..f1d5f9b59301ff13e3e74463a11c5fd500024ce7 100644 (file)
@@ -71,7 +71,7 @@ static size_t event_filter_parser_input_proc(char *buf, size_t size, yyscan_t sc
 [Oo][Rr]                       { return OR; }
 [Nn][Oo][Tt]                   { return NOT; }
 [<>=()]                                { return *yytext; }
-[A-Za-z0-9:.*_-]+              { yylval->str = t_strdup(yytext); return TOKEN; }
+[A-Za-z0-9:.*?_-]+             { yylval->str = t_strdup(yytext); return TOKEN; }
 [ \t\n\r]                      { /* ignore */ }
 .                              {
                                        char msg[160];
index 3f769777c7494a0095246875b85e304546b3ce65..c7973d7ea51c4a0f1879ca97bbd19aad2067c0cf 100644 (file)
@@ -51,6 +51,16 @@ static const char *values_single[] = {
        "foo",
        "foo.c",
        "foo.c:123",
+
+       /* wildcards */
+       "*foo",
+       "f*o",
+       "foo*",
+       "*",
+       "?foo",
+       "f?o",
+       "foo?",
+       "?",
 };
 
 /* values that need to be quoted */
@@ -75,6 +85,10 @@ static const char *values_multi[] = {
        "\xc3\xa4\xc3\xa1\xc4\x8d\xc4\x8f\xc4\x9b\xc5\x88\xc3\xb6\xc5\x99\xc3\xbc\xc3\xba\xc5\xaf",
        /* utf-8: ascii + combining char */
        "r\xcc\x8c",
+
+       /* wildcards */
+       "foo * bar",
+       "foo ? bar",
 };
 
 /* boolean operators used as values get lowercased unless they are quoted */