Maildir and mbox formats were using index_sync_changes_read(), which assumed that
they were sorted. So some of the intended expunges weren't actually always being
done. This mainly affected when expunges were being done simultaneously by multiple
processes or by pipelined commands. For example:
Aki Tuomi [Mon, 15 Feb 2016 12:02:19 +0000 (14:02 +0200)]
doveadm: Add infrastructure for doveadm_cmd_ver2
Version 2 commands have named parameters, which also have types. This is
especially useful for reading input from HTTP/JSON API. This also simplifies
the parameter parsing for command line input.
For v2.3 the plan is to replace all the old doveadm_cmds with this new
version and get rid of the _ver2 suffixes. But for now we'll have two
versions of commands.
For backwards compatibility with old commands we have also implemented
wrappers so that v2 structs can be defined and there's a function to convert
the named parameters to old v1 style args[] string, so the old command
handlers can still be run. This will also be removed in v2.3.
This change also adds requirement for getopt_long(). It's already available
in all the Linuxes and BSDs, so this shouldn't be too big of a requirement.
Other systems can install it from an external library.
Timo Sirainen [Thu, 11 Feb 2016 11:25:28 +0000 (13:25 +0200)]
auth: Moved all passdb/userdb template handling to auth_passdb/userdb.
This is because passdb_find() and userdb_find() attempts to avoid
duplicating passdbs and userdbs when they have identical driver+args.
This deduplication is useful when using multiple protocol { .. } blocks
that duplicate some passdb/userdb backends. For example we might want
to have only a single SQL connection regardless of how the protocol-specific
passdbs and userdbs are being set up. All the default/override_fields and
result_* settings aren't relevant to the passdb/userdb backends, so removing
them will again allow the deduplication to work correctly.
Stephan Bosch [Wed, 10 Feb 2016 22:39:25 +0000 (23:39 +0100)]
lib-http: Created test program that tests payload exchange between client and server with various configurations.
It recursively uses all files in the current directory as payload.
It is currenrly not part of `make check', because it is a stress-testing tool that can run for a long time.
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.