From: Josef 'Jeff' Sipek Date: Thu, 20 May 2021 14:24:35 +0000 (-0400) Subject: lib: event filter - Allow '?' in filter language tokens X-Git-Tag: 2.3.16~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c6ea200af1a67b6717ee75959e5c59be818cf51;p=thirdparty%2Fdovecot%2Fcore.git lib: event filter - Allow '?' in filter language tokens Without this, it is not possible to use '?' wildcards without quoting the value. --- diff --git a/src/lib/event-filter-lexer.l b/src/lib/event-filter-lexer.l index ec35a12101..f1d5f9b593 100644 --- a/src/lib/event-filter-lexer.l +++ b/src/lib/event-filter-lexer.l @@ -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]; diff --git a/src/lib/test-event-filter-parser.c b/src/lib/test-event-filter-parser.c index 3f769777c7..c7973d7ea5 100644 --- a/src/lib/test-event-filter-parser.c +++ b/src/lib/test-event-filter-parser.c @@ -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 */