Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ftpd * Add hidesymlinks configuration option



details:   https://anonhg.NetBSD.org/src/rev/25f04459e615
branches:  trunk
changeset: 574531:25f04459e615
user:      ginsbach <ginsbach%NetBSD.org@localhost>
date:      Thu Mar 03 22:19:47 2005 +0000

description:
* 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? :-)]

diffstat:

 libexec/ftpd/conf.c      |  10 +++++++---
 libexec/ftpd/extern.h    |  17 ++++++++++-------
 libexec/ftpd/ftpcmd.y    |  10 +++++++---
 libexec/ftpd/ftpd.conf.5 |  26 +++++++++++++++++++++++---
 libexec/ftpd/version.h   |   4 ++--
 5 files changed, 49 insertions(+), 18 deletions(-)

diffs (183 lines):

diff -r 3e9067a7fa9f -r 25f04459e615 libexec/ftpd/conf.c
--- a/libexec/ftpd/conf.c       Thu Mar 03 21:15:26 2005 +0000
+++ b/libexec/ftpd/conf.c       Thu Mar 03 22:19:47 2005 +0000
@@ -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 @@
 
        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 @@
                } 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);
 
diff -r 3e9067a7fa9f -r 25f04459e615 libexec/ftpd/extern.h
--- a/libexec/ftpd/extern.h     Thu Mar 03 21:15:26 2005 +0000
+++ b/libexec/ftpd/extern.h     Thu Mar 03 22:19:47 2005 +0000
@@ -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 {
        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;
 
diff -r 3e9067a7fa9f -r 25f04459e615 libexec/ftpd/ftpcmd.y
--- a/libexec/ftpd/ftpcmd.y     Thu Mar 03 21:15:26 2005 +0000
+++ b/libexec/ftpd/ftpcmd.y     Thu Mar 03 22:19:47 2005 +0000
@@ -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 @@
                {
                        char *argv[] = { INTERNAL_LS, "-lgA", NULL };
                        
+                       if (CURCLASS_FLAGS_ISSET(hidesymlinks))
+                               argv[1] = "-LlgA";
                        if ($2)
                                retrieve(argv, "");
                }
@@ -519,6 +521,8 @@
                {
                        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);
diff -r 3e9067a7fa9f -r 25f04459e615 libexec/ftpd/ftpd.conf.5
--- a/libexec/ftpd/ftpd.conf.5  Thu Mar 03 21:15:26 2005 +0000
+++ b/libexec/ftpd/ftpd.conf.5  Thu Mar 03 22:19:47 2005 +0000
@@ -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 @@
 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
diff -r 3e9067a7fa9f -r 25f04459e615 libexec/ftpd/version.h
--- a/libexec/ftpd/version.h    Thu Mar 03 21:15:26 2005 +0000
+++ b/libexec/ftpd/version.h    Thu Mar 03 22:19:47 2005 +0000
@@ -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



Home | Main Index | Thread Index | Old Index