Problem with libssh2_session_handshake

Get help for specific problems
Posts: 7
Joined: 7 Nov 2022

dapepe

After the recent update I am receiving the following error message when syncing files via SFTP:
Cannot read file attributes of "sftp://username@192.168.1.5:22".
LIBSSH2_ERROR_NONE [libssh2_session_handshake]
Any suggestions why this is happening?
Posts: 7
Joined: 7 Nov 2022

dapepe

P.S.: Using Version 11.27 (Donation Edition) on MacOS Ventura 13.0
User avatar
Site Admin
Posts: 7506
Joined: 9 Dec 2007

Zenju

There's only one place inside libssh2_session_handshake() with buggy error handling, so I'm guessing you're hitting it.
Does the following fixed version give a better error message? https://www.mediafire.com/file/0mcagr2utbu6x4g/FreeFileSync_11.28_beta_macOS%25282%2529.zip
Posts: 7
Joined: 7 Nov 2022

dapepe

Thanks for your quick response. I tried your version, unfortunately same results!
Posts: 7
Joined: 7 Nov 2022

dapepe

Again, no luck:
Cannot find the following folders:

sftp://xxxxxxxxx@192.168.157.5:20202/home/media
___________________________________________

Cannot read file attributes of "sftp://xxxxxxxxx@192.168.157.5:20202".
LIBSSH2_ERROR_OUT_OF_BOUNDARY
I tested the SFTP connection with CyberDuck, it's working.
User avatar
Site Admin
Posts: 7506
Joined: 9 Dec 2007

Zenju

Which SFTP server are you using? Ideally, I'd have steps to reproduce this.

Until then, the following version should give a more detailed error message: https://www.mediafire.com/file/2e55usw5sy90958/FreeFileSync_11.28_beta3_macOS.zip
Posts: 7
Joined: 7 Nov 2022

dapepe

I am accessing my local Synology NAS.

This is the error messages:
Cannot read file attributes of "sftp://xxxxxxxxxx@192.168.157.5:20202".
LIBSSH2_ERROR_OUT_OF_BOUNDARY: Failed to get response to ssh-userauth request [libssh2_session_handshake]
Posts: 7
Joined: 7 Nov 2022

dapepe

Thanks! Here's the new error message:
Cannot read file attributes of "sftp://xxxxxxx@192.168.157.5:20202".
LIBSSH2_ERROR_OUT_OF_BOUNDARY: transport.c line 478: -117770238 [libssh2_session_handshake]
Hope this helps!
User avatar
Site Admin
Posts: 7506
Joined: 9 Dec 2007

Zenju

libssh2 is sending SSH_MSG_SERVICE_REQUEST for "ssh-userauth", then waiting for the server to respond with SSH_MSG_SERVICE_ACCEPT:
https://github.com/libssh2/libssh2/blob/821d50dad313b53fb2782f26aec1f52f1be34fc0/src/session.c#L781

However, while unpacking the response stream it finds p->packet_length is 4177197058 > LIBSSH2_PACKET_MAXPAYLOAD(40000) and fails with LIBSSH2_ERROR_OUT_OF_BOUNDARY.
https://github.com/libssh2/libssh2/blob/821d50dad313b53fb2782f26aec1f52f1be34fc0/src/transport.c#L444

The 4177197058 value looks like corrupted data. If it is a SFTP server bug, or an issue of libssh2 doing something wrong in the steps prior I don't know.

If you know some way to reproduce the issue on my machine I could try to find the issue. Otherwise it's a job for these guys: https://github.com/libssh2/libssh2/issues
Posts: 7
Joined: 7 Nov 2022

dapepe

OK, thanks for investigating! I guess I will stay with version 11.17 for now, this is the last version where everything worked fine!