diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-05-07 09:07:17 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-05-07 09:07:17 +0000 |
commit | e7fd0524d206a0931fd5d4301284693615b84d4c (patch) | |
tree | 5186c04584302ae3b8d9834e9a46117294140f64 /cpukit/ftpd/ftpd.c | |
parent | cdeead64f6602e29752e8db4d194e9fde65002f3 (diff) |
2010-05-07 Arnout Vandecappelle <arnout@mind.be>
PR 1511/networking
* ftpd/ftpd.c: Abort RETR for directories.
Diffstat (limited to '')
-rw-r--r-- | cpukit/ftpd/ftpd.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |