Fix bugs 1572579 and 1574246. Thanks to Stephen Cristol for reporting the bugs and testing the fix.
This commit is contained in:
@@ -42,25 +42,25 @@ static int parse_dir_unix(const char *line,
|
||||
|
||||
#define SPACES "%*[ \t]"
|
||||
res = sscanf(line,
|
||||
"%11s" SPACES
|
||||
"%11s"
|
||||
"%lu" SPACES
|
||||
"%32s" SPACES
|
||||
"%32s" SPACES
|
||||
"%lu" SPACES
|
||||
"%3s" SPACES
|
||||
"%2s" SPACES
|
||||
"%5s" SPACES
|
||||
"%5s" "%*c"
|
||||
"%1023c",
|
||||
mode, &nlink, user, group, &size, month, day, year, file);
|
||||
if (res < 9) {
|
||||
res = sscanf(line,
|
||||
"%11s" SPACES
|
||||
"%11s"
|
||||
"%32s" SPACES
|
||||
"%32s" SPACES
|
||||
"%lu" SPACES
|
||||
"%3s" SPACES
|
||||
"%2s" SPACES
|
||||
"%5s" SPACES
|
||||
"%5s" "%*c"
|
||||
"%1023c",
|
||||
mode, user, group, &size, month, day, year, file);
|
||||
if (res < 8) {
|
||||
|
@@ -54,6 +54,8 @@ int main(int argc, char **argv) {
|
||||
struct tm tm;
|
||||
struct tm test_tm;
|
||||
|
||||
ftpfs.debug = 1;
|
||||
|
||||
tt = time(NULL);
|
||||
gmtime_r(&tt, &tm);
|
||||
ftpfs.blksize = 4096;
|
||||
@@ -121,5 +123,20 @@ int main(int argc, char **argv) {
|
||||
strftime(date, 20, "00:00:00 %d/%m/%Y", &test_tm);
|
||||
check(sbuf, 0, 0, S_IFREG, 1, 0, 0, 0, 1803128, 4096, 3528, date);
|
||||
|
||||
list = "-rw-r--r-- 1 robson users 1803128 Jun 20 02:13 test\r\n";
|
||||
err = parse_dir(list, "/", " test", &sbuf, NULL, 0, NULL, NULL);
|
||||
assert(err == 0);
|
||||
check(sbuf, 0, 0, S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, 1, 0, 0, 0, 1803128, 4096, 3528, "02:13:00 20/06/2006");
|
||||
|
||||
list = "drwxrwsr-x+ 14 cristol molvis 1024 Feb 17 2000 v2\r\n";
|
||||
err = parse_dir(list, "/", "v2", &sbuf, NULL, 0, NULL, NULL);
|
||||
assert(err == 0);
|
||||
check(sbuf, 0, 0, S_IFDIR|S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH, 14, 0, 0, 0, 1024, 4096, 8, "00:00:00 17/02/2000");
|
||||
|
||||
list = "drwxrwsr-x+144 cristol molvis 10240 Dec 31 2005 v11\r\n";
|
||||
err = parse_dir(list, "/", "v11", &sbuf, NULL, 0, NULL, NULL);
|
||||
assert(err == 0);
|
||||
check(sbuf, 0, 0, S_IFDIR|S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH, 144, 0, 0, 0, 10240, 4096, 24, "00:00:00 31/12/2005");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user