diff options
author | mdodd <mdodd@FreeBSD.org> | 2002-07-01 02:30:11 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2002-07-01 02:30:11 +0000 |
commit | c8cc9e8e671aae07cf3c0019d74129b08df50630 (patch) | |
tree | 0ea963b8bd74f9619b70fb125bf3ff231ef7a3a8 /libexec/ftpd/ftpd.c | |
parent | e7f13daa73e7590006209f6c6f7daa3962f0c2b2 (diff) | |
download | FreeBSD-src-c8cc9e8e671aae07cf3c0019d74129b08df50630.zip FreeBSD-src-c8cc9e8e671aae07cf3c0019d74129b08df50630.tar.gz |
Implement a flag to disable directory creation for anonymous users.
PR: misc/38987
Submitted by: Peter da Silva <peter@abbnm.com>
MFC after: 1 week
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r-- | libexec/ftpd/ftpd.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 2736946..2ae2d6d 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -143,6 +143,7 @@ int readonly=0; /* Server is in readonly mode. */ int noepsv=0; /* EPSV command is disabled. */ int noretr=0; /* RETR command is disabled. */ int noguestretr=0; /* RETR command is disabled for anon users. */ +int noguestmkd=0; /* MKD command is disabled for anon users. */ static volatile sig_atomic_t recvurg; sig_atomic_t transflag; @@ -297,7 +298,7 @@ main(int argc, char *argv[], char **envp) #endif /* OLD_SETPROCTITLE */ - while ((ch = getopt(argc, argv, "AdlDESURrt:T:u:vOoa:p:46")) != -1) { + while ((ch = getopt(argc, argv, "AdlDESURrt:T:u:vMOoa:p:46")) != -1) { switch (ch) { case 'D': daemon_mode++; @@ -380,6 +381,10 @@ main(int argc, char *argv[], char **envp) family = AF_INET6; break; + case 'M': + noguestmkd = 1; + break; + case 'O': noguestretr = 1; break; @@ -2247,7 +2252,9 @@ makedir(char *name) { LOGCMD("mkdir", name); - if (mkdir(name, 0777) < 0) + if (guest && noguestmkd) + reply(550, "%s: permission denied", name); + else if (mkdir(name, 0777) < 0) perror_reply(550, name); else reply(257, "MKD command successful."); |