Markus Valentin [Fri, 14 May 2021 13:57:20 +0000 (15:57 +0200)]
acl: Fix broken LIST for shared namespaces
Due to the recent changes in the usage of the acl_ignore_namespace
setting shared namespaces where trying to use fast listing too. This
resulted in wrong LIST IMAP command outputs when using acl plugin.
Markus Valentin [Fri, 30 Apr 2021 09:34:51 +0000 (11:34 +0200)]
acl: Prevent crashes with acl_ignore_namespace
In case a namespace was ignored for ACLs an crash could occur because of
"Module context acl_storage_module missing". This panic is prevented by this
change.
Stephan Bosch [Wed, 14 Apr 2021 08:45:55 +0000 (10:45 +0200)]
lib-http: http-client-peer - Fix segfault occurring upon backoff connect.
If peers decide to close and destroy immediately, the iteration in the shared
peer yields an invalid pointer for the next peer to connect. Fixed by preserving
pointer to next peer inside the loop.
lib: event filter - Avoid using event field wildcard matching when not needed
If the right hand side of an event field comparison is not using any
wildcards, we can compare using strcasecmp() instead of the more expensive
wildcard_match_icase().
This wildcard matching avoidance change speeds up matching quite a bit.
When the desired comparison is *not* a wildcard match (i.e., the filter is
'fieldname=abc'), microbenchmarks show at least a 11% speedup in filter
matching speed. When the comparison includes a wildcard (i.e., the filter
is 'fieldname=abc*'), microbenchmarks show approximately 0.9% filer matching
slowdown.
Since there are so many non-wildcard matches in a typical filter, this is a
very good trade-off.
lib: event filter - Avoid using event name wildcard matching when not needed
If the right hand side of an event name comparison is not using any
wildcards, we can compare using strcmp() instead of the more expensive
wildcard_match().
This wildcard matching avoidance change speeds up matching quite a bit.
When the desired comparison is *not* a wildcard match (i.e., the filter is
'event=abc'), microbenchmarks show at least a 30% speedup in filter matching
speed. When the comparison includes a wildcard (i.e., the filter is
'event=abc*'), microbenchmarks show approximately 0.4% filer matching
slowdown.
Since there are so many non-wildcard matches in a typical filter, this is a
very good trade-off.
Timo Sirainen [Thu, 1 Apr 2021 14:24:10 +0000 (17:24 +0300)]
lib-index: Try harder to open index with MAIL_INDEX_OPEN_FLAG_READONLY
The readonly-flag is used when rebuilding index or dumping indexes.
In both cases it's better to try to open the index as best as possible,
since fsck isn't allowed.
Timo Sirainen [Wed, 5 May 2021 13:41:21 +0000 (16:41 +0300)]
dict-redis: dict-client: Use the proper active ioloop while calling commit() callbacks
If the callbacks did any IO/timeout changes, they would have gone to a wrong
ioloop. This would have caused a warning about IO/timeout leak though, so
it doesn't seem like there were such code paths currently.
Timo Sirainen [Thu, 29 Apr 2021 12:49:00 +0000 (15:49 +0300)]
imap: move: Sync source mailbox between commits
This way the messages are actually expunged from storage after the commit,
not just requested to be expunged. Most importantly this means that if
another session attempts to start moving the same messages it can be noticed
earlier and one of the moves aborted.
Timo Sirainen [Thu, 29 Apr 2021 12:39:29 +0000 (15:39 +0300)]
lib-storage: Always set struct mail.expunged
Previously it was set only when some error noticed that there was a problem
accessing the mail. Now this is set immediately in mail_set_seq(). This
allows e.g. IMAP COPY/MOVE to abort when it encounters expunged mails.
Stephan Bosch [Mon, 3 May 2021 21:54:26 +0000 (23:54 +0200)]
lib-program-client: program-client-remote - Fix result parsing in the istream.
This fixes internal errors occurring when the parent stream is fully read before
EOF is signaled. This was caused by the fact that the final bytes were not
always reserved properly for parsing, so that these ended up being exposed to
and eaten by the application. At the end, the result parsing code would be faced
with no data, thereby causing an internal error to be returned by the calling
application.
This came to light as CI tests involving Sieve extprograms failed irregularly.
This problem only occurs when a (slight) delay exists between the last data
being sent and the connection being closed by the script service, making this
hard to reproduce. It typically occurred only under high server load.
Timo Sirainen [Thu, 22 Apr 2021 09:07:12 +0000 (12:07 +0300)]
lib-test: Convert test_assert()s to fatal asserts when running static analyzer
This avoids unnecessary warnings about unit tests crashing when
test_assert()s fail. The warnings are correct, but it's a bit unnecessary
to write the failure code paths that nicely.