Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetBox FTP connection doesn't preserve non-default port number #396

Open
alabuzhev opened this issue Feb 22, 2024 · 0 comments
Open

NetBox FTP connection doesn't preserve non-default port number #396

alabuzhev opened this issue Feb 22, 2024 · 0 comments

Comments

@alabuzhev
Copy link
Contributor

FarGroup#42 by @yulian5

Far Manager version

3.0

OS version

10

Other software

FTP server will be useful on the same or different machine

Steps to reproduce

Create new FTP or edit existing FTP connection in NetBox. Set FTP (not SFTP!) port to any value except 21 (for example, 443). Close the dialog and open it again. See, that port reversed to default value 21. Actually internally it looks like the new port number is set correctly (for the session, at least) and it's possible to connect with the new port number. But FTP dialog still shows wrong default 21 port number.

Expected behavior

Preserved NetBox FTP connection session should save the new defined port (like 443, for example).

Actual behavior

FTP dialog shows 21 port number for FTP connection but (for at least in the current session) uses the new port defined by the user.


I have more information about that problem. It happens only with a few ports actually for plain FTP.

In file .\src\NetBox\WinSCPDialogs.cpp
in function “TsessionDialog::TransferProtocolComboChange”
lines 2874-2880:

else if ((FSProtocol == fsFTP) && ((Ftps == ftpsNone) || (Ftps == ftpsExplicitSsl) || (Ftps == ftpsExplicitTls)))
  {
    if ((Port == SshPortNumber) || (Port == FtpsImplicitPortNumber) || (Port == HTTPPortNumber) || (Port == HTTPSPortNumber))
    {
      PortNumberEdit->SetAsInteger(FtpPortNumber);
    }
  }

So for plain FTP it sets default port 21 if user try to set any of 4 listed above ports.

As I know FTP can use any ports for it purpose and Filezilla Server allows that.
At my work only 80 and 443 ports are open and I cannot use USB sticks. So I use 443 for FTP transfer, maybe not a good idea as login/password in a plain text, but I transfer just work files anyway between my computers.

There are actually 2 problems here:

  1. Why are those TransferProtocolComboChange happens? For plain FTP it’s definitely incorrect, I’m not sure about other changes in this function. Most likely that code comes from somewhere else and probably not relevant anymore or incorrect in some parts (as for FTP, for instance)

Does anybody have knowledge about that?

  1. This function works incorrectly anyway: If user sets FTP port to 443, the FTP dialog sets and saves it in SessionData. In SessionData port is always correct and it’s always saved correctly. If user uses FTP session it connects with correct port number 443. But if user try to edit saved FTP session, it shows default port 21 as it set it in line 2878. At this point, if user press Esc, dialog will save existing port (443, for example, even if it shows port 21). But if user press Enter (Ok), port with change from 443 to 21. That is a bug with the whole function “TransferProtocolComboChange” with other changes too.

Any ideas about that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant