1

everyone!

I'm yanrk, I get a problem:

the FTP server force SSL for user login

so I code like this:

curl_easy_setopt(ftp_handle, CURLOPT_URL, "ftp://192.168.1.xxx:990");
curl_easy_setopt(ftp_handle, CURLOPT_USERNAME, "user");
curl_easy_setopt(ftp_handle, CURLOPT_PASSWORD, "password");
curl_easy_setopt(ftp_handle, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(ftp_handle, CURLOPT_SSL_VERIFYHOST, 2L);
curl_easy_setopt(ftp_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_DEFAULT);
curl_easy_setopt(ftp_handle, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_SSL);
curl_easy_setopt(ftp_handle, CURLOPT_VERBOSE, 1L);
CURLcode res = curl_easy_perform(ftp_handle);

when I run with this code, I get message:

  • About to connect() to 127.0.0.1 port 990 (#0)
  • Trying 127.0.0.1...
  • Adding handle: conn: 0x3ff480
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
    • Conn 0 (0x3ff480) send_pipe: 1, recv_pipe: 0
  • Connected to 127.0.0.1 (127.0.0.1) port 990 (#0)

It blocking here, not to auth ssl/tls

I search so many pages, and try with them, but alway failed

So, anyone know how to fix this code?

Thanks!

1 Answers1

1

Using an FTP:// URL with libcurl implies explicit FTPS, which means it will start out in plain text and upgrade to SSL using explicit commands. That's usually done on port 21.

Port 990 is usually what's used for implicit FTPS, which means the server speaks SSL already in the negotiation phase and then you need to use an FTPS:// URL with libcurl.

Based on your error description, I would guess you need an FTPS:// URL.

Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222