From pi@home.opsec.eu  Wed Feb  2 15:50:17 2011
Return-Path: <pi@home.opsec.eu>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE3F21065674
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  2 Feb 2011 15:50:17 +0000 (UTC)
	(envelope-from pi@home.opsec.eu)
Received: from home.opsec.eu (home.opsec.eu [IPv6:2001:14f8:200::1])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F53C8FC19
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  2 Feb 2011 15:50:17 +0000 (UTC)
Received: from pi by home.opsec.eu with local (Exim 4.72 (FreeBSD))
	(envelope-from <pi@home.opsec.eu>)
	id 1PkeyH-0000HH-OK; Wed, 02 Feb 2011 16:50:17 +0100
Message-Id: <E1PkeyH-0000HH-OK@home.opsec.eu>
Date: Wed, 02 Feb 2011 16:50:17 +0100
From: Kurt Jaeger <fbsd-pr@opsec.eu>
Reply-To: Kurt Jaeger <fbsd-pr@opsec.eu>
To: FreeBSD-gnats-submit@freebsd.org
Cc: support@nepustil.net
Subject: ftp-proxy bug, merge from openbsd ?
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         154469
>Category:       bin
>Synopsis:       ftp-proxy(8) bug, can be fixed via merge from openbsd ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 02 16:00:22 UTC 2011
>Closed-Date:    Thu Feb 09 09:01:55 UTC 2012
>Last-Modified:  Thu Feb  9 09:10:10 UTC 2012
>Originator:     Kurt Jaeger
>Release:        FreeBSD 8.1-RELEASE amd64
>Organization:
-
>Environment:
System: FreeBSD home.opsec.eu 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64


>Description:
	FreeBSD version of
	/usr/src/contrib/pf/ftp-proxy/ftp-proxy.c
	is version 1.13.

	OpenBSD has a fix for an annoying problem:

	http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/ftp-proxy/ftp-proxy.c.diff?r1=1.17;r2=1.18;f=h

>How-To-Repeat:
	transfer files via FTP from a client behind a pf ruleset with NAT
	and ftp-proxy running.

	Sometimes, the ftp server will send a "221 Bye" packet and
	the client will never see the 'bye', but will only see a
	tcp disconnect. This causes some automated transfers systems
	that use FTP to retransmit.

>Fix:

	Apply the fix from OpenBSD.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Thu Jun 23 08:00:55 UTC 2011 
Responsible-Changed-Why:  
Merge after pf45 hit HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154469 
State-Changed-From-To: open->patched 
State-Changed-By: bz 
State-Changed-When: Mon Jul 25 15:14:38 UTC 2011 
State-Changed-Why:  
HEAD got it with pf45, stable/8 I just committed. Will take 
care of 7.x in a while. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154469 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/154469: commit references a PR
Date: Mon, 25 Jul 2011 15:14:13 +0000 (UTC)

 Author: bz
 Date: Mon Jul 25 15:14:03 2011
 New Revision: 224326
 URL: http://svn.freebsd.org/changeset/base/224326
 
 Log:
   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
 
 Modified:
   stable/8/contrib/pf/ftp-proxy/ftp-proxy.c
 
 Modified: stable/8/contrib/pf/ftp-proxy/ftp-proxy.c
 ==============================================================================
 --- stable/8/contrib/pf/ftp-proxy/ftp-proxy.c	Mon Jul 25 15:10:53 2011	(r224325)
 +++ stable/8/contrib/pf/ftp-proxy/ftp-proxy.c	Mon Jul 25 15:14:03 2011	(r224326)
 @@ -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)
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: bz 
State-Changed-When: Thu Feb 9 09:01:12 UTC 2012 
State-Changed-Why:  
Thanks for the report pi.  Merged to 7 now as well. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154469 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/154469: commit references a PR
Date: Thu,  9 Feb 2012 09:01:20 +0000 (UTC)

 Author: bz
 Date: Thu Feb  9 09:01:03 2012
 New Revision: 231259
 URL: http://svn.freebsd.org/changeset/base/231259
 
 Log:
   MF8 r224326:
   
    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.
   
    Obtained from:	OpenBSD r1.18
   PR:		bin/154469
 
 Modified:
   stable/7/contrib/pf/ftp-proxy/ftp-proxy.c
 Directory Properties:
   stable/7/contrib/pf/   (props changed)
 
 Modified: stable/7/contrib/pf/ftp-proxy/ftp-proxy.c
 ==============================================================================
 --- stable/7/contrib/pf/ftp-proxy/ftp-proxy.c	Thu Feb  9 08:41:56 2012	(r231258)
 +++ stable/7/contrib/pf/ftp-proxy/ftp-proxy.c	Thu Feb  9 09:01:03 2012	(r231259)
 @@ -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)
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
