*BSD News Article 67046


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!vic.news.telstra.net!act.news.telstra.net!psgrain!news.uoregon.edu!arclight.uoregon.edu!news.dacom.co.kr!usenet.seri.re.kr!news.cais.net!van-bc!unixg.ubc.ca!rover.ucs.ualberta.ca!news.nl2k.edmonton.ab.CA!news.nl2k.edmonton.ab.CA!not-for-mail
From: doctor@nl2k.edmonton.AB.ca (The Doctor)
Newsgroups: comp.unix.bsd.bsdi.misc,comp.unix.bsd.netbsd.misc,comp.unix.bsd.freebsd.misc
Subject: Re: configuring virtual ftp (wu-ftp)
Date: 26 Apr 1996 09:59:26 -0600
Organization: NetLine 2000
Lines: 456
Message-ID: <4lqrsu$rbp@doctor.nl2k.edmonton.ab.ca>
References: <4kk2pc$pvs@moon.igcom.net> <DqFAFI.CC2@kraken.aldhfn.org>
NNTP-Posting-Host: doctor.nl2k.edmonton.ab.ca
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.bsdi.misc:3543 comp.unix.bsd.netbsd.misc:3402 comp.unix.bsd.freebsd.misc:18230

In article <DqFAFI.CC2@kraken.aldhfn.org>,
Skip Watson <ciaran@phoenix.aldhfn.org> wrote:
>David B. Bauman (david@terra.igcom.net) wrote:
>: sd.misc
>: References: <316BA418.65EF@softaid.net> <4ki14r$nv9@doctor.nl2k.edmonton.ab.ca>
>: Organization: InterGlobal Communications
>: Distribution: 
>: The Doctor (doctor@nl2k.edmonton.AB.ca) wrote:
>:
>: : Recompile and reinstall.  BSDI's wu-ftpd is NOT virtual.  BTW
>: : where did you pick up vwu-ftpd?
>: 
>: Please let me know as well.  Ive been searching for it for a while.
>
>	I found the following file in wu-ftpd-2.4.BSDI.tar.gz. Looking through
>that archive it appears to have been compiled for FreeBSD. It does compile and
>run on FreeBSD 2.1.
>
>	Add the following line to ftpaccess and make sure name server is set
>up correctly. Also make sure the interfaces are setup correctly just like for
>WWW virtual host.
>
>virtual	[IP Number]	[ftp home directory]	[ftp home directory/].message
>
>
>	One problem I have noticed. After logging into the virtual host, 
>"ls pub" causes the server to disconnect. If you "cd pub" and then do "ls"
>it works. Someone that is a programmer needs to look into this "problem".
>I'm not a programmer but I'm interested in any fixes/improvements ;-).
>
>	Anyway here it is. It isn't mine so don't ask me about.

Which version of the ftpd DO you have?

The one Nebulus (Breckenridge) carries is 2.4(9).  

I joined the wu-ftpd mailing bt no info on were the CURRENT wu-ftpd is.

