Commit c036f6ae authored by Yang Tse's avatar Yang Tse
Browse files

Adjust some libssh2 preprocessor symbol definition checks

parent e35e2ea6
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -36,17 +36,6 @@
#include <libssh2.h>
#include <libssh2_sftp.h>

#if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000)
#error "this requires libssh2 0.16 or later"
#endif

#if !defined(HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION) && \
   (LIBSSH2_VERSION_NUM >= 0x001300)
/* this is just a check for non-configure based systems to get this properly
   setup if libssh2 0.19+ is used */
#define HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION 1
#endif

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -2070,7 +2059,7 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn)
    bool block;
    result = ssh_statemach_act(conn, &block);

#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION
#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTIONS
    if((CURLE_OK == result) && block) {
      int dir = libssh2_session_block_directions(sshc->ssh_session);
      curl_socket_t sock = conn->sock[FIRSTSOCKET];
+14 −4
Original line number Diff line number Diff line
#ifndef __SSH_H
#define __SSH_H

#ifndef HEADER_CURL_SSH_H
#define HEADER_CURL_SSH_H
/***************************************************************************
 *                                  _   _ ____  _
 *  Project                     ___| | | |  _ \| |
@@ -25,6 +24,17 @@
 ***************************************************************************/

#ifdef USE_LIBSSH2

#if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000)
#  error "SCP/SFTP protocols require libssh2 0.16 or later"
#endif

#if (LIBSSH2_VERSION_NUM >= 0x001300)
#  ifndef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTIONS
#    define HAVE_LIBSSH2_SESSION_BLOCK_DIRECTIONS 1
#  endif
#endif

extern const struct Curl_handler Curl_handler_scp;
extern const struct Curl_handler Curl_handler_sftp;

@@ -49,4 +59,4 @@ ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex,

#endif /* USE_LIBSSH2 */

#endif /* __SSH_H */
#endif /* HEADER_CURL_SSH_H */