From 4d66f6762ca3fc45d9c74f175edd991c5bb41499 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 8 Mar 2019 00:06:11 +0100 Subject: [PATCH] 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 --- src/session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/session.c b/src/session.c index bec76525..b327efe4 100644 --- a/src/session.c +++ b/src/session.c @@ -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));