1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-23 01:22:37 +03:00

session_disconnect: clear state

If authentication is started but not completed before the application
gives up and instead wants to shut down the session, the '->state' field
might still be set and thus effectively dead-lock session_disconnect.

This happens because both _libssh2_transport_send() and
_libssh2_transport_read() refuse to do anything as long as state is set
without the LIBSSH2_STATE_KEX_ACTIVE bit.

Reported in curl bug https://github.com/curl/curl/issues/3650

Closes #310
This commit is contained in:
Daniel Stenberg
2019-03-08 00:06:11 +01:00
parent 6394c0dbff
commit 4d66f6762c

View File

@@ -1161,7 +1161,7 @@ libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason,
const char *desc, const char *lang)
{
int rc;
session->state = 0;
BLOCK_ADJUST(rc, session,
session_disconnect(session, reason, desc, lang));