From ab941aff19b1518b897a6069831a1e22f1c0261b Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Mon, 25 Jul 2011 15:14:03 +0000 Subject: Flush output buffers before closing TCP session. Fixes the case where the proxy would eat the 221 response coming from the server towards the client. This is a commit as HEAD got the change with the entire pf45 import. PR: bin/154469 Obtained from: OpenBSD r1.18 MFC after: 2 weeks --- contrib/pf/ftp-proxy/ftp-proxy.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'contrib') diff --git a/contrib/pf/ftp-proxy/ftp-proxy.c b/contrib/pf/ftp-proxy/ftp-proxy.c index 06c848795b8d..1c3e8c6e1ce0 100644 --- a/contrib/pf/ftp-proxy/ftp-proxy.c +++ b/contrib/pf/ftp-proxy/ftp-proxy.c @@ -273,6 +273,12 @@ end_session(struct session *s) logmsg(LOG_INFO, "#%d ending session", s->id); + /* Flush output buffers. */ + if (s->client_bufev && s->client_fd != -1) + evbuffer_write(s->client_bufev->output, s->client_fd); + if (s->server_bufev && s->server_fd != -1) + evbuffer_write(s->server_bufev->output, s->server_fd); + if (s->client_fd != -1) close(s->client_fd); if (s->server_fd != -1) -- cgit v1.3