diff options
| author | lukem <lukem@NetBSD.org> | 2001-04-17 00:59:58 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 2001-04-17 00:59:58 +0000 |
| commit | 6443de4b8e46bee76eeda78037720b8255596b2d (patch) | |
| tree | c1335b560b7ebffaac87c52b8505bf5bf7b11a2e /libexec | |
| parent | 264c404593038b6d26180e59d852c5517b04caa3 (diff) | |
limit the number of matches in a ~ pathname glob, and complain if more
than one path is matched.
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ftpd/ftpcmd.y | 14 | ||||
| -rw-r--r-- | libexec/ftpd/version.h | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 7b405b77a0f..731d183bcc2 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -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 @@ pathname */ 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 @@ pathname 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 --git a/libexec/ftpd/version.h b/libexec/ftpd/version.h index 9ed980fddae..27c9c5ed10c 100644 --- a/libexec/ftpd/version.h +++ b/libexec/ftpd/version.h @@ -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 |
