Timo Sirainen [Tue, 30 May 2017 06:36:49 +0000 (09:36 +0300)]
lib-storage: Fix LAYOUT=fs potentially not ignoring ACLs when requested
fs_get_existence_info_flag() was only being called with LAYOUT=fs and
Maildir combination. This mainly affected that combination when using
mailbox_list_index=yes and trying to list mailboxes with ACL checking
disabled.
Timo Sirainen [Tue, 30 May 2017 06:18:14 +0000 (09:18 +0300)]
lib-storage: Fix ACL in parent mailbox potentially hiding its children.
fs_get_existence_info_flag() was only being called with LAYOUT=fs and
Maildir combination, so only it was broken if the parent mailbox wasn't
visible but its children were.
If the auto=subscribe mailbox didn't have a lookup ACL, it shouldn't have
been listed. This didn't work properly, because ACL plugin initialized the
autocreate_ctx only for the index iterator, while the autoboxes were
listed using the backend iterator. Fixed by not creating index iterator at
all when doing a passthrough iteration.
Timo Sirainen [Mon, 29 May 2017 10:53:17 +0000 (13:53 +0300)]
acl: Skip auto=create|subscribe mailboxes that don't have lookup-right
Removing them entirely from the boxes and box_sets arrays in the list
context treats them as if they weren't configured at all. This way they
don't need any other special code.
Stephan Bosch [Wed, 24 May 2017 19:59:32 +0000 (21:59 +0200)]
lib-http: client: When a request is destroyed prematurely during payload input, consider the payload stream destroyed and act accordingly.
The application may hold a reference to the payload stream still, and it may be difficult to prevent that.
This causes lib-http to keep waiting for the payload to be destroyed.
When nothing else is going on, the current ioloop may then become empty, which caused the familiar assert failure.
Timo Sirainen [Fri, 19 May 2017 13:34:29 +0000 (16:34 +0300)]
imap: Allow plugins to replace existing FETCH handlers
They can use imap_fetch_handler_lookup() to get the old init() function.
Then they can imap_fetch_handler_unregister() the existing handler and
register a new handler, which can do its own work and call the old init()
if needed.
Timo Sirainen [Wed, 17 May 2017 16:02:06 +0000 (19:02 +0300)]
imap NOTIFY: Flush any pending notifications on NOOP
This is mainly to allow testing NOTIFY easily with imaptest scripts.
This is cheap anyway, because mailbox_list_notify_flush() doesn't do any
syscalls when there's no work.
This flushes any pending notifications. For now it only checks if there's
a pending notification waiting for a timeout. It could also stat() the
files to make sure, but that's probably unnecessary.
Timo Sirainen [Wed, 17 May 2017 14:49:25 +0000 (17:49 +0300)]
lib-storage: Always update highestmodseq in mailbox list index
This is required for mailbox-list-notify API to work correctly. For
example IMAP NOTIFY session with CONDSTORE enabled could be listening for
FlagChanges, but another session without CONDSTORE enabled could be updating
flags in a mailbox that has never been opened with CONDSTORE enabled.
NOTIFY wouldn't see this change, unless it was always written to
dovecot.list.index.
Timo Sirainen [Thu, 18 May 2017 20:13:38 +0000 (23:13 +0300)]
lib-storage: Fix mailbox list index records without guid having invalid flags
With LAYOUT=index the mailbox is found with its GUID. If it doesn't exist,
the mailbox has to be either \NonExistent or \NoSelect. It probably doesn't
make much difference which one, so we'll fix them by adding \NoSelect.
With other layouts the GUID is allowed to be empty, because it can be looked
up from the actual mailbox.
Timo Sirainen [Thu, 18 May 2017 17:18:24 +0000 (20:18 +0300)]
lib-imap-client: Change server IP only on connect() failures
Also log an warning-level message about it. This is mainly useful to see
that a slow connection could be caused by a connect() timeout. Since more
IPs are still available, it's not yet an error.
Timo Sirainen [Thu, 18 May 2017 16:42:03 +0000 (19:42 +0300)]
imapc: Fix infinite reconnection when server keeps sending corrupted state
When corrupted state was found, imapc_client_mailbox_reconnect() is called
to reconnect. This call skipped the normal "is it safe to reconnect?"
checks causing potentially infinite reconnections.
Timo Sirainen [Thu, 18 May 2017 16:40:04 +0000 (19:40 +0300)]
lib-imap: imap_parser_unref() should always set parser=NULL
Not just when the last reference is cleared. This is how *_unref()s should
work everywhere in Dovecot. This fixes a bug in lib-imap-client where a
parser could have been accessed after it was already freed.
Aki Tuomi [Thu, 18 May 2017 11:59:51 +0000 (14:59 +0300)]
virtual: Match any metadata condition
The old code ignored succesful earlier matches for
patterns, and stopped looking on first non-matching
metadata pattern. Now it breaks on error or on first
matching pattern.
Timo Sirainen [Thu, 18 May 2017 08:57:38 +0000 (11:57 +0300)]
director: Add old host's up/down and vhost count parameters to director_flush_socket
The "down" status allows the script to determine whether it should try to
perform any work on the old host. The vhost count may be unnecessary, but
might be useful for some purpose.
Including it in lib.h allows all of the Dovecot code (as well as any
external plugins) to just use these macros without worrying about what
system headers to include.