for now unless we do better fixed LIBSSH2_APINO compares to use long constants.

This commit is contained in:
Gunter Knauf 2007-07-14 15:59:01 +00:00
parent 1261c3feba
commit fee4f8c86d
4 changed files with 46 additions and 46 deletions

View File

@ -163,11 +163,11 @@
/* Local functions: */ /* Local functions: */
static const char *sftp_libssh2_strerror(unsigned long err); static const char *sftp_libssh2_strerror(unsigned long err);
#if (LIBSSH2_APINO < 200706012030) #if (LIBSSH2_APINO < 200706012030L)
static CURLcode sftp_sendquote(struct connectdata *conn, static CURLcode sftp_sendquote(struct connectdata *conn,
struct curl_slist *quote); struct curl_slist *quote);
static CURLcode sftp_create_dirs(struct connectdata *conn); static CURLcode sftp_create_dirs(struct connectdata *conn);
#endif /* !(LIBSSH2_APINO < 200706012030) */ #endif /* !(LIBSSH2_APINO < 200706012030L) */
static LIBSSH2_ALLOC_FUNC(libssh2_malloc); static LIBSSH2_ALLOC_FUNC(libssh2_malloc);
static LIBSSH2_REALLOC_FUNC(libssh2_realloc); static LIBSSH2_REALLOC_FUNC(libssh2_realloc);
@ -243,7 +243,7 @@ static LIBSSH2_FREE_FUNC(libssh2_free)
(void)abstract; (void)abstract;
} }
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
/* /*
* SSH State machine related code * SSH State machine related code
*/ */
@ -1231,19 +1231,19 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
break; break;
case SSH_SFTP_READDIR: case SSH_SFTP_READDIR:
#if (LIBSSH2_APINO >= 200706151200) #if (LIBSSH2_APINO >= 200706151200L)
sshc->readdir_len = libssh2_sftp_readdir_ex(sftp_scp->sftp_handle, sshc->readdir_len = libssh2_sftp_readdir_ex(sftp_scp->sftp_handle,
sshc->readdir_filename, sshc->readdir_filename,
PATH_MAX, PATH_MAX,
sshc->readdir_longentry, sshc->readdir_longentry,
PATH_MAX, PATH_MAX,
&sshc->readdir_attrs); &sshc->readdir_attrs);
#else /* !(LIBSSH2_APINO >= 200706151200) */ #else /* !(LIBSSH2_APINO >= 200706151200L) */
sshc->readdir_len = libssh2_sftp_readdir(sftp_scp->sftp_handle, sshc->readdir_len = libssh2_sftp_readdir(sftp_scp->sftp_handle,
sshc->readdir_filename, sshc->readdir_filename,
PATH_MAX, PATH_MAX,
&sshc->readdir_attrs); &sshc->readdir_attrs);
#endif /* !(LIBSSH2_APINO >= 200706151200) */ #endif /* !(LIBSSH2_APINO >= 200706151200L) */
if (sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) { if (sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
@ -1268,7 +1268,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
sshc->readdir_len, conn); sshc->readdir_len, conn);
} }
} else { } else {
#if (LIBSSH2_APINO >= 200706151200) #if (LIBSSH2_APINO >= 200706151200L)
sshc->readdir_currLen = strlen(sshc->readdir_longentry); sshc->readdir_currLen = strlen(sshc->readdir_longentry);
sshc->readdir_totalLen = 80 + sshc->readdir_currLen; sshc->readdir_totalLen = 80 + sshc->readdir_currLen;
sshc->readdir_line = (char *)calloc(sshc->readdir_totalLen, 1); sshc->readdir_line = (char *)calloc(sshc->readdir_totalLen, 1);
@ -1284,7 +1284,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
memcpy(sshc->readdir_line, sshc->readdir_longentry, memcpy(sshc->readdir_line, sshc->readdir_longentry,
sshc->readdir_currLen); sshc->readdir_currLen);
#else /* !(LIBSSH2_APINO >= 200706151200) */ #else /* !(LIBSSH2_APINO >= 200706151200L) */
sshc->readdir_totalLen = 80 + sshc->readdir_len; sshc->readdir_totalLen = 80 + sshc->readdir_len;
sshc->readdir_line = (char *)malloc(sshc->readdir_totalLen); sshc->readdir_line = (char *)malloc(sshc->readdir_totalLen);
if (!sshc->readdir_line) { if (!sshc->readdir_line) {
@ -1401,7 +1401,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
sshc->readdir_totalLen - sshc->readdir_totalLen -
sshc->readdir_currLen, " %s", sshc->readdir_currLen, " %s",
sshc->readdir_filename); sshc->readdir_filename);
#endif /* !(LIBSSH2_APINO >= 200706151200) */ #endif /* !(LIBSSH2_APINO >= 200706151200L) */
if ((sshc->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) && if ((sshc->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) &&
((sshc->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) == ((sshc->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) ==
LIBSSH2_SFTP_S_IFLNK)) { LIBSSH2_SFTP_S_IFLNK)) {
@ -1858,7 +1858,7 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn)
return result; return result;
} }
#endif /* (LIBSSH2_APINO >= 200706012030) */ #endif /* (LIBSSH2_APINO >= 200706012030L) */
/* /*
* SSH setup and connection * SSH setup and connection
@ -1942,7 +1942,7 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
infof(data, "SSH socket: %d\n", sock); infof(data, "SSH socket: %d\n", sock);
#endif /* CURL_LIBSSH2_DEBUG */ #endif /* CURL_LIBSSH2_DEBUG */
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
state(conn, SSH_S_STARTUP); state(conn, SSH_S_STARTUP);
if (data->state.used_interface == Curl_if_multi) if (data->state.used_interface == Curl_if_multi)
@ -1963,7 +1963,7 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
(void)fingerprint; /* not used */ (void)fingerprint; /* not used */
(void)i; /* not used */ (void)i; /* not used */
#else /* !(LIBSSH2_APINO >= 200706012030) */ #else /* !(LIBSSH2_APINO >= 200706012030L) */
if (libssh2_session_startup(ssh->ssh_session, sock)) { if (libssh2_session_startup(ssh->ssh_session, sock)) {
failf(data, "Failure establishing ssh session"); failf(data, "Failure establishing ssh session");
@ -2200,10 +2200,10 @@ CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done)
*done = TRUE; *done = TRUE;
return CURLE_OK; return CURLE_OK;
#endif /* !(LIBSSH2_APINO >= 200706012030) */ #endif /* !(LIBSSH2_APINO >= 200706012030L) */
} }
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
/* /*
*********************************************************************** ***********************************************************************
@ -2257,11 +2257,11 @@ CURLcode Curl_scp_doing(struct connectdata *conn,
return result; return result;
} }
#endif /* !(LIBSSH2_APINO >= 200706012030) */ #endif /* !(LIBSSH2_APINO >= 200706012030L) */
CURLcode Curl_scp_do(struct connectdata *conn, bool *done) CURLcode Curl_scp_do(struct connectdata *conn, bool *done)
{ {
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
CURLcode res; CURLcode res;
bool connected = 0; bool connected = 0;
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
@ -2299,7 +2299,7 @@ CURLcode Curl_scp_do(struct connectdata *conn, bool *done)
return res; return res;
#else /* !(LIBSSH2_APINO >= 200706012030) */ #else /* !(LIBSSH2_APINO >= 200706012030L) */
struct stat sb; struct stat sb;
struct SSHPROTO *scp = conn->data->reqdata.proto.ssh; struct SSHPROTO *scp = conn->data->reqdata.proto.ssh;
@ -2351,13 +2351,13 @@ CURLcode Curl_scp_do(struct connectdata *conn, bool *done)
} }
return res; return res;
#endif /* !(LIBSSH2_APINO >= 200706012030) */ #endif /* !(LIBSSH2_APINO >= 200706012030L) */
} }
CURLcode Curl_scp_done(struct connectdata *conn, CURLcode status, CURLcode Curl_scp_done(struct connectdata *conn, CURLcode status,
bool premature) bool premature)
{ {
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
bool done = FALSE; bool done = FALSE;
@ -2382,7 +2382,7 @@ CURLcode Curl_scp_done(struct connectdata *conn, CURLcode status,
} }
return result; return result;
#else /* !(LIBSSH2_APINO >= 200706012030) */ #else /* !(LIBSSH2_APINO >= 200706012030L) */
struct SSHPROTO *scp = conn->data->reqdata.proto.ssh; struct SSHPROTO *scp = conn->data->reqdata.proto.ssh;
@ -2411,7 +2411,7 @@ CURLcode Curl_scp_done(struct connectdata *conn, CURLcode status,
Curl_pgrsDone(conn); Curl_pgrsDone(conn);
return CURLE_OK; return CURLE_OK;
#endif /* !(LIBSSH2_APINO >= 200706012030) */ #endif /* !(LIBSSH2_APINO >= 200706012030L) */
(void)premature; /* not used */ (void)premature; /* not used */
(void)status; /* unused */ (void)status; /* unused */
@ -2428,7 +2428,7 @@ ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
* NOTE: we should not store nor rely on connection-related data to be * NOTE: we should not store nor rely on connection-related data to be
* in the SessionHandle struct * in the SessionHandle struct
*/ */
#if defined(LIBSSH2CHANNEL_EAGAIN) && (LIBSSH2_APINO < 200706012030) #if defined(LIBSSH2CHANNEL_EAGAIN) && (LIBSSH2_APINO < 200706012030L)
nwrite = (ssize_t) nwrite = (ssize_t)
libssh2_channel_writenb(conn->data->reqdata.proto.ssh->ssh_channel, libssh2_channel_writenb(conn->data->reqdata.proto.ssh->ssh_channel,
mem, len); mem, len);
@ -2436,7 +2436,7 @@ ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
nwrite = (ssize_t) nwrite = (ssize_t)
libssh2_channel_write(conn->data->reqdata.proto.ssh->ssh_channel, libssh2_channel_write(conn->data->reqdata.proto.ssh->ssh_channel,
mem, len); mem, len);
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
if (nwrite == LIBSSH2_ERROR_EAGAIN) { if (nwrite == LIBSSH2_ERROR_EAGAIN) {
return 0; return 0;
} }
@ -2462,7 +2462,7 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex,
* in the SessionHandle struct * in the SessionHandle struct
*/ */
#if defined(LIBSSH2CHANNEL_EAGAIN) && (LIBSSH2_APINO < 200706012030) #if defined(LIBSSH2CHANNEL_EAGAIN) && (LIBSSH2_APINO < 200706012030L)
/* we prefer the non-blocking API but that didn't exist previously */ /* we prefer the non-blocking API but that didn't exist previously */
nread = (ssize_t) nread = (ssize_t)
libssh2_channel_readnb(conn->data->reqdata.proto.ssh->ssh_channel, libssh2_channel_readnb(conn->data->reqdata.proto.ssh->ssh_channel,
@ -2479,7 +2479,7 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex,
* =============== SFTP =============== * =============== SFTP ===============
*/ */
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
/* /*
*********************************************************************** ***********************************************************************
@ -2533,11 +2533,11 @@ CURLcode Curl_sftp_doing(struct connectdata *conn,
return result; return result;
} }
#endif /* !(LIBSSH2_APINO >= 200706012030) */ #endif /* !(LIBSSH2_APINO >= 200706012030L) */
CURLcode Curl_sftp_do(struct connectdata *conn, bool *done) CURLcode Curl_sftp_do(struct connectdata *conn, bool *done)
{ {
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
CURLcode res; CURLcode res;
bool connected = 0; bool connected = 0;
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
@ -2575,7 +2575,7 @@ CURLcode Curl_sftp_do(struct connectdata *conn, bool *done)
return res; return res;
#else /* !(LIBSSH2_APINO >= 200706012030) */ #else /* !(LIBSSH2_APINO >= 200706012030L) */
LIBSSH2_SFTP_ATTRIBUTES attrs; LIBSSH2_SFTP_ATTRIBUTES attrs;
struct SSHPROTO *sftp = conn->data->reqdata.proto.ssh; struct SSHPROTO *sftp = conn->data->reqdata.proto.ssh;
@ -2866,7 +2866,7 @@ CURLcode Curl_sftp_do(struct connectdata *conn, bool *done)
} }
return res; return res;
#endif /* !(LIBSSH2_APINO >= 200706012030) */ #endif /* !(LIBSSH2_APINO >= 200706012030L) */
} }
CURLcode Curl_sftp_done(struct connectdata *conn, CURLcode status, CURLcode Curl_sftp_done(struct connectdata *conn, CURLcode status,
@ -2874,7 +2874,7 @@ CURLcode Curl_sftp_done(struct connectdata *conn, CURLcode status,
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
bool done = FALSE; bool done = FALSE;
struct ssh_conn *sshc = &conn->proto.sshc; struct ssh_conn *sshc = &conn->proto.sshc;
@ -2905,7 +2905,7 @@ CURLcode Curl_sftp_done(struct connectdata *conn, CURLcode status,
Curl_pgrsDone(conn); Curl_pgrsDone(conn);
} }
#else /* !(LIBSSH2_APINO >= 200706012030) */ #else /* !(LIBSSH2_APINO >= 200706012030L) */
struct SSHPROTO *sftp = conn->data->reqdata.proto.ssh; struct SSHPROTO *sftp = conn->data->reqdata.proto.ssh;
@ -2948,7 +2948,7 @@ CURLcode Curl_sftp_done(struct connectdata *conn, CURLcode status,
Curl_safefree(conn->data->reqdata.proto.ssh); Curl_safefree(conn->data->reqdata.proto.ssh);
conn->data->reqdata.proto.ssh = NULL; conn->data->reqdata.proto.ssh = NULL;
Curl_pgrsDone(conn); Curl_pgrsDone(conn);
#endif /* !(LIBSSH2_APINO >= 200706012030) */ #endif /* !(LIBSSH2_APINO >= 200706012030L) */
(void)status; /* unused */ (void)status; /* unused */
@ -2962,14 +2962,14 @@ ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex,
ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14 ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14
but is changed to ssize_t in 0.15! */ but is changed to ssize_t in 0.15! */
#if defined(LIBSSH2SFTP_EAGAIN) && (LIBSSH2_APINO < 200706012030) #if defined(LIBSSH2SFTP_EAGAIN) && (LIBSSH2_APINO < 200706012030L)
/* we prefer the non-blocking API but that didn't exist previously */ /* we prefer the non-blocking API but that didn't exist previously */
nwrite = (ssize_t) nwrite = (ssize_t)
libssh2_sftp_writenb(conn->data->reqdata.proto.ssh->sftp_handle, mem, len); libssh2_sftp_writenb(conn->data->reqdata.proto.ssh->sftp_handle, mem, len);
#else #else
nwrite = (ssize_t) nwrite = (ssize_t)
libssh2_sftp_write(conn->data->reqdata.proto.ssh->sftp_handle, mem, len); libssh2_sftp_write(conn->data->reqdata.proto.ssh->sftp_handle, mem, len);
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
if (nwrite == LIBSSH2_ERROR_EAGAIN) { if (nwrite == LIBSSH2_ERROR_EAGAIN) {
return 0; return 0;
} }
@ -2991,7 +2991,7 @@ ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex,
/* libssh2_sftp_read() returns size_t !*/ /* libssh2_sftp_read() returns size_t !*/
#if defined(LIBSSH2SFTP_EAGAIN) && (LIBSSH2_APINO < 200706012030) #if defined(LIBSSH2SFTP_EAGAIN) && (LIBSSH2_APINO < 200706012030L)
/* we prefer the non-blocking API but that didn't exist previously */ /* we prefer the non-blocking API but that didn't exist previously */
nread = (ssize_t) nread = (ssize_t)
libssh2_sftp_readnb(conn->data->reqdata.proto.ssh->sftp_handle, mem, len); libssh2_sftp_readnb(conn->data->reqdata.proto.ssh->sftp_handle, mem, len);
@ -3156,7 +3156,7 @@ static const char *sftp_libssh2_strerror(unsigned long err)
return "Unknown error in libssh2"; return "Unknown error in libssh2";
} }
#if (LIBSSH2_APINO < 200706012030) #if (LIBSSH2_APINO < 200706012030L)
/* BLOCKING */ /* BLOCKING */
static CURLcode sftp_sendquote(struct connectdata *conn, static CURLcode sftp_sendquote(struct connectdata *conn,
struct curl_slist *quote) struct curl_slist *quote)
@ -3365,7 +3365,7 @@ static CURLcode sftp_sendquote(struct connectdata *conn,
* returns CURL_OK on success, -1 on failure * returns CURL_OK on success, -1 on failure
* *
* NOTE: This version of sftp_create_dirs() is only used when * NOTE: This version of sftp_create_dirs() is only used when
* LIBSSH2_APINO < 200706012030. After that version the code is in * LIBSSH2_APINO < 200706012030L. After that version the code is in
* ssh_statemachine_act() * ssh_statemachine_act()
*/ */
static CURLcode sftp_create_dirs(struct connectdata *conn) { static CURLcode sftp_create_dirs(struct connectdata *conn) {
@ -3403,6 +3403,6 @@ static CURLcode sftp_create_dirs(struct connectdata *conn) {
} }
return result; return result;
} }
#endif /* !(LIBSSH2_APINO < 200706012030) */ #endif /* !(LIBSSH2_APINO < 200706012030L) */
#endif /* USE_LIBSSH2 */ #endif /* USE_LIBSSH2 */

View File

@ -45,12 +45,12 @@ ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex,
ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex, ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex,
char *mem, size_t len); char *mem, size_t len);
#if (LIBSSH2_APINO >= 200706012030) #if (LIBSSH2_APINO >= 200706012030L)
CURLcode Curl_sftp_doing(struct connectdata *conn, CURLcode Curl_sftp_doing(struct connectdata *conn,
bool *dophase_done); bool *dophase_done);
CURLcode Curl_scp_doing(struct connectdata *conn, CURLcode Curl_scp_doing(struct connectdata *conn,
bool *dophase_done); bool *dophase_done);
#endif /* (LIBSSH2_APINO >= 200706012030) */ #endif /* (LIBSSH2_APINO >= 200706012030L) */
#endif /* USE_LIBSSH2 */ #endif /* USE_LIBSSH2 */

View File

@ -332,10 +332,10 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if((k->keepon & (KEEP_READ|KEEP_READ_HOLD)) == KEEP_READ) { if((k->keepon & (KEEP_READ|KEEP_READ_HOLD)) == KEEP_READ) {
fd_read = conn->sockfd; fd_read = conn->sockfd;
#if defined(USE_LIBSSH2) && (LIBSSH2_APINO >= 200706012030) #if defined(USE_LIBSSH2) && defined(LIBSSH2_APINO) && (LIBSSH2_APINO >= 200706012030L)
if (conn->protocol & (PROT_SCP|PROT_SFTP)) if (conn->protocol & (PROT_SCP|PROT_SFTP))
select_res |= CURL_CSELECT_IN; select_res |= CURL_CSELECT_IN;
#endif /* USE_LIBSSH2 && (LIBSSH2_APINO >= 200706012030) */ #endif /* USE_LIBSSH2 && LIBSSH2_APINO && (LIBSSH2_APINO >= 200706012030L) */
} else } else
fd_read = CURL_SOCKET_BAD; fd_read = CURL_SOCKET_BAD;

View File

@ -3361,10 +3361,10 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn->curl_connect = Curl_ssh_connect; /* ssh_connect? */ conn->curl_connect = Curl_ssh_connect; /* ssh_connect? */
conn->curl_do = Curl_scp_do; conn->curl_do = Curl_scp_do;
conn->curl_done = Curl_scp_done; conn->curl_done = Curl_scp_done;
#if (LIBSSH2_APINO >= 200706012030) #if defined(LIBSSH2_APINO) && (LIBSSH2_APINO >= 200706012030L)
conn->curl_connecting = Curl_ssh_multi_statemach; conn->curl_connecting = Curl_ssh_multi_statemach;
conn->curl_doing = Curl_scp_doing; conn->curl_doing = Curl_scp_doing;
#endif /* (LIBSSH2_APINO >= 200706012030) */ #endif /* LIBSSH2_APINO && (LIBSSH2_APINO >= 200706012030L) */
conn->curl_do_more = (Curl_do_more_func)ZERO_NULL; conn->curl_do_more = (Curl_do_more_func)ZERO_NULL;
#else #else
failf(data, LIBCURL_NAME failf(data, LIBCURL_NAME
@ -3380,10 +3380,10 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn->curl_connect = Curl_ssh_connect; /* ssh_connect? */ conn->curl_connect = Curl_ssh_connect; /* ssh_connect? */
conn->curl_do = Curl_sftp_do; conn->curl_do = Curl_sftp_do;
conn->curl_done = Curl_sftp_done; conn->curl_done = Curl_sftp_done;
#if (LIBSSH2_APINO >= 200706012030) #if defined(LIBSSH2_APINO) && (LIBSSH2_APINO >= 200706012030L)
conn->curl_connecting = Curl_ssh_multi_statemach; conn->curl_connecting = Curl_ssh_multi_statemach;
conn->curl_doing = Curl_sftp_doing; conn->curl_doing = Curl_sftp_doing;
#endif /* (LIBSSH2_APINO >= 200706012030) */ #endif /* LIBSSH2_APINO && (LIBSSH2_APINO >= 200706012030L) */
conn->curl_do_more = (Curl_do_more_func)ZERO_NULL; conn->curl_do_more = (Curl_do_more_func)ZERO_NULL;
#else #else
failf(data, LIBCURL_NAME failf(data, LIBCURL_NAME