Subject: Timeout-Patch for WU-FTPD 2.4

From: "Georg v.Zezschwitz" <[email-masked]>
Date: Thu, 10 Apr 1997 17:43:45 +0200 (MET DST)

Hello,

We are using wu-ftpd 2.4.

Some of our customers are using our ftp-server for massive file exchange
between Russia and Germany. Due to the rather bad telephone qualitity
in Russia, transmissions of files often abort with a hangup of the
local modem. Because of this, the running wu-ftpd process will never terminate
(timeout feature is only working when in idle state).

We ran into difficulties when a lot of aborted transmissions with remaining
server processes filled up the user classes.

I implemented a patch for wu-ftpd-2.4 which applies to ftpd.c.
It makes use of the "select"-function during file transmission and
receiving and applies the same timeout as defined for idle timeout
as the maximum interval between two data packets.

This works in ASCII as well as BINARY-mode. I roughly tested the patch,
but as I reimplemented the ASCII-conversion, I cannot absolutely 
guarantee the identical behaviour for every kind of file.

I don't know if 2.4 beta contains a similar feature. If it does, please
excuse.

I'd consider the current behaviour of wu-ftpd as a (minor) security 
whole, as an attacker might lock up a whole class of users by starting
up as many ftp-processes the server allows him to do, abort them during 
transmission of a file, and leave the ftp-server unusable till the 
operator kills the processes or reboots the machine.

You will find the patch at:

 ftp://ftp.pop.de/pub/LOCAL/wu-ftpd/wu-ftpd-2.4-timeout-patch

(This is also an opportunity of checking out the patch :-) )

Hope it helps,

Georg v.Zezschwitz

POP Point Of Presecne GmbH, Germany

---

From: Alain Magloire <[email-masked]>
Date: Thu, 10 Apr 1997 15:14:59 -0400 (EDT)

> Hello,

howdy dude ! (my new Americanize Hello :-)

> (timeout feature is only working when in idle state).

to be precise in the main control loop
and reset to 0 when doing data xfert.

> server processes filled up the user classes.

Yes there was a long thread on this issue, 1 or 2 months 
back. Subject was "hanging ftpd", you can check out the archive
for more.

> as the maximum interval between two data packets.

One of the cons of this approach was pointed out by Bob ...(?)
His server was uploading file over 24 hours.
So what's a good timeout for the data transmission ?

*
Another way is to move out the timeout and make it global
So any process will harakiri after 24 hours ... a bit rude :-)

*
send a probe

*
I don't remember all the ideas, but I use the KEEP_ALIVE 
approach on the data socket. So there was no need to play
with select() nor alarm()

> guarantee the identical behaviour for every kind of file.

why not ? I didn't follow the argumentation here
1- Dowloading we don't worry
  the write() will return -1, errno set end of story.

2- uploading
  If you use alarm() you can put it before the read loop.
  If you use select() enclose the read()'s inside a select() loop.

why is the file type important to your mechanism ?

> I don't know if 2.4 beta contains a similar feature. If it does, please

no it doesn't and wu-ftpd is up to beta-13,
Wu-ftpd is maintain by Stan Barber. Maybe you can send your
ideas to him, for release 2.5

> operator kills the processes or reboots the machine.

yes it is a pain, but that is not entirely wu-ftpd's fault
That's the way TCP/IP works, It's hard to know when
a peer goes AWOL.

> (This is also an opportunity of checking out the patch :-) )

cool !! I love patches :-)

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!

---

From: Bob Luckin <[email-masked]>
Date: Thu, 10 Apr 97 15:19:50 CDT

[Re: applying timeouts to non-idle sessions to avoid hangs...]

Alain said :-
> One of the cons of this approach was pointed out by Bob ...(?)

Oui, mois.  Vous n'oubliez rien, Alain...  :-)

> So what's a good timeout for the data transmission ?

I suggested that thif this does get implemented, it should be controlled
by a switch in the ftpaccess file.  Then if you find you need to change it
to fine tune your setup, you won't have to recompile.  You should also
be able to turn it off by setting the switch in the ftpaccess file to say, 0.

It's clear that what is a good timeout value for one site is not going to
be good for another, so it needs to be easily configurable...

Cheers, Bob
-- 
Bob Luckin      [email-masked]      "Ere we were here, we weren't"

---

From: Juergen Christoffel <[email-masked]>
Date: Thu, 10 Apr 1997 22:38:33 +0200

Date: Thu, 10 Apr 1997 15:14:59 -0400 (EDT)
   From: Alain Magloire <[email-masked]>

So don't make it global but make it an attribute of user classes. That
would allow for long file transfers if the user is in an appropriate
class and give decent timeouts for processes in other classes.

	--jc