Subject: Re: Virtual Homing patches....

From: "Keith Smith" <[email-masked]>
Date: Fri, 16 Feb 1996 13:18:53 +1300

On 15 Feb 95, Mark W. de Raad wrote:

> Sorry to bother you all with this request, but the virtual hosting
> patches that were so kindly posted a week or so ago have been
> removed from my mailbox by a system crash!
> 
> Can someone PLEASE forward them to me? Or repost them to the list? 

Sure thing.

-------------------------------

> Date sent:        Tue, 13 Feb 1996 11:13:21 -0600 (CST)
> Send reply to:    [email-masked]
> From:             Vidiot <[email-masked]>
> To:               [email-masked]
> Copies to:        [email-masked]
> Subject:          ftp hangup patch

OK, I finally got around to getting Beta 9 up on my system.  Attached
below is the patch for killing off idle daemons.

Side note for Stan:  Please add to beta 10 release.

MB
-- 
System Administrator - Finnigan FT/MS - Madison WI.
<URL:http://www.ftms.com/> e-mail: [email-masked] phone: (608)
273-8262  fax: (608) 273-8719  voice-mail: (800) 538-7067 ext 8451
Visit - <URL:http://www.cdsnet.net/vidiot/>  (Your link to Star Trek
and UPN)

***** CUT HERE for ftpd.c.patch *****
*** ftpd.c.dist	Tue Jan 23 00:09:11 1996
--- ftpd.c	Tue Feb 13 10:56:43 1996
***************
*** 52,53 ****
--- 52,54 ----
  #include <sys/types.h>
+ #include <sys/uio.h>
  #include <sys/param.h>
***************
*** 162,163 ****
--- 163,166 ----

+ extern int timeout;
+ 
  /* File containing login names NOT to be used on this machine.
  Commonly used
***************
*** 269,270 ****
--- 272,274 ----
  extern int authenticated;
+ static void TPtoolong();

***************
*** 1120,1121 ****
--- 1124,1141 ----

+ static void
+ TPtoolong()
+ {
+     time_t now;
+ 
+     reply(421,
+       "Timeout (%d seconds): closing control connection.", timeout);
+     (void) time(&now);
+     if (logging) {
+         syslog(LOG_INFO,
+             "User %s timed out after %d seconds at %.24s",
+             (pw ? pw -> pw_name : "unknown"), timeout, ctime(&now));
+     }
+     dologout(1);
+ }
+ 
  int
***************
*** 2038,2039 ****
--- 2058,2060 ----
      byte_count = 0;
+     (void) signal(SIGALRM, TPtoolong);
      if (size != (off_t) - 1)
***************
*** 2046,2049 ****
            fromlen = sizeof(from);
! 
          s = accept(pdata, (struct sockaddr *) &from, &fromlen); if
          (s < 0) {
--- 2067,2071 ----
            fromlen = sizeof(from);
! 	alarm(timeout);
          s = accept(pdata, (struct sockaddr *) &from, &fromlen); +
	alarm(0);
          if (s < 0) {
***************
*** 2113,2114 ****
--- 2135,2137 ----
  {
+ 
      register int c,
***************
*** 2119,2121 ****
--- 2142,2147 ----

+     (void) signal(SIGALRM, TPtoolong);
+ 
      transflag++;
+ 
      if (setjmp(urgcatch)) {
***************
*** 2127,2128 ****
--- 2153,2155 ----
      case TYPE_A:
+         alarm(timeout);
          while ((c = getc(instr)) != EOF) {
***************
*** 2133,2134 ****
--- 2160,2162 ----
                  (void) putc('\r', outstr);
+ 		alarm(timeout);
              }
***************
*** 2135,2138 ****
              (void) putc(c, outstr);
!         }
          fflush(outstr);
          transflag = 0;
--- 2163,2167 ----
              (void) putc(c, outstr);
! 	}
          fflush(outstr);
+ 	alarm(0);
          transflag = 0;
***************
*** 2165,2167 ****
          while ((cnt = read(filefd, buf, (u_int) blksize)) > 0 && !  
             write(netfd, buf, cnt) == cnt)
              byte_count += cnt;
--- 2194,2196 ----
          while ((cnt = read(filefd, buf, (u_int) blksize)) > 0 && !  
             TPwrite(netfd, buf, cnt) == cnt)
              byte_count += cnt;
***************
*** 2185,2186 ****
--- 2214,2216 ----
      transflag = 0;
+     alarm(0);
      perror_reply(426, "Data connection");
***************
*** 2190,2191 ****
--- 2220,2222 ----
      transflag = 0;
+     alarm(0);
      perror_reply(551, "Error on input file");
***************
*** 2210,2212 ****
--- 2241,2246 ----

+     (void) signal(SIGALRM, TPtoolong);
+ 
      transflag++;
+ 
      if (setjmp(urgcatch)) {
***************
*** 2219,2221 ****
      case TYPE_L:
!         while ((cnt = read(fileno(instr), buf, sizeof buf)) > 0) {
              if (write(fileno(outstr), buf, cnt) != cnt)
--- 2253,2255 ----
      case TYPE_L:
!         while ((cnt = TPread(fileno(instr), buf, sizeof buf)) > 0) {
              if (write(fileno(outstr), buf, cnt) != cnt)
***************
*** 2235,2236 ****
--- 2269,2271 ----
      case TYPE_A:
+ 	alarm(timeout);
          while ((c = getc(instr)) != EOF) {
***************
*** 2237,2240 ****
              byte_count++;
!             if (c == '\n')
                  bare_lfs++;
              while (c == '\r') {
--- 2272,2277 ----
              byte_count++;
!             if (c == '\n') {
                  bare_lfs++;
+ 	        alarm(timeout);
+ 	     }
              while (c == '\r') {
***************
*** 2244,2245 ****
--- 2281,2283 ----
                      (void) putc('\r', outstr);
+ 		    alarm(timeout);
                      if (c == '\0' || c == EOF)
***************
*** 2252,2253 ****
--- 2290,2292 ----
          fflush(outstr);
+ 	alarm(0);
          if (ferror(instr))
***************
*** 2270,2271 ****
--- 2309,2311 ----
      transflag = 0;
+     alarm(0);
      perror_reply(426, "Data Connection");
***************
*** 2275,2276 ****
--- 2315,2317 ----
      transflag = 0;
+     alarm(0);
      perror_reply(452, "Error writing file");
***************
*** 3420 ****
--- 3461,3486 ----
  #endif /* ULTRIX_AUTH */
