From b6d44d65d8db173967f86fa3fd64a549926e5fa5 Mon Sep 17 00:00:00 2001 From: yar Date: Sat, 7 Feb 2004 14:11:38 +0000 Subject: 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 nas com> MFC after: 1 week --- libexec/ftpd/ftpd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libexec') 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; } -- cgit v1.1