FtpServer
  1. FtpServer
  2. FTPSERVER-300

Create an extensible getPassiveExternalAddress() method in PASV command so ftp integrators can define additional ways to obtain their 'external passive address'.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.2
    • Component/s: None
    • Labels:
      None

      Description

      PASV command will return the server's ip address and a port number to the client in order for this to initiate a new data connection.

      In the case we are behind a NAT proxy, we need to figure out what is the IP address the client is actually connecting to. For this, ftpserver provides a configuration option to establish the IP address which will be returned after a PASV command is sent.

      This method will work in a number of cases but it is not enough in several others , e.g., if the server has a dynamic ip or if different users see different ips for the same machine ( which can be the case, it is my case actually) .

      So we might add a protected method getExternalPassiveAddress() in PASV command implementation so the external ip guessing can be customized as needed by extenders. Otherwise, the whole Passive method should be re-implemented.

        Activity

        Hide
        David Latorre added a comment -

        Are you ok with this, Niklas? We are exporting FtpIoSession but FtpSession doesn't have access to the Listener information... would that cause any trouble in the case of OSGI? Sorry, I didn't think about that possibility until I had already committed.

        Show
        David Latorre added a comment - Are you ok with this, Niklas? We are exporting FtpIoSession but FtpSession doesn't have access to the Listener information... would that cause any trouble in the case of OSGI? Sorry, I didn't think about that possibility until I had already committed.
        Hide
        Niklas Gustavsson added a comment -

        Both PASV and FtpIoSession are marked as internal classes so I don't have a problem with this patch. A user that decides to override getPassiveExternalAddress would know that we will freely break it as we see fit.

        But, could we have some Javadoc and maybe even a test if that makes sense?

        /niklas

        Show
        Niklas Gustavsson added a comment - Both PASV and FtpIoSession are marked as internal classes so I don't have a problem with this patch. A user that decides to override getPassiveExternalAddress would know that we will freely break it as we see fit. But, could we have some Javadoc and maybe even a test if that makes sense? /niklas
        Hide
        Niklas Gustavsson added a comment -

        Oh, I should also note that neither of these classes are exposed to OSGi and thus that has no impact on this commit.

        Show
        Niklas Gustavsson added a comment - Oh, I should also note that neither of these classes are exposed to OSGi and thus that has no impact on this commit.
        Hide
        David Latorre added a comment -

        Added javadoc and a test case.

        Show
        David Latorre added a comment - Added javadoc and a test case.

          People

          • Assignee:
            David Latorre
            Reporter:
            David Latorre
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development