Skip to content

Commit

Permalink
login proxy: Hanging outgoing SSL connections caused using already-fr…
Browse files Browse the repository at this point in the history
…eed memory

This mainly happened when login proxy closed the connection due to connect
timeout. The ssl-proxy still had a reference and existed for a longer time.
If SSL handshake still succeeded afterwards, it now called
login_proxy_ssl_handshaked(), which accessed the already-freed proxy and
likely crashed.

Fixed the ssl-client proxy code specifically. Alternatively ssl_proxy_free()
could be calling ssl_proxy_destroy() always, but since ssl-server side of
the code seems to have been working fine, I don't want to accidentally
break it.
  • Loading branch information
sirainen committed Oct 20, 2016
1 parent 3a60990 commit 9382f66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/login-common/login-proxy.c
Expand Up @@ -515,8 +515,10 @@ static void login_proxy_free_final(struct login_proxy *proxy)
o_stream_destroy(&proxy->client_output);
if (proxy->client_fd != -1)
net_disconnect(proxy->client_fd);
if (proxy->ssl_server_proxy != NULL)
if (proxy->ssl_server_proxy != NULL) {
ssl_proxy_destroy(proxy->ssl_server_proxy);
ssl_proxy_free(&proxy->ssl_server_proxy);
}
i_free(proxy->host);
i_free(proxy);
}
Expand Down

0 comments on commit 9382f66

Please sign in to comment.