mscdex / node-ftp

An FTP client module for node.js
MIT License
1.13k stars 246 forks source link

Can't parse entries containing the "S" permission #223

Open PikeUK opened 6 years ago

PikeUK commented 6 years ago

The REX_LISTUNIX regex in parser.js for the third character of a file permission group is as follows:

[\\-xstT]

However a directory on a server I'm trying to connect to has the S file mode bit set:

    drwx--S---   7 ftp      ftp          4096 May  2  2017 .\r\n
    drwx--S---   7 ftp      ftp          4096 May  2  2017 ..\r\n
    drwx------   2 ftp      ftp          4096 Apr 27 12:02 cgi-bin\r\n
    -rw-------   1 ftp      ftp             0 Jul  2  2014 .htaccess\r\n
    drwx------   2 ftp      ftp          8192 May  2  2017 logs\r\n
    drwx--S---   5 ftp      ftp          4096 Apr 13 09:39 public\r\n
    drwxr-sr-x   2 ftp      ftp          4096 Mar 10  2014 secure\r\n
    drwx--S---   2 ftp      ftp          4096 May  2  2017 secure-cgi-bin\r\n

This causes those entries to be returned unparsed. I found this problem trying to connect using the sftp extension in VS Code which fails to work at all on the particular server with this issue.

PikeUK commented 6 years ago

According to the ls manual S is a valid file mode bit which means:

If the set-user-ID or set-group-ID bit is set but the corresponding executable bit is not set.