diff options
author | joel <joel@openbsd.org> | 2008-04-22 02:22:22 +0000 |
---|---|---|
committer | joel <joel@openbsd.org> | 2008-04-22 02:22:22 +0000 |
commit | 6767c32ef47198e5a51fd146ce49cc424788cb3a (patch) | |
tree | 3d37e4ca3e711854a141b0fdb7acc3a8137aa1bb /usr.sbin/ftp-proxy | |
parent | Works better, but still needs debug on to work.. (diff) | |
download | wireguard-openbsd-6767c32ef47198e5a51fd146ce49cc424788cb3a.tar.xz wireguard-openbsd-6767c32ef47198e5a51fd146ce49cc424788cb3a.zip |
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.
Patch from camield@. Tested by Camiel and myself.
ok camield@
Diffstat (limited to 'usr.sbin/ftp-proxy')
-rw-r--r-- | usr.sbin/ftp-proxy/ftp-proxy.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/ftp-proxy/ftp-proxy.c b/usr.sbin/ftp-proxy/ftp-proxy.c index cf697b56614..b35c0448611 100644 --- a/usr.sbin/ftp-proxy/ftp-proxy.c +++ b/usr.sbin/ftp-proxy/ftp-proxy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp-proxy.c,v 1.17 2008/04/13 00:22:17 djm Exp $ */ +/* $OpenBSD: ftp-proxy.c,v 1.18 2008/04/22 02:22:22 joel Exp $ */ /* * Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl> @@ -282,6 +282,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) |