Stephan Bosch [Fri, 17 Mar 2017 22:35:55 +0000 (23:35 +0100)]
lib-http: client: Restructured the handling of delayed errors.
The req->delayed_error* fields are cleared before the callback is called and before the request is dereferenced.
This way, freeing the request never removes it from the delayed request list when the list is being processed.
It also makes it possible to resubmit the request from the callback (mainly for future use).
Stephan Bosch [Wed, 1 Mar 2017 23:42:13 +0000 (00:42 +0100)]
lib-smtp: lmtp-client: Fixed bug in timeout handling.
The timeout was erroneously stopped when lmtp_client_send() was invoked before a connection was established.
Once the connection finally got established, the timeout was removed.
This would cause the client to wait indefinitely.
Stephan Bosch [Wed, 1 Mar 2017 23:03:50 +0000 (00:03 +0100)]
lib-lda: smtp-client: Make sure only the first error determines the tempfail status.
The client is supposed to stop running the moment the first error occurs. However, there is a (very unlikely) possiblity that the encapsulated LMTP client issues both an RCPT and DATA error callback in sequence.
In that case, the second callback should not override the tempfail status of the first (the second likely is a tempfail).
If the server disconnects right after failing the last of at least two recipients, the lmtp-client would issue a DATA callback with a disconnection error.
The disconnect error would set the client->tempfail flag, which caused smtp_client_deinit*() to always return -1 in this scenario.
Timo Sirainen [Thu, 16 Mar 2017 16:46:28 +0000 (18:46 +0200)]
lib-storage: Don't reset \Recent flags when rebuilding index
The recent flags are tracked with first_recent_uid in the header. If the
first_recent_uid is valid in the old index, preserve it. This way all
mails don't show as having \Recent flag.
Aki Tuomi [Mon, 20 Feb 2017 07:32:15 +0000 (09:32 +0200)]
lib-ssl-iostream: Fix ambiguity with SSL settings
- lib-ssl-iostream as client: Use only allow_invalid_cert. If it's not set, verify the server cert.
- lib-ssl-iostream as server: If verify_client_cert=FALSE, don't ask for the client cert. Otherwise, ask for client cert but still allow it if allow_invalid_cert=TRUE.
Aki Tuomi [Sat, 11 Mar 2017 17:20:30 +0000 (19:20 +0200)]
doveadm: Do not crash doveadm-server if input file missing
save commands expects valid input file for it to work,
if we are not running for cli, and input file is not
provided, provide EINVAL error to caller via i_stream_error.
Timo Sirainen [Mon, 13 Mar 2017 12:23:11 +0000 (14:23 +0200)]
auth: Auth workers shouldn't return username if it wasn't changed
This continues the previous fix where username was always added to
passdb/userdb cache, even if the username wasn't changed. That could have
resulted in wrongly changing usernames if the cache key didn't uniquely
identify the user.
Timo Sirainen [Mon, 13 Mar 2017 11:49:04 +0000 (13:49 +0200)]
auth: passdb/userdb lookups via auth-worker cached too much of the replies
Only the fields returned by the lookup itself were supposed to be cached.
This was especially problematic if the lookup via auth-worker didn't
uniquely identify the user. For example doing a passdb lookup for an
attribute shared by multiple users could have caused the reply to contain
the previous cached user's all extra fields.
Timo Sirainen [Wed, 15 Mar 2017 23:22:09 +0000 (01:22 +0200)]
lib-oauth2: Don't free oauth2_request too early.
Move the freeing explicitly to only after calling the callback. The
previous method of freeing it on when http_request was destroyed could
have happened too early when oauth2_parse_json() called i_stream_unref(),
which released the last reference to the http_request.
Timo Sirainen [Wed, 15 Mar 2017 22:51:15 +0000 (00:51 +0200)]
auth: oauth2 - make it easier to see where db_oauth2_callback() is called
Doesn't fix anything, but places the db_oauth2_callback() calls into the end
of _continue() calls so it's clearer that they're always being called
exactly once.
result->error is NULL only if result->success && !result->valid.
Also !result->success is the more important error handling case.
Write out these cases explicitly so it's easier to understand.
Timo Sirainen [Sun, 26 Feb 2017 12:32:44 +0000 (14:32 +0200)]
lazy-expunge: Use mailbox_move() instead of mailbox_copy()
This allows some optimizations to be performed that are only possible when
moving messages.
It's slightly strange now that mail_expunge() is triggered twice for the
same source mail, but lazy_expunge plugin is called very early so most
plugins won't see it called twice. Currently only acl plugin sees it, and
it doesn't care.
Stephan Bosch [Thu, 23 Feb 2017 18:38:31 +0000 (19:38 +0100)]
lib-http: client: Fixed i_unreached() failure occurring when a host's list of IPs changes while a connection is still pending.
In that case, the IP of the pending connection may no longer be associated with that host.
If the IP was not found anymore, the i_unreached() error occurred.