Fix file descriptor leak in passthrough mode (-P)

When using passthrough mode, if a connection to a server fails with an
SSL error, sslsplit falls back to plain TCP passthrough.  When
reconnecting with plain TCP, the SSL context was freed, but the file
descriptor was never closed.  The fix remedies that by calling the
proper cleanup function for the dst bev before reconnecting.

Reported by:	Peter Haag
pull/13/head
Daniel Roethlisberger 11 years ago
parent e129041c1c
commit 56842b2f63

@ -1428,6 +1428,7 @@ pxy_bev_eventcb(struct bufferevent *bev, short events, void *arg)
ctx->src.ssl = pxy_srcssl_create(ctx, this->ssl);
if (!ctx->src.ssl) {
bufferevent_free_and_close_fd(bev, ctx);
ctx->dst.bev = NULL;
ctx->dst.ssl = NULL;
if (ctx->opts->passthrough && !ctx->enomem) {
ctx->passthrough = 1;
@ -1569,7 +1570,8 @@ pxy_bev_eventcb(struct bufferevent *bev, short events, void *arg)
ctx->opts->passthrough && have_sslerr) {
/* ssl callout failed, fall back to plain
* TCP passthrough of SSL connection */
SSL_free(ctx->dst.ssl);
bufferevent_free_and_close_fd(bev, ctx);
ctx->dst.bev = NULL;
ctx->dst.ssl = NULL;
ctx->passthrough = 1;
log_dbg_printf("SSL dst connection failed; fal"

Loading…
Cancel
Save