]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Make sure users are sorted after unfinished handshake
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 17 Nov 2017 16:53:18 +0000 (18:53 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 25 Nov 2017 22:59:17 +0000 (00:59 +0200)
The users were sorted after the handshake was finished, but if the
connection was closed before that hapepned, the users were left
unsorted. This could have caused the users to not expire early
enough.

src/director/director-connection.c

index 62eaf25bb2af584f3abb8b718aa1e1875c5d341c..28af1f238e4fd4d8dc353d9a8a668854c5dba284 100644 (file)
@@ -2241,6 +2241,12 @@ void director_connection_deinit(struct director_connection **_conn,
        if (dir->right == conn)
                dir->right = NULL;
 
+       if (conn->users_unsorted) {
+               /* Users were received, but handshake didn't finish.
+                  Finish sorting so the users won't stay in wrong order. */
+               mail_hosts_sort_users(conn->dir->mail_hosts);
+       }
+
        if (conn->connect_request_to != NULL) {
                director_host_unref(conn->connect_request_to);
                conn->connect_request_to = NULL;