+ 
+ 
+ int TPwrite(fd, buf, nbyte)
+      int fd;
+      char *buf;
+      int nbyte;
+ {
+   int cnt;
+   alarm(timeout);
+   cnt = write(fd, buf, nbyte);
+   alarm(0);
+   return cnt;
+ }
+ 
+ int TPread(fd, buf, nbyte)
+      int fd;
+      char *buf;
+      int nbyte;
+ {
+   int cnt;
+   alarm(timeout);
+   cnt = read(fd, buf, nbyte);
+   alarm(0);
+   return cnt;
+ }
***** End of PATCH *****

------------
Keith Smith                                 [email-masked]
Paradigm Technology Limited                 Senior Software Engineer
PO Box 10-268                               +64 (4) 495-1000 (voice)
Wellington, New Zealand                     +64 (4) 405-1003 (fax)
             Finger [email-masked] for PGP key
                  [all required disclaimers apply]

---

From: Vidiot <[email-masked]>
Date: Fri, 16 Feb 1996 09:12:57 -0600 (CST)

<
<On 15 Feb 95, Mark W. de Raad wrote:
<
<> Sorry to bother you all with this request, but the virtual hosting
<> patches that were so kindly posted a week or so ago have been
<> removed from my mailbox by a system crash!
<> 
<> Can someone PLEASE forward them to me? Or repost them to the list? 
<
<Sure thing.
<
<OK, I finally got around to getting Beta 9 up on my system.  Attached
<below is the patch for killing off idle daemons.

I don't believe that the reposted patch was the patch Mark was looking for.
There was another set of patches that someone else posted that I didn't
hang on to.

MB
-- 
System Administrator - Finnigan FT/MS - Madison WI. <URL:http://www.ftms.com/>
e-mail: [email-masked]
phone: (608) 273-8262  fax: (608) 273-8719  voice-mail: (800) 538-7067 ext 8451
Visit - <URL:http://www.cdsnet.net/vidiot/>  (Your link to Star Trek and UPN)

---

From: "Marc G. Fournier" <[email-masked]>
Date: Fri, 16 Feb 1996 13:55:34 -0500 (EST)

> There was another set of patches that someone else posted that I didn't
	Are you looking for the ones I posted, against 2.4?  if that is the
one, check out http://www.ki.net/rtfm/softdocs/wu-ftpd, where i have both
the extensions I created, and Brian's original patches that my extensions are
based on.

	If someone can tell me where (lost the URL to the FAQ :( ) the latest
copy of FTPD is located, I'll grab that and make sure that the patches are
up to date for that...if someone else hasn't?

Marc G. Fournier | POP Mail  Telnet Acct  DNS Hosting
System           |  WWW Services   Database Services  | Knowledge, 
  Administrator  |                                    | Information and
 [email-masked]  |      WWW: http://www.ki.net        | Communications, Inc