unifdef -DINTERNAL_LS - it's too useful to be off by default. If anyone

really dislikes this, we could add a switch to disable it at runtime and
check in popen.c.
This commit is contained in:
peter 1999-08-26 00:45:36 +00:00
parent bdd6d89c3f
commit 673d35729a
5 changed files with 7 additions and 32 deletions

View File

@ -1,5 +1,5 @@
# @(#)Makefile 8.2 (Berkeley) 4/4/94
# $Id: Makefile,v 1.24 1998/05/04 18:20:18 bde Exp $
# $Id: Makefile,v 1.25 1998/11/21 02:11:16 jdp Exp $
PROG= ftpd
MAN8= ftpd.8
@ -12,12 +12,10 @@ YFLAGS=
LDADD= -lskey -lmd -lcrypt -lutil
DPADD= ${LIBSKEY} ${LIBMD} ${LIBCRYPT} ${LIBUTIL}
.ifdef FTPD_INTERNAL_LS
LSDIR= ../../bin/ls
.PATH: ${.CURDIR}/${LSDIR}
SRCS+= ls.c cmp.c print.c stat_flags.c util.c
CFLAGS+=-DINTERNAL_LS -Dmain=ls_main -I${.CURDIR}/${LSDIR}
.endif
.if exists(${DESTDIR}/usr/lib/libkrb.a) && defined(MAKE_KERBEROS4)
.PATH: ${.CURDIR}/../../lib/libpam/modules/pam_kerberosIV

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)extern.h 8.2 (Berkeley) 4/4/94
* $Id: extern.h,v 1.10 1997/09/05 11:17:22 tg Exp $
* $Id: extern.h,v 1.11 1997/09/05 11:43:56 tg Exp $
*/
void blkfree __P((char **));
@ -70,6 +70,4 @@ int yyparse __P((void));
#if defined(SKEY) && defined(_PWD_H_) /* XXX evil */
char *skey_challenge __P((char *, struct passwd *, int));
#endif
#if defined(INTERNAL_LS)
int ls_main __P((int, char **));
#endif

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
.\" $Id: ftpd.8,v 1.26 1999/05/04 19:42:01 ghelmer Exp $
.\" $Id: ftpd.8,v 1.27 1999/06/28 10:50:47 mpp Exp $
.\"
.Dd April 19, 1994
.Dt FTPD 8
@ -408,24 +408,15 @@ value is to be used.
As with any anonymous login configuration, due care must be given
to setup and maintenance to guard against security related problems.
.Pp
If compiled with the
.Em INTERNAL_LS
option,
.Nm
will have internal support for handling remote requests to list
has internal support for handling remote requests to list
files, and will not execute
.Pa /bin/ls
in either a chrooted or non-chrooted environment.
In this case, the
in either a chrooted or non-chrooted environment. The
.Pa ~/bin/ls
executable need not be placed into the chrooted tree, nor need the
.Pa ~/bin
directory exist.
This support may be added by making ftpd with the
.Em FTPD_INTERNAL_LS
variable set either in
.Pa /etc/make.conf
or in the shell's environment.
.Sh FILES
.Bl -tag -width /etc/ftpwelcome -compact
.It Pa /etc/ftpusers

View File

@ -44,7 +44,7 @@ static char copyright[] =
static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#endif
static const char rcsid[] =
"$Id: ftpd.c,v 1.54 1999/04/07 08:27:40 brian Exp $";
"$Id: ftpd.c,v 1.55 1999/04/25 22:23:35 imp Exp $";
#endif /* not lint */
/*
@ -103,12 +103,8 @@ static const char rcsid[] =
#include <varargs.h>
#endif
#ifdef INTERNAL_LS
static char version[] = "Version 6.00LS";
#undef main
#else
static char version[] = "Version 6.00";
#endif
extern off_t restart_point;
extern char cbuf[];

View File

@ -39,7 +39,7 @@
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#endif
static const char rcsid[] =
"$Id: popen.c,v 1.14 1998/05/15 16:51:06 ache Exp $";
"$Id: popen.c,v 1.15 1998/05/18 00:06:28 ache Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -54,12 +54,10 @@ static const char rcsid[] =
#include <unistd.h>
#include "extern.h"
#ifdef INTERNAL_LS
#include "pathnames.h"
#include <syslog.h>
#include <time.h>
#include <varargs.h>
#endif
#define MAXUSRARGS 100
#define MAXGLOBARGS 1000
@ -119,12 +117,8 @@ ftpd_popen(program, type)
gargv[gargc] = NULL;
iop = NULL;
#ifdef INTERNAL_LS
fflush(NULL);
pid = (strcmp(gargv[0], _PATH_LS) == 0) ? fork() : vfork();
#else
pid = vfork();
#endif
switch(pid) {
case -1: /* error */
(void)close(pdes[0]);
@ -146,7 +140,6 @@ ftpd_popen(program, type)
}
(void)close(pdes[1]);
}
#ifdef INTERNAL_LS
if (strcmp(gargv[0], _PATH_LS) == 0) {
extern int optreset;
/* Reset getopt for ls_main() */
@ -162,7 +155,6 @@ ftpd_popen(program, type)
}
exit(ls_main(gargc, gargv));
}
#endif
execv(gargv[0], gargv);
_exit(1);
}