Siavash Tavakoli [Mon, 22 Feb 2021 15:29:30 +0000 (15:29 +0000)]
lib-storage: mailbox-list: Add default storage name escaping for index layout
Add a default value for "storage_name_escape_char" when "LAYOUT=index".
Needed for situations where mailbox name contains separator char (e.g.
after migration to new separator) and listescape plugin is not active.
Timo Sirainen [Mon, 15 Mar 2021 16:18:07 +0000 (18:18 +0200)]
lib: cpu-limit - Redesign the API
The new API no longer has a signal callback, just a cpu_limit_exceeded()
function that needs to be periodically called to check if the limit has
exceeded. The callback could be added back if really necessary, but it's
just too easy to use signal handlers unsafely.
The new API also supports separating limits for user and system CPU usage.
It also attempts to guard against any unexpected kernel behavior resulting
from unclear behavior on how exactly the getrlimit(), setrlimit() and XCPU
signals interact.
Timo Sirainen [Mon, 15 Mar 2021 13:37:55 +0000 (15:37 +0200)]
lib: cpu-time - Use the original struct rusage as the initial_usage
This will allow separation of user and system CPU usage tracking.
They could have been tracked with two separate struct timevals, but
the extra memory usage is small and it might be nice to have all the
available data for debugging.
Timo Sirainen [Wed, 10 Mar 2021 15:40:47 +0000 (17:40 +0200)]
lib-imap: Fix assert-crash if parsing invalid BODYSTRUCTURE with empty Content-Language list
If there's no Content-Language, it should be NIL in the bodystructure.
So if the value is (), it is invalid.
This could in theory have happened when parsing corrupted
dovecot.index.cache or receiving it from a broken remote IMAP server with
imapc. The bug was found by fuzzing though.
It is possible that the system has several different versions of Lua
installed. This change allows one to force a specific version of Lua during
./configure. For example:
Timo Sirainen [Tue, 9 Mar 2021 16:42:38 +0000 (18:42 +0200)]
lib-storage: Don't trust last-rename-stamp that is too far into the future
If the timestamp is in the future, autoexpunging stops working until the
future time is passed. If this happened due to corruption, it could take
a long time before the timestamp is reached.
Timo Sirainen [Thu, 31 Oct 2019 13:27:49 +0000 (15:27 +0200)]
auth: auth-worker-client: Set "error" for all auth worker request failures
Previously the error was set only for protocol errors. Now it's set for
everything, including password mismatches. However, only the protocol
errors are logged with error level, others are debug level.
Timo Sirainen [Tue, 2 Mar 2021 13:15:09 +0000 (15:15 +0200)]
lib-smtp: Standardize iostream error handling
Use [io]_stream_get_disconnect_reason() for logging all errors.
None of the iostream errors are logged as error level anymore. This way
for example TLS connection problems caused by broken clients aren't
logged as errors.
client_disconnect() is now removed. Instead, client_destroy() now calls
smtp_server_connection_terminate() directly to cause a disconnection and
smtp_server_callbacks.conn_disconnect() handles the disconnection directly.
This same behavior happened earlier also, but it wasn't as clear.
Timo Sirainen [Fri, 5 Mar 2021 15:03:11 +0000 (17:03 +0200)]
lib-smtp, lmtp, submission: Move adding "(state=%s)" in disconnection reason to lib-smtp
The following changes will break this in submission and lmtp. The state
will be reset before conn_disconnect() is called, so they would always log
state=READY.
Timo Sirainen [Tue, 2 Mar 2021 12:17:29 +0000 (14:17 +0200)]
lib-smtp: Add "unfinished %s command" if client disconnected during command processing
This also removes the need for special code path to differentiate between
logging "Remote closed connection" and "Remote closed connection
unexpectedly".
Emit an event named "indexer_worker_indexing_finished", with following
extra fields:
- message_count: Number of messages indexed
- first_uid: First uid of the message indexed
- last_uid: Last uid of the message indexed
- user_cpu_usecs: Total user mode cpu time spent on indexing
On successful indexing and on MAIL_ERROR_NOTFOUND error event is emitted
with "e_debug()", in other error situations event is emitted with "e_error()".
- Add an internal rusage struct to events to keep track of resource usage.
- "event_enable_user_cpu_usecs()" enables "user_cpu_usecs" field for the event
If "user_cpu_usecs" field is enabled, user CPU time will be calculated
at the time of sending the event and will be added to event fields.
Stephan Bosch [Fri, 12 Feb 2021 12:11:53 +0000 (13:11 +0100)]
lib-smtp: test-smtp-client-errors - Amend early data reply test to verify that connection is still viable.
Some problems only surface when the connection is reused for the next command.
Before, the connection was terminated immediately after the transaction, which
hides such issues.
Timo Sirainen [Fri, 5 Mar 2021 13:26:24 +0000 (15:26 +0200)]
lib-mail: mail-html2text - Fix character signedness type mismatch
Fixes ubsan complaints:
mail-html2text.c:186:12: runtime error: implicit conversion from type 'unsigned char' of value 226 (8-bit, unsigned) to type 'char' changed the value to -30 (8-bit, signed)
Timo Sirainen [Fri, 5 Mar 2021 10:44:42 +0000 (12:44 +0200)]
fts-tika: Don't fail indexing if Tika returns 5xx error
Broken by 8e1eaf849ce4668c0941338e3e3671db159da575, which changed 5xx to be
retried once before it was ignored. However, it accidentally changed the
second 5xx to return failure instead of being ignored.