]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Check for auth failures when saving messages
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 12 Jun 2017 09:07:52 +0000 (12:07 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Jun 2017 09:06:42 +0000 (12:06 +0300)
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.

src/lib-storage/index/imapc/imapc-save.c

index e308c29889a0573ecb50f5d88f5220db6886d917..ab6bd63a9cb7be8d08c6adc892585773875519bd 100644 (file)
@@ -66,6 +66,9 @@ int imapc_save_begin(struct mail_save_context *_ctx, struct istream *input)
 
        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 @@ static void imapc_save_callback(const struct imapc_command_reply *reply,
                        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);