[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 282/411: libssh2: fix transport over HTTPS proxy
From: |
gnunet |
Subject: |
[gnurl] 282/411: libssh2: fix transport over HTTPS proxy |
Date: |
Wed, 13 Jan 2021 01:21:37 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit 9a844625c414c5abb89b82c5c017ff25b098ada7
Author: Daniel Stenberg <daniel@haxx.se>
AuthorDate: Mon Oct 26 11:10:49 2020 +0100
libssh2: fix transport over HTTPS proxy
The fix in #6021 was not enough. This fix makes sure SCP/SFTP content
can also be transfered over a HTTPS proxy.
Fixes #6113
Closes #6128
---
lib/vssh/libssh2.c | 19 ++++++++++++++++++-
lib/vssh/ssh.h | 6 ++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index b9ed5be90..fbadb246e 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -3024,9 +3024,15 @@ static ssize_t ssh_tls_recv(libssh2_socket_t sock, void
*buffer,
struct connectdata *conn = (struct connectdata *)*abstract;
ssize_t nread;
CURLcode result;
+ Curl_recv *backup = conn->recv[0];
+ struct ssh_conn *ssh = &conn->proto.sshc;
(void)flags;
+ /* swap in the TLS reader function for this call only, and then swap back
+ the SSH one again */
+ conn->recv[0] = ssh->tls_recv;
result = Curl_read(conn, sock, buffer, length, &nread);
+ conn->recv[0] = backup;
if(result == CURLE_AGAIN)
return -EAGAIN; /* magic return code for libssh2 */
else if(result)
@@ -3042,9 +3048,15 @@ static ssize_t ssh_tls_send(libssh2_socket_t sock, const
void *buffer,
struct connectdata *conn = (struct connectdata *)*abstract;
ssize_t nwrite;
CURLcode result;
+ Curl_send *backup = conn->send[0];
+ struct ssh_conn *ssh = &conn->proto.sshc;
(void)flags;
+ /* swap in the TLS writer function for this call only, and then swap back
+ the SSH one again */
+ conn->send[0] = ssh->tls_send;
result = Curl_write(conn, sock, buffer, length, &nwrite);
+ conn->send[0] = backup;
if(result == CURLE_AGAIN)
return -EAGAIN; /* magic return code for libssh2 */
else if(result)
@@ -3134,8 +3146,13 @@ static CURLcode ssh_connect(struct connectdata *conn,
bool *done)
LIBSSH2_CALLBACK_RECV, sshrecv.recvp);
libssh2_session_callback_set(ssh->ssh_session,
LIBSSH2_CALLBACK_SEND, sshsend.sendp);
+
+ /* Store the underlying TLS recv/send function pointers to be used when
+ reading from the proxy */
+ ssh->tls_recv = conn->recv[FIRSTSOCKET];
+ ssh->tls_send = conn->send[FIRSTSOCKET];
}
- else
+
#endif /* CURL_DISABLE_PROXY */
if(conn->handler->protocol & CURLPROTO_SCP) {
conn->recv[FIRSTSOCKET] = scp_recv;
diff --git a/lib/vssh/ssh.h b/lib/vssh/ssh.h
index 9e49993e9..bae81d654 100644
--- a/lib/vssh/ssh.h
+++ b/lib/vssh/ssh.h
@@ -182,6 +182,12 @@ struct ssh_conn {
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
LIBSSH2_SFTP_HANDLE *sftp_handle;
+#ifndef CURL_DISABLE_PROXY
+ /* for HTTPS proxy storage */
+ Curl_recv *tls_recv;
+ Curl_send *tls_send;
+#endif
+
#ifdef HAVE_LIBSSH2_AGENT_API
LIBSSH2_AGENT *ssh_agent; /* proxy to ssh-agent/pageant */
struct libssh2_agent_publickey *sshagent_identity,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 299/411: hsts: add support for Strict-Transport-Security, (continued)
- [gnurl] 299/411: hsts: add support for Strict-Transport-Security, gnunet, 2021/01/12
- [gnurl] 300/411: hsts: add read/write callbacks, gnunet, 2021/01/12
- [gnurl] 320/411: url: make sure an HSTS upgrade updates URL and scheme correctly, gnunet, 2021/01/12
- [gnurl] 369/411: examples: update .gitignore, gnunet, 2021/01/12
- [gnurl] 328/411: examples/httpput: remove use of CURLOPT_PUT, gnunet, 2021/01/12
- [gnurl] 325/411: configure: pass -pthread to Libs.private for pkg-config, gnunet, 2021/01/12
- [gnurl] 301/411: curlver: bumped to 7.74.0, gnunet, 2021/01/12
- [gnurl] 332/411: mqttd: fclose test file when done, gnunet, 2021/01/12
- [gnurl] 309/411: KNOWN_BUGS: SMB tests fail with Python 2, gnunet, 2021/01/12
- [gnurl] 324/411: altsvc: minimize variable scope and avoid "DEAD_STORE", gnunet, 2021/01/12
- [gnurl] 282/411: libssh2: fix transport over HTTPS proxy,
gnunet <=
- [gnurl] 363/411: KNOWN_BUGS: curl with wolfSSL lacks support for renegotiation, gnunet, 2021/01/12
- [gnurl] 335/411: http_proxy: use enum with state names for 'keepon', gnunet, 2021/01/12
- [gnurl] 298/411: CI/tests: enable test target on TravisCI for CMake builds, gnunet, 2021/01/12
- [gnurl] 358/411: CI/cirrus: simplify logic for disabled tests, gnunet, 2021/01/12
- [gnurl] 370/411: docs/INTERNALS: remove reference to Curl_sendf(), gnunet, 2021/01/12
- [gnurl] 336/411: cmake: don't pass -fvisibility=hidden to clang-cl on Windows, gnunet, 2021/01/12
- [gnurl] 338/411: httpput-postfields.c: new example doing PUT with POSTFIELDS, gnunet, 2021/01/12
- [gnurl] 276/411: CI/github: work-around for brew breakage on macOS, gnunet, 2021/01/12
- [gnurl] 303/411: RELEASE-NOTES: synced, gnunet, 2021/01/12
- [gnurl] 293/411: gnutls: fix memory leaks (certfields memory wasn't released), gnunet, 2021/01/12