Timo Sirainen [Thu, 20 Jan 2022 13:13:48 +0000 (14:13 +0100)]
lib: ostream-multiplex - Call flush callbacks also when stream has failed
It may be important for the flush callbacks to know when ostream has been
closed. This is a partial fix to prevent doveadm-server hanging when it's
printing lots of output and doveadm client disconnects.
Markus Valentin [Wed, 22 Dec 2021 11:12:51 +0000 (12:12 +0100)]
imapc: Fix doveadm copy with imapc
When copying to a mailbox with imapc it does not sync the destination
mailbox when opening. This created "Error: Syncing mailbox '$mailboxname'
failed: Internal error occurred." Prevent this error by checking for the
MAILBOX_FLAG_SAVEONLY flag which is used by doveadm to create the
destination mailbox. If that flag is set ignore that there was no initial
fetching done.
Stephan Bosch [Mon, 9 Nov 2020 01:29:04 +0000 (02:29 +0100)]
lib-smtp: smtp-server-cmd-rset - Stop processing pipeline until RSET is complete.
A subsequent MAIL command could get reset in the middle otherwise. Before, it
only blocked input until a reply was submitted, but the transaction isn't reset
until the RSET command is complete (just before actually sending the reply)
which can cause issues when the subsequent MAIL command is already being
processed.
Stephan Bosch [Sun, 8 Nov 2020 23:02:51 +0000 (00:02 +0100)]
lib-smtp: smtp-server-cmd-helo - Stop processing pipeline until HELO/EHLO is complete.
A subsequent MAIL command could get reset in the middle otherwise. Before, it
only blocked input until a reply was submitted, but the transaction isn't reset
until the EHLO/HELO command is complete (just before actually sending the reply)
which can cause issues when the subsequent MAIL command is already
being processed.
Timo Sirainen [Thu, 20 Jan 2022 10:42:57 +0000 (12:42 +0200)]
lib-storage: Don't delay setting mail event's log prefix
This caused crashes if the mail event was kept referenced and used for
logging after struct mail was already freed. With the delayed mail event
creation the log prefix shouldn't be much of a performance problem, so just
set the prefix immediately.
Stephan Bosch [Mon, 13 Dec 2021 03:08:32 +0000 (04:08 +0100)]
submssion: submission-backend-relay - Avoid logging two errors about a connection problem.
Earlier commit changed lib-smtp to consistently log an error for connection
problems, which causes a second error to occur for submission relay backend.
This is undesirable.
Timo Sirainen [Tue, 28 Dec 2021 07:37:42 +0000 (09:37 +0200)]
lib-storage: Remove most reason_code=mail:*
Event reasons create events internally. This is rather expensive if it's
done for operations that access all emails in a large folder, e.g. SORT.
The per-mail reason_codes also didn't seem to be hugely helpful, so best
to just remove them.
Some of the mail:* reasons were left where they are causing mail stream to
be opened anyway. In these cases the extra CPU used by event reasons is
relatively little.
Timo Sirainen [Thu, 9 Dec 2021 17:06:11 +0000 (18:06 +0100)]
lib-fts: Reuse textcat handle between sessions
textcat initialization is rather CPU intensive. Its configuration is
normally always the same between sessions, so we can keep the latest textcat
handle cached.
Timo Sirainen [Mon, 29 Nov 2021 12:26:25 +0000 (13:26 +0100)]
lib-storage: Optimize setting mail event log prefix
This was much more important before mail event creation was delayed. In one
installation the t_strdup_printf() call itself took about 4% of the total CPU
usage. Now that mail events are delayed, this is likely much less of an issue.
Still, this is easy enough of an optimization that might as well do it.
Timo Sirainen [Mon, 29 Nov 2021 14:43:29 +0000 (15:43 +0100)]
lib-storage: Make sure mail event is created before accessing streams or metadata
This is in preparation for the next commit which delays the mail event
creation. The event duration behaves better if the event is created before
any potentially slow access is done.
Timo Sirainen [Mon, 29 Nov 2021 17:24:30 +0000 (18:24 +0100)]
lib-storage: Rename mail.mail_stream_opened to mail_stream_accessed
It is set to TRUE even if the mail stream couldn't successfully be opened,
so this describes it better. Also it's now consistent with
mail_metadata_accessed.
Karl Fleischmann [Wed, 15 Dec 2021 08:19:40 +0000 (09:19 +0100)]
login-common: Explicitly null client auth fields on proxy pool unref
Explicitly setting `client_id` and `forward_fields` to null in the
client may reveal use-after-free issues when trying to access these
fields on a client proxy.
Karl Fleischmann [Fri, 10 Dec 2021 10:04:06 +0000 (11:04 +0100)]
login-common: Use base index for aliases
Define a base index for aliases in the login variable table. Assign
values via offset of that base index. This allows adding more values
later without updating any subsequent index.
Marco Bettini [Mon, 6 Dec 2021 10:54:16 +0000 (11:54 +0100)]
auth: userdb-ldap - Avoid early dereferencing
userdb_ldap_iterate_callback() is still invoked after dereferencing
auth_request in userdb_ldap_iterate_deinit().
Normally this happens only on teardown, but it may happens also
in case of auth disconnecting from auth-worker during iteration.
(which shouldn't happen unless the auth process crashes)
Timo Sirainen [Mon, 19 Apr 2021 16:48:09 +0000 (18:48 +0200)]
lib-storage: Optimize behavior when building THREAD tree with empty cache
Although it's possible that Date, Subject or received-date isn't actually
needed for all mails, it's much more efficient behavior to add all of these
to cache at the same time if they're not there already. Otherwise the same
mail could be opened and parsed up to 3 times.