Source-Changes-HG archive

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

[src/netbsd-1-6]: src/libexec/ftpd Pull up revision 1.67 (requested by lukem ...



details:   https://anonhg.NetBSD.org/src/rev/f0fcd315e921
branches:  netbsd-1-6
changeset: 527927:f0fcd315e921
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sat Jun 15 03:42:33 2002 +0000

description:
Pull up revision 1.67 (requested by lukem in ticket #282):
Implement "SITE UMASK" `enabled command' check with (modified)
check_write(), so that a user who has modify disabled gets an error
message rather than a hung connection.
Noted by M.J. Rutter <mjr19%cus.cam.ac.uk@localhost> in private email.

diffstat:

 libexec/ftpd/ftpcmd.y |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r ffc5c8b7ee35 -r f0fcd315e921 libexec/ftpd/ftpcmd.y
--- a/libexec/ftpd/ftpcmd.y     Sat Jun 15 02:20:09 2002 +0000
+++ b/libexec/ftpd/ftpcmd.y     Sat Jun 15 03:42:33 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftpcmd.y,v 1.66 2001/12/01 10:25:30 lukem Exp $        */
+/*     $NetBSD: ftpcmd.y,v 1.66.2.1 2002/06/15 03:42:33 lukem Exp $    */
 
 /*-
  * Copyright (c) 1997-2001 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.66 2001/12/01 10:25:30 lukem Exp $");
+__RCSID("$NetBSD: ftpcmd.y,v 1.66.2.1 2002/06/15 03:42:33 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -656,7 +656,7 @@
                {
                        int oldmask;
 
-                       if ($4 && CURCLASS_FLAGS_ISSET(modify)) {
+                       if ($4 && check_write("", 0)) {
                                if (($6 == -1) || ($6 > 0777)) {
                                        reply(501, "Bad UMASK value");
                                } else {
@@ -1285,6 +1285,8 @@
 /*
  * Check if a filename is allowed to be modified (isupload == 0) or
  * uploaded (isupload == 1), and if necessary, check the filename is `sane'.
+ * If the filename is NULL, fail.
+ * If the filename is "", don't do the sane name check.
  */
 static int
 check_write(const char *file, int isupload)
@@ -1305,8 +1307,9 @@
                reply(502, "No permission to use this command.");
                return (0);
        }
+
                /* checking sanenames */
-       if (CURCLASS_FLAGS_ISSET(sanenames)) {
+       if (file[0] != '\0' && CURCLASS_FLAGS_ISSET(sanenames)) {
                const char *p;
 
                if (file[0] == '.')



Home | Main Index | Thread Index | Old Index