>
>-------------------------- cut here -----------------------
>--- extensions.c	
>+++ extensions.c	Fri May 26 20:48:13 1995
>@@ -278,7 +278,7 @@
> /*************************************************************************/
> 
> void
>-show_banner(int msgcode)
>+show_banner(int msgcode, int virtual_mode, char *virtual_banner)
> {
>     char *crptr,
>       linebuf[1024],
>@@ -286,22 +286,38 @@
>     struct aclmember *entry = NULL;
>     FILE *infile;
> 
>-    /* banner <path> */
>-    while (getaclentry("banner", &entry)) {
>+    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, "");
>-            }
>-        }
>+	    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, "");
>+	    }
>+	 }
>+      }
>     }
>+
> }
> 
> /*************************************************************************/
>--- ftpd.c
>+++ ftpd.c	Fri May 26 20:53:57 1995
>@@ -150,6 +150,14 @@
> 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];
>+#endif
>+
> int data;
> jmp_buf errcatch,
>   urgcatch;
>@@ -261,6 +269,11 @@
> #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,6 +512,31 @@
>     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 (ARG1 != NULL && ARG2 != NULL) {
>+	    virtual_mode = 1;
>+	    strncpy(virtual_root, ARG1, MAXPATHLEN);
>+	    strncpy(virtual_banner, ARG2, MAXPATHLEN);
>+	    syslog(LOG_ERR, "VirtualFTP Connect to: %s",
>+		   inet_ntoa(virtual_ptr->sin_addr));
>+	  }
>+	}
>+      }
>+    }
>+#endif
>+
>     if (is_shutdown(1) != 0) {
>         syslog(LOG_INFO, "connection refused (server shut down) from %s [%s]",
>                remotehost, remoteaddr);
>@@ -506,7 +544,8 @@
>               hostname);
>         exit(0);
>     }
>-    show_banner(220);
>+
>+    show_banner(220, virtual_mode, virtual_banner);
> 
>     entry = (struct aclmember *) NULL;
>     if (getaclentry("lslong", &entry) && ARG0 && strlen(ARG0) > 0) {
>@@ -1108,6 +1147,13 @@
>     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.");
>--- makefiles/Makefile.aix
>+++ makefiles/Makefile.aix	Fri May 26 20:57:36 1995
>@@ -1,13 +1,14 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS} 
> LIBES    = -lsupport
> LIBC     = /lib/libc.a
> LINTFLAGS=
> LKERB    = -lauth -lckrb -lkrb -ldes
> MKDEP    = ../util/mkdep
> 
>+ 
> SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
>          realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
> OBJS   = ftpd.o ftpcmd.o glob.o logwtmp.o popen.o vers.o access.o extensions.o \
>--- makefiles/Makefile.bsd	
>+++ makefiles/Makefile.bsd	Fri May 26 20:57:56 1995
>@@ -1,12 +1,13 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /usr/lib/libc.a
> LINTFLAGS=	
> LKERB    = -lauth -lckrb -lkrb -ldes
> MKDEP    = ../util/mkdep
>+ 
> 
> SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
> 		 realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
>--- makefiles/Makefile.dgx
>+++ makefiles/Makefile.dgx	Fri May 26 20:58:05 1995
>@@ -1,12 +1,13 @@
> CC       = gcc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -g -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -g -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = -lc
> LINTFLAGS=	
> LKERB    = -lauth -lckrb -lkrb -ldes
> MKDEP    = ../util/mkdep
>+ 
> 
> SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
> 		 realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
>--- makefiles/Makefile.dyn	
>+++ makefiles/Makefile.dyn	Fri May 26 20:58:15 1995
>@@ -1,7 +1,7 @@
> CC       = gcc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /lib/libc.a
> LINTFLAGS=	
>--- makefiles/Makefile.gen
>+++ makefiles/Makefile.gen	Fri May 26 20:58:25 1995
>@@ -1,12 +1,14 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /lib/libc.a
> LINTFLAGS=	
> LKERB    = -lauth -lckrb -lkrb -ldes
> MKDEP    = ../util/mkdep
>+DEFINES  = -DVIRTUAL
>+ 
> 
> SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
> 		 realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
>--- makefiles/Makefile.hpx
>+++ makefiles/Makefile.hpx	Fri May 26 20:58:46 1995
>@@ -1,12 +1,13 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -Aa -Dunix -D_HPUX_SOURCE -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -Aa -Dunix -DVIRTUAL -D_HPUX_SOURCE -O -DDEBUG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport -lc -lPW
> LIBC     = /lib/libc.a
> LINTFLAGS=	
> LKERB    = -lauth -lckrb -lkrb -ldes
> MKDEP    = ../util/mkdep.hpx
>+ 
> 
> SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
> 		 realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
>--- makefiles/Makefile.isc
>+++ makefiles/Makefile.isc	Fri May 26 20:58:57 1995
>@@ -1,12 +1,13 @@
> CC       = gcc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DISC -DM_UNIX -DPOSIX_JC -DHAVE_VPRINTF -DHAVE_DIRENT -DNBBY=8 -DHAVE_GETDTABLESIZE -DHAVE_GETCWD -DREGEX -DSHADOW_PASSWORD ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL -DISC -DM_UNIX -DPOSIX_JC -DHAVE_VPRINTF -DHAVE_DIRENT -DNBBY=8 -DHAVE_GETDTABLESIZE -DHAVE_GETCWD -DREGEX -DSHADOW_PASSWORD ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport -linet -lnsl_s -lcposix -lPW -lsec
> LIBC     = /lib/libc.a
> LINTFLAGS=	
> #LKERB    =
> MKDEP    = ../util/mkdep
>+ 
> 
> SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
> 		 realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
>--- makefiles/Makefile.lnx
>+++ makefiles/Makefile.lnx	Fri May 26 20:59:22 1995
>@@ -1,13 +1,13 @@
> CC       = gcc
> IFLAGS   = -I.. -I../support -I/usr/include/bsd
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL -DDEBUG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport -lbsd
> LIBC     = /usr/lib/libc.a
> LINTFLAGS=	
> LKERB    = -lauth -lckrb -lkrb -ldes
> MKDEP    = ../util/mkdep
>-
>+ 
> SRCS   = ftpd.c ftpcmd.c glob.c logwtmp.c popen.c vers.c access.c extensions.c \
> 		 realpath.c acl.c private.c authenticate.c conversions.c hostacc.c
> OBJS   = ftpd.o ftpcmd.o glob.o logwtmp.o popen.o vers.o access.o extensions.o \
>@@ -22,7 +22,7 @@
> 	${CC} ${CFLAGS} -o $@ ftpshut.c vers.o ${LIBES}
> 
> ftpd: ${OBJS} ${LIBC}
>-	${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBES}
>+	${CC} ${CFLAGS} ${DEFINES} -o $@ ${OBJS} ${LIBES}
> 
> ckconfig:   ckconfig.c
> 	${CC} ${CFLAGS} -o $@ ckconfig.c
>--- makefiles/Makefile.nx2	
>+++ makefiles/Makefile.nx2	Fri May 26 20:59:12 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL -DDEBUG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /lib/libsys_s.a
> LINTFLAGS=	
>--- makefiles/Makefile.nx3
>+++ makefiles/Makefile.nx3	Fri May 26 20:59:31 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I..
> LFLAGS   = -L../support
>-CFLAGS   = -O2 ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O2 -DVIRTUAL ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = 
> LINTFLAGS=	
>--- makefiles/Makefile.osf	
>+++ makefiles/Makefile.osf	Fri May 26 20:59:39 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support -s -x
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL -DDEBUG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /lib/libc.a
> LINTFLAGS=	
>--- makefiles/Makefile.ptx	
>+++ makefiles/Makefile.ptx	Fri May 26 20:59:47 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL -DDEBUG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport -lsec -lgen -lseq -lsocket -linet -lnsl -lmalloc
> LIBC     = /lib/libc.a
> LINTFLAGS=	
>--- makefiles/Makefile.s41
>+++ makefiles/Makefile.s41	Fri May 26 20:59:56 1995
>@@ -2,7 +2,7 @@
> #CC       = acc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = $(OPT) -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = $(OPT) -DVIRTUAL -DDEBUG ${IFLAGS} ${LFLAGS}
> OPT      = -g
> LIBES    = -lsupport
> LIBC     = /lib/libc.a
>--- makefiles/Makefile.sco
>+++ makefiles/Makefile.sco	Fri May 26 21:00:09 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL ${IFLAGS} ${LFLAGS}
> # 1) If you do not have -lprot_s, use -lprot instead.
> # 2) -lcrypt can be used in place of -lcrypt_i. If you do not have any crypt
> #    library, get and install ftp.sco.com:/SLS/lng225* (International Crypt
>--- makefiles/Makefile.sgi
>+++ makefiles/Makefile.sgi	Fri May 26 21:00:18 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL -DDEBUG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /usr/lib/libc.a
> LINTFLAGS=	
>--- makefiles/Makefile.sny
>+++ makefiles/Makefile.sny	Fri May 26 21:00:26 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -O -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -O -DVIRTUAL -DDEBUG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /lib/libc.a
> LINTFLAGS=	
>--- makefiles/Makefile.sol	
>+++ makefiles/Makefile.sol	Fri May 26 21:00:35 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -g -DDEBUG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -g -DDEBUG -DVIRTUAL ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport -lsocket -lnsl -lgen
> LIBC     = /lib/libc.a
> LINTFLAGS=	
>--- makefiles/Makefile.ult	
>+++ makefiles/Makefile.ult	Fri May 26 21:00:47 1995
>@@ -1,7 +1,7 @@
> CC       = cc
> IFLAGS   = -I.. -I../support
> LFLAGS   = -L../support
>-CFLAGS   = -Dconst="" -O -DDEBUG -DSYSSYSLOG ${IFLAGS} ${LFLAGS}
>+CFLAGS   = -Dconst="" -O -DVIRTUAL -DDEBUG -DSYSSYSLOG ${IFLAGS} ${LFLAGS}
> LIBES    = -lsupport
> LIBC     = /lib/libc.a
> LINTFLAGS=	
>-------------------------- cut here -------------------------------
>
>Skip
>--
>Auldhaefen Online Services		automated info: info@aldhfn.org
>216 745-9380 voice			     questions: support@aldhfn.org
>216 753-8791 bbs/fax			        person: ciaran@aldhfn.org
>216 745-7624 data		experimental webserver: http://www.aldhfn.org


-- 
God, Queen and Country                Member - Liberal International
NEVER Satan, President and Republic   Board Member - Edmonton Heritage Nazarene
Hating Bachelor's Living;  Doctor Who returns: 13 May at BAFTA for DWAS, 14 May on Fox for NA, 27 May on BBC1 - check rec.arts.drwho for local gatherings
http://doctor.nl2k.edmonton.ab.ca/~doctor  British Columbia, beware of Van Der Zalm Reform and Harcourt/Clark NDP.