Fix proxy_disconnect on systems without pthread

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit b804aa9286)
This commit is contained in:
Jakub Jelen
2024-08-02 10:41:29 +02:00
parent 318f675ef8
commit eae3a60ef8

View File

@@ -47,6 +47,12 @@
#include "libssh/pki.h"
#include "libssh/kex.h"
#ifndef _WIN32
#ifdef HAVE_PTHREAD
extern int proxy_disconnect;
#endif /* HAVE_PTHREAD */
#endif /* _WIN32 */
#define set_status(session, status) do {\
if (session->common.callbacks && session->common.callbacks->connect_status_function) \
session->common.callbacks->connect_status_function(session->common.callbacks->userdata, status); \
@@ -765,8 +771,6 @@ ssh_session_set_disconnect_message(ssh_session session, const char *message)
return SSH_OK;
}
extern int proxy_disconnect;
/**
* @brief Disconnect from a session (client or server).
*
@@ -789,12 +793,14 @@ ssh_disconnect(ssh_session session)
}
#ifndef _WIN32
#ifdef HAVE_PTHREAD
/* Only send the disconnect to all other threads when the root session calls
* ssh_disconnect() */
if (session->proxy_root) {
proxy_disconnect = 1;
}
#endif
#endif /* HAVE_PTHREAD */
#endif /* _WIN32 */
if (session->disconnect_message == NULL) {
session->disconnect_message = strdup("Bye Bye") ;