Timo Sirainen [Mon, 19 Jun 2017 08:30:27 +0000 (11:30 +0300)]
acl: Add acl_globals_only setting
The local dovecot-acl files aren't even attempted to be looked up if this is
set. This is mainly useful to avoid unnecessary stat()s to dovecot-acl files
that never exist.
Timo Sirainen [Sun, 18 Jun 2017 08:14:05 +0000 (11:14 +0300)]
imap: NOTIFY - Fix crash due to not hooking into commands correctly
The pre/post hooks aren't always called immediately when commands are
created. They're called only after the command input is being read.
Call notify hooks explicitly now immediately when commands are allocated.
Fixes a panic with for example:
a notify set (selected (Messagenew (uid flags) MessageExpunge FlagChange) personal (MessageNew MessageExpunge FlagChange))
b select inbox
c store 1 +flags \deleted
d expunge
e append inbox {10}
Which crashed with:
Panic: file imap-notify.c: line 397 (imap_notify_callback): assertion failed: (client->command_queue_size == 0)
Stephan Bosch [Thu, 15 Jun 2017 07:18:03 +0000 (09:18 +0200)]
lib: Fix ostream-buffer to return buffer contents size in o_stream_get_buffer_used_size().
This is necessary for querying o_stream_get_buffer_avail_size() with respect to a limit set earlier using o_stream_set_max_buffer_size().
This is mainly useful for test suites.
Timo Sirainen [Mon, 12 Jun 2017 21:57:08 +0000 (00:57 +0300)]
imapc: Fix prefetching specific headers
FETCH BODY[HEADER.FIELDS ...] shouldn't be used if imapc_features doesn't
include fetch-headers. Also neither this nor BODY[HEADER] should be sent
if we already have header/body stream.
Timo Sirainen [Tue, 13 Jun 2017 19:14:11 +0000 (22:14 +0300)]
lib-index: Fix cache lookups from uncommitted transactions with in-memory indexes
This especially fixes mail_get_header_stream() with imapc and
imapc_features=fetch-headers, because it works by first fetching the
specific headers and putting them to the cache transaction, then later on
relying on index_mail_get_header_stream() to get them from the transaction.
Before this fix they wouldn't be found, which triggered another unnecessary
FETCH BODY.PEEK[HEADER].
Timo Sirainen [Mon, 12 Jun 2017 19:52:56 +0000 (22:52 +0300)]
*-login: Add client_vfuncs.input_next_cmd()
This allows plugins to hook into all the pre-login commands. For example
with imap-login most of the commands could already be hooked into, except
for ID and AUTHENTICATE because their parameters reading is handled
specially. This allows hooking into them as well.
This is actually internal to all the login binaries, so it wouldn't have to
be in login-common. However, login-common already has all the code to handle
overriding functions nicely and this is a rather useful feature for all the
protocols anyway, so it's easier this way and not too ugly.
Timo Sirainen [Mon, 12 Jun 2017 20:45:05 +0000 (23:45 +0300)]
push-notification: Switch to main ioloop while calling drivers' commit callbacks
There aren't any guarantees what ioloop happens to be active at the time
the commit is called. The active ioloop can also be destroyed early on,
which can cause an I/O leak and crashes later on.
Some consumers of lib.h are in C++ and therefore they try to compile
byteorder.h as C++ code. C++ compilers don't like the implicit void *
-> struct anything * conversion, so we squelch those by adding explicit
casts.
Timo Sirainen [Mon, 12 Jun 2017 09:07:52 +0000 (12:07 +0300)]
imapc: Check for auth failures when saving messages
First, don't even attempt an APPEND if we've already seen an auth failure.
Second, if APPEND does fail because of auth error, set the correct error to
storage.
Timo Sirainen [Mon, 12 Jun 2017 08:40:03 +0000 (11:40 +0300)]
imapc: Make sure storage error has the proper auth failure error string
The first failed command always had the correct error string, but the
following failed commands just returned -1 without updating storage error.
The storage error could have been something completely different by then.
Timo Sirainen [Thu, 8 Jun 2017 17:25:11 +0000 (20:25 +0300)]
quota: quota_root_iter_next() - Iterate all visible roots
Don't try to skip the roots that don't have an active quota. imap_quota
plugin does the skipping now itself, and quota_clone shouldn't really be
even used with more than one quota root.
Timo Sirainen [Thu, 8 Jun 2017 17:29:05 +0000 (20:29 +0300)]
quota-clone: Don't clone quota resources that aren't enabled.
They would always just be zeros anyway, so this makes the update slightly
more efficient. Although practically this only matters with dirsize and
fs quotas, which people generally don't use with quota_clone.
Timo Sirainen [Sat, 10 Jun 2017 07:35:54 +0000 (10:35 +0300)]
lib: Fix test-path-util unit test with some cwd path lengths
The component-component directory might not have been created at all,
in which case the following symlink creations would fail since they were
already created to the same directory in a previous test.
Timo Sirainen [Wed, 7 Jun 2017 20:47:56 +0000 (23:47 +0300)]
master: Don't include imap-hibernate when counting auth's max client_limit
imap-hibernate doesn't do any auth connections, so it doesn't need it.
It's a bit ugly to add an explicit service name comparison here, but
there didn't really seem to be many other good choices:
* Could have removed protocol=imap from imap-hibernate. I was close to
doing this, but maybe it's better that imap-only processes would have
their protocol set to "imap".
* Could have added a new service type, but seems pretty unnecessary to add
some kind of a "nonauth" just for this. A reverse "needs-auth" might have
been ok though.
Perhaps in future we'll implement proper dependencies across services and
those dependencies could be used to calculate this limit more precisely.