summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-10-22 12:29:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-10-22 12:29:21 +0200
commit301cfa39fe51b297fc239a3bdd49926da078a77b (patch)
tree747acb88ea3de6c836f65a346f92697350ca4baa
parent141e23d78974774217fc22671934d16499505890 (diff)
downloadcurl-bagder/libssh2-req-1.0.tar.gz
libssh2: require version 1.0 or laterbagder/libssh2-req-1.0
... and simplify the code accordingly. libssh2 version 1.0 was released in April 2009.
-rwxr-xr-xconfigure.ac3
-rw-r--r--docs/INTERNALS.md2
-rw-r--r--lib/vssh/libssh2.c22
3 files changed, 3 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index 8676b4825..d4ccc268a 100755
--- a/configure.ac
+++ b/configure.ac
@@ -3062,7 +3062,8 @@ if test X"$OPT_LIBSSH2" != Xno; then
CPPFLAGS="$CPPFLAGS $CPP_SSH2"
LIBS="$LIB_SSH2 $LIBS"
- AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
+ dnl check for function added in libssh2 version 1.0
+ AC_CHECK_LIB(ssh2, libssh2_session_block_directions)
AC_CHECK_HEADERS(libssh2.h,
curl_ssh_msg="enabled (libSSH2)"
diff --git a/docs/INTERNALS.md b/docs/INTERNALS.md
index e9be0889a..9885c9901 100644
--- a/docs/INTERNALS.md
+++ b/docs/INTERNALS.md
@@ -87,7 +87,7 @@ Dependencies
- OpenSSL 0.9.7
- GnuTLS 3.1.10
- zlib 1.1.4
- - libssh2 0.16
+ - libssh2 1.0
- c-ares 1.6.0
- libidn2 2.0.0
- wolfSSL 2.0.0
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index d983cc9a9..6c6db049b 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -2887,7 +2887,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
static int ssh_perform_getsock(const struct connectdata *conn,
curl_socket_t *sock)
{
-#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION
int bitmap = GETSOCK_BLANK;
sock[0] = conn->sock[FIRSTSOCKET];
@@ -2899,11 +2898,6 @@ static int ssh_perform_getsock(const struct connectdata *conn,
bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET);
return bitmap;
-#else
- /* if we don't know the direction we can use the generic *_getsock()
- function even for the protocol_connect and doing states */
- return Curl_single_getsock(conn, sock);
-#endif
}
/* Generic function called by the multi interface to figure out what socket(s)
@@ -2911,20 +2905,11 @@ static int ssh_perform_getsock(const struct connectdata *conn,
static int ssh_getsock(struct connectdata *conn,
curl_socket_t *sock)
{
-#ifndef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION
- (void)conn;
- (void)sock;
- /* if we don't know any direction we can just play along as we used to and
- not provide any sensible info */
- return GETSOCK_BLANK;
-#else
/* if we know the direction we can use the generic *_getsock() function even
for the protocol_connect and doing states */
return ssh_perform_getsock(conn, sock);
-#endif
}
-#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION
/*
* When one of the libssh2 functions has returned LIBSSH2_ERROR_EAGAIN this
* function is used to figure out in what direction and stores this info so
@@ -2949,10 +2934,6 @@ static void ssh_block2waitfor(struct connectdata *conn, bool block)
the original set */
conn->waitfor = sshc->orig_waitfor;
}
-#else
- /* no libssh2 directional support so we simply don't know */
-#define ssh_block2waitfor(x,y) Curl_nop_stmt
-#endif
/* called repeatedly until done from multi.c */
static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done)
@@ -3001,7 +2982,6 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
return CURLE_OPERATION_TIMEDOUT;
}
-#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION
if(block) {
int dir = libssh2_session_block_directions(sshc->ssh_session);
curl_socket_t sock = conn->sock[FIRSTSOCKET];
@@ -3015,8 +2995,6 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
(void)Curl_socket_check(fd_read, CURL_SOCKET_BAD, fd_write,
left>1000?1000:left);
}
-#endif
-
}
return result;