]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Avoid a potential assert-crash after removing a director from ring.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 30 Mar 2016 05:24:51 +0000 (08:24 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 30 Mar 2016 05:27:06 +0000 (08:27 +0300)
This should fix the crash:
Panic: director: file director-connection.c: line 1926 (director_connection_init_out): assertion failed: (!host->removed)

Also moved the last_network_failure timestamp reset a bit later, since
there's no need to reset the timestamp if we're not actually connecting
to the server.

src/director/director-connection.c

index 9c058f2150d9550d1377bc9f7455f0b5f3c2ffa7..a727658efd796b0532880c1cc35efb48833cf383 100644 (file)
@@ -1472,8 +1472,6 @@ static bool director_cmd_connect(struct director_connection *conn,
        }
 
        host = director_host_get(conn->dir, &ip, port);
-       /* reset failure timestamp so we'll actually try to connect there. */
-       host->last_network_failure = 0;
 
        /* remote suggests us to connect elsewhere */
        if (dir->right != NULL &&
@@ -1485,6 +1483,11 @@ static bool director_cmd_connect(struct director_connection *conn,
                return TRUE;
        }
 
+       /* reset failure timestamp so we'll actually try to connect there. */
+       host->last_network_failure = 0;
+       /* reset removed-flag, so we don't crash */
+       host->removed = FALSE;
+
        if (dir->right == NULL) {
                dir_debug("Received CONNECT request to %s, "
                          "initializing right", host->name);