Subject: Re: idle-ftp patch

From: Phil Soli <[email-masked]>
Date: Fri, 23 Feb 1996 15:47:37 -0500 (EST)

Howdy,
	Could someone please re-post the idle-ftp patch for beta 9

	Thanks in advance.

	-= Phil =-
--
w ,///  |  Mr. Phil Soli             [email-masked]               |  ```,
s c-oo  +  System Administrator      http://www.portup.com/~soli/  +  oo-c
d    \  |  The Portage - "Your full service ISP."                  |  /
c   -   |  506 Sheldon Ave., Houghton MI 49931  (906)487-9832      |   -

---

From: Vidiot <[email-masked]>
Date: Fri, 23 Feb 1996 15:53:07 -0600 (CST)

<
<Howdy,
<	Could someone please re-post the idle-ftp patch for beta 9
<
<	Thanks in advance.
<
<	-= Phil =-

-- 
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 *****
*** 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;
+ }
***** CUT HERE FOR END OF FILE *****

---

From: Angelos Karageorgiou <[email-masked]>
Date: Fri, 23 Feb 1996 18:35:00 -0500 (EST)

> <	Could someone please re-post the idle-ftp patch for beta 9

Any chance of getting this ON a new beta ? I get the feeling that there are
a few betas and patches ( gammas ? )  floating about :-)

---

From: Vidiot <[email-masked]>
Date: Fri, 23 Feb 1996 17:47:29 -0600 (CST)

<
<On Fri, 23 Feb 1996, Vidiot wrote:
<
<> <Howdy,
<> <	Could someone please re-post the idle-ftp patch for beta 9
<> <
<> <	Thanks in advance.
<> <
<> <	-= Phil =-
<
<Any chance of getting this ON a new beta ? I get the feeling that there are
<a few betas and patches ( gammas ? )  floating about :-)
<

I sent it to the person that does the beta distribution.  Hopefully it will
get installed.

MB