Stephan Bosch [Mon, 8 Feb 2016 21:57:13 +0000 (22:57 +0100)]
lib-http: message parser: Made sure that payload stream is always destroyed (hence closed) when the next request is to be parsed.
This makes sure that the connection input is always at the correct position
for the next request. Remaining references to the payload stream could
theoretically mess this up.
Stephan Bosch [Mon, 8 Feb 2016 21:55:09 +0000 (22:55 +0100)]
lib-http: server: Make sure that any pending request is aborted and destroyed before connection FDs are closed.
This way, any payload io struct created from the request callback can be
freed before the associated FD becomes invalid. This would cause an assert
failure otherwise.
Stephan Bosch [Mon, 8 Feb 2016 21:49:28 +0000 (22:49 +0100)]
lib-http: request parser: Made sure that partially parsed requests never have stale string values.
Due to the fact that we assign method and target fields early for proper
error messages, stale fields from previous requests could have ended up in a
partially parsed new request.
Stephan Bosch [Mon, 8 Feb 2016 21:45:54 +0000 (22:45 +0100)]
lib-http: client: Make sure that any pending request is aborted and destroyed before connection FDs are closed.
This way, any payload io struct created from the response callback can be freed before the associated FD becomes invalid.
This would cause an assert failure otherwise.
Timo Sirainen [Fri, 5 Feb 2016 12:55:56 +0000 (14:55 +0200)]
stats: Added ADD-USER command to add stats to a user without having a session.
This will be used by at least the auth process. Although the auth process
does have a session, it's a bit too early to start using it yet. At least the
PID should be possible to change when the session moves to imap process.
Also the unsuccessful authentication sessions shouldn't really be added at
all.
Timo Sirainen [Mon, 1 Feb 2016 20:48:22 +0000 (22:48 +0200)]
sdbox: Failing after saved mails' UIDs were already assigned caused unlink()ing garbage
Mainly with dsync when it fails, the transaction is still committed and
mails are given UIDs. If the transaction commit still fails, it attempts to
rollback the saved mails by unlink()ing them, but at that point the path
pointed to an already freed memory. This caused unlink() errors with some
garbage strings as the path (and hopefully no actually valid paths).
The easiest way to reproduce this was to fill up the filesystem with dsync.
Timo Sirainen [Mon, 1 Feb 2016 18:26:19 +0000 (20:26 +0200)]
imap: Removed special EXPUNGE callback for an Outlook workaround.
As the comment mentions, this workaround isn't needed if index files are
used. Hopefully also the Outlook bug itself is gone nowadays.. In any case
the current callback code didn't work, because it was returning FALSE and
causing an assert in a pipelined EXPUNGE+APPEND combination after 6e9454f:
It would probably be possible to fix this, but it would complicate the code
even further, so it's easier just to get rid of this feature. It was easily
triggered by running imaptest stress testing.
Timo Sirainen [Mon, 1 Feb 2016 17:08:24 +0000 (19:08 +0200)]
pop3-migration: Ignore mails returned as expunged by pop3c.
Whether the -ERR actually meant they were expunged or not is another
issue, but the answer to that belongs to pop3c code. MAIL_ERROR_EXPUNGED
in any case can be safely handled this way here.
Timo Sirainen [Mon, 1 Feb 2016 17:07:59 +0000 (19:07 +0200)]
pop3c: If prefetch fails, treat it as if prefetching simply wasn't done.
This avoids having error handling twice. Also in case the error was caused
by -ERR, this should retry the operation, which even might fix it in some
situations.
Timo Sirainen [Mon, 1 Feb 2016 15:30:23 +0000 (17:30 +0200)]
lib: Fixed json-parser to correctly parse numbers at EOF.
Numbers are a bit special compared to others, because they don't have any
clear character indicating that the number ends. So we can only assume that
the number is finished when EOF is reached, although even that isn't
necessarily correct in case the stream is terminated unexpectedly.
This change is in prepartion for the next change. With current JSON parser
this issue could never happen because "}" was expected just before EOF.
Timo Sirainen [Thu, 28 Jan 2016 13:36:58 +0000 (15:36 +0200)]
imap: Send all pending tagged command replies before APPEND is started.
This probably doesn't matter a lot, but it's cleaner.
One side effect of this change is that if multiple APPENDs are pipelined
(without MULTIAPPEND) on the selected mailbox, this now performs a sync
between each APPEND and sends the EXISTS replies. This may be slightly
lower in performance, but it's also slightly more correct behavior.
Timo Sirainen [Wed, 27 Jan 2016 13:16:18 +0000 (15:16 +0200)]
imapc: Don't use fetch-fix-broken-mails for OK and NO [SERVERBUG] FETCH replies
Hopefully no servers are actually returning OK without returning a FETCH
reply. If they are, maybe we need another workaround..
In any case Yahoo IMAP sometimes loses state and starts returning OK without
FETCH replies to all UID FETCH requests (and BADs to FETCHes). It also may
return NO [UNAVAILABLE] for both permanent and temporary FETCH failures, so
we can't do anything with that.
I added NO [SERVERBUG] because that's what Dovecot responds to temporary
failures. I'm not sure how useful that check is though.
Timo Sirainen [Tue, 26 Jan 2016 22:35:34 +0000 (00:35 +0200)]
fts-solr: Changed default operator to AND to fix multi-word queries.
Previously for example searching from:foo@example.com was expanded to
foo OR example OR com. Now it's foo AND example AND com, which makes a lot
more sense.
Timo Sirainen [Tue, 26 Jan 2016 17:56:43 +0000 (19:56 +0200)]
dsync: When comparing headers' hashes to match messages, try to normalize the input.
This is especially useful because some IMAP servers return different data
depending on whether we're fetching only specific header fields, all headers
or entire body. For now we're assuming that any non-ASCII is going to be
replaced with '?', which helps at least with Zimbra and Yahoo. The header
hashing algorithm is now versionable, so it can be modified more easily in
future.
This change should make imapc_features=zimbra-workarounds setting obsolete.
Timo Sirainen [Tue, 26 Jan 2016 13:22:50 +0000 (15:22 +0200)]
pop3-migration: Cached header hashes weren't actually being used for imapc.
We'll need to do the search twice: Once to find out the actual cached header
hashes and then second time do a search for the message headers excluding the
emails whose hashes we already know. This allows prefetching to work for imapc
without prefetching all the emails as it was doing.