]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap-client: Disconnection during LOGIN should still have state=disconnected
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Apr 2017 13:44:52 +0000 (16:44 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Apr 2017 15:00:13 +0000 (18:00 +0300)
It's not an authentication failure, which would imply that the user or
password was wrong.

src/lib-imap-client/imapc-client.h
src/lib-imap-client/imapc-connection.c

index 08863f25b4f7b44b2be3d6207ade02396077e24a..b07e4f057a017a9eb66d248be8d66f030b735607 100644 (file)
@@ -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
 };
 
index 37fbf0748ddc27878d401992262b97709b58985d..df9d4d7d94719e0f997e3e287d496a7d7658c768 100644 (file)
@@ -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);