Timo Sirainen [Tue, 14 Feb 2017 16:48:51 +0000 (18:48 +0200)]
lib-storage: Update vsize header after sync only if sizes are cached.
The result isn't needed yet in that case, so if it's slow to get the sizes
it might as well be delayd until later. This is especially useful when
indexer-worker triggers FTS indexing. The vsizes can be added to index
after the mail is already read for FTS. Without this change the vsize
update would first open all the mails and then the FTS indexing would
open all the mails a second time.
If folder vsize calculation requires opening more than this many mails from
disk (i.e. mail sizes aren't in cache already), return failure and finish
the calculation via indexer process.
Timo Sirainen [Tue, 7 Feb 2017 11:53:52 +0000 (13:53 +0200)]
lib-storage: Don't stop vsize calculation on expunged mails.
I don't know why I added such logic there in the first place. If we just
skip the expunged mails, the end result should still be correct and
usable when cached.
If user received a mail every day, the day_first_uid wasn't being updated.
This caused wrong caching decisions to be made in dovecot.index.cache:
- Accessing >1 week old emails should have changed caching decision from
"tmp" to "yes". This might not have happened, although as long as
day_first_uid[7] pointed to an existing mail and email client accessed
all the mails, this wouldn't have changed anything.
- Cache compression is supposed to drop >1 week old mails when caching
decision is "tmp". Not enough mails were being dropped because
day_first_uid[7] pointed to a much older than 1 week old mails.
Timo Sirainen [Wed, 15 Feb 2017 16:18:46 +0000 (18:18 +0200)]
lib-storage: Don't sync mailbox after undeleting it.
This is useful only when deleting it. With undeletion the syncing isn't
useful and might actually be harmful with mailbox formats that didn't
fully open the mailbox while it was undeleted.
Timo Sirainen [Wed, 15 Feb 2017 21:32:52 +0000 (23:32 +0200)]
mail-log: Add mail_log_cached_only setting.
If enabled, everything except "save" event will log only the fields that can
be looked up from cache. This improves performance if some of the fields
aren't cached and it's not a strict requirement to log them.
It can never be NULL after the previous change: "lib-storage: Always create
mail_save_context.dest_mail".
The code removal in maildir_transaction_save_commit_pre() seemed
potentially dangerous, but I don't think such code path is possible
anymore. Also even if it is, it's probably fine since the mail_free()
is called even earlier than before (although that itself might have
been a problem).
This also removes last traces of code that made it possible to save mails to
mbox without assigning UID to the mail. The previous commit already caused
this, so this is just removing dead code.
This allows removing similar mail_alloc() from storage backends and plugins
that need it.
As a side effect, this changes mbox code to always assign UIDs to saved
mails. This shouldn't be much of a problem, since it happened practically
always already.
These don't check that they're entirely correct as required by HTTP
specifications. They're mainly there as a quick check that if the caller
didn't validate the key/value in any way, we'll crash instead of creating
a potential security hole. (Because with line feeds the attacker could
add extra headers or even entirely new HTTP requests.)
johnkwoods [Wed, 28 Dec 2016 18:02:14 +0000 (12:02 -0600)]
lib-ldap: Remove extra return
The ldap_connection_queue_request() function returns void. Trying to
"return" something from a void function caused compiling issues on
Solaris (Oracle Developer Studio 12.5).
J. Nick Koston [Sun, 22 Jan 2017 23:24:02 +0000 (17:24 -0600)]
fts-solr: Allow username/password for solr connction
Solr comes open to the world by default. For better
security, we protect our solr installs with a user
and password. This change allows dovecot to connect
to these instances.
Example usage in a fts.conf (permissions 0600)
fts_solr = url=http://nick:pass@127.0.0.1:8983/solr/dovecot/
Timo Sirainen [Sun, 5 Feb 2017 14:49:05 +0000 (16:49 +0200)]
imap: Add imap_fetch_failure setting
This controls what happens when FETCH fails for some mails. The possible
values are:
disconnect-immediately: This is the original behavior. Whenever FETCH
fails for a mail, the FETCH is aborted and client is disconnected.
disconnect-after: The FETCH runs for all the requested mails, skipping
any mails that returned failures, but at the end the client is still
disconnected.
no-after: The FETCH runs for all the requested mails, skipping any mails
that returned failures. At the end tagged NO reply is returned. If the
client attempts to FETCH the same failed mail more than once, the client
is disconnected. This is to avoid clients from going into infinite loops
trying to FETCH a broken mail.
Using such a library results in the same code being duplicated (in OSX) in
both libssl_iostream_openssl.so and libdcrypt_openssl.so. This breaks the
idea of openssl_init_refcount, because each one will have their own one.
libdcrypt_openssl.so now links to libssl_iostream_openssl.so, which
shouldn't really be a problem, because lib-ssl-iostream is part of the core
libdovecot.so already. It would have been possible to also install
libdovecot_openssl_common.so and link it to both libssl_iostream_openssl.so
and libdcrypt_openssl.so, but that seems unnecessarily complicated.