changeset 22188:c6e7ba218fb3

imapc: Check for auth failures when saving messages First, don't even attempt an APPEND if we've already seen an auth failure. Second, if APPEND does fail because of auth error, set the correct error to storage.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 12 Jun 2017 12:07:52 +0300
parents 226c1f5c34c2
children 7728c01e1603
files src/lib-storage/index/imapc/imapc-save.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-save.c	Mon Jun 12 12:03:39 2017 +0300
+++ b/src/lib-storage/index/imapc/imapc-save.c	Mon Jun 12 12:07:52 2017 +0300
@@ -66,6 +66,9 @@
 
 	i_assert(ctx->fd == -1);
 
+	if (imapc_storage_client_handle_auth_failure(ctx->mbox->storage->client))
+		return -1;
+
 	ctx->fd = imapc_client_create_temp_fd(ctx->mbox->storage->client->client,
 					      &path);
 	if (ctx->fd == -1) {
@@ -171,6 +174,8 @@
 			imapc_save_appenduid(ctx->ctx, reply, &uid);
 		imapc_save_add_to_index(ctx->ctx, uid);
 		ctx->ret = 0;
+	} else if (imapc_storage_client_handle_auth_failure(ctx->ctx->mbox->storage->client)) {
+		ctx->ret = -1;
 	} else if (reply->state == IMAPC_COMMAND_STATE_NO) {
 		imapc_copy_error_from_reply(ctx->ctx->mbox->storage,
 					    MAIL_ERROR_PARAMS, reply);