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

Fix incorrect cast when parsing FTP connection port #2142

Merged
merged 1 commit into from Jun 23, 2022

Conversation

kimci86
Copy link
Contributor

@kimci86 kimci86 commented Jun 23, 2022

Description

This commit fixes a regression introduced in eb19331 as part of PR #1846.

How to test this PR?

  • Start a local FTP server. I used pyftpdlib.
    pip3 install --user pyftpdlib
    python3 -m pyftpdlib -u user -P pass
  • Edit SFML's example program ftp to use port 2121 (pyftpdlib's default port).
    Note I am not using port 21 to avoid having to run the server as root.
    diff --git a/examples/ftp/Ftp.cpp b/examples/ftp/Ftp.cpp
    index e4de8adc..469937a9 100644
    --- a/examples/ftp/Ftp.cpp
    +++ b/examples/ftp/Ftp.cpp
    @@ -36,7 +36,7 @@ int main()
    
         // Connect to the server
         sf::Ftp server;
    -    sf::Ftp::Response connectResponse = server.connect(address);
    +    sf::Ftp::Response connectResponse = server.connect(address, 2121);
         std::cout << connectResponse << std::endl;
         if (!connectResponse.isOk())
             return EXIT_FAILURE;
  • Compile and run SFML's example program ftp.

Without the patch, the example program cannot gather the content of the server's working directory.
With the patch, it can :)

@eXpl0it3r eXpl0it3r added this to Discussion in SFML 2.6.0 via automation Jun 23, 2022
@eXpl0it3r eXpl0it3r added this to the 2.6 milestone Jun 23, 2022
@eXpl0it3r eXpl0it3r moved this from Discussion to Review & Testing in SFML 2.6.0 Jun 23, 2022
SFML 2.6.0 automation moved this from Review & Testing to Ready Jun 23, 2022
Copy link
Member

@vittorioromeo vittorioromeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! We should have tests for this stuff... :)

@vittorioromeo vittorioromeo merged commit 618c963 into SFML:2.6.x Jun 23, 2022
SFML 2.6.0 automation moved this from Ready to Done Jun 23, 2022
@kimci86 kimci86 deleted the bugfix/ftp_port_cast branch June 23, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.6.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants