Skip to content

Fix bad authentication state after failed GSSAPI authentication

Anderson Sasaki requested to merge gssapi_auth_state into master

The objective of this PR is to fix https://bugs.libssh.org/T56

When the GSSAPI authentication failed inside one of the response packet handling callbacks, the session->auth_state was not set to SSH_AUTH_STATE_ERROR.

Then, ssh_auth_response_termination() would return 0 because the state would be kept as SSH_AUTH_STATE_GSSAPI_REQUEST_SENT, for instance, which would result in ssh_userauth_get_response() to return SSH_AUTH_AGAIN.

Finally, in ssh_userauth_gssapi(), if the returned error code was SSH_AUTH_AGAIN, session->pending_call_state is not reset to SSH_PENDING_CALL_NONE, being kept as SSH_PENDING_CALL_AUTH_GSSAPI_MIC.

This would lead to errors in following tries to authenticate the user using the same session due to the wrong state.

Merge request reports