Timo Sirainen [Wed, 25 May 2016 19:29:47 +0000 (22:29 +0300)]
cassandra: Added metrics=path connect setting.
Cassandra's metrics are written to the path in JSON format. It can be a file
or a FIFO. The path supports expanding the standard global %variables, such
as %{pid}
J. Nick Koston [Fri, 20 May 2016 00:15:49 +0000 (19:15 -0500)]
dsync: race condition where done/finish is received after one side has closed
We do not tell the remote we are closing if they have
already told us because they close the
connection after sending ITEM_FINISH or ITEM_DONE and will
not be ever receive anything else from us unless
it just happens to get combined into the same packet
as a previous response and is already in the buffer.
Timo Sirainen [Mon, 23 May 2016 15:46:09 +0000 (18:46 +0300)]
lib-index: Make sure cache compression doesn't clear the file unneededly.
This probably never happened with current code, except when the cache file
was already broken.
mail_cache_compress() unmapped cache when map_with_read==TRUE, but we never
mapped it back. This would cause cache copying code to think cache was
unusable and not copy anything.
Timo Sirainen [Mon, 23 May 2016 10:12:41 +0000 (13:12 +0300)]
lib-ldap: Use ldap_unbind_ext() instead of ldap_destroy()
This allows it to compile with older LDAP libraries. Their behavior (at least
in OpenLDAP) is identical as long as LDAP_OPT_CLIENT_CONTROLS haven't been
changed, which we haven't.
Broken by 79490ec1a. The idea is to delete the mailbox early to avoid
unnecessary work, but we deleted it too early. If the last mail(s) were
deleted instead of just expunging them we deleted the whole mailbox.
It should do it on the following parsings as well if there were any
callbacks that were called, or if the hdr==NULL callback added any
headers. This is important because the hdr==NULL call could do some
cleanups.
Phil Carmody [Mon, 8 Feb 2016 16:32:10 +0000 (18:32 +0200)]
lib: istream - provide alternatives to i_stream_read_data()
Providing as a parameter the number of bytes that you would be
disappointed to receive was confusing compared to providing the
number that you would be happy to receive. This lets us get rid
of all the '-1's in the callers. The callers which used 0 as
a parameter were so common that it's worth providing a separate
API just to simplify their demands.
Deep down, these are still the same underlying function. Currently
we route the new API through the old one, but eventually, the old
API can be routed through the new one, so that the friendlier
interface has the simplest implementation.
Timo Sirainen [Wed, 11 May 2016 20:58:59 +0000 (16:58 -0400)]
dict-sql: Cache reading settings files.
The settings were read for every dict init, which was done for every new
dict connection. This was using a lot of CPU. There are usually only a
couple dict-sql settings files, so we cache all of the ones we read.
Timo Sirainen [Tue, 10 May 2016 21:35:43 +0000 (17:35 -0400)]
lib-ldap: Reverted previous commit for now.
We don't have libdovecot built at at this stage. But we can't build it
earlier, because it needs lib-dict-extra, which needs lib-ldap. So we have
cyclical dependencies now.
Timo Sirainen [Thu, 5 May 2016 18:26:37 +0000 (21:26 +0300)]
stats: Handle getrusage() errors better
I'm not aware of these errors actually happening anywhere, but its
error handling wouldn't have been correct if previous getrusage() calls
had succeeded. Now if it fails, log an error once and just keep on using
the last working rusage.
We can't just treat i_stream_get_size() returning 0 as the reason being
istream is async and not fully read. It might be, but it might also be
because of other reasons. And since we're closing the istream we couldn't
even properly finish up the async handling. So for now just return an
error if we see this happening.
This probably doesn't affect the results much, since the stream_errno is set
anyway. But it's better to abort early, just in case the broken state might
end up asserting later.
Timo Sirainen [Tue, 3 May 2016 12:27:22 +0000 (15:27 +0300)]
lib-storage: Fixed potential crash in mailbox_sync_deinit() error handling
If mailbox_sync*() was called before mailbox was opened, the automatic
mailbox opening could fail. mailbox_sync_deinit() would still try to access
box->view, which would be NULL.
Timo Sirainen [Mon, 2 May 2016 12:20:18 +0000 (15:20 +0300)]
lib-ldap: Added initial connection pooling code.
This is mainly about allowing multiple dict-ldaps to use the same
ldap-connection. In future we could support load balancing with multiple
concurrent LDAP connections.
Timo Sirainen [Mon, 2 May 2016 11:21:06 +0000 (14:21 +0300)]
dict-ldap: Don't reuse dict for different usernames.
Fixes doing priv/* lookups for multiple usernames.
This currently also means that each username will create a separate LDAP
connection, which isn't ideal. But this is probably better fixed in
lib-ldap code similar to how lib-sql does connection pooling.
Timo Sirainen [Sat, 30 Apr 2016 11:55:14 +0000 (14:55 +0300)]
lib-storage: Clear list error before mailbox_list_get_hierarchy_sep()
With ACL plugin enabled the call could have triggered dovecot-acl-list
rebuild, which in turn could have set list errors if it didn't have
permissions to all the mailboxes. This caused IMAP logins to fail.
Timo Sirainen [Sat, 30 Apr 2016 11:19:02 +0000 (14:19 +0300)]
lib-mail: message-parser assert-crashfix
Crashes when multipart MIME header is missing end-of-headers line and the
boundary begins with the same prefix as one of the parent boundaries.
Broken by 7a12331c6
Timo Sirainen [Thu, 28 Apr 2016 19:33:14 +0000 (22:33 +0300)]
lib: Set timestamp part more accurately in guid_128_generate()
Previously a long-running process would keep the timestamp close to its
original start time. This doesn't really matter as long as GUIDs are treated
opaque, but some pieces of code prefer to try to use the timestamp fields
since they're already there. This makes such code work more nicely.
Timo Sirainen [Fri, 29 Apr 2016 16:25:52 +0000 (19:25 +0300)]
quota: Added quota_over_flag_lazy_check flag.
By default the quota_over_flag is checked immediately at startup. With this
option the check is done only at a time when the quota is anyway being read.