BABYL OPTIONS: -*- rmail -*-
Version: 5
Labels:
Note:   This is the header of an rmail file.
Note:   If you are seeing it in rmail,
Note:    it means the file has no messages in it.

1, answered,,
Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by e40-po.MIT.EDU (5.61/4.7) id AA22621; Mon, 5 Jun 95 10:34:51 EDT
Received: from ets.cis.brown.edu by MIT.EDU with SMTP
	id AA15428; Mon, 5 Jun 95 10:34:49 EDT
Received: (from james@localhost) by ets.cis.brown.edu (8.6.12/8.6.12) id KAA14893 for tytso@MIT.EDU; Mon, 5 Jun 1995 10:34:48 -
0400
From: James_Mathiesen <james@ets.cis.brown.edu>
Message-Id: <199506051434.KAA14893@ets.cis.brown.edu>
Subject: hanging wu-ftpd daemons
To: tytso@MIT.EDU
Date: Mon, 5 Jun 1995 10:34:48 -0400 (EDT)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1854      

*** EOOH ***
0400
From: James_Mathiesen <james@ets.cis.brown.edu>
Subject: hanging wu-ftpd daemons
To: tytso@MIT.EDU
Date: Mon, 5 Jun 1995 10:34:48 -0400 (EDT)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1854      

I was just catching up on comp.protocols.kerberos and saw you mention
problems with your wu-ftpd derivitive not timing out connections.  This
patch really helped our server.


Article: 29613 of comp.unix.solaris
Path: cat.cis.Brown.EDU!agate!howland.reston.ans.net!Germany.EU.net!EU.net!sun4nl!fwi.uva.nl!not-for-mail
From: casper@fwi.uva.nl (Casper H.S. Dik)
Newsgroups: comp.unix.solaris
Subject: Re: Curious wu-ftpd Problem
Date: 22 Nov 1994 13:22:36 +0100
Organization: FWI, University of Amsterdam
Lines: 44
Distribution: inet
Message-ID: <3asnqc$1h0@mail.fwi.uva.nl>
References: <3agabp$qfd@news.CCIT.Arizona.EDU> <3agmmm$lul@mail.fwi.uva.nl> <3aq6dr$4u0@mail.fwi.uva.nl>
NNTP-Posting-Host: mail.fwi.uva.nl

casper@fwi.uva.nl (Casper H.S. Dik) writes:


>	ftp <server>
>	quote pasv
>	quote retr file

>Then abort your ftp client.

>From the looks of it, it seems like someone's ftp client code is broken.
>But wu-ftpd should time out the accept.


Here's a tentative fix for the problem (works for Solaris, should work
for a number of other OSes too).  This fix make accept time out after
120 seconds, instead of waiting forever.

*** ftpd.c.org	Thu Apr 14 22:05:35 1994
--- ftpd.c	Mon Nov 21 19:40:59 1994
***************
*** 1710,1717 ****
--- 1710,1731 ----
          int s,
            fromlen = sizeof(from);
  
+ #ifdef FD_ZERO
+ 	struct timeval timeout;
+ 	fd_set set;
+ 
+ 	FD_ZERO(&set);
+ 	FD_SET(pdata, &set);
+ 
+ 	timeout.tv_usec = 0;
+ 	timeout.tv_sec = 120;
+ 
+ 	if (select(pdata+1, &set, (fd_set *) 0, (fd_set *) 0, &timeout) == 0 ||
+ 	    (s = accept(pdata, (struct sockaddr *) &from, &fromlen)) < 0) {
+ #else
          s = accept(pdata, (struct sockaddr *) &from, &fromlen);
          if (s < 0) {
+ #endif
              reply(425, "Can't open data connection.");
              (void) close(pdata);
              pdata = -1;



1, answered,,
Received: from PACIFIC-CARRIER-ANNEX.MIT.EDU by e40-po.MIT.EDU (5.61/4.7) id AA29971; Thu, 1 Jun 95 15:46:54 EDT
Received: from inet-smtp-gw-1.us.oracle.com by MIT.EDU with SMTP
	id AA18051; Thu, 1 Jun 95 15:46:53 EDT
Received:  from teal.us.oracle.com by inet-smtp-gw-1.us.oracle.com with ESMTP (8.6.12/37.7)
	id MAA15655; Thu, 1 Jun 1995 12:46:52 -0700
Received:  from localhost by teal.us.oracle.com with SMTP (8.6.9/37.8)
	id MAA22390; Thu, 1 Jun 1995 12:46:47 -0700
Message-Id: <199506011946.MAA22390@teal.us.oracle.com>
To: tytso@MIT.EDU
Subject: wu-ftpd hangs
Date: Thu, 01 Jun 1995 12:46:47 -0700
From: Dave Morrison <dmorriso@us.oracle.com>

*** EOOH ***
To: tytso@MIT.EDU
Subject: wu-ftpd hangs
Date: Thu, 01 Jun 1995 12:46:47 -0700
From: Dave Morrison <dmorriso@us.oracle.com>


Saw your posting in comp.protocols.kerberos, and thought you might like
to know about details of the wu-hangs if you didn't know.

> One of these days, in my copious free time, I'll have to see if this
> problem is fixed in the latest wuarchive ftpd, and then port the
> MIT-specific changes to ftpd to it......

It's not unless you count some bogus betas...

wu-ftpd has a design deficiency in that its timeout only applies during
periods in which wu-ftpd is waiting for a command (IDLE state).  
Hangs which happens during a command execution (e.g. ftp to your ftp
server, type "get filename" on a large file, and during the transfer
suspend the ftp... the server will block, and never timeout - good way
of doing a denial of service attack on an anonymous ftp server).

A point patch fixes the common problem with web browsers, which
sometimes, due to the user aborting the ftp, will not connect() to the
server's accept() during a "get".  This is a specific case of the above.

Mail archives on, which does have the patch somewhere...:

http://freeway.oact.hq.nasa.gov/wuftp.html
http://freeway.oact.hq.nasa.gov/wuarchive.html

http://freeway.oact.hq.nasa.gov/wuftp/mar/msg00035.html

has an FAQ, which lists the patch...

Dave Morrison
