Timo Sirainen [Thu, 20 Aug 2020 13:17:48 +0000 (16:17 +0300)]
director: Use director_connection.event wherever possible
This adds the "director(name): " log prefix to many log messages where it
didn't previously exist. The director name is now sometimes duplicated in
the log messages, but maybe that's good for clarity.
lib: Always use the representative when comparing event's categories
We need to be consistent about using the representative category pointer.
Otherwise, we may end up with duplicates in an event's categories array.
Since an event's categories are conceptually a set, it is reasonable to
write event using code that assumes no duplicates. If duplicates are
present, it may lead to incorrect behavior or even crashes.
lib: event-filter-parser - Use str_begins() to compare unit test error strings
Different versions of bison generate slightly different error strings, but
they always begin the same way. So, instead of comparing them let's only
compare the beginning.
Timo Sirainen [Thu, 13 Aug 2020 19:49:43 +0000 (22:49 +0300)]
lib-index: Remove log prefix from cache events
Index events don't have a prefix either. The parent event likely already
contains the mailbox name, which should be enough. It's especially bad
using the full filesystem path in the event prefix, because it could be
very long.
Timo Sirainen [Thu, 13 Aug 2020 16:26:23 +0000 (19:26 +0300)]
log: Fix busy loop when a long line is logged
If the line exceeded PIPE_MAX (4 kB usually), the process got into a busy
loop. It would still break out of it every 100ms and maybe handle some
other services' logging, but the service that logged the long line would
be stuck. This resulted in all those service processes also hanging because
they were waiting to be able to write to log.
Timo Sirainen [Thu, 23 Apr 2020 14:09:33 +0000 (17:09 +0300)]
lib-mail: message-parser - Support limiting max number of MIME parts
The default is to allow 10000 MIME parts. When it's reached, no more
MIME boundary lines will be recognized, so the rest of the mail belongs
to the last added MIME part.
Timo Sirainen [Thu, 23 Apr 2020 13:59:40 +0000 (16:59 +0300)]
lib-mail: message-parser - Support limiting max number of nested MIME parts
The default is to allow 100 nested MIME parts. When the limit is reached,
the innermost MIME part's body contains all the rest of the inner bodies
until a parent MIME part is reached.
Timo Sirainen [Thu, 23 Apr 2020 09:53:12 +0000 (12:53 +0300)]
lib-mail: message-parser - Truncate excessively long MIME boundaries
RFC 2046 requires that the boundaries are a maximum of 70 characters
(excluding the "--" prefix and suffix). We allow 80 characters for a bit of
extra safety. Anything longer than that is truncated and treated the same
as if it was just 80 characters.
Timo Sirainen [Thu, 6 Aug 2020 14:46:07 +0000 (17:46 +0300)]
lib: When clearing signal handlers, ignore the signals instead of restoring defaults
This is mainly happening in while the process is shutting down. Getting a
signal at a time when the normal signal handlers are gone isn't something
that is expected. It's better to just ignore the signal and let the process
to finish shutting down normally instead of getting killed.
This should also fix some unit tests where the child processes were
sometimes dying with SIGTERM due to these race conditions.
Stephan Bosch [Sun, 5 Jul 2020 10:16:06 +0000 (12:16 +0200)]
imap: cmd-notify - Do not try to notify for removable namespaces.
It is not going to work anyway and it will cause a crash when the IMAP sync code
subsequently drops those namespaces as part of mail_user_drop_useless_namespaces().
This does not drop the earlier created mailbox_list_notify object, causing its
mailbox list index view object to remain open. This causes the following panic:
Panic: Leaked view for index <path>/dovecot.list.index: Opened in mailbox-list-index-notify.c:142
Stephan Bosch [Mon, 29 Jun 2020 09:56:02 +0000 (11:56 +0200)]
imap: cmd-notify - Fix segfault ocurring upon NOTIFY error.
The client_send_line() function in imap_client_notify_more() uses notify_ns to
obtain access to client struct, while that is available as a direct function
parameter. And notify_ns is invalid at the end of the for loop, so dereferencing
it causes a segmentation fault.
Markus Valentin [Tue, 30 Jun 2020 12:28:03 +0000 (14:28 +0200)]
lib-compression: Change compression_lookup_handler_from_ext return value
In order to improve the error handling for
compression_lookup_handler_from_ext calls return an integer rather then
a pointer to struct compression_handler.
Timo Sirainen [Tue, 19 May 2020 19:08:25 +0000 (22:08 +0300)]
lib: lib-signals - Use persistent signal IOs
When ioloop is switched, don't remove the IO from old ioloop and create it
to new ioloop. Just use persistent IOs for each separate ioloop. This can
reduce a lot of syscalls when ioloops are often switched.
Timo Sirainen [Tue, 19 May 2020 18:02:38 +0000 (21:02 +0300)]
lib: lib-signals - Replace LIBSIG_FLAG_NO_IOLOOP_AUTOMOVE with LIBSIG_FLAG_IOLOOP_AUTOMOVE
There aren't many signal handlers that actually want to move automatically.
It's just causing accidental bugs when signal handlers are run in
unexpected ioloops.