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.
Stephan Bosch [Mon, 3 Apr 2017 22:32:07 +0000 (00:32 +0200)]
lib-http: client: Fixed race condition between DNS refresh lookup and a soft connection timeout.
The refreshing DNS lookup cleared all the IPs, but the soft connection timeout (and maybe other code) still relied on them.
Adding tests everywhere for host->ips_count == 0 is annoying, so I changed the DNS lookup code such that the stale IPs remain present while the DNS lookup is being performed.
The pending lookup prevents new connections through http_client_host_refresh(), so this will not create potentially useless connections.
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 [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.
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.
Timo Sirainen [Fri, 5 May 2017 12:20:05 +0000 (15:20 +0300)]
lib-storage: Avoid unnecessary UIDNEXT lookups after saving a mail
The vsize checking code was expecting that this would always be a cheap
operation, but with imapc code it could trigger a remote STATUS (UIDNEXT)
call. Do this only when we've checked that this mailbox is updating vsize
header at all.
Timo Sirainen [Fri, 12 May 2017 12:42:31 +0000 (15:42 +0300)]
imapc-quota: Avoid sending unnecessarily many GETQUOTA[ROOT] commands
The last_refresh == ioloop_timeval check didn't work, because the refresh
itself updated ioloop_timeval. This caused a single quota lookup to issue
multiple GETQUOTA[ROOT] commands to imapc.
Timo Sirainen [Tue, 2 May 2017 09:18:40 +0000 (12:18 +0300)]
lib-imap: imap_append_string_for_humans() - Change CR/LF to space
Practically this shouldn't matter, because in email headers a CR/LF is
always followed by a space/tab. But maybe this can be used for some
other purposes in future, and it makes the unit tests clearer. :)
Timo Sirainen [Tue, 2 May 2017 15:40:43 +0000 (18:40 +0300)]
master: Send SIGQUIT to processes running at deinit to close socket listeners.
This allows Dovecot to be restarted even when some lmtp/doveadm process is
running for a long time. Otherwise it would keep the inet_listener socket
open and prevent the new Dovecot from binding to the port.
Aki Tuomi [Fri, 28 Apr 2017 09:51:20 +0000 (12:51 +0300)]
auth: Add username_filter for passdb block
username_filter lets you specify one or more pattern(s) for
including or excluding users. exclusion patterns are denoted
with ! prefix.
if any exclude matches the username, passdb will be skipped.
if any inclusions is specified, and the username does not match
one of them, passdb will be skipped.
Just write the original invalid keyword string as output. It might not be
entirely invalid - just invalid within this mailbox (e.g. a mailbox doesn't
allow new keywords).
Timo Sirainen [Thu, 27 Apr 2017 09:50:13 +0000 (12:50 +0300)]
lib-index: mail_index_update_keywords() - don't assert if adding/removing 0 keywords
Although it would be nice for the caller to check it, it's easier to do
here. It's mainly a problem with mailbox_keywords_create_valid() that may
unexpectedly create empty keywords.