* Add hidesymlinks configuration option

This adds a -L to all ls command arguments so that the file or directory
  the link references is listed rather than the link itself.  This was
  inspired by IRIX ftpd's -S option.
  [Discussed with lukem some time ago.]
* Crank version.h [right Luke? :-)]
This commit is contained in:
ginsbach 2005-03-03 22:19:47 +00:00
parent 6d840cfd52
commit f0b5287312
5 changed files with 49 additions and 18 deletions

View File

@ -1,7 +1,7 @@
/* $NetBSD: conf.c,v 1.53 2004/12/11 18:37:26 christos Exp $ */
/* $NetBSD: conf.c,v 1.54 2005/03/03 22:19:47 ginsbach Exp $ */
/*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
* Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: conf.c,v 1.53 2004/12/11 18:37:26 christos Exp $");
__RCSID("$NetBSD: conf.c,v 1.54 2005/03/03 22:19:47 ginsbach Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -126,6 +126,7 @@ init_curclass(void)
CURCLASS_FLAGS_SET(checkportcmd);
CURCLASS_FLAGS_CLR(denyquick);
CURCLASS_FLAGS_CLR(hidesymlinks);
CURCLASS_FLAGS_SET(modify);
CURCLASS_FLAGS_SET(passive);
CURCLASS_FLAGS_CLR(private);
@ -354,6 +355,9 @@ parse_conf(const char *findclass)
} else if (strcasecmp(word, "display") == 0) {
CONF_STRING(display);
} else if (strcasecmp(word, "hidesymlinks") == 0) {
CONF_FLAG(hidesymlinks);
} else if (strcasecmp(word, "homedir") == 0) {
CONF_STRING(homedir);

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.51 2004/11/11 01:14:10 christos Exp $ */
/* $NetBSD: extern.h,v 1.52 2005/03/03 22:19:47 ginsbach Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -32,7 +32,7 @@
*/
/*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
* Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -252,12 +252,15 @@ typedef enum {
typedef enum {
FLAG_checkportcmd = 1<<0, /* Check port commands */
FLAG_denyquick = 1<<1, /* Check ftpusers(5) before PASS */
FLAG_modify = 1<<2, /* Allow CHMOD, DELE, MKD, RMD, RNFR,
FLAG_hidesymlinks = 1<<2, /* For symbolic links, list the file
or directory the link references
rather than the link itself */
FLAG_modify = 1<<3, /* Allow CHMOD, DELE, MKD, RMD, RNFR,
UMASK */
FLAG_passive = 1<<3, /* Allow PASV mode */
FLAG_private = 1<<4, /* Don't publish class info in STAT */
FLAG_sanenames = 1<<5, /* Restrict names of uploaded files */
FLAG_upload = 1<<6, /* As per modify, but also allow
FLAG_passive = 1<<4, /* Allow PASV mode */
FLAG_private = 1<<5, /* Don't publish class info in STAT */
FLAG_sanenames = 1<<6, /* Restrict names of uploaded files */
FLAG_upload = 1<<7, /* As per modify, but also allow
APPE, STOR, STOU */
} classflag_t;

View File

@ -1,7 +1,7 @@
/* $NetBSD: ftpcmd.y,v 1.82 2005/01/05 10:31:27 lukem Exp $ */
/* $NetBSD: ftpcmd.y,v 1.83 2005/03/03 22:19:47 ginsbach Exp $ */
/*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
* Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -79,7 +79,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
__RCSID("$NetBSD: ftpcmd.y,v 1.82 2005/01/05 10:31:27 lukem Exp $");
__RCSID("$NetBSD: ftpcmd.y,v 1.83 2005/03/03 22:19:47 ginsbach Exp $");
#endif
#endif /* not lint */
@ -511,6 +511,8 @@ cmd
{
char *argv[] = { INTERNAL_LS, "-lgA", NULL };
if (CURCLASS_FLAGS_ISSET(hidesymlinks))
argv[1] = "-LlgA";
if ($2)
retrieve(argv, "");
}
@ -519,6 +521,8 @@ cmd
{
char *argv[] = { INTERNAL_LS, "-lgA", NULL, NULL };
if (CURCLASS_FLAGS_ISSET(hidesymlinks))
argv[1] = "-LlgA";
if ($2 && $4 != NULL) {
argv[2] = $4;
retrieve(argv, $4);

View File

@ -1,6 +1,6 @@
.\" $NetBSD: ftpd.conf.5,v 1.28 2003/06/27 18:59:54 wiz Exp $
.\" $NetBSD: ftpd.conf.5,v 1.29 2005/03/03 22:19:47 ginsbach Exp $
.\"
.\" Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
.\" Copyright (c) 1997-2001, 2005 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 30, 2002
.Dd March 3, 2005
.Dt FTPD.CONF 5
.Os
.Sh NAME
@ -304,6 +304,26 @@ Escape sequences are supported; refer to
in
.Xr ftpd 8
for more information.
.It Sy hidesymlinks Ar class Op Sy off
If
.Ar class
is
.Dq none
or
.Sy off
is specified, disable this feature.
Otherwise, the
.Sy LIST
command lists symbolic links as the file or directory the link
references
.Pq Dq Li "ls -LlA" .
Servers which run an anonymous service may wish to enable this
feature for
.Sy GUEST
users, so that symbolic links do not leak names in
directories that are not searchable by
.Sy GUEST
users.
.It Sy homedir Ar class Op Sy pathformat
If
.Ar pathformat

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.58 2004/11/19 16:03:59 ginsbach Exp $ */
/* $NetBSD: version.h,v 1.59 2005/03/03 22:19:47 ginsbach Exp $ */
/*-
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
* All rights reserved.
@ -36,5 +36,5 @@
*/
#ifndef FTPD_VERSION
#define FTPD_VERSION "NetBSD-ftpd 20041119"
#define FTPD_VERSION "NetBSD-ftpd 20050303"
#endif