]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp_server_connection_input() - Ensure output errors (and closure) are...
authorMarco Bettini <marco.bettini@open-xchange.com>
Mon, 16 Jan 2023 14:14:34 +0000 (14:14 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Thu, 19 Jan 2023 14:13:41 +0000 (14:13 +0000)
This is especially critical while performing the DATA command.
The DATA (and AUTH) command use smtp_server_connection_reply_immediate()
from within the connection input handler. Without the new code, output
errors in that function are not caught and lead to the server to hang
if the connection is closed in the right moment.

src/lib-smtp/smtp-server-connection.c

index 20f08811607072632890dc4ca180e5d3ad86d975..d31305ec3ec415ba3ef4c8e4634a9553a5aa4e05 100644 (file)
@@ -600,6 +600,11 @@ static void smtp_server_connection_input(struct connection *_conn)
            conn->callbacks->conn_cmd_input_post != NULL)
                conn->callbacks->conn_cmd_input_post(conn->context);
        conn->handling_input = FALSE;
+
+       /* Handle output errors from immediate replies sent to client
+          (normal replies are exclusively sent in output handler). */
+       if (conn->conn.output != NULL && conn->conn.output->closed)
+                       smtp_server_connection_handle_output_error(conn);
        smtp_server_connection_unref(&conn);
 }