Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

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

Closed
yulian5 opened this issue Dec 8, 2023 · 2 comments
Closed

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

yulian5 opened this issue Dec 8, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@yulian5
Copy link

yulian5 commented Dec 8, 2023

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.

@yulian5
Copy link
Author

yulian5 commented Dec 19, 2023

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?

@alabuzhev
Copy link
Collaborator

Moved to michaellukashov#396

@alabuzhev alabuzhev closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants