Topic: wolfSSH_SFTP_connect does not return if username/password incorrect

I'm trying to get a very simple SFTP client runnning, based on the example SFTP client in wolfSSH.
I'm currently using just username and password to log in (no SSH keys or certificates etc).
I need the client code to return an error if it can't connect because of incorrect username/password, but wolfSSH_SFTP_connect doesn't ever return if username/password is incorrect - there seems to be no timeout.
The example SFTP client does this.
How can I modify it so it returns an error on login failure?

Share

Re: wolfSSH_SFTP_connect does not return if username/password incorrect

Updates: having run with debug logging enabled, it seems that the code gets stuck in a loop where it calls DoUserAuthFailure to process a MSGID_USERAUTH_FAILURE, and then calls SendUserAuthRequest presumably to repeat the authorisation request. Is there a way to terminate this loop when all authorisation methods have been tried?

Share

Re: wolfSSH_SFTP_connect does not return if username/password incorrect

Which version of wolfSSH are you using? The current master branch in GitHub repo?

Re: wolfSSH_SFTP_connect does not return if username/password incorrect

Hi John, thanks for your reply. I downloaded the master branch on 15th Sept so I'm currently using commit 79bc747.

Share

Re: wolfSSH_SFTP_connect does not return if username/password incorrect

Update: I've now rebuilt with the latest master branch and it's the same.
Running echoserver and then ./wolfsftp -h 127.0.0.1 -p 22222 -u jill -P upthehill works fine.
However with incorrect username:
./wolfsftp -h 127.0.0.1 -p 22222 -u jillx -P upthehill
wolfsftp does not report an error, continuously trys to authenticate and doesn't stop even with control-C.

Share

Re: wolfSSH_SFTP_connect does not return if username/password incorrect

SOLUTION: it seems this is a server rather than a client issue. When I use the example sftpclient with a generic Linux SFTP server, if the username or password is incorrect it reports failure to connect after about 20 seconds - which is fine. So it seems that the issue is with the example echoserver implementation rather than the client.

Share