VMS port of libssh2; changes in the libssh2 common code

This commit is contained in:
Jose Baars 2010-04-25 19:57:45 +02:00 committed by Daniel Stenberg
parent d4edb0b9c3
commit c511177d39
4 changed files with 36 additions and 8 deletions

View File

@ -1110,7 +1110,7 @@ _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
#define SSH_MSG_CHANNEL_SUCCESS 99
#define SSH_MSG_CHANNEL_FAILURE 100
#ifdef WIN32
#if defined( WIN32 ) || defined( __VMS )
ssize_t _libssh2_recv(libssh2_socket_t socket, void *buffer, size_t length, int flags);
ssize_t _libssh2_send(libssh2_socket_t socket, const void *buffer, size_t length, int flags);
#else

View File

@ -96,6 +96,11 @@ _libssh2_recv(libssh2_socket_t socket, void *buffer, size_t length, int flags)
#ifdef WIN32
if (rc < 0 )
errno = wsa2errno();
#endif
#ifdef __VMS
if (rc < 0 ){
if ( errno == EWOULDBLOCK ) errno = EAGAIN;
}
#endif
return rc;
}
@ -115,6 +120,11 @@ _libssh2_send(libssh2_socket_t socket, const void *buffer, size_t length, int fl
#ifdef WIN32
if (rc < 0 )
errno = wsa2errno();
#endif
#ifdef VMS
if (rc < 0 ){
if ( errno == EWOULDBLOCK ) errno = EAGAIN;
}
#endif
return rc;
}

View File

@ -280,7 +280,7 @@ session_nonblock(libssh2_socket_t sockfd, /* operate on this */
#endif
#if defined(HAVE_FIONBIO) && (SETBLOCK == 0)
/* older unix versions */
/* older unix versions and VMS*/
int flags;
flags = nonblock;
@ -375,10 +375,28 @@ get_socket_nonblocking(int sockfd)
#define GETBLOCK 5
#endif
#if defined(SO_STATE) && defined( __VMS ) && (GETBLOCK == 0)
/* VMS TCP/IP Services */
size_t sockstat = 0;
int callstat = 0;
size_t size = sizeof( int );
callstat = getsockopt(sockfd, SOL_SOCKET, SO_STATE,
(char *)&sockstat, &size);
if ( callstat == -1 ) return(0);
if ( (sockstat&SS_NBIO) )return(1);
return(0);
#undef GETBLOCK
#define GETBLOCK 6
#endif
#ifdef HAVE_DISABLED_NONBLOCKING
return 1; /* returns blocking */
#undef GETBLOCK
#define GETBLOCK 6
#define GETBLOCK 7
#endif
#if (GETBLOCK == 0)

View File

@ -601,7 +601,7 @@ sign_fromfile(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
if(rc)
return rc;
datavec.iov_base = (unsigned char *)data;
datavec.iov_base = (void *)data;
datavec.iov_len = data_len;
if (privkeyobj->signv(session, sig, sig_len, 1, &datavec,
@ -711,11 +711,11 @@ userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
}
_libssh2_htonu32(buf, session->session_id_len);
datavec[0].iov_base = buf;
datavec[0].iov_base = (void *)buf;
datavec[0].iov_len = 4;
datavec[1].iov_base = session->session_id;
datavec[1].iov_base = (void *)session->session_id;
datavec[1].iov_len = session->session_id_len;
datavec[2].iov_base = session->userauth_host_packet;
datavec[2].iov_base = (void *)session->userauth_host_packet;
datavec[2].iov_len = session->userauth_host_packet_len;
if (privkeyobj->signv(session, &sig, &sig_len, 3, datavec, &abstract)) {