Subject: PATCH: Redone Patch for Virtual Domain Extension

From: "Marc G. Fournier" <[email-masked]>
Date: Wed, 7 Feb 1996 12:02:03 -0500 (EST)

NOTE: I'm resubmitting this as there were a couple of ppl reporting a failure
      for the original to patch cleanly.  Can someone please tell me what the
      subscribe address is for this list, as the only reason I know to send to
      here is because it was in Brian's patch itself.  This patch works from 
      the only "clean" copy of wu-ftpd that I know to be available, at
      wuarchive.wustl.edu.  If there is newer, I'm willing to combine the
      appropriate changes to it and resubmitting...

Hi...

	The following patch is for wu-ftpd-2.4 and includes those patches 
required for *BSD (generated by ?), the virtual ftpd patches created by Brian 
Kramer <[email-masked]> plus an extension on the virtual ftpd patches 
created by myself <[email-masked]>

	The extensions change the syntax of the virtual tag, and add a new
variable that can be set for individual domains

	from:

virtual <ip> <new root> <banner>

	to:

virtual <ip> root <new root>
virtual <ip> banner <banner file> <-- optional
virtual <ip> logfile <logfile> <-- optional

	If there are any problems applying this patch, please let me know.

	This patch is also available at 

		http://www.ki.net/rtfm/softdocs/wu-ftpd

----[ CUT HERE ]----

diff -rc wu-ftpd-2.4/Makefile wu-ftpd-2.4.orig/Makefile
*** wu-ftpd-2.4/Makefile	Fri Apr  1 14:03:58 1994
--- wu-ftpd-2.4.orig/Makefile	Tue Nov 28 00:40:59 1995
***************
*** 1,25 ****
! BINDIR=		/usr/local/bin
! ETCDIR=		/usr/local/etc
! MANDIR=		/usr/local/man
  MANEXT=		8
  
  all:
  	@ echo 'Use the "build" command (shell script) to make ftpd.'
  	@ echo 'You can say "build help" for details on how it works.'
  
  install: bin/ftpd bin/ftpcount bin/ftpshut
! 	-mv -f ${ETCDIR}/ftpd ${ETCDIR}/ftpd-old
  	@echo Installing binaries.
! 	install -o bin -g bin -m 755 bin/ftpd ${ETCDIR}/ftpd
! 	install -o bin -g bin -m 755 bin/ftpshut ${BINDIR}/ftpshut
! 	install -o bin -g bin -m 755 bin/ftpcount ${BINDIR}/ftpcount
! 	install -o bin -g bin -m 755 bin/ftpwho ${BINDIR}/ftpwho
  	@echo Installing manpages.
! 	install -o bin -g bin -m 755 doc/ftpd.8 ${MANDIR}/man8/ftpd.8
! 	install -o bin -g bin -m 755 doc/ftpcount.1 ${MANDIR}/man1/ftpcount.1
! 	install -o bin -g bin -m 755 doc/ftpwho.1 ${MANDIR}/man1/ftpwho.1
! 	install -o bin -g bin -m 755 doc/ftpshut.8 ${MANDIR}/man8/ftpshut.8
! 	install -o bin -g bin -m 755 doc/ftpaccess.5 ${MANDIR}/man5/ftpaccess.5
! 	install -o bin -g bin -m 755 doc/ftphosts.5 ${MANDIR}/man5/ftphosts.5
! 	install -o bin -g bin -m 755 doc/ftpconversions.5 ${MANDIR}/man5/ftpconversions.5
! 	install -o bin -g bin -m 755 doc/xferlog.5 ${MANDIR}/man5/xferlog.5
--- 1,42 ----
! PREFIX=		/usr/local
! BINDIR=		${PREFIX}/bin
! LIBEXECDIR=		${PREFIX}/etc
! ETCDIR=		${PREFIX}/etc
! MANDIR=		${PREFIX}/man
  MANEXT=		8
  
  all:
+ 	/bin/sh build fb2
  	@ echo 'Use the "build" command (shell script) to make ftpd.'
  	@ echo 'You can say "build help" for details on how it works.'
  
  install: bin/ftpd bin/ftpcount bin/ftpshut
! 	-mv -f ${LIBEXECDIR}/ftpd ${LIBEXECDIR}/ftpd-old
  	@echo Installing binaries.
! 	install -c -o bin -g bin -m 755 bin/ftpd ${LIBEXECDIR}/ftpd
! 	install -c -o bin -g bin -m 755 bin/ftpshut ${BINDIR}/ftpshut
! 	install -c -o bin -g bin -m 755 bin/ftpcount ${BINDIR}/ftpcount
! 	install -c -o bin -g bin -m 755 bin/ftpwho ${BINDIR}/ftpwho
! 	install -c -o bin -g bin -m 755 bin/ckconfig ${BINDIR}/ftpckconfig
! 	@echo Installing basic configuration
! 	install -c -o root -g bin -m 755 doc/examples/ftpaccess ${ETCDIR}/ftpaccess
! 	install -c -o root -g bin -m 755 doc/examples/ftpusers ${ETCDIR}/ftpusers
! 	install -c -o root -g bin -m 755 doc/examples/ftpconversions ${ETCDIR}/ftpconversions
  	@echo Installing manpages.
! 	install -c -o bin -g bin -m 755 doc/ftpd.8 ${MANDIR}/man8/ftpd.8
! 	install -c -o bin -g bin -m 755 doc/ftpcount.1 ${MANDIR}/man1/ftpcount.1
! 	install -c -o bin -g bin -m 755 doc/ftpwho.1 ${MANDIR}/man1/ftpwho.1
! 	install -c -o bin -g bin -m 755 doc/ftpshut.8 ${MANDIR}/man8/ftpshut.8
! 	install -c -o bin -g bin -m 755 doc/ftpaccess.5 ${MANDIR}/man5/ftpaccess.5
! 	install -c -o bin -g bin -m 755 doc/ftphosts.5 ${MANDIR}/man5/ftphosts.5
! 	install -c -o bin -g bin -m 755 doc/ftpconversions.5 ${MANDIR}/man5/ftpconversions.5
! 	install -c -o bin -g bin -m 755 doc/xferlog.5 ${MANDIR}/man5/xferlog.5
! 	@echo Compressing manpages
! 	gzip -f -9 ${MANDIR}/man8/ftpd.8
! 	gzip -f -9 ${MANDIR}/man1/ftpcount.1
! 	gzip -f -9 ${MANDIR}/man1/ftpwho.1
! 	gzip -f -9 ${MANDIR}/man8/ftpshut.8
! 	gzip -f -9 ${MANDIR}/man5/ftpaccess.5
! 	gzip -f -9 ${MANDIR}/man5/ftphosts.5
! 	gzip -f -9 ${MANDIR}/man5/ftpconversions.5
! 	gzip -f -9 ${MANDIR}/man5/xferlog.5
diff -rc wu-ftpd-2.4/config.h wu-ftpd-2.4.orig/config.h
*** wu-ftpd-2.4/config.h	Fri Apr  1 14:03:59 1994
--- wu-ftpd-2.4.orig/config.h	Tue Nov 28 00:03:37 1995
***************
*** 30,35 ****
--- 30,43 ----
  #define LOG_FAILED
  
  /*
+  * log login attempts that fail because of class connection
+  * limits.  Busy servers may want to prevent this logging
+  * since it can fill up the log file and put a high load on
+  * syslog.
+  */
+ #define LOG_TOOMANY
+ 
+ /*
   * allow use of private file.  (for site group and site gpass)
   */
  
diff -rc wu-ftpd-2.4/doc/examples/ftpconversions wu-ftpd-2.4.orig/doc/examples/ftpconversions
*** wu-ftpd-2.4/doc/examples/ftpconversions	Fri Apr  1 14:03:23 1994
--- wu-ftpd-2.4.orig/doc/examples/ftpconversions	Tue Nov 28 00:03:08 1995
***************
*** 1,7 ****
!  :.Z:  :  :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
   :   : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS
   :.gz: :  :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP
   :   : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
   :   : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
   :   : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS
!  :   : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP
\ No newline at end of file
--- 1,7 ----
!  :.Z:  :  :/bin/gzip -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
   :   : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS
   :.gz: :  :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP
   :   : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
   :   : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
   :   : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS
!  :   : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP
diff -rc wu-ftpd-2.4/src/access.c wu-ftpd-2.4.orig/src/access.c
*** wu-ftpd-2.4/src/access.c	Wed Apr 13 17:02:22 1994
--- wu-ftpd-2.4.orig/src/access.c	Tue Nov 28 00:03:39 1995
***************
*** 309,314 ****
--- 309,315 ----
      log_outbound_xfers = 0;
      log_commands = 0;
  
+     bzero(class, sizeof(class));
      (void) acl_getclass(class);
  
      entry = (struct aclmember *) NULL;
***************
*** 802,809 ****
--- 803,812 ----
          acl_join(class);
          return (1);
      } else {
+ #ifdef LOG_TOOMANY
          syslog(LOG_NOTICE, "ACCESS DENIED (user limit %d; class %s) TO %s [%s]",
                 limit, class, remotehost, remoteaddr);
+ #endif
          pr_mesg(msgcode, msgfile);
          return (-1);
      }
Only in wu-ftpd-2.4.orig/src: banner.msg
Only in wu-ftpd-2.4.orig/src: edit
diff -rc wu-ftpd-2.4/src/extensions.c wu-ftpd-2.4.orig/src/extensions.c
*** wu-ftpd-2.4/src/extensions.c	Wed Apr 13 17:02:46 1994
--- wu-ftpd-2.4.orig/src/extensions.c	Wed Jan 24 19:10:43 1996
***************
*** 278,284 ****
  /*************************************************************************/
  
  void
! show_banner(int msgcode)
  {
      char *crptr,
        linebuf[1024],
--- 278,284 ----
  /*************************************************************************/
  
  void
! show_banner(int msgcode, int virtual_mode, char *virtual_banner)
  {
      char *crptr,
        linebuf[1024],
***************
*** 286,307 ****
      struct aclmember *entry = NULL;
      FILE *infile;
  
!     /* banner <path> */
!     while (getaclentry("banner", &entry)) {
          if (ARG0 && strlen(ARG0) > 0) {
!             infile = fopen(ARG0, "r");
!             if (infile) {
!                 while (fgets(linebuf, 255, infile) != NULL) {
!                     if ((crptr = strchr(linebuf, '\n')) != NULL)
!                         *crptr = '\0';
!                     msg_massage(linebuf, outbuf);
!                     lreply(msgcode, "%s", outbuf);
!                 }
!                 fclose(infile);
!                 lreply(msgcode, "");
!             }
          }
      }
  }
  
  /*************************************************************************/
--- 286,323 ----
      struct aclmember *entry = NULL;
      FILE *infile;
  
!     if (virtual_mode) {
!         infile = fopen(virtual_banner, "r");
!        if (infile) {
!            while (fgets(linebuf, 255, infile) != NULL) {
!                   if ((crptr = strchr(linebuf, '\n')) != NULL)
!                        *crptr = '\0';
!                   msg_massage(linebuf, outbuf);
!                   lreply(msgcode, "%s", outbuf);
!            }
!            fclose(infile);
!            lreply(msgcode, "");
!         }
!     }
!     else {
!       /* banner <path> */
!       while (getaclentry("banner", &entry)) {
          if (ARG0 && strlen(ARG0) > 0) {
!            infile = fopen(ARG0, "r");
!            if (infile) {
!                while (fgets(linebuf, 255, infile) != NULL) {
!                  if ((crptr = strchr(linebuf, '\n')) != NULL)
!                    *crptr = '\0';
!                  msg_massage(linebuf, outbuf);
!                  lreply(msgcode, "%s", outbuf);
!                }
!                fclose(infile);
!                lreply(msgcode, "");
!            }
          }
+       }
      }
+ 
  }
  
  /*************************************************************************/
diff -rc wu-ftpd-2.4/src/ftpd.c wu-ftpd-2.4.orig/src/ftpd.c
*** wu-ftpd-2.4/src/ftpd.c	Wed Apr 13 17:17:18 1994
--- wu-ftpd-2.4.orig/src/ftpd.c	Tue Feb  6 18:34:40 1996
***************
*** 139,146 ****
   *freopen(const char *, const char *, FILE *);
  extern int ftpd_pclose(FILE *iop),
    fclose(FILE *);
! extern char *getline(),
!  *realpath(char *pathname, char *result);
  extern char cbuf[];
  extern off_t restart_point;
  
--- 139,146 ----
   *freopen(const char *, const char *, FILE *);
  extern int ftpd_pclose(FILE *iop),
    fclose(FILE *);
! extern char *getline();
! extern char *realpath(const char *pathname, char *result);
  extern char cbuf[];
  extern off_t restart_point;
  
***************
*** 150,155 ****
--- 150,164 ----
  struct sockaddr_in his_addr;
  struct sockaddr_in pasv_addr;
  
+ int virtual_mode=0;
+ #ifdef VIRTUAL
+ struct sockaddr_in virtual_addr;
+ struct sockaddr_in *virtual_ptr;
+ char virtual_root[MAXPATHLEN];
+ char virtual_banner[MAXPATHLEN];
+ char virtual_logfile[MAXPATHLEN];
+ #endif
+ 
  int data;
  jmp_buf errcatch,
    urgcatch;
***************
*** 237,242 ****
--- 246,256 ----
  
  #endif /* SETPROCTITLE */
  
+ #ifdef SKEY
+ #include <skey.h>
+ int	pwok = 0;
+ #endif
+ 
  #ifdef KERBEROS
  void init_krb();
  void end_krb();
***************
*** 252,257 ****
--- 266,278 ----
  char  ls_short[50];
  struct aclmember *entry = NULL;
  
+ void end_login(void);
+ void send_data(FILE *, FILE *, off_t);
+ void dolog(struct sockaddr_in *);
+ void dologout(int);
+ void perror_reply(int, char *);
+ 
+ void
  main(int argc, char **argv, char **envp)
  {
      int addrlen,
***************
*** 261,266 ****
--- 282,292 ----
  #endif
      char *cp;
  
+ #ifdef VIRTUAL
+       int virtual_len;
+       int set;
+ #endif
+ 
  #ifdef SecureWare
      setluid(1);                         /* make sure there is a valid luid */
      set_auth_parameters(argc,argv);
***************
*** 499,504 ****
--- 525,558 ----
      authenticate();
      conv_init();
  
+ 
+ #ifdef VIRTUAL
+     virtual_len = sizeof(virtual_addr);
+     if (getsockname(0, (struct sockaddr *) &virtual_addr,
+                    &virtual_len) < 0) {
+       virtual_mode = 0;
+     }
+     else {
+       virtual_ptr = (struct sockaddr_in *) &virtual_addr;
+       set = 0;
+       entry = (struct aclmember *) NULL;
+       while (!set && getaclentry("virtual", &entry)) {
+        if (!strcmp(ARG0, inet_ntoa(virtual_ptr->sin_addr))) {
+          if(!strcmp(ARG1, "root")) {
+            syslog(LOG_NOTICE, "VirtualFTP Connect to: %s",
+                   inet_ntoa(virtual_ptr->sin_addr));
+            virtual_mode = 1;
+            strncpy(virtual_root, ARG2, MAXPATHLEN);
+          }
+          if(!strcmp(ARG1, "banner")) 
+            strncpy(virtual_banner, ARG2, MAXPATHLEN);
+          if(!strcmp(ARG1, "logfile")) 
+            strncpy(virtual_logfile, ARG2, MAXPATHLEN);
+        }
+       }
+     }
+ #endif
+ 
      if (is_shutdown(1) != 0) {
          syslog(LOG_INFO, "connection refused (server shut down) from %s [%s]",
                 remotehost, remoteaddr);
***************
*** 506,512 ****
                hostname);
          exit(0);
      }
!     show_banner(220);
  
      entry = (struct aclmember *) NULL;
      if (getaclentry("lslong", &entry) && ARG0 && strlen(ARG0) > 0) {
--- 560,567 ----
                hostname);
          exit(0);
      }
! 
!     show_banner(220, virtual_mode, virtual_banner);
  
      entry = (struct aclmember *) NULL;
      if (getaclentry("lslong", &entry) && ARG0 && strlen(ARG0) > 0) {
***************
*** 686,691 ****
--- 741,748 ----
   * does not have a standard shell as returned by getusershell().  Disallow
   * anyone mentioned in the file _PATH_FTPUSERS to allow people such as root
   * and uucp to be avoided. */
+ 
+ void
  user(char *name)
  {
      register char *cp;
***************
*** 878,884 ****
--- 935,946 ----
      } else
          acl_setfunctions();
  
+ #ifdef SKEY
+     pwok = skeyaccess(name, NULL, remotehost, remoteaddr);
+     reply(331, "%s", skey_challenge(name, pw, pwok));
+ #else
      reply(331, "Password required for %s.", name);
+ #endif
      askpasswd = 1;
      /* Delay before reading passwd after first failed attempt to slow down
       * passwd-guessing programs. */
***************
*** 887,892 ****
--- 949,955 ----
  }
  
  /* Check if a user is in the file _PATH_FTPUSERS */
+ int
  checkuser(char *name)
  {
      register FILE *fd;
***************
*** 911,916 ****
--- 974,980 ----
  
  /* Terminate login as previous user, if any, resetting state; used when USER
   * command is given or login fails. */
+ void
  end_login(void)
  {
  
***************
*** 965,970 ****
--- 1029,1035 ----
          return 0;
  }
  
+ void
  pass(char *passwd)
  {
      char *xpasswd,
***************
*** 1007,1014 ****
--- 1072,1084 ----
  #ifdef KERBEROS
          xpasswd = crypt16(passwd, salt);
  #else
+ #ifdef SKEY
+ 	xpasswd = skey_crypt(passwd, salt, pw, pwok);
+ 	pwok = 0;
+ #else
          xpasswd = crypt(passwd, salt);
  #endif
+ #endif
  
  #ifdef ULTRIX_AUTH
          if ((numfails = ultrix_check_pass(passwd, xpasswd)) < 0) {
***************
*** 1095,1113 ****
      (void) initgroups(pw->pw_name, pw->pw_gid);
  
      /* open wtmp before chroot */
!     (void) sprintf(ttyline, "ftp%d", getpid());
      logwtmp(ttyline, pw->pw_name, remotehost);
      logged_in = 1;
  
      /* if logging is enabled, open logfile before chroot */
      if (log_outbound_xfers || log_incoming_xfers)
          xferlog = open(_PATH_XFERLOG, O_WRONLY | O_APPEND | O_CREAT, 0660);
  
      expand_id();
  
      if (anonymous || guest) {
          /* We MUST do a chdir() after the chroot. Otherwise the old current
           * directory will be accessible as "." outside the new root! */
          if (anonymous) {
              if (chroot(pw->pw_dir) < 0 || chdir("/") < 0) {
                  reply(550, "Can't set guest privileges.");
--- 1165,1198 ----
      (void) initgroups(pw->pw_name, pw->pw_gid);
  
      /* open wtmp before chroot */
! #if (defined(BSD) && (BSD >= 199103))
!     (void) sprintf(ttyline, "ftp%ld", getpid());
! #else
!     (void) sprintf(ttyline, "ftpd%d", getpid());
! #endif
      logwtmp(ttyline, pw->pw_name, remotehost);
      logged_in = 1;
  
      /* if logging is enabled, open logfile before chroot */
      if (log_outbound_xfers || log_incoming_xfers)
+ #ifdef VIRTUAL
+         xferlog = open(virtual_logfile, O_WRONLY | O_APPEND | O_CREAT, 0660);
+ #else
          xferlog = open(_PATH_XFERLOG, O_WRONLY | O_APPEND | O_CREAT, 0660);
+ #endif
  
      expand_id();
  
      if (anonymous || guest) {
          /* We MUST do a chdir() after the chroot. Otherwise the old current
           * directory will be accessible as "." outside the new root! */
+ 
+ #ifdef VIRTUAL
+       if (virtual_mode) {
+         strcpy(pw->pw_dir, virtual_root);
+       }
+ #endif
+ 
          if (anonymous) {
              if (chroot(pw->pw_dir) < 0 || chdir("/") < 0) {
                  reply(550, "Can't set guest privileges.");
***************
*** 1190,1197 ****
          reply(230, "Guest login ok, access restrictions apply.");
  #ifdef SETPROCTITLE
          sprintf(proctitle, "%s: anonymous/%.*s", remotehost,
!                     sizeof(proctitle) - sizeof(remotehost) -
!                     sizeof(": anonymous/"), passwd);
          setproctitle("%s", proctitle);
  #endif /* SETPROCTITLE */
          if (logging)
--- 1275,1282 ----
          reply(230, "Guest login ok, access restrictions apply.");
  #ifdef SETPROCTITLE
          sprintf(proctitle, "%s: anonymous/%.*s", remotehost,
!                     (int) (sizeof(proctitle) - sizeof(remotehost) -
!                     sizeof(": anonymous/")), passwd);
          setproctitle("%s", proctitle);
  #endif /* SETPROCTITLE */
          if (logging)
***************
*** 1235,1240 ****
--- 1320,1326 ----
      return (buf);
  }
  
+ void
  retrieve(char *cmd, char *name)
  {
      FILE *fin,
***************
*** 1403,1409 ****
      if (dout == NULL)
          goto done;
  #ifdef HAVE_ST_BLKSIZE
!     send_data(fin, dout, st.st_blksize);
  #else
      send_data(fin, dout, BUFSIZ);
  #endif
--- 1489,1495 ----
      if (dout == NULL)
          goto done;
  #ifdef HAVE_ST_BLKSIZE
!     send_data(fin, dout, st.st_blksize*2);
  #else
      send_data(fin, dout, BUFSIZ);
  #endif
***************
*** 1422,1428 ****
--- 1508,1518 ----
          for (loop = 0; namebuf[loop]; loop++)
              if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
                  namebuf[loop] = '_';
+ #if (defined(BSD) && (BSD >= 199103))
+         sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
+ #else
          sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
+ #endif
                  ctime(&curtime),
                  xfertime,
                  remotehost,
***************
*** 1445,1450 ****
--- 1535,1541 ----
          (*closefunc) (fin);
  }
  
+ void
  store(char *name, char *mode, int unique)
  {
      FILE *fout, *din;
***************
*** 1610,1616 ****
          for (loop = 0; namebuf[loop]; loop++)
              if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
                  namebuf[loop] = '_';
!         sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
                  ctime(&curtime),
                  xfertime,
                  remotehost,
--- 1701,1711 ----
          for (loop = 0; namebuf[loop]; loop++)
              if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
                  namebuf[loop] = '_';
! #if (defined(BSD) && (BSD >= 199103))
!         sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
! #else
!         sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n", 
! #endif
                  ctime(&curtime),
                  xfertime,
                  remotehost,
***************
*** 1678,1683 ****
--- 1773,1789 ----
      if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *) &on, sizeof(int)) < 0)
            syslog(LOG_WARNING, "setsockopt (IP_TOS): %m");
  #endif
+ #ifdef TCP_NOPUSH
+ 	/*
+ 	 * Turn off push flag to keep sender TCP from sending short packets
+ 	 * at the boundaries of each write().  Should probably do a SO_SNDBUF
+ 	 * to set the send buffer size as well, but that may not be desirable
+ 	 * in heavy-load situations.
+ 	 */
+ 	on = 1;
+ 	if (setsockopt(s, IPPROTO_TCP, TCP_NOPUSH, (char *)&on, sizeof on) < 0)
+ 		syslog(LOG_WARNING, "setsockopt (TCP_NOPUSH): %m");
+ #endif
  
      return (fdopen(s, mode));
    bad:
***************
*** 1699,1705 ****
      file_size = size;
      byte_count = 0;
      if (size != (off_t) - 1)
!         (void) sprintf(sizebuf, " (%ld bytes)", size);
      else
          (void) strcpy(sizebuf, "");
      if (pdata >= 0) {
--- 1805,1815 ----
      file_size = size;
      byte_count = 0;
      if (size != (off_t) - 1)
! #if (defined(BSD) && (BSD >= 199103))
!         (void) sprintf(sizebuf, " (%qd bytes)", size);
! #else
! 	(void) sprintf(sizebuf, " (%d bytes)", size);
! #endif
      else
          (void) strcpy(sizebuf, "");
      if (pdata >= 0) {
***************
*** 1707,1715 ****
          int s,
            fromlen = sizeof(from);
  
!         s = accept(pdata, (struct sockaddr *) &from, &fromlen);
!         if (s < 0) {
!             reply(425, "Can't open data connection.");
              (void) close(pdata);
              pdata = -1;
              return (NULL);
--- 1817,1839 ----
          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;
              return (NULL);
***************
*** 1764,1769 ****
--- 1888,1894 ----
   * encapsulation of the data subject to Mode, Structure, and Type.
   *
   * NB: Form isn't handled. */
+ void
  send_data(FILE *instr, FILE *outstr, off_t blksize)
  {
      register int c,
***************
*** 1839,1844 ****
--- 1964,1970 ----
   * the data subject to Mode, Structure, and Type.
   *
   * N.B.: Form isn't handled. */
+ int
  receive_data(FILE *instr, FILE *outstr)
  {
      register int c;
***************
*** 1915,1920 ****
--- 2041,2047 ----
      return (-1);
  }
  
+ void
  statfilecmd(char *filename)
  {
      char line[BUFSIZ];
***************
*** 1948,1953 ****
--- 2075,2081 ----
      reply(211, "End of Status");
  }
  
+ void
  statcmd(void)
  {
      struct sockaddr_in *sin;
***************
*** 2001,2006 ****
--- 2129,2135 ----
      reply(211, "End of status");
  }
  
+ void
  fatal(char *s)
  {
      reply(451, "Error in server: %s\n", s);
***************
*** 2095,2100 ****
--- 2224,2230 ----
  
  #else
  /* VARARGS2 */
+ void
  reply(int n, char *fmt, int p0, int p1, int p2, int p3, int p4, int p5)
  {
      if (autospout != NULL) {
***************
*** 2129,2134 ****
--- 2259,2265 ----
  }
  
  /* VARARGS2 */
+ void
  lreply(int n, char *fmt, int p0, int p1, int p2, int p3, int p4, int p5)
  {
      if (!dolreplies)
***************
*** 2144,2160 ****
--- 2275,2294 ----
  }
  #endif
  
+ void
  ack(char *s)
  {
      reply(250, "%s command successful.", s);
  }
  
+ void
  nack(char *s)
  {
      reply(502, "%s command not implemented.", s);
  }
  
  /* ARGSUSED */
+ void
  yyerror(char *s)
  {
      char *cp;
***************
*** 2164,2169 ****
--- 2298,2304 ----
      reply(500, "'%s': command not understood.", cbuf);
  }
  
+ void
  delete(char *name)
  {
      struct stat st;
***************
*** 2208,2213 ****
--- 2343,2349 ----
      ack("DELE");
  }
  
+ void
  cwd(char *path)
  {
      struct aclmember *entry = NULL;
***************
*** 2248,2253 ****
--- 2384,2390 ----
      }
  }
  
+ void
  makedir(char *name)
  {
  	uid_t uid;
***************
*** 2274,2282 ****
      reply(257, "MKD command successful.");
  }
  
  removedir(char *name)
  {
! 	int c, d;  /* dummy variables */
          int valid = 0;
  
      /*
--- 2411,2420 ----
      reply(257, "MKD command successful.");
  }
  
+ void
  removedir(char *name)
  {
! 	unsigned long c, d;  /* dummy variables */
          int valid = 0;
  
      /*
***************
*** 2298,2303 ****
--- 2436,2442 ----
          ack("RMD");
  }
  
+ void
  pwd(void)
  {
      char path[MAXPATHLEN + 1];
***************
*** 2312,2318 ****
  #else
      if (getwd(path) == (char *) NULL)
  #endif
!         reply(550, "%s.", path);
      else
          reply(257, "\"%s\" is current directory.", path);
  }
--- 2451,2458 ----
  #else
      if (getwd(path) == (char *) NULL)
  #endif
! /*        reply(550, "%s.", path); */
! 	reply(550, "Permission denied.");
      else
          reply(257, "\"%s\" is current directory.", path);
  }
***************
*** 2342,2347 ****
--- 2482,2488 ----
      return (name);
  }
  
+ void
  renamecmd(char *from, char *to)
  {
  
***************
*** 2357,2362 ****
--- 2498,2504 ----
          ack("RNTO");
  }
  
+ void
  dolog(struct sockaddr_in *sin)
  {
      struct hostent *hp;
***************
*** 2412,2417 ****
--- 2554,2560 ----
  }
  
  /* Record logout in wtmp file and exit with supplied status. */
+ void
  dologout(int status)
  {
      if (logged_in) {
***************
*** 2459,2464 ****
--- 2602,2608 ----
   * PASV command in RFC959. However, it has been blessed as a legitimate
   * response by Jon Postel in a telephone conversation with Rick Adams on 25
   * Jan 89. */
+ void
  passive(void)
  {
      int len;
***************
*** 2530,2535 ****
--- 2674,2680 ----
  }
  
  /* Format and send reply containing system error number. */
+ void
  perror_reply(int code, char *string)
  {
      reply(code, "%s: %s.", string, strerror(errno));
***************
*** 2538,2543 ****
--- 2683,2689 ----
  static char *onefile[] =
  {"", 0};
  
+ void
  send_file_list(char *whichfiles)
  {
      struct stat st;
diff -rc wu-ftpd-2.4/src/glob.c wu-ftpd-2.4.orig/src/glob.c
*** wu-ftpd-2.4/src/glob.c	Fri Apr  1 14:03:42 1994
--- wu-ftpd-2.4.orig/src/glob.c	Tue Nov 28 00:02:56 1995
***************
*** 65,71 ****
  static	int gargc;		/* Number args in gargv */
  static	int gnleft;
  static	short gflag;
! static	int tglob();
  char	**ftpglob();
  char	*globerr;
  char	*home;
--- 65,71 ----
  static	int gargc;		/* Number args in gargv */
  static	int gnleft;
  static	short gflag;
! static	int tglob(register char);
  char	**ftpglob();
  char	*globerr;
  char	*home;
***************
*** 74,80 ****
  static	char *strend();
  char	**copyblk();
  
! static void acollect(), addpath(), collect(), expand(), Gcat();
  static void ginit(), matchdir(), rscan(), sort();
  static int amatch(), execbrc(), match();
  
--- 74,80 ----
  static	char *strend();
  char	**copyblk();
  
! static void acollect(), addpath(char), collect(), expand(), Gcat();
  static void ginit(), matchdir(), rscan(), sort();
  static int amatch(), execbrc(), match();
  
***************
*** 87,95 ****
  static	char *entp;
  static	char **sortbas;
  
  char **
! ftpglob(v)
! 	register char *v;
  {
  	char agpath[BUFSIZ];
  	char *agargv[GAVSIZ];
--- 87,100 ----
  static	char *entp;
  static	char **sortbas;
  
+ void blkfree(char **);
+ int letter(register char);
+ int digit(register char);
+ int gethdir(char *);
+ int any(register int, register char *);
+ 
  char **
! ftpglob(register char *v)
  {
  	char agpath[BUFSIZ];
  	char *agargv[GAVSIZ];
***************
*** 116,123 ****
  }
  
  static void
! ginit(agargv)
! 	char **agargv;
  {
  
  	agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0;
--- 121,127 ----
  }
  
  static void
! ginit(char ** agargv)
  {
  
  	agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0;
***************
*** 125,132 ****
  }
  
  static void
! collect(as)
! 	register char *as;
  {
  	if (eq(as, "{") || eq(as, "{}")) {
  		Gcat(as, "");
--- 129,135 ----
  }
  
  static void
! collect(register char *as)
  {
  	if (eq(as, "{") || eq(as, "{}")) {
  		Gcat(as, "");
***************
*** 136,143 ****
  }
  
  static void
! acollect(as)
! 	register char *as;
  {
  	register int ogargc = gargc;
  
--- 139,145 ----
  }
  
  static void
! acollect(register char *as)
  {
  	register int ogargc = gargc;
  
***************
*** 165,172 ****
  }
  
  static void
! expand(as)
! 	char *as;
  {
  	register char *cs;
  	register char *sgpathp, *oldcs;
--- 167,173 ----
  }
  
  static void
! expand(char *as)
  {
  	register char *cs;
  	register char *sgpathp, *oldcs;
***************
*** 218,225 ****
  }
  
  static void
! matchdir(pattern)
! 	char *pattern;
  {
  	struct stat stb;
  
--- 219,225 ----
  }
  
  static void
! matchdir(char *pattern)
  {
  	struct stat stb;
  
***************
*** 261,268 ****
  }
  
  static int
! execbrc(p, s)
! 	char *p, *s;
  {
  	char restbuf[BUFSIZ + 2];
  	register char *pe, *pm, *pl;
--- 261,267 ----
  }
  
  static int
! execbrc(char *p, char *s)
  {
  	char restbuf[BUFSIZ + 2];
  	register char *pe, *pm, *pl;
***************
*** 341,348 ****
  }
  
  static int
! match(s, p)
! 	char *s, *p;
  {
  	register int c;
  	register char *sentp;
--- 340,346 ----
  }
  
  static int
! match(char *s, char *p)
  {
  	register int c;
  	register char *sentp;
***************
*** 359,366 ****
  }
  
  static int
! amatch(s, p)
! 	register char *s, *p;
  {
  	register int scc;
  	int ok, lc;
--- 357,363 ----
  }
  
  static int
! amatch(register char *s, register char *p)
  {
  	register int scc;
  	int ok, lc;
***************
*** 448,456 ****
  	}
  }
  
! static
! Gmatch(s, p)
! 	register char *s, *p;
  {
  	register int scc;
  	int ok, lc;
--- 445,452 ----
  	}
  }
  
! static int
! Gmatch(register char *s, register char *p)
  {
  	register int scc;
  	int ok, lc;
***************
*** 509,516 ****
  }
  
  static void
! Gcat(s1, s2)
! 	register char *s1, *s2;
  {
  	register int len = strlen(s1) + strlen(s2) + 1;
  
--- 505,511 ----
  }
  
  static void
! Gcat(register char *s1, register char *s2)
  {
  	register int len = strlen(s1) + strlen(s2) + 1;
  
***************
*** 525,532 ****
  }
  
  static void
! addpath(c)
! 	char c;
  {
  
  	if (gpathp >= lastgpathp)
--- 520,526 ----
  }
  
  static void
! addpath(char c)
  {
  
  	if (gpathp >= lastgpathp)
***************
*** 538,546 ****
  }
  
  static void
! rscan(t, f)
! 	register char **t;
! 	int (*f)();
  {
  	register char *p, c;
  
--- 532,538 ----
  }
  
  static void
! rscan(register char **t, int (*f)())
  {
  	register char *p, c;
  
***************
*** 556,564 ****
  }
  /*
  static
! scan(t, f)
! 	register char **t;
! 	int (*f)();
  {
  	register char *p, c;
  
--- 548,554 ----
  }
  /*
  static
! scan(register char **t, int (*f)())
  {
  	register char *p, c;
  
***************
*** 567,575 ****
  			*p++ = (*f)(c);
  } */
  
! static
! tglob(c)
! 	register char c;
  {
  
  	if (any(c, globchars))
--- 557,564 ----
  			*p++ = (*f)(c);
  } */
  
! static int
! tglob(register char c)
  {
  
  	if (any(c, globchars))
***************
*** 578,608 ****
  }
  /*
  static
! trim(c)
! 	char c;
  {
  
  	return (c & TRIM);
  } */
  
! 
! letter(c)
! 	register char c;
  {
  
! 	return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_');
  }
  
! digit(c)
! 	register char c;
  {
  
  	return (c >= '0' && c <= '9');
  }
  
! any(c, s)
! 	register int c;
! 	register char *s;
  {
  
  	while (*s)
--- 567,595 ----
  }
  /*
  static
! trim(char c)
  {
  
  	return (c & TRIM);
  } */
  
! int
! letter(register char c)
  {
  
! 	return ((c >= 'a') && (c <= 'z') || (c >= 'A') && (c <= 'Z')
! 		|| (c == '_'));
  }
  
! int
! digit(register char c)
  {
  
  	return (c >= '0' && c <= '9');
  }
  
! int
! any(register int c, register char *s)
  {
  
  	while (*s)
***************
*** 610,617 ****
  			return(1);
  	return(0);
  }
! blklen(av)
! 	register char **av;
  {
  	register int i = 0;
  
--- 597,605 ----
  			return(1);
  	return(0);
  }
! 
! int
! blklen(register char **av)
  {
  	register int i = 0;
  
***************
*** 621,629 ****
  }
  
  char **
! blkcpy(oav, bv)
! 	char **oav;
! 	register char **bv;
  {
  	register char **av = oav;
  
--- 609,615 ----
  }
  
  char **
! blkcpy(char **oav, register char **bv)
  {
  	register char **av = oav;
  
***************
*** 632,639 ****
  	return (oav);
  }
  
! blkfree(av0)
! 	char **av0;
  {
  	register char **av = av0;
  
--- 618,625 ----
  	return (oav);
  }
  
! void
! blkfree(char **av0)
  {
  	register char **av = av0;
  
***************
*** 642,649 ****
  }
  
  char *
! strspl(cp, dp)
! 	register char *cp, *dp;
  {
  	register char *ep = malloc((unsigned)(strlen(cp) + strlen(dp) + 1));
  
--- 628,634 ----
  }
  
  char *
! strspl(register char *cp, register char *dp)
  {
  	register char *ep = malloc((unsigned)(strlen(cp) + strlen(dp) + 1));
  
***************
*** 655,662 ****
  }
  
  char **
! copyblk(v)
! 	register char **v;
  {
  	register char **nv = (char **)malloc((unsigned)((blklen(v) + 1) *
  						sizeof(char **)));
--- 640,646 ----
  }
  
  char **
! copyblk(register char **v)
  {
  	register char **nv = (char **)malloc((unsigned)((blklen(v) + 1) *
  						sizeof(char **)));
***************
*** 668,675 ****
  
  static
  char *
! strend(cp)
! 	register char *cp;
  {
  
  	while (*cp)
--- 652,658 ----
  
  static
  char *
! strend(register char *cp)
  {
  
  	while (*cp)
***************
*** 682,689 ****
   * user whose home directory is sought is currently.
   * We write the home directory of the user back there.
   */
! gethdir(home)
! 	char *home;
  {
  	register struct passwd *pp = getpwnam(home);
  
--- 665,672 ----
   * user whose home directory is sought is currently.
   * We write the home directory of the user back there.
   */
! int
! gethdir(char *home)
  {
  	register struct passwd *pp = getpwnam(home);
  
Only in wu-ftpd-2.4.orig/src/makefiles: Makefile.aix.rej
diff -rc wu-ftpd-2.4/src/makefiles/Makefile.bsd wu-ftpd-2.4.orig/src/makefiles/Makefile.bsd
*** wu-ftpd-2.4/src/makefiles/Makefile.bsd	Fri Apr  1 14:03:30 1994
--- wu-ftpd-2.4.orig/src/makefiles/Makefile.bsd	Wed Jan 24 19:13:06 1996
***************
*** 1,8 ****
  CC       = cc
  IFLAGS   = -I.. -I../support
  LFLAGS   = -L../support
! CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
! LIBES    = -lsupport
  LIBC     = /usr/lib/libc.a
  LINTFLAGS=	
  LKERB    = -lauth -lckrb -lkrb -ldes
--- 1,8 ----
  CC       = cc
  IFLAGS   = -I.. -I../support
  LFLAGS   = -L../support
! CFLAGS   = -O -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS}
! LIBES    = -lsupport -lcrypt
  LIBC     = /usr/lib/libc.a
  LINTFLAGS=	
  LKERB    = -lauth -lckrb -lkrb -ldes
Only in wu-ftpd-2.4.orig/src/makefiles: Makefile.bsd.rej
Only in wu-ftpd-2.4.orig/src/makefiles: Makefile.dgx.rej
diff -rc wu-ftpd-2.4/src/makefiles/Makefile.dyn wu-ftpd-2.4.orig/src/makefiles/Makefile.dyn
*** wu-ftpd-2.4/src/makefiles/Makefile.dyn	Fri Apr  1 14:03:30 1994
--- wu-ftpd-2.4.orig/src/makefiles/Makefile.dyn	Wed Jan 24 19:10:46 1996
***************
*** 1,7 ****
  CC       = gcc
  IFLAGS   = -I.. -I../support
  LFLAGS   = -L../support
! CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
  LIBES    = -lsupport
  LIBC     = /lib/libc.a
  LINTFLAGS=	
--- 1,7 ----
  CC       = gcc
  IFLAGS   = -I.. -I../support
  LFLAGS   = -L../support
! CFLAGS   = -O -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS}
  LIBES    = -lsupport
  LIBC     = /lib/libc.a
  LINTFLAGS=	
Only in wu-ftpd-2.4.orig/src/makefiles: Makefile.gen.rej
Only in wu-ftpd-2.4.orig/src/makefiles: Makefile.hpx.rej
diff -rc wu-ftpd-2.4/src/newvers.sh wu-ftpd-2.4.orig/src/newvers.sh
*** wu-ftpd-2.4/src/newvers.sh	Wed Apr 13 14:41:33 1994
--- wu-ftpd-2.4.orig/src/newvers.sh	Tue Nov 28 00:04:08 1995
***************
*** 22,25 ****
--- 22,27 ----
  awk '	{	edit = $1 + 1; }\
  END	{	printf "char version[] = \"Version wu-2.4(%d) ", edit > "vers.c";\
  		printf "%d\n", edit > "edit"; }' < edit
+ LANG=
+ LC_TIME=
  echo `date`'";' >> vers.c
diff -rc wu-ftpd-2.4/src/realpath.c wu-ftpd-2.4.orig/src/realpath.c
*** wu-ftpd-2.4/src/realpath.c	Fri Apr  1 14:03:45 1994
--- wu-ftpd-2.4.orig/src/realpath.c	Tue Nov 28 00:02:10 1995
***************
*** 42,48 ****
  #endif
  
  char *
! realpath(char *pathname, char *result)
  {
      struct stat sbuf;
      char curpath[MAXPATHLEN],
--- 42,48 ----
  #endif
  
  char *
! realpath(const char *pathname, char *result)
  {
      struct stat sbuf;
      char curpath[MAXPATHLEN],
diff -rc wu-ftpd-2.4/src/vers.c wu-ftpd-2.4.orig/src/vers.c
*** wu-ftpd-2.4/src/vers.c	Wed Apr 13 17:38:41 1994
--- wu-ftpd-2.4.orig/src/vers.c	Tue Feb  6 18:35:00 1996
***************
*** 1 ****
! char version[] = "Version wu-2.4(1) Wed Apr 13 16:38:41 CDT 1994";
--- 1 ----
! char version[] = "Version wu-2.4(4) Tue Feb 6 18:35:00 EST 1996";
diff -rc wu-ftpd-2.4/support/makefiles/Makefile.bsd wu-ftpd-2.4.orig/support/makefiles/Makefile.bsd
*** wu-ftpd-2.4/support/makefiles/Makefile.bsd	Fri Apr  1 14:03:49 1994
--- wu-ftpd-2.4.orig/support/makefiles/Makefile.bsd	Tue Nov 28 00:10:12 1995
***************
*** 4,10 ****
  LIBC   = /usr/lib/libc.a
  IFLAGS = 
  LFLAGS = 
! CFLAGS = -O -DDEBUG ${IFLAGS} ${LFLAGS}
  
  SRCS   = fnmatch.c strcasestr.c authuser.c ftw.c
  OBJS   = fnmatch.o strcasestr.o authuser.o ftw.o
--- 4,10 ----
  LIBC   = /usr/lib/libc.a
  IFLAGS = 
  LFLAGS = 
! CFLAGS = -O -DNO_MALLOC_PROTO -DDEBUG ${IFLAGS} ${LFLAGS}
  
  SRCS   = fnmatch.c strcasestr.c authuser.c ftw.c
  OBJS   = fnmatch.o strcasestr.o authuser.o ftw.o

----[ CUT HERE ]-----

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