Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-666

Pure-FTP MLSD Answer is not interpreted correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.6
    • None
    • FTP
    • None

    Description

      Hello,

      For our integration tests, we made an FTPS server setup with Pure-FTP.
      It is running with a self-signed TLS certificate in a docker container.

      With FileZilla, we can make a connection and see files or we can upload/download files.
      You can see the complete FileZilla communication logs in the FileZillaLog.txt
      The part related to MLSD is like following:


      Command: MLSD
      Trace: Trying to resume existing TLS session.
      Trace: TLS Handshake successful
      Trace: TLS Session resumed
      Trace: Protocol: TLS1.2, Key exchange: ECDHE-RSA, Cipher: CHACHA20-POLY1305, MAC: AEAD
      Trace: Hostname does not match certificate SANs
      Response: 150 Accepted data connection
      Response: 226-Options: -a -l
      Response: 226 3 matches total
      Listing: type=cdir;sizd=30;modify=20190218135100;UNIX.mode=0755;UNIX.uid=1000;UNIX.gid=1000;unique=fd0eg103ba52; .
      Listing: type=pdir;sizd=40;modify=20190218134929;UNIX.mode=0755;UNIX.uid=1000;UNIX.gid=0;unique=fd0eg81323a; ..
      Listing: type=file;size=1002;modify=20190218135100;UNIX.mode=0644;UNIX.uid=1000;UNIX.gid=1000;unique=fd0eg103ba53; test-file.txt
      Status: Directory listing of "/test" successful


      With Commons-Net I have written a small test class based on CCCTester
      The test file is available in ListFilesTester.java and complete logs in ListFilesLog.txt
      The part related to MLSD is like following:

      COMMAND: PASV
      REPLY: 227 Entering Passive Mode (192,168,52,185,117,53)
      COMMAND: MLSD
      REPLY: 150 Accepted data connection
      org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
      at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:324)
      at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:300)
      at org.apache.commons.net.ftp.FTP.getReply(FTP.java:732)
      at org.apache.commons.net.ftp.FTPClient.completePendingCommand(FTPClient.java:1857)
      at org.apache.commons.net.ftp.FTPClient.initiateMListParsing(FTPClient.java:3452)
      at org.apache.commons.net.ftp.FTPClient.mlistDir(FTPClient.java:2546)
      at org.apache.commons.net.ftp.FTPClient.mlistDir(FTPClient.java:2533)
      at org.apache.commons.net.ftp.parser.ListFilesTester.test(ListFilesTester.java:48)
      at org.apache.commons.net.ftp.parser.ListFilesTester.main(ListFilesTester.java:103)

      Once we debug inside __getReply method we can actually see
      150 Accepted data connection
      message in "_replyLines" list but it is written in the list of previous answer lines.
      Next call to controlInput.readLine(); results NULL in the "line" variable and exception is thrown.

      This issue seems also very similar to
      https://issues.apache.org/jira/browse/NET-598

      It would be nice to make Pure-FTP working together with Commons-Net.
      It is used in one of the popular Docker Images for FTP Servers and it is useful for integration tests.
      Docker Image is available under:
      https://hub.docker.com/r/stilliard/pure-ftpd/

      Attachments

        1. FileZillaLog.txt
          2 kB
          Mehmet Can Cömert
        2. ListFilesLog.txt
          2 kB
          Mehmet Can Cömert
        3. ListFilesTester.java
          3 kB
          Mehmet Can Cömert

        Activity

          People

            Unassigned Unassigned
            mcancomert Mehmet Can Cömert
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: