Append missing include directory for GNUTLS and OPENSSL in CMake project

Append support of gnutls > v 2.99.01 (gnutls_transport_set_global_errno have a different signature)
pull/1/head
Cédric Georges 8 years ago
parent e91132f6a9
commit 6fabf75f9c

@ -106,10 +106,12 @@ if(GNUTLS_FOUND)
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (gnutls)" ON)
set(WEBSOCKET_LIBRARIES ${RESOLV_LIB} ${GNUTLS_LIBRARIES})
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_gnutls ${LIBVNCSERVER_DIR}/rfbcrypto_gnutls)
include_directories(${GNUTLS_INCLUDE_DIR})
elseif(OPENSSL_FOUND)
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (openssl)" ON)
set(WEBSOCKET_LIBRARIES ${RESOLV_LIB} ${OPENSSL_LIBRARIES})
set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_openssl ${LIBVNCSERVER_DIR}/rfbcrypto_openssl)
include_directories(${OPENSSL_INCLUDE_DIR})
else()
option(LIBVNCSERVER_WITH_WEBSOCKETS "Build with websockets support (no ssl)" ON)
set(WEBSOCKET_LIBRARIES ${RESOLV_LIB})

@ -67,9 +67,20 @@ InitializeTLS(void)
* libvncclient are linked to different versions of msvcrt.dll.
*/
#ifdef WIN32
static void WSAtoTLSErrno()
static void WSAtoTLSErrno(gnutls_session_t* session)
{
switch(WSAGetLastError()) {
#if (GNUTLS_VERSION_NUMBER >= 0x029901)
case WSAEWOULDBLOCK:
gnutls_transport_set_errno(session, EAGAIN);
break;
case WSAEINTR:
gnutls_transport_set_errno(session, EINTR);
break;
default:
gnutls_transport_set_errno(session, EIO);
break;
#else
case WSAEWOULDBLOCK:
gnutls_transport_set_global_errno(EAGAIN);
break;
@ -79,11 +90,11 @@ static void WSAtoTLSErrno()
default:
gnutls_transport_set_global_errno(EIO);
break;
#endif
}
}
#endif
static ssize_t
PushTLS(gnutls_transport_ptr_t transport, const void *data, size_t len)
{
@ -96,7 +107,7 @@ PushTLS(gnutls_transport_ptr_t transport, const void *data, size_t len)
if (ret < 0)
{
#ifdef WIN32
WSAtoTLSErrno();
WSAtoTLSErrno((gnutls_session_t*)&client->tlsSession);
#endif
if (errno == EINTR) continue;
return -1;
@ -118,7 +129,7 @@ PullTLS(gnutls_transport_ptr_t transport, void *data, size_t len)
if (ret < 0)
{
#ifdef WIN32
WSAtoTLSErrno();
WSAtoTLSErrno((gnutls_session_t*)&client->tlsSession);
#endif
if (errno == EINTR) continue;
return -1;

Loading…
Cancel
Save