Timo Sirainen [Sat, 26 Feb 2022 21:16:33 +0000 (22:16 +0100)]
lib-settings: Add settings_parser_get_root_set()
To make this work, for now we need to have a pointer to the original
struct setting_parser_info before dynamic parsers reallocate it. After
removing dynamic parsers this orig_info can be removed as well.
Timo Sirainen [Thu, 17 Nov 2022 17:04:54 +0000 (19:04 +0200)]
lib-storage: Fix calling mail_user_get_mail_home() during user initialization
When it's not already known that settings have been expanded, access
mail_home via unexpanded settings. This guarantees that the setting
hasn't been expanded yet. There's no guarantee whether user->set has
been expanded or not during mail_user_init().
Marco Bettini [Tue, 22 Nov 2022 14:28:53 +0000 (14:28 +0000)]
lib-fts: fts_filter_stemmer_snowball_filter() - Handle cases where the stemmer returns no tokens
Fixes an issue raised originally against flatcurve in GitHub Issue #37,
where in some combination of languages and filters, the indexing crashes.
The ultimate cause was the improper assumption that snowball ALWAYS returns
a token, which happens to not be true.
Marco Bettini [Thu, 17 Nov 2022 15:59:02 +0000 (15:59 +0000)]
fts-flatcurve: Fix queries with non character-based searches
Xapian::QueryParser tries to tokenize phrases with non-letters (at least
in certain situations), so this was leading to strange behavior when
searching for e-mail addresses.
Solution: manually create queries using low-level Xapian::Query commands
to precisely define the query. Has the added benefit of making the code
more compact and easier to read.
Marco Bettini [Thu, 17 Nov 2022 15:10:56 +0000 (15:10 +0000)]
fts-flatcurve: Simplify handling of phrase queries
Dovecot FTS drivers can't properly support phrase searching (as of
v2.3.19), so simply ignore these queries in flatcurve. Both IMAP
searches and doveadm searches will pass both the phrase and the
component terms as part of the query, so no need to split the phrases
in the plugin.
Karl Fleischmann [Fri, 11 Nov 2022 14:42:01 +0000 (15:42 +0100)]
lib: Try to interpret filter values as intervals when parsing integer event values
This allows event filter values to be given as "1days" or "1week". This
is only done after parsing sizes and thus sizes takes precedences. Thus
for ambiguous units like "M" sizes are used before intervals (e.g. "1M"
= "1024 * 1024" and not "1M" = "60 * 60 * 1000 * 1000").
This change also slightly changes the lmtp log prefixes in some places.
It removes "conn $ip:$port [$idx]: rcpt $user:" from some of the log
messages (but that wasn't in all of the log messages anyway), but it now
always includes mail_log_prefix in these log messages, which previously
wasn't always set at that point yet.
Timo Sirainen [Fri, 4 Nov 2022 19:58:30 +0000 (21:58 +0200)]
login-common: Handle haproxy's TLS terminated connections same as if Dovecot did TLS termination
If haproxy is running on localhost, this is clearly the case. If haproxy
is not running on localhost, it's a bit more ambiguous. It is possible to
configure haproxy to do TLS termination and then use another TLS connection
towards Dovecot, but this is likely a not so common configuration. More
likely the intention is that if haproxy has done TLS termination, it should
be handle the same as if Dovecot had done it.
This commit doesn't actually change any behavior. It just makes the tls
variables work in a more consistent way.
Timo Sirainen [Fri, 4 Nov 2022 21:50:49 +0000 (23:50 +0200)]
login-common: Connections from haproxy are always considered secured
Similarly to non-haproxy connections from login_trusted_networks are
considered secured, connections from haproxy_trusted_networks should also be
considered secured.
Timo Sirainen [Thu, 3 Nov 2022 17:22:07 +0000 (19:22 +0200)]
lib-master: Rename "proxy" connections to "haproxy"
We already have a Dovecot proxy, and naming haproxy connections simply as
"proxy" just causes confusion. If we end up supporting other types of
proxy protocols later on, we can try to figure out a better name.
Aki Tuomi [Tue, 15 Nov 2022 11:44:46 +0000 (13:44 +0200)]
lib: event-filter - Ensure 0 can be matched correctly in filters
Allow matching fields with > 0, priorly this would have always been
treated as string equality / wildcard match, instead we now want
to match it as number. Forgotten in 61cb32860f5237c5d928a7fed8a89f783c2f9b30
Aki Tuomi [Tue, 15 Nov 2022 11:22:16 +0000 (13:22 +0200)]
lib: event-filter - Fix matching duration field
If duration field is used in event filter, it cannot be matched
here as no such field exists. We need to actually synthesize the
field here for matching.
In 1a7b1f66fe the non-standard extern timezone was partially removed,
but some instances were left. Since the test is supposed to run with
TZ=UTC, and timezone would have been zero anyway, remove them all.