Skip to content

Commit

Permalink
lib-imap-client: Disconnection during LOGIN should still have state=d…
Browse files Browse the repository at this point in the history
…isconnected

It's not an authentication failure, which would imply that the user or
password was wrong.
  • Loading branch information
sirainen committed Apr 10, 2017
1 parent 59a0265 commit 4b32dbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/lib-imap-client/imapc-client.h
Expand Up @@ -10,7 +10,9 @@ enum imapc_command_state {
IMAPC_COMMAND_STATE_OK,
IMAPC_COMMAND_STATE_NO,
IMAPC_COMMAND_STATE_BAD,
/* Authentication to IMAP server failed (NO or BAD) */
IMAPC_COMMAND_STATE_AUTH_FAILED,
/* Client was unexpectedly disconnected. */
IMAPC_COMMAND_STATE_DISCONNECTED
};

Expand Down
4 changes: 3 additions & 1 deletion src/lib-imap-client/imapc-connection.c
Expand Up @@ -164,7 +164,9 @@ imapc_auth_failed(struct imapc_connection *conn, const struct imapc_command_repl
const char *error)
{
struct imapc_command_reply reply = *_reply;
reply.state = IMAPC_COMMAND_STATE_AUTH_FAILED;

if (reply.state != IMAPC_COMMAND_STATE_DISCONNECTED)
reply.state = IMAPC_COMMAND_STATE_AUTH_FAILED;
reply.text_without_resp = reply.text_full =
t_strdup_printf("Authentication failed: %s", error);
i_error("imapc(%s): %s", conn->name, reply.text_full);
Expand Down

0 comments on commit 4b32dbb

Please sign in to comment.