[wp-trac] [WordPress Trac] #51170: FTP automatic updates are not RFC 959 compliant for NLST command

WordPress Trac noreply at wordpress.org
Thu Mar 31 15:37:47 UTC 2022


#51170: FTP automatic updates are not RFC 959 compliant for NLST command
----------------------------+-----------------------
 Reporter:  giox069         |       Owner:  afragen
     Type:  defect (bug)    |      Status:  assigned
 Priority:  normal          |   Milestone:  6.0
Component:  Filesystem API  |     Version:  3.7
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+-----------------------

Comment (by costdev):

 [https://github.com/WordPress/wordpress-develop/pull/2460 PR 2460] has now
 been tested using vsftpd, Filezilla server and PureFTP.

 In all three cases, the PR returns the expected results:

 ||= **Test** =||= **Result** =||
 || A directory that exists || true ||
 || An empty hidden file || true ||
 || A non-empty hidden file || true ||
 || An empty file || true ||
 || A non-empty file || true ||
 || A directory that does not exist || false ||
 || A file that does not exist || false ||

 If passed a directory path, the PR uses the relative `::is_dir()` method
 to check for an existing directory.

 - If this passes, it returns `true` for an existing directory.
 - If it fails, it uses `ftp_rawlist()` to check for a file.

 When using `ftp_rawlist()` on a path that doesn't exist, some FTP servers
 will return `false`, others will return an empty array. The PR uses a
 falsy check to cover both of these instances.

 -----
 `ftp_rawlist()` uses the FTP "LIST" command. Per RFC 959:
  This command causes a list to be sent from the server to the passive DTP.
 If the pathname specifies a directory or other group of files, the server
 should transfer a list of files in the specified directory.  **If the
 pathname specifies a file then the server should send current information
 on the file**.

 (my emphasis)

 `ftp_rawlist()` is called without passing the `-a` flag, used to include
 hidden files, which had caused issues in attempts to patch this issue in
 previous tickets. In testing, it became apparent that Filezilla Server
 doesn't support adding the flag, and already shows hidden files.
 -----
 After successful testing using three different pieces of FTP server
 software, on both the `WP_Filesystem_FTPext` and
 `WP_Filesystem_ftpsockets` filesystem methods, this looks ready for
 `commit` to me.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51170#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list