Skip to content

Commit

Permalink
imapc: Check for auth failures when saving messages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen authored and GitLab committed Jun 12, 2017
1 parent 68e81f0 commit d824b1a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib-storage/index/imapc/imapc-save.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -165,6 +168,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);
Expand Down

0 comments on commit d824b1a

Please sign in to comment.