]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: require version 1.0 or later
authorDaniel Stenberg <daniel@haxx.se>
Thu, 22 Oct 2020 10:29:21 +0000 (12:29 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 22 Oct 2020 14:45:40 +0000 (16:45 +0200)
... and simplify the code accordingly. libssh2 version 1.0 was released
in April 2009.

Closes #6116

configure.ac
docs/INTERNALS.md
lib/vssh/libssh2.c

index 8676b482594c5900562af8e78d94452c601a6bc6..d4ccc268a01bfb4fae7362b3bdf61e170af2455f 100755 (executable)
@@ -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)"
index e9be0889a2621fabf9fd9bebc22b84a0a9d5222e..9885c9901950672bf013ef6900464abad563839b 100644 (file)
@@ -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
index d983cc9a9cfaf4a41c00ac6ccb2cad5ccde2d876..6c6db049bf5a37343ab0344d9af9dc6edf5afd8a 100644 (file)
@@ -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;