Timo Sirainen [Mon, 5 May 2014 12:05:20 +0000 (15:05 +0300)]
liblib: Added str_append_data(), which is simply a wrapper to buffer_append()
This is intended for appending data that may contain NUL characters that are
wanted to be added to the string.
Timo Sirainen [Mon, 5 May 2014 11:18:31 +0000 (14:18 +0300)]
imap: Brought back the original SEARCH PARTIAL code with the minor fix that it actually needed.
The new code in v2.2.11 was completely wrong. The code in previous commit
was broken with SORT. The original code was correct otherwise, except it
couldn't handle partial1 pointing past the valid range.
Timo Sirainen [Fri, 2 May 2014 10:36:00 +0000 (13:36 +0300)]
maildir: Returning mail's received/saved date or refcount was sometimes broken with zlib plugin.
If the value wasn't already cached and the same transaction also accessed
the message body, i_stream_stat() was used, which ended up to
i_stream_seekable_stat() due to caching the file, which didn't again fstat()
the actual maildir file but just used some internal values.
Timo Sirainen [Fri, 2 May 2014 08:40:05 +0000 (11:40 +0300)]
auth: Fixed userdb extra fields handling in passdb failure.
userdb prefetch -flag wasn't correctly set, causing the prefetch userdb in
some situations incorrectly either to be called or not be called.
This also fixes a crash when using userdb static and multiple passdbs. The
userdb_reply was set to NULL, which caused a crash later.
Timo Sirainen [Fri, 2 May 2014 08:12:58 +0000 (11:12 +0300)]
imap: Make sure we don't return empty "* n FETCH ()" reply, which violates RFC 3501 ABNF.
It happened only during error conditions, and it would be a bit too much
trouble to try to remove the reply entirely, so just append the message UID
there.
Timo Sirainen [Wed, 30 Apr 2014 14:37:43 +0000 (17:37 +0300)]
lib-storage: Partially reverted the mail.get_real_mail() API change for backwards compatibility.
I hadn't realized Pigeonhole was also using it. (I thought it was using only
the mail_get_real_mail() public API.) This fixes Pigeonhole v0.4.2 to work
again.
Timo Sirainen [Wed, 30 Apr 2014 03:08:46 +0000 (06:08 +0300)]
dsync: saved-date doesn't need to be looked up until mail body is being read.
This should improve the performance when the saved-date isn't already cached
or otherwise quickly accessible.
This change also makes dsync slightly incompatible with earlier versions.
When using dsync with an earlier version the saved-dates aren't synced. It
would be too much trouble to try to preserve full backwards compatibility,
especially because saved-date doesn't matter so much and isn't even visible
to IMAP clients.
Timo Sirainen [Tue, 29 Apr 2014 13:03:17 +0000 (16:03 +0300)]
lib-mail: istream-attachment-extractor handled mixed LFs vs CRLFs correctly.
Unless all the lines have the same newlines, the attachment can't be
recreated back exactly the same.
Timo Sirainen [Mon, 28 Apr 2014 17:14:03 +0000 (20:14 +0300)]
dsync: If incremental dsync finds that its state is stale, retry (later) with full sync.
This works only when the master itself notices such changes locally. Remote
changes aren't noticed, because the master doesn't send the state to remote
dsync and the master is also the one that decides which mailboxes are
synced. The fix to this probably means sending the state string to remote
dsync and have it check if the state is still valid (= protocol change).
Timo Sirainen [Mon, 28 Apr 2014 15:34:27 +0000 (18:34 +0300)]
doveadm replicator add <user mask> command added.
This allows quickly adding users from userdb that don't exist in replicator.
For example "doveadm replicator add '*'" adds all the new users from userdb.
This isn't really necessary though. Users will be automatically added as
soon as their mailboxes change in some way and replicator gets notified
about them.
Stephan Bosch [Sat, 26 Apr 2014 19:40:14 +0000 (22:40 +0300)]
lib-http: Fixed problem with connections idling indefinitely.
Forgot to check for idle connections when request finished after waiting
for payload to be read by application.
Timo Sirainen [Fri, 25 Apr 2014 13:15:20 +0000 (16:15 +0300)]
lib-lda: When non-RCPT/DATA command fails permanently, translate it internally to temporary failure.
We shouldn't be answering permanent failures to RCPT/DATA command when the
failure really had nothing to do with the recipient/content itself. Most
likely it's just some server misconfiguration, which should be treated as
temporary error.
Timo Sirainen [Wed, 23 Apr 2014 13:45:10 +0000 (16:45 +0300)]
virtual: Fixed assert-crash in IDLE caused by earlier changes.
This change negates all the improvements of the earlier changes when IDLE is
used. This could be fixed by using mailbox-list-notify.h API.
Timo Sirainen [Wed, 23 Apr 2014 13:31:36 +0000 (16:31 +0300)]
virtual: Delay initializing search args until the mailbox is actually opened.
Fixes assert-crash caused by recent changes when virtual mailbox search args
contained e.g. keywords.
Timo Sirainen [Tue, 22 Apr 2014 10:15:21 +0000 (13:15 +0300)]
safe_memset() wasn't safe with modern compilers anymore.
Another try based on David Jacobson's code in
https://www.mail-archive.com/openssl-dev@openssl.org/msg34134.html :
"""
Since vs points to a volatile, the load in the while clause actually has to
be done. That forces the compiler to actually store c into at least the byte
that is tested, in practice byte zero. But the fact that the index is
volatile zero, and since it is volatile it could spontaneously change to
anything, the compiler has to store c into all bytes.
The key observation is that while you can't pass a volatile to memset (you
get a warning and the volatile gets stripped away), you can use a volatile
in a test that could go the wrong way if the memset were elided.
"""
Timo Sirainen [Sat, 19 Apr 2014 09:21:47 +0000 (11:21 +0200)]
lib-http: Fixed resource leaks in http_client_wait() occurring a dns_client is used.
If all DNS lookups finished before the end of the wait cycle, the dns_client would not be switched back to the original ioloop.
Timo Sirainen [Sat, 19 Apr 2014 09:07:45 +0000 (11:07 +0200)]
ioloop: Fixed segfault crash in io_loop_call_pending().
When a callback called io_set_pending(), the io_loop_call_pending() loop
crossed the end of the ioloop->io_files list.
Timo Sirainen [Thu, 17 Apr 2014 14:42:02 +0000 (16:42 +0200)]
fts-lucene: Added mime_parts parameter to index MIME parts as separate documents.
This is in preparation for being able to actually read such information and
show it to clients via some new IMAP extension.
Also it might be better to index some MIME parts together to avoid wasting
disk space, but for now this is all or nothing. For example anything that is
"message body" could probably be indexed without the part number at all.
Timo Sirainen [Thu, 17 Apr 2014 12:21:55 +0000 (14:21 +0200)]
auth: Use special AUTH_SUBSYS_DB/MECH parameters as auth_request_log*() subsystem.
This avoids hardcoded strings all over the place and also allows assigning
the correct passdb/userdb name for log messages generated by generic
passdb/userdb code, which doesn't know exactly where it was called from.
Timo Sirainen [Thu, 17 Apr 2014 08:17:09 +0000 (10:17 +0200)]
lib-http: http_client_request_finish_payload() no longer waits for the entire result payload.
The caller can now read it instead, or just discard it by not reading it.
Timo Sirainen [Wed, 16 Apr 2014 14:05:12 +0000 (16:05 +0200)]
maildir: Added maildir_empty_new setting to avoid keeping mails in new/ directory.
This is useful for example when using an external MDA that calls "doveadm
index" and the user hasn't opened the mailbox for a long time.
Also this removes the delay that user may see when opening a rarely accessed
mailbox, which renames a ton of files to cur/ while the user is waiting.
Timo Sirainen [Tue, 15 Apr 2014 22:04:29 +0000 (00:04 +0200)]
lib-storage: Further changes to mailbox_alloc_guid() caching.
We'll now cache the GUIDs forever and force invalidation after mailbox
rename or when mailbox GUIDs have been updated. This is what dsync needs,
especially for good performance, and currently there aren't any other users
for this API.
Timo Sirainen [Tue, 15 Apr 2014 21:44:54 +0000 (23:44 +0200)]
lib-storage: mailbox_alloc_guid() shouldn't refresh GUID cache on every nonexistent GUID.
Refresh it only if we know it has had some changes (made by our process) or
timestamp has changed. This should handle the cases that are currently
important (=single dsync run).