diff options
-rw-r--r-- | cpukit/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/ftpd/ftpd.c | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 7b42d5bc81..ff89b0ac26 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2010-05-07 Arnout Vandecappelle <arnout@mind.be> + + PR 1511/networking + * ftpd/ftpd.c: Abort RETR for directories. + 2010-05-03 Sebastian Huber <sebastian.huber@embedded-brains.de> * sapi/include/confdefs.h: New define CONFIGURE_SEMAPHORES for the diff --git a/cpukit/ftpd/ftpd.c b/cpukit/ftpd/ftpd.c index 51fd93f428..f6895754ca 100644 --- a/cpukit/ftpd/ftpd.c +++ b/cpukit/ftpd/ftpd.c @@ -795,6 +795,7 @@ command_retrieve(FTPD_SessionInfo_t *info, char const *filename) int s = -1; int fd = -1; char buf[FTPD_DATASIZE]; + struct stat stat_buf; int res = 0; if(!can_read()) @@ -809,6 +810,14 @@ command_retrieve(FTPD_SessionInfo_t *info, char const *filename) return; } + if (fstat(fd, &stat_buf) == 0 && S_ISDIR(stat_buf.st_mode)) + { + if (-1 != fd) + close(fd); + send_reply(info, 550, "Is a directory."); + return; + } + send_mode_reply(info); s = data_socket(info); |