Timo Sirainen [Tue, 1 Feb 2022 13:57:16 +0000 (14:57 +0100)]
lmtp: proxy - Add per-connection counter to session_id
This way connections to two different backends don't try to use the same
session_id. Add 'P' letter before the counter to clarify that it's the
proxy connection counter.
Timo Sirainen [Tue, 1 Feb 2022 13:40:48 +0000 (14:40 +0100)]
lmtp: Simplify/clarify per-recipient session ID
The session ID is the transaction ID followed by an increasing recipient
count (number of RCPT commands) in the SMTP transaction. Clarify this by
adding 'R' letter before the counter. Also don't add the counter suffix at
all for the first recipient, since most transactions only have a single
recipient.
Timo Sirainen [Tue, 1 Feb 2022 13:35:05 +0000 (14:35 +0100)]
lib-smtp: server-transaction - Simplify/clarify transaction ID
The transaction ID is the session ID followed by an increasing transaction
count (number of MAIL commands) in the SMTP server connection. Clarify
this by adding 'T' letter before the counter. Also don't add the counter
suffix at all for the first session, since most sessions only have a
single transaction.
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.
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)