I got sick of (presumably) warez people probing my anonymous ftp site and
dropping all kinds of hard-to-delete trash in incoming, so I patched my
ftpd to only allow directories to start with alphanumerics. There's
probably a better solution, but this works for me so I figure'd I'd share.

Combining this with a umask that doesn't allow reading uploaded files keeps
things reasonably well in hand.

--Aaron


Index: ftpd.c
===================================================================
RCS file: /usr/cvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.62.2.15
diff -u -r1.62.2.15 ftpd.c
--- ftpd.c      2001/12/18 18:35:55     1.62.2.15
+++ ftpd.c      2002/01/19 09:47:42
@@ -2216,6 +2216,12 @@
 {
 
        LOGCMD("mkdir", name);
+
+       if (!isalnum(*name)) {
+               reply(521, "Bite me.");
+               return;
+       }
+
        if (mkdir(name, 0777) < 0)
                perror_reply(550, name);
        else

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to