From fenner@mango.attlabs.att.com Tue Apr 20 16:41:24 1999
Return-Path: <fenner@mango.attlabs.att.com>
Received: from mango.attlabs.att.com (gate.ipo.att.com [135.197.57.2])
	by hub.freebsd.org (Postfix) with ESMTP id E8ED514D44
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Apr 1999 16:41:23 -0700 (PDT)
	(envelope-from fenner@mango.attlabs.att.com)
Received: (from fenner@localhost)
	by mango.attlabs.att.com (8.9.2/8.9.2) id QAA14027;
	Tue, 20 Apr 1999 16:38:40 -0700 (PDT)
	(envelope-from fenner)
Message-Id: <199904202338.QAA14027@mango.attlabs.att.com>
Date: Tue, 20 Apr 1999 16:38:40 -0700 (PDT)
From: Bill Fenner <fenner@research.att.com>
Sender: fenner@mango.attlabs.att.com
Reply-To: fenner@research.att.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: fetch doesn't notice FTP error after RETR starts
X-Send-Pr-Version: 3.2

>Number:         11247
>Category:       bin
>Synopsis:       fetch doesn't notice FTP error after RETR starts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 20 16:40:01 PDT 1999
>Closed-Date:    Tue Oct 31 12:47:06 PST 2000
>Last-Modified:  Tue Oct 31 12:47:30 PST 2000
>Originator:     Bill Fenner
>Release:        FreeBSD 3.1-STABLE i386
>Organization:
AT&T
>Environment:

fetch(1) since probably forever.

>Description:

During a valid FTP protocol exchange, during which an error occurs
after the file transfer starts, such as:

	RETR foo ---->
	<---- 150 Opening BINARY mode data connection for fenner.tar.gz (264367025 bytes).
	<---- 500 Failed to contact content security server

fetch(1) creates a zero-length file and exits with success.
This is because
1) libftpio doesn't appear to provide a way to check the second return
code (although it might be sufficiently confused to think that it was
the return code for its "QUIT" request)
2) fetch doesn't check the return value of fclose(ftp), even though
libftpio goes to some trouble to provide one.

(Although RFC 959 doesn't explicitly list 550 as a valid response
to a RETR command after the 150 preliminary response, the state
machine on page 55 shows failing on any 4xx or 5xx result after
the initial 1xx result)

>How-To-Repeat:

ftp a file through a Firewall/1 with aftpd and content security
enabled while the content security server is unavailable.

(Why do I always end up at places with weird firewalls?...)

>Fix:
	
Unknown.  I know that libftpio is supposedly dead and libfetch is
supposedly its replacement.  However, libfetch doesn't appear to handle
this problem either.  (In fact, libfetch appears to never attempt to
close the FTP connection cleanly, tsk tsk...)

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Thu Jun 29 02:20:46 PDT 2000 
Responsible-Changed-Why:  
fetch(1) is mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=11247 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Tue Oct 31 12:47:06 PST 2000 
State-Changed-Why:  
Fixed in -CURRENT and -STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=11247 
>Unformatted:
