Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ftpd limit the number of matches in a ~ pathname glo...
details: https://anonhg.NetBSD.org/src/rev/8696563ca0b1
branches: trunk
changeset: 508659:8696563ca0b1
user: lukem <lukem%NetBSD.org@localhost>
date: Tue Apr 17 00:59:58 2001 +0000
description:
limit the number of matches in a ~ pathname glob, and complain if more
than one path is matched.
diffstat:
libexec/ftpd/ftpcmd.y | 14 ++++++++++----
libexec/ftpd/version.h | 4 ++--
2 files changed, 12 insertions(+), 6 deletions(-)
diffs (58 lines):
diff -r 4030f5fa020f -r 8696563ca0b1 libexec/ftpd/ftpcmd.y
--- a/libexec/ftpd/ftpcmd.y Tue Apr 17 00:50:13 2001 +0000
+++ b/libexec/ftpd/ftpcmd.y Tue Apr 17 00:59:58 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpcmd.y,v 1.62 2001/04/12 02:28:59 lukem Exp $ */
+/* $NetBSD: ftpcmd.y,v 1.63 2001/04/17 00:59:58 lukem Exp $ */
/*-
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@@ -83,7 +83,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
-__RCSID("$NetBSD: ftpcmd.y,v 1.62 2001/04/12 02:28:59 lukem Exp $");
+__RCSID("$NetBSD: ftpcmd.y,v 1.63 2001/04/17 00:59:58 lukem Exp $");
#endif
#endif /* not lint */
@@ -1083,7 +1083,8 @@
*/
if (logged_in && $1 && *$1 == '~') {
glob_t gl;
- int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE;
+ int flags = GLOB_BRACE | GLOB_NOCHECK | \
+ GLOB_TILDE | GLOB_LIMIT;
if ($1[1] == '\0')
$$ = xstrdup(homedir);
@@ -1091,7 +1092,12 @@
memset(&gl, 0, sizeof(gl));
if (glob($1, flags, NULL, &gl) ||
gl.gl_pathc == 0) {
- reply(550, "not found");
+ reply(550, "%s: Not found",
+ $1);
+ $$ = NULL;
+ } else if (gl.gl_matchc > 1) {
+ reply(550,
+ "%s: Too many matches", $1);
$$ = NULL;
} else
$$ = xstrdup(gl.gl_pathv[0]);
diff -r 4030f5fa020f -r 8696563ca0b1 libexec/ftpd/version.h
--- a/libexec/ftpd/version.h Tue Apr 17 00:50:13 2001 +0000
+++ b/libexec/ftpd/version.h Tue Apr 17 00:59:58 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.29 2001/04/10 01:44:56 itojun Exp $ */
+/* $NetBSD: version.h,v 1.30 2001/04/17 00:59:59 lukem Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -36,5 +36,5 @@
*/
#ifndef FTPD_VERSION
-#define FTPD_VERSION "NetBSD-ftpd 20010410"
+#define FTPD_VERSION "NetBSD-ftpd 20010417"
#endif
Home |
Main Index |
Thread Index |
Old Index