2010-05-07 Arnout Vandecappelle <arnout@mind.be>

PR 1511/networking
	* ftpd/ftpd.c: Abort RETR for directories.
This commit is contained in:
Sebastian Huber
2010-05-07 09:07:17 +00:00
parent cdeead64f6
commit e7fd0524d2
2 changed files with 14 additions and 0 deletions

View File

@@ -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> 2010-05-03 Sebastian Huber <sebastian.huber@embedded-brains.de>
* sapi/include/confdefs.h: New define CONFIGURE_SEMAPHORES for the * sapi/include/confdefs.h: New define CONFIGURE_SEMAPHORES for the

View File

@@ -795,6 +795,7 @@ command_retrieve(FTPD_SessionInfo_t *info, char const *filename)
int s = -1; int s = -1;
int fd = -1; int fd = -1;
char buf[FTPD_DATASIZE]; char buf[FTPD_DATASIZE];
struct stat stat_buf;
int res = 0; int res = 0;
if(!can_read()) if(!can_read())
@@ -809,6 +810,14 @@ command_retrieve(FTPD_SessionInfo_t *info, char const *filename)
return; 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); send_mode_reply(info);
s = data_socket(info); s = data_socket(info);