veeso / suppaftp

a super FTP/FTPS client library for Rust with support for both passive and active mode
Apache License 2.0
112 stars 28 forks source link

[BUG] - Ftp with TLS (native-tls) Not working #54

Closed c60cb859 closed 1 year ago

c60cb859 commented 1 year ago

Description

When copying the example from https://github.com/veeso/suppaftp#ftp-with-tls-native-tls the first unwrap errors with status: NotLoggedIn

Steps to reproduce

  1. cargo new ftps_test
  2. cd ftps_test
  3. cargo add suppaftp -F native-tls
  4. Copy example to main.rs
  5. cargo run

This gives me:

% cargo run
warning: unused import: `TlsStream`
 --> src/main.rs:1:42
  |
1 | use suppaftp::native_tls::{TlsConnector, TlsStream};
  |                                          ^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `ftps_test` (bin "ftps_test") generated 1 warning (run `cargo fix --bin "ftps_test"` to apply 1 suggestion)
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/ftps_test`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnexpectedResponse(Response { status: NotLoggedIn, body: [53, 51, 48, 32, 78, 111, 116, 32, 108, 111, 103, 103, 101, 100, 32, 105, 110, 46, 13, 10] })', src/main.rs:12:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behaviour

I would assume I could expect the unwraps and the assert to not give an error

Environment

Additional information

It could very well be me that does something wrong

c60cb859 commented 1 year ago

I have now tried with the suppaftp-cli, getting the same Not logged in error

% suppaftp -V
suppaftp 5.2.0 - developed by Christian Visintin <christian.visintin@veeso.dev>
>> CONNECT+S test.rebex.net:21
Failed to setup TLS stream: Invalid response: [530] 530 Not logged in.
>> LOGIN
Can't perform command: you must connect to remote first
>>

looks like it is working without TLS

% suppaftp -V
suppaftp 5.2.0 - developed by Christian Visintin <christian.visintin@veeso.dev>
>> CONNECT test.rebex.net:21
Failed to set transfer type to binary: Invalid response: [530] 530 Not logged in.
OK
>> LOGIN
Username:

Password:

OK
>>
c60cb859 commented 1 year ago

It might actually be the servers TLS configuration that is wrong

veeso commented 1 year ago

yeah, the rebex server hasn't been working for a while

c60cb859 commented 1 year ago

sorry for the bug :-D