Timo Sirainen [Thu, 23 Apr 2015 13:33:19 +0000 (16:33 +0300)]
lib-storage: Fixed assert-crash with mailbox_list_index=yes if root mailbox name was empty.
This happened if the index was used for a non-listable namespace whose
prefix started with the namespace separator (e.g. prefix="/expunged/")
Timo Sirainen [Thu, 23 Apr 2015 10:37:22 +0000 (13:37 +0300)]
imapc: After auth failed, return failure immediately when opening a mailbox.
Instead of trying to re-authenticate which again will most likely fail.
Based on patch by Michael M Slusarz
Timo Sirainen [Thu, 23 Apr 2015 10:27:17 +0000 (13:27 +0300)]
lib-storage: Small code cleanup for index_mail_get_binary_stream()
stream_r is always non-NULL here. Also move unreferencing cache istream to
be last in case it might fix data.stream=NULL being here in some situations.
Timo Sirainen [Wed, 22 Apr 2015 15:17:10 +0000 (18:17 +0300)]
lib-storage: Added support for subscriptions file version 2 format.
The v2 format's main benefit is that it doesn't write the hierarchy
separator to the subscriptions file, which allows the separator to be
changed without breaking subscriptions. This mainly affects LAYOUT=INDEX,
which doesn't have a native hardcoded separator.
The plan is to start writing v2 subscription files in Dovecot v2.3. So for
now we simply read such files and if we find v2 file we also modify it in v2
format, but we never create new v2 format files or convert v0 to v2.
Timo Sirainen [Tue, 21 Apr 2015 18:28:41 +0000 (21:28 +0300)]
fts: If backend has FTS_BACKEND_FLAG_TOKENIZED_INPUT set, index also the header name.
We were sending the hdr_name to the backend without tokenizing it or
filtering it, so the backend couldn't have done anything useful about it.
Timo Sirainen [Tue, 21 Apr 2015 14:01:39 +0000 (17:01 +0300)]
lmtp proxy: Include in log messages how long it took to deliver the mail.
In multi-RCPT TO sessions it's a bit unreliable to split the single DATA
reply's times to multiple lines, so instead each line just says
"(2/3 at 123 ms)" meaning that the second mail was delivered at the time
when 123 milliseconds had elapsed since the delivery was started.
Timo Sirainen [Tue, 21 Apr 2015 13:54:51 +0000 (16:54 +0300)]
lib-lda: Assume that the caller sets delivery_time_started
This is required because parts of the delivery time may be done at the time
the user is being initialized, so it needs to be set before the user init is
done.
Timo Sirainen [Tue, 21 Apr 2015 13:52:59 +0000 (16:52 +0300)]
lib-lda: mail_deliver_log() now updates the %{delivery_time} instead of using the first cached value.
The first time the cached values are set the transaction isn't committed and
the mailbox isn't synced.
Timo Sirainen [Tue, 21 Apr 2015 11:06:22 +0000 (14:06 +0300)]
imap: Include in tagged reply how much running time each IMAP command takes.
The running time doesn't include time spent waiting for the client on
ioloop.
Timo Sirainen [Tue, 21 Apr 2015 10:19:24 +0000 (13:19 +0300)]
lda, lmtp: Added delivery_time and session_time variables to deliver_log_format
session_time is meaningful only with LMTP. The delivery_time is separate for
each mail delivery. The results are in milliseconds now. If needed we could
add a new %modifier that converts it into secs.millisecs.
Timo Sirainen [Mon, 20 Apr 2015 14:33:09 +0000 (17:33 +0300)]
lib-fts: Fixed test-fts-language to use TEXTCAT_DATADIR
This may still make too many assumptions about what data exists where.. So
we may need to remove this test from "make check". But for now leave it
there.
Timo Sirainen [Mon, 20 Apr 2015 13:19:07 +0000 (16:19 +0300)]
Initial import for lib-fts.
Parts of what this code does was already implemented internally by
fts-lucene. lib-fts is intended to be usable for all the FTS backends. The
APIs are still going to change a bit, but hopefully not after v2.2.17
release.
Timo Sirainen [Mon, 20 Apr 2015 12:27:02 +0000 (15:27 +0300)]
configure: Fixed/improved finding and using libexttextcat.
libexttextcat wasn't actually being used at all by fts-lucene. Now we'll
first prefer finding it via pkg-config, next finding exttextcat and only
last look up textcat.
Timo Sirainen [Mon, 20 Apr 2015 12:12:14 +0000 (15:12 +0300)]
configure: Stemmer and textcat checks are now done even if CLucene isn't used.
They'll be useful for other FTS backends as well. This patch doesn't change
any actual functionality.
Timo Sirainen [Thu, 16 Apr 2015 11:19:51 +0000 (14:19 +0300)]
doveadm mailbox metadata: The keys must always be lowercased.
The keys need to be case-insensitive in IMAP, so the IMAP code always also
lowercases them.
Phil Carmody [Thu, 16 Apr 2015 08:46:22 +0000 (11:46 +0300)]
lib: test-array build warnings on Solaris 10
Solaris cc doesn't think I've read N1570 6.7.9p11, 6.5.16.1p2, and 6.3.1.3p2,
and wants to save me from myself.
Reported-by: Juergen Obermann <http://www.dovecot.org/list/dovecot/2015-April/100427.html> Signed-off-by: Phil Carmody <phil@dovecot.fi>
Timo Sirainen [Wed, 15 Apr 2015 18:01:11 +0000 (21:01 +0300)]
imapc: Added imapc_features=zimbra-workarounds
Zimbra (at least v5.0.18_GA_3011.RHEL4_64) can return different headers
depending on whether the whole message body was fetched or only (partial)
headers. This probably happens only for invalid characters that are
translated into '?'. With this workaround enabled we don't use FETCH
BODY.PEEK[], but we do FETCH (BODY.PEEK[HEADER] BODY.PEEK[TEXT]) and merge
the results together. This way the results are always consistent and headers
don't suddenly change.
Timo Sirainen [Tue, 14 Apr 2015 06:58:01 +0000 (09:58 +0300)]
dict-file: Use tabescaping for keys and values to allow LFs in them.
Although this makes the format slightly incompatible, it's doubtful anybody
is using dict values containing \001 characters.
Timo Sirainen [Wed, 8 Apr 2015 04:55:35 +0000 (13:55 +0900)]
lib: Added json-tree API for parsing JSON input into a tree structure.
This makes it easier to access complicated JSON structs that can fit into
memory.
Timo Sirainen [Fri, 27 Mar 2015 13:12:50 +0000 (15:12 +0200)]
imapc: Don't assert-crash when trying to sync a mailbox with MAILBOX_FLAG_SAVEONLY.
We can just skip the sync, because we don't do anything except save mails.
Timo Sirainen [Fri, 27 Mar 2015 12:31:01 +0000 (14:31 +0200)]
quota: When reporting quota value/limit in kilobytes, round the value upwards.
Most importantly this doesn't truncate <1024 values to 0, which also in
quota limit means unlimited.
Timo Sirainen [Sun, 22 Mar 2015 18:54:29 +0000 (20:54 +0200)]
lib-storage: Added mailbox_list_fs_get_list()
Using mailbox_list_init_fs() now sets the mailbox_list pointer to root fs,
which allows the fs backends to lookup the list. Although this can't be done
in the init() function since the list is set only afterwards.
Timo Sirainen [Sun, 22 Mar 2015 18:52:16 +0000 (20:52 +0200)]
lib-fs: When autoloading fs plugins with '-' in the name, translate them to '_'
It's not possible for the function names to contain '-' in any case. Also
Dovecot in general uses '-' instead of '_' in the configuration names. This
change actually allows using either of them.
Timo Sirainen [Fri, 20 Mar 2015 11:27:00 +0000 (13:27 +0200)]
Removed mountpoint checking and updating code.
After a few years it seems like it has just caused more problems than it has
actually fixed. The only thing it's been used for is to make sure that
Dovecot can't create empty user directories when the user's mail filesystem
isn't mounted. But that's supposed to be normally prevented already if the
mount root directory permissions are only writable by root.
For now the mountpoint listing code and doveadm mount code still exists just
in case people have some scripts using those. Those could be removed in v2.3.
If we somehow figured out which mountpoints existed (not so easy because
they could be only visible in userdb lookups for different users), we could
maybe create some kind of a script that checks the permissions at startup.
This would work with Linux at least:
mkdir test
mount / -o bind test
ls -ld test/var/mail # assuming /var/mail mountpoint
umount test
Timo Sirainen [Wed, 18 Mar 2015 23:24:32 +0000 (01:24 +0200)]
imapc: Don't wait for login to succeed at mailbox list creation.
The failure will be visible in the next command. This wait was here mainly
for imap, but cbdfca7d24a6 implements the wait in imap process directly.
Other (current) protocols don't need such wait at all.
Most importantly this change allows doveadm to handle imapc login failures
by seeing them as MAIL_ERROR_PERM errors when listing mailboxes or opening a
mailbox. This allows it to return a different exit code from temporary
failure (which it is not).
Timo Sirainen [Wed, 18 Mar 2015 22:38:01 +0000 (00:38 +0200)]
imapc: If authentication fails, preserve the error message as storage/list error.
This isn't very helpful yet, because the mailbox list creation itself fails.
Phil Carmody [Wed, 18 Mar 2015 15:10:23 +0000 (17:10 +0200)]
lib: buffer - paranoid compile-time check for struct sizes
At the moment, nothing guarantees that the public struct is big
enough to contain the private struct.
Timo Sirainen [Mon, 16 Mar 2015 21:25:34 +0000 (23:25 +0200)]
auth ldap: Start LDAP connection only after auth process initialization is finished.
This way even if connecting to LDAP takes a while it won't cause the master
process to kill the auth process due to it not sending the startup "I'm ok"
notification early enough.
Timo Sirainen [Mon, 16 Mar 2015 21:17:39 +0000 (23:17 +0200)]
auth ldap: If any tls_* settings are given when they're not supported, fail with fatal instead of just warning.
These may be important for intended security, especially tls_cipher_suite.
We shouldn't allow setting them and then somewhat silently just ignore them.
Timo Sirainen [Mon, 16 Mar 2015 21:14:49 +0000 (23:14 +0200)]
auth ldap: Call ldap_init*() already at db_ldap_init().
ldap_init*() doesn't start connecting yet, but this way we can verify that
all the settings are correct.