]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3c: Show the exact state where client timed out
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 17 Nov 2025 13:23:11 +0000 (15:23 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 17 Nov 2025 13:34:42 +0000 (15:34 +0200)
Many different states caused "Authentication timed out".

src/lib-storage/index/pop3c/pop3c-client.c

index 244ba19b704a7eb9cd8ede471ac1c430b31a747b..9f494f2ea0c6119a8d6e9756097b25e50619673f 100644 (file)
@@ -37,8 +37,21 @@ enum pop3c_client_state {
        /* Post-authentication, asking for capabilities */
        POP3C_CLIENT_STATE_CAPA,
        /* Authenticated, ready to accept commands */
-       POP3C_CLIENT_STATE_DONE
+       POP3C_CLIENT_STATE_DONE,
+
+       POP3C_CLIENT_STATE_COUNT
+};
+static const char *pop3c_client_state_names[] = {
+       "disconnected",
+       "connecting",
+       "starttls",
+       "USER",
+       "AUTH",
+       "PASS",
+       "CAPA",
+       "authenticated",
 };
+static_assert_array_size(pop3c_client_state_names, POP3C_CLIENT_STATE_COUNT);
 
 struct pop3c_client_sync_cmd_ctx {
        enum pop3c_command_state state;
@@ -231,7 +244,8 @@ static void pop3c_client_timeout(struct pop3c_client *client)
                break;
        default:
                e_error(client->event,
-                       "Authentication timed out after %u seconds",
+                       "Timed out in state %s after %u seconds",
+                       pop3c_client_state_names[client->state],
                        POP3C_CONNECT_TIMEOUT_MSECS/1000);
                break;
        }
@@ -472,6 +486,7 @@ pop3c_client_prelogin_input_line(struct pop3c_client *client, const char *line)
                break;
        case POP3C_CLIENT_STATE_DISCONNECTED:
        case POP3C_CLIENT_STATE_DONE:
+       case POP3C_CLIENT_STATE_COUNT:
                i_unreached();
        }
        return 0;