Timo Sirainen [Thu, 16 Jan 2025 13:44:50 +0000 (15:44 +0200)]
lib-auth-client: auth-master - Fix crash if failing to connect to socket
auth_master_unset_io() would be called twice: once by
auth_master_run_cmd_pre() and again by auth_master_run_cmd_post(), which
attempts to add the idle timeout again.
It starts to fail with (upcoming) GCC 15 which has improvements for
optimising out redundant pointer-vs-pointer comparisons, specifically r15-580-gf3e5f4c58591f5 for gcc bug PR13962.
Anyway, this is a problem for this assertion because t_malloc_no0
is marked with `__attribute__((malloc))` which guarantees that the
returned pointer doesn't alias, hence a == b must be false.
Timo Sirainen [Sat, 14 Dec 2024 19:20:40 +0000 (21:20 +0200)]
lib-index: mail_transaction_log_view_mark() - Fix crash when log view is empty
This happened when IMAP NOTIFY was used and syncing was delayed enough for
dovecot.list.index to have become rotated twice and gotten missing
transactions.
Stephan Bosch [Tue, 10 Dec 2024 14:45:12 +0000 (15:45 +0100)]
lib-smtp: smtp-command-parser - Explicitly disallow 8-bit characters for AUTH response
Later Base64 parsing would catch that, but command parser errors become clearer
when this is caught early. Also, this fixes a unit test failure when
experimental SMTPUTF8 support is enabled.
When SMTPUTF8 support is disabled, smtp_char_is_textstr() disallows 8-bit
implicitly, but when SMTPUTF8 is enabled 8-bit octets will be let through.
This caused the invalidity unit test to fail.
Timo Sirainen [Mon, 2 Dec 2024 10:11:48 +0000 (12:11 +0200)]
dict-ldap: Avoid linking to a dovecot-ldap shared library
The dict-ldap itself is the plugin, which is dynamically loaded.
There's no need for dovecot-ldap shared library to be used. This
changes the lib-ldap linking behavior to same as lib-sql.
Timo Sirainen [Thu, 21 Nov 2024 10:23:46 +0000 (12:23 +0200)]
auth: Fix userdb auth cache with username changes
The problem was for example when userdb lookup uses only the username part
of the username@domain lookup. Then:
* "username" lookup caches the results for "username". Since the username
didn't change, it doesn't store in the cache the "user" field.
* "username@domain" lookup looks up "username" from cache. Since there is
no "user" field, the code didn't think the username had changed.
Fix this by saving the "user" field to auth cache, regardless of whether
it's the same as the current username.
Timo Sirainen [Tue, 29 Oct 2024 08:36:43 +0000 (10:36 +0200)]
imap: Fix potential hang/assert-crash when client sends too long line
If client sent some commands pipelined, followed by a command with too long
line, the previous commands' tagged replies weren't sent. This caused it to
hang until more input was received. After that it crashed.
Timo Sirainen [Wed, 23 Oct 2024 07:42:35 +0000 (10:42 +0300)]
lib-index: Fix potential crash after resetting index
The log's sync_offset wasn't updated after the reset if there were no other
changes. This ended up in a broken state in
mail_transaction_log_append_locked() where it thought there was garbage at
the end of the transaction log, and crashed trying to truncate it.
Markus Valentin [Wed, 2 Oct 2024 08:18:07 +0000 (10:18 +0200)]
imapc: If a shared namespace INBOX is listed as \Noselect enforce it
In specific configurations a shared namespace INBOX is listed as
\Noselect
* LIST (\HasChildren) "/" shared/user
* LIST (\HasChildren \Noselect) "/" shared/user/INBOX
Timo Sirainen [Mon, 14 Oct 2024 05:49:37 +0000 (08:49 +0300)]
lib-storage: Mailbox list rebuild - avoid opening mailbox on recovery name collision
If recovered-lost-folder-$guid already unexpectedly exists, there's no need
to open it (at this point) to try to recover its name. This didn't really harm
anything, so it mainly fixes the code logic to make sense.
Timo Sirainen [Mon, 14 Oct 2024 09:53:33 +0000 (12:53 +0300)]
imap: Fix potential hang/crash when unhibernating
This fixes two potential bugs:
a) Unhibernation is triggered by new mailbox changes. While sending these
to IMAP client, Dovecot notices that the client has disconnected. The
process will stay IDLEing for 30 minutes until it gets disconnected with
"Disconnected: Inactivity - no input for 1800 secs"
b) Unhibernation is triggered by DONE command with some further pipelined
commands. During unhibernation new mailbox changes are noticed, and
again IMAP client is found to be disconnected while sending the changes.
This causes a segfault.
Timo Sirainen [Mon, 9 Jul 2018 13:23:10 +0000 (16:23 +0300)]
lib: o_stream_close() - Don't reset error checking on automatic flush
Otherwise it will be difficult to find missing o_stream_flush() calls.
The missing error handling would be found only when the flushing fails,
which would result in assert-crash.