diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-06-15 23:43:33 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-06-15 23:43:35 +0200 |
commit | ef22d5c42a25eb4c9c1fbc2bb20427f7017ce118 (patch) | |
tree | ae76af12cc7ee434fcc43b0ee03ab500346073b7 /lib/vssh | |
parent | c828dc72e52a245f48e5b005e895f5ff4d35b002 (diff) | |
download | curl-ef22d5c42a25eb4c9c1fbc2bb20427f7017ce118.tar.gz |
libssh: skip the fake-close when libssh does the right thing
Starting in libssh 0.10.0 ssh_disconnect() will no longer close our
socket. Instead it will be kept alive as we want it, and it is our
responsibility to close it later.
Ref: #8718
Ref: https://gitlab.com/libssh/libssh-mirror/-/merge_requests/240
Closes #9021
Diffstat (limited to 'lib/vssh')
-rw-r--r-- | lib/vssh/libssh.c | 13 | ||||
-rw-r--r-- | lib/vssh/ssh.h | 6 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 5499d88d9..5aa99e618 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -1972,10 +1972,13 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) } ssh_disconnect(sshc->ssh_session); - /* conn->sock[FIRSTSOCKET] is closed by ssh_disconnect behind our back, - explicitly mark it as closed with the memdebug macro: */ - fake_sclose(conn->sock[FIRSTSOCKET]); - conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; + if(!ssh_version(SSH_VERSION_INT(0, 10, 0))) { + /* conn->sock[FIRSTSOCKET] is closed by ssh_disconnect behind our back, + explicitly mark it as closed with the memdebug macro. This libssh + bug is fixed in 0.10.0. */ + fake_sclose(conn->sock[FIRSTSOCKET]); + conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; + } SSH_STRING_FREE_CHAR(sshc->homedir); data->state.most_recent_ftp_entrypath = NULL; @@ -2958,7 +2961,7 @@ void Curl_ssh_cleanup(void) void Curl_ssh_version(char *buffer, size_t buflen) { - (void)msnprintf(buffer, buflen, "libssh/%s", CURL_LIBSSH_VERSION); + (void)msnprintf(buffer, buflen, "libssh/%s", ssh_version(0)); } #endif /* USE_LIBSSH */ diff --git a/lib/vssh/ssh.h b/lib/vssh/ssh.h index 551890232..7e1d8159c 100644 --- a/lib/vssh/ssh.h +++ b/lib/vssh/ssh.h @@ -211,11 +211,7 @@ struct ssh_conn { #endif /* USE_LIBSSH */ }; -#if defined(USE_LIBSSH) - -#define CURL_LIBSSH_VERSION ssh_version(0) - -#elif defined(USE_LIBSSH2) +#if defined(USE_LIBSSH2) /* Feature detection based on version numbers to better work with non-configure platforms */ |