]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth-client: auth-master - Fix panic when reconnecting after handshake timeout main
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 2 Feb 2026 21:40:19 +0000 (23:40 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 6 Feb 2026 21:17:11 +0000 (21:17 +0000)
The connection wasn't fully disconnected after handshake timeout. Fix this
by moving connection_disconnect() to auth_master_connection_failure() so it
always gets called.

Fixes:
Panic: file connection.c: line 797 (connection_client_connect_with_retries): assertion failed: (conn->fd_in == -1)

src/lib-auth-client/auth-master.c

index ea062f7d89cc48d28e649d08223eaff74c16a254..181d60ece5ffb1e1a950b9e0f8601f1443bc47b8 100644 (file)
@@ -101,6 +101,7 @@ auth_master_connection_failure(struct auth_master_connection *conn,
 
        if (conn->connected)
                e_debug(conn->conn.event, "%s", reason);
+       connection_disconnect(&conn->conn);
 
        conn->connected = FALSE;
        conn->sent_handshake = FALSE;
@@ -136,7 +137,6 @@ auth_master_connection_abort_requests(struct auth_master_connection *conn)
 
 void auth_master_disconnect(struct auth_master_connection *conn)
 {
-       connection_disconnect(&conn->conn);
        auth_master_connection_failure(conn, NULL);
 }
 
@@ -191,9 +191,6 @@ static void auth_master_destroy(struct connection *_conn)
        struct auth_master_connection *conn =
                container_of(_conn, struct auth_master_connection, conn);
 
-       if (conn->connected)
-               connection_disconnect(&conn->conn);
-
        switch (_conn->disconnect_reason) {
        case CONNECTION_DISCONNECT_HANDSHAKE_FAILED:
                auth_master_connection_failure(