summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2004-02-07 14:11:38 +0000
committeryar <yar@FreeBSD.org>2004-02-07 14:11:38 +0000
commitb6d44d65d8db173967f86fa3fd64a549926e5fa5 (patch)
tree2b017221fc9f867d7832ed5015e7182f00269036 /libexec/ftpd
parentaff53081b3a5d795eb73cb6a091c05ad84d68958 (diff)
downloadFreeBSD-src-b6d44d65d8db173967f86fa3fd64a549926e5fa5.zip
FreeBSD-src-b6d44d65d8db173967f86fa3fd64a549926e5fa5.tar.gz
Work around a bug in some clients by never returning raw directory
contents in reply to a RETR command. Such clients consider RETR as a way to tell a file from a directory. Mozilla is an example. PR: bin/62232 Submitted by: Bob Finch <bob+freebsd <at> nas <dot> com> MFC after: 1 week
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 68899dd..27182de 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1653,7 +1653,14 @@ retrieve(char *cmd, char *name)
goto done;
}
if (!S_ISREG(st.st_mode)) {
- if (guest) {
+ /*
+ * Never sending a raw directory is a workaround
+ * for buggy clients that will attempt to RETR
+ * a directory before listing it, e.g., Mozilla.
+ * Preventing a guest from getting irregular files
+ * is a simple security measure.
+ */
+ if (S_ISDIR(st.st_mode) || guest) {
reply(550, "%s: not a plain file.", name);
goto done;
}
OpenPOWER on IntegriCloud