Subject: fptd hangs around

From: Vidiot <[email-masked]>
Date: Fri, 03 Feb 1995 23:54:20 -0600 (CST)

I recently installed the 2.4 version of ftpd.  The daemon hangs around for
some strange reason.  I saw in the www archives a mention of this problem,
but the patch that I grabbed fails to compile on SunOS 4.1.3.

Does anyone have a patch for the daemon in order to stop this from happening?

Thanks in advance.

MB

PS: Yes, I'm a newbie to the list.
-- 
System Administrator - Extrel FTMS - Madison WI.
e-mail: [email-masked]
phone: (608) 273-8262  fax: (608) 273-8719  voice-mail: (800) 426-6488 ext 6293
Visit - http://www.ftms.com/vidiot/  (Your link to the world of Star Trek)

---

From: Brian 'Doc' O'Neill <[email-masked]>
Date: Sat, 04 Feb 1995 09:21:01 -0500 (EST)

> Does anyone have a patch for the daemon in order to stop this from happening?

I likewise see this problem. It seems to be related to WWW browsers,
usually...

-- 
===========================================================================
Brian O'Neill - Systems Manager, Computer Science         [email-masked]
University of Massachusetts at Lowell        Chief Editor, InterWeb Journal
(508) 934-3645 				  http://interweb.uml.edu/InterWeb/
"Nothing's the same anymore." - Sinclair, Babylon 5, _Chrysalis_

---

From: [email-masked] (Bill Campbell)
Date: Sat, 04 Feb 1995 10:06:31 -0800 (PST)

> I likewise see this problem. It seems to be related to WWW browsers,
I've just compiled and installed the latest version of tcp_wrappers
here and they have a 'keepalive' option in their extended hosts_options
which:
    ``Causes the server to periodically send a message to the client.
    The connection is considered broken when the client does not
    respond.  The keepalive option can be useful when users turn off
    their machine while it is still connected to a server.  The
    keepalive option is not useful for datagram (UDP) services''.

I haven't tried this yet with wu-ftpd, but it sounds like it would do
exactly what's required in this case.  Adding the tcp_wrappers to
wu-ftpd also can provide protection against source routing, and log
the real users if identd is running on the connecting system.

Bill
--
INTERNET:  [email-masked]   Bill Campbell; Celestial Systems, Inc.
UUCP:              camco!bill   2835 82nd Avenue S.E. S-100
FAX:           (206) 232-9186   Mercer Island, WA 98040; (206) 947-5591
http://www.celestial.com/

The difference between science and the fuzzy subjects is that science
requires reasoning while those other subjects merely require scholarship.
                -- Robert Heinlein

---

From: Vidiot <[email-masked]>
Date: Sat, 04 Feb 1995 12:00:25 -0600 (CST)

Brian:

<> I recently installed the 2.4 version of ftpd.  The daemon hangs around for
<> some strange reason.  I saw in the www archives a mention of this problem,
<> but the patch that I grabbed fails to compile on SunOS 4.1.3.
<> 
<> Does anyone have a patch for the daemon in order to stop this from happening?
<> 
<> Thanks in advance.
<
<I likewise see this problem. It seems to be related to WWW browsers,
<usually...

Now, all we need is a fix.

MB

---

From: [email-masked] (Tom Dubinski)
Date: Sat, 04 Feb 1995 16:14:11 -0600 (CST)

According to Vidiot...
> Now, all we need is a fix.

We had the same problem until we installed a patch that was posted to this
very list last November.  I just had to make a couple of very minor changes
to the original patch (changed some line numbers and the name of an included
filename).  We are running SunOS 4.1.3, by the way, and our anonymous ftp
server sees quite a bit of WWW browser traffic.

Here is the patch, prefixed with the original accompanying message.  It seems
to have solved the problem for us -- "your mileage may vary."

} Date: Fri, 25 Nov 1994 15:00:18 +0100
} From: Casper Dik <[email-masked]>
} Subject: [772] hanging ftpds fix for wu-ftpd 2.4
} To: [email-masked]
} 
} The following patch works around a problem with wu-ftpd.
} Recently we've seen an increasing number of ftpd's sticking around.
} 
} This scenario has become increasingly common since netscape was released
} and from our logs it does look like web-browser connections caused this
} problem.
} 
} After some investigation it turned out that ftpd hung in accept.
} (thanks to lsof and truss).
} 
} Problem scenario:
} 
}         client sends "PASV"
}         client sends "RETR file"
}         client doesn't open a connection, instead the client aborts.
} 
} 
} This fix may not be portable, but works for me on Solaris 2.x and probably
} works on SunOS 4.1.x and BSD derivatives with fd_set typedef'ed as well.
} Some systes may need to include extra files.
} 
} The fix is a timeout on accept with select().  The timeout is set to 120
} seconds, but I have no idea whether that is sufficient.

[ modified slightly to correct line numbers and use <sys/time.h} -- TMD/UofM ]

*** ftpd.c.orig	Wed Apr 13 16:17:18 1994
--- ftpd.c	Fri Nov 25 14:22:10 1994
***************
*** 77,83 ****
  #else
  #include <syslog.h>
  #endif
! #include <time.h>
  #include "conversions.h"
  #include "extensions.h"
  #include "pathnames.h"
--- 77,83 ----
  #else
  #include <syslog.h>
  #endif
! #include <sys/time.h>
  #include "conversions.h"
  #include "extensions.h"
  #include "pathnames.h"
***************
*** 1707,1714 ****
--- 1707,1728 ----
          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;

-- 
Tom Dubinski				Internet: <[email-masked]>
Department of Computer Science		CIS: 72007,3216 | AOL: perogy
University of Manitoba			Phone: (204)474-8841
Winnipeg, MB, R3T 2N2, Canada		Fax:   (204)269-9178