Timo Sirainen [Sun, 27 Feb 2022 21:08:31 +0000 (22:08 +0100)]
lib-storage: Change storage-specific settings to regular settings roots (1/3)
This removes the need to have support for "dynamic settings".
This unfortunately also breaks Dovecot for the next two commits. The commits
are large enough that it doesn't make sense to squash them, and trying to
get them to work in the intermediate commits seems to be too much effort.
Timo Sirainen [Tue, 15 Nov 2022 23:20:38 +0000 (01:20 +0200)]
lib-storage, dsync: Use a copy of unexpanded location settings
The unexpanded settings structs are used in only a few places. Replace
this usage by explicitly copying the few variables that are actually
needed. This allows getting rid of the full unexpanded settings structs,
which simplifies the settings handling code.
The original parser stays unexpanded, while a duplicate parser will be
used for expanding settings. Also, since the whole parser is duplicated,
there's no need to anymore duplicate the settings structs themselves.
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.