Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fix SSH state machine for ssh-agent authentication #2248
In case an identity didn't match, the state machine would fail in
This was introduced as part of commit c4eb10e,
 libssh2_agent_userauth returning LIBSSH2_ERROR_AUTHENTICATION_FAILED
In case an identity didn't match, the state machine would fail in state SSH_AUTH_AGENT instead of progressing to the next identity in ssh-agent. As a result, ssh-agent authentication only worked if the identity required happened to be the first added to ssh-agent. This was introduced as part of commit c4eb10e, which stated that the "else" statement was required to prevent getting stuck in state SSH_AUTH_AGENT. Given the state machine's logic and libssh2's interface I couldn't see how this could happen or reproduce it and I also couldn't find a more detailed description of the problem which would explain a test case to reproduce the problem this was supposed to fix.  libssh2_agent_userauth returning LIBSSH2_ERROR_AUTHENTICATION_FAILED
How to reproduce:
After applying the patch, 5. succeeds as expected.