Timo Sirainen [Tue, 17 May 2022 10:31:40 +0000 (12:31 +0200)]
lib-master: Use ssl_require_crl setting only for server-side SSL settings
We don't currently properly support checking CRLs when acting as SSL client.
The CRL would have to be stored as part of the CAs, which isn't commonly
done. This bug has been in the code ever since it was added in 30c5c1fc3608ae575f11960281d3e338b6bf7bc8, but it became more noticeable
with recent changes that started using lib-master for getting all SSL
client settings, e.g. 1e5324b5805bf7299cd8196f7b659fe935f027bd
Use the generic dbox scanning code, which avoids stat()ing the directory by
keeping the timestamp in index header. Also do the scanning while at
session deinit instead of startup, so the latency isn't visible to clients.
dbox files are always created with DBOX_TEMP_FILE_PREFIX, not the mailbox
list-specific prefix. This was a problem only if dbox was used with
LAYOUT=Maildir++, which nobody was likely to do. Other layouts had
identical temp file prefixes to DBOX_TEMP_FILE_PREFIX.
Timo Sirainen [Tue, 20 Jun 2023 15:44:52 +0000 (18:44 +0300)]
mdbox: Don't do temp file scanning for mailbox directories
The intention was to delete any temporary mail files that have been left
behind by crashed processes, but mail files are written to storage/
directory.
Timo Sirainen [Tue, 20 Jun 2023 15:24:34 +0000 (18:24 +0300)]
mdbox: Fix fdatasync() path when saving mails
It was supposed to be called on the parent directory of where mails were
written, i.e. storage/ directory. The previous code was instead calling it
on the mailbox-specific directory (similarly to sdbox) where nothing was
written.
Timo Sirainen [Sun, 5 Feb 2023 18:47:08 +0000 (20:47 +0200)]
lib-index: Don't update max_tail_offset if write to dovecot.index.log fails
The max_tail_offset didn't actually increase in that situation.
This fixes wrongly updating mail_index_header.log_file_tail_offset after
write to dovecot.index.log failed (due to out of disk space), which in
turn can cause some unexpected errors.
Timo Sirainen [Fri, 24 Mar 2023 00:29:39 +0000 (02:29 +0200)]
imap: Update process title while unhibernating
Previously the process title stayed as [idling] even though the process was
busy waiting on the imap-hibernate process to finish sending the
unhibernation request.
Timo Sirainen [Thu, 23 Mar 2023 23:45:34 +0000 (01:45 +0200)]
imap: Improve disconnection log message if it happens immediately after unhibernation
The "No commands sent after unhibernation" can mean that imap-hibernate
process saw a timeout while unhibernating and shutdown the connection.
Or it can also mean just that the client itself disconnected.
Timo Sirainen [Thu, 23 Mar 2023 23:41:37 +0000 (01:41 +0200)]
imap-hibernate: If unhibernation fails, make sure imap process won't finish it later on
Especially if unhibernation fails due to a connection timeout to imap
process due to high load, it's possible that the imap process will
eventually finish the unhibernation and continue with the client. This is
rather confusing, since imap-hibernate process already logged that the
client got disconnected.
Timo Sirainen [Thu, 23 Mar 2023 20:23:39 +0000 (22:23 +0200)]
master: Fix service { idle_kill } to work better on busy servers
The previous behavior was to kill a process once it had idled for idle_kill
seconds. However, on a busy server the new connections are picked up somewhat
randomly by all the idling processes, so there's never any single process
idling for a long time. This effectively prevents the idle_kill from killing
any processes, even if there are unnecessarily many of them.
The new behavior here tracks the lowest number of idling processes during
idle_kill time interval. Then it kills that many processes. If the load
stays the same, this should shrink the number of processes to the number
that is needed to handle the load, but no more.
Timo Sirainen [Mon, 3 Apr 2023 21:43:55 +0000 (00:43 +0300)]
dsync: Fix handling mailboxes with % character when BROKENCHAR isn't explicitly set in config
When vname_escape_char (= BROKENCHAR) isn't explicitly set in configuration,
'%' character (or if it was hierarchy separator, '~') was used as the default
internal escape character. However, this was used inconsistently between local
and remote mailbox trees. The remote tree stored the mailbox names unescaped,
while the local mailbox names were escaped. This inconsistency caused dsync
to do unnecessary mailbox renames, which might have ended up failing.
This especially fixes dsync failures when mailbox name ended with the '%'
character.
Timo Sirainen [Thu, 9 Feb 2023 15:04:22 +0000 (17:04 +0200)]
lib-imap-client: Fix/clarify selection state handling
The old code assumed that selected_box would be non-NULL while a new mailbox
is being selected. That's not true though, the imapc-storage code closes the
old mailbox before selecting the next one. So the QRESYNC-specific code for
tracking selected-state was never being used. Fixed this, and clarified in
general how the selected-state is supposed to work.
Timo Sirainen [Thu, 9 Feb 2023 14:12:35 +0000 (16:12 +0200)]
imapc: Don't process untagged replies in mailbox that isn't fully selected yet
For example if the communication was:
C: a SELECT box1
...
C: b SELECT box2
S: * 1 EXPUNGE
S: * 1 EXISTS
S: * OK [UIDVALIDITY 1675948459] UIDs valid
S: ...
S: b OK
The expunge was intended for box1, not box2. This caused:
Warning: imapc(...): Mailbox '...' state corrupted: EXPUNGE received for empty mailbox - reconnecting
Fixed this by ignoring untagged EXPUNGE, FETCH, SEARCH and ESEARCH replies
when the UIDVALIDITY reply hasn't been yet received for a mailbox.