Timo Sirainen [Mon, 21 Sep 2015 13:32:27 +0000 (16:32 +0300)]
lib-storage: Update mailbox vsize header on save/copy/expunge.
This allows always efficiently looking up maiboxes' vsizes after they're
initially calculated.
The expunge handling is unfortunately done currently in quota handling code,
so it works only if quota is enabled. Ideally this would be solved in v2.3
with some lib-storage core changes.
Timo Sirainen [Mon, 21 Sep 2015 13:12:43 +0000 (16:12 +0300)]
quota: Commit expunge transaction instead of rolling back.
This likely won't make much of a difference, since it should have accessed
only expunged mails. But it's a bit cleaner this way.
Timo Sirainen [Mon, 21 Sep 2015 11:02:47 +0000 (14:02 +0300)]
imap: Improved command timing information reporting.
We now report also the time we spent waiting on ioloop. Also fixed reporting
command timing information when multiple commands were running in parallel
(e.g. SEARCH + FETCH). If multiple commands are running in parallel they all
report the same ioloop wait time, because there's no easy way to know which
one of them caused the wait.
Timo Sirainen [Mon, 21 Sep 2015 10:59:22 +0000 (13:59 +0300)]
imap: When running SEARCH on "background", run it through command_exec()
Otherwise all the timing information isn't right and the pre/post hooks
weren't being called so stats counting was also wrong.
Timo Sirainen [Sun, 20 Sep 2015 19:25:11 +0000 (22:25 +0300)]
lib-index: Added mail_index_sync_have_any_expunges()
This can be used to quickly check before mail_index_sync_begin() if there
are likely to be any expunges that will be synced.
Stephan Bosch [Sun, 20 Sep 2015 18:49:51 +0000 (21:49 +0300)]
auth: The mechanisms configured using the auth_mechanisms setting were not enforced.
The login service would check whether the mechanism is supported by auth,
but auth performed no such check of its own. This means that any
implemented mechanism was accessible from a login, even though was
presumably disabled.
Timo Sirainen [Fri, 11 Sep 2015 11:02:01 +0000 (14:02 +0300)]
lib-storage: Fixed iterating attribute prefix that matched the attribute itself.
So if attribute key was "foo", iterating "foo" returned garbage because it
skipped over the trailing \0.
Phil Carmody [Tue, 8 Sep 2015 16:28:31 +0000 (19:28 +0300)]
lib: test-strnum - do not invite undetectable errors
The very numbers which could cause a broken parser to over-run, the ones we
are testing, are the ones which will be parsed as having a value similar to
'value', so check that no value was returned by using a number completely
dissimilar to that. Otherwise, there might be an accidental mis-parse that
overwrote value, but left its value the same.
Timo Sirainen [Tue, 8 Sep 2015 16:12:26 +0000 (19:12 +0300)]
lib-storage: Replaced some unlink()s with i_unlink*()s where we could.
This changes some mail_storage_set_critical() calls to i_error()s, but
because these unlink() failures don't actually fail the operation it doesn't
matter.
Timo Sirainen [Tue, 8 Sep 2015 16:11:45 +0000 (19:11 +0300)]
lib-index: Replaced some unlink()s with i_unlink*()s where we could.
This changes some mail_index_set_error() calls to i_error()s, but because
these unlink() failures don't actually fail the operation it doesn't matter.
In fact it may be even better that it doesn't overwrite the existing
index->error if it exists.
Timo Sirainen [Tue, 8 Sep 2015 15:49:00 +0000 (18:49 +0300)]
lib: Added i_unlink() and i_unlink_if_exists()
These log the error message on a failed unlink(). They also include the
source code file and line number to make it easier to find which unlink()
actually failed if the path itself doesn't already clearly identify it.
This can be especially useful if the path is (null), "" or contains some
corrupted garbage.
Timo Sirainen [Tue, 8 Sep 2015 15:45:28 +0000 (18:45 +0300)]
lib-storage: Use MAIL_ERROR_NOTPOSSIBLE if mailbox_attribute_*set() fails for read-only attribute.
MAIL_ERROR_PARAMS indicates that there was something wrong with the
parameters itself. But the caller can't know (at least with current APIs)
if it's a read-only attribute it's trying to change before actually doing it.
Timo Sirainen [Tue, 8 Sep 2015 10:41:21 +0000 (13:41 +0300)]
lib-storage: If mail_attribute_dict is set, ignore non-authority rank internal attributes.
This way dsync can still sync things like Sieve scripts, but it doesn't
attempt to sync anything that actually requires dict.
Timo Sirainen [Tue, 8 Sep 2015 10:07:59 +0000 (13:07 +0300)]
lib-charset: Fixed assert-crash with some iconv() versions.
Older glibc iconv() versions seem to skip over invalid characters, at least
with some charsets, while newer versions don't. We were assuming that the
skipping never happened, so if the invalid character was at the end of the
string we could have wrapped size to (size_t)-1 and caused a crash later on.
Timo Sirainen [Mon, 7 Sep 2015 21:07:55 +0000 (00:07 +0300)]
lib-storage: Mailbox list notifications didn't work for INBOX.
Because of some earlier optimizations that changes to INBOX aren't written
to dovecot.list.index.log file.
Timo Sirainen [Mon, 7 Sep 2015 20:55:31 +0000 (23:55 +0300)]
Mailbox list notify API changed to return multiple events at once.
This fixes some issues where a single event could actually trigger multiple
different kinds of events.
lib: Fix hang in safe_sendfile on SmartOS
The call to sendfile on SmartOS can fail with EOPNOTSUPP. This is a valid
error code and documented in the man page. This error code needs to be
handled or else dovecot will retry the sendfile call endlessly and hang.
Timo Sirainen [Mon, 7 Sep 2015 19:14:18 +0000 (22:14 +0300)]
imap: Fixed assert-crash in NOTIFY when using multiple namespaces.
I'm not sure why the original code was trying to add it to multiple
namespaces. A single mailbox name should be matching only a single
namespace (visible one at least). In any case we can't use
mail_namespace_find() with only partial namespaces-list, because it'll
assert-crash if it can't find a namespace for the mailbox.
Timo Sirainen [Mon, 7 Sep 2015 17:24:25 +0000 (20:24 +0300)]
director: Added director_user_kick_delay setting.
This replaces the hardcoded 2 seconds delay. This setting specifies how long
to wait for after user has been kicked from all directors before letting the
user login to the new server. This timeout should be large enough that the
user's existing processes in the old backend should be finished.
Timo Sirainen [Mon, 7 Sep 2015 15:50:24 +0000 (18:50 +0300)]
login proxy: Added delayed disconnection of clients on server mass-disconnect.
login_proxy_max_disconnect_delay setting (default 0 = disabled) controls for
how long time period the disconnections are spread to. The idea behind this
is to avoid load spikes due to client reconnections when a backend server
dies or is restarted.
Timo Sirainen [Mon, 7 Sep 2015 13:23:40 +0000 (16:23 +0300)]
lib-storage: Allow MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT to use get=NULL
This is useful for registering internal attributes whose only purpose is to
be able to set/get them via dict. (Because normally the dict access would be
denied completely.)
Timo Sirainen [Mon, 7 Sep 2015 13:22:11 +0000 (16:22 +0300)]
lib-storage: Allow set/get for Dovecot-private attributes via internal attributes.
This allows registering attributes with MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT
prefix and having them be get/set via dict, instead of failing them.
Timo Sirainen [Mon, 7 Sep 2015 13:38:24 +0000 (16:38 +0300)]
lib-storage: Added MAIL_ATTRIBUTE_INTERNAL_FLAG_CHILDREN
This also adds the key to get() and set() functions, so they can know
exactly what key is wanted to be accessed.
Timo Sirainen [Mon, 7 Sep 2015 11:08:52 +0000 (14:08 +0300)]
auth: Fixed passdb skip_password_check / result_success=continue-fail handling
If passdb returned success, but result_success=continue-fail, it means that
the authentication didn't succeed. So we still want to check the password
again and in general treat the request as unauthenticated (especially for
the passdb { skip } setting).
So the current logic means that there are 2 ways for the request to be
treated as authenticated and skipping any password checking:
1) passdb lookup succeeding, with result_success=continue, continue-ok,
return or return-ok
2) passdb lookup not succeeding, with result_failure=continue-ok or
return-ok
It's a bit questionable though if 2) should be allowed.
Timo Sirainen [Thu, 3 Sep 2015 18:37:09 +0000 (21:37 +0300)]
cassandra: Handle async queries internally - don't use sql pooling code.
There's no need to create multiple Cassandra instances, since the single
instance is capable of doing multiple asynchronous requests in parallel.
Timo Sirainen [Thu, 3 Sep 2015 17:55:18 +0000 (20:55 +0300)]
lib-storage: Another fix to using index_storage_mailbox_close() without an opened view.
Calling mail_index_close() without mail_index_open() caused it to
assert-crash.
Timo Sirainen [Thu, 3 Sep 2015 11:10:36 +0000 (14:10 +0300)]
Removed SET_IN_PORT_ZERO - SET_IN_PORT now always allows zeros as well.
A zero in all the port settings means that the port is disabled, which is
also the default. So it shouldn't be an error to explicitly set it to zero
in the config file.
Phil Carmody [Thu, 3 Sep 2015 11:01:57 +0000 (14:01 +0300)]
lib: strnum - simplify hex and oct overflow code
uintmax_t is defined to have modulo-2^n semantics, and therefore the bottom
bits of (uintmax_t) are guaranteed to be all set. Therefore the checking of
the next character read is unnecessary, as it's already done in the loop
control statement itself. (This is not true about the bottom digit base 10,
which is why the check remains in the decimal case)