From 445fb7d53111757f584aad6ba9757d1c029e9f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Georges?= Date: Sat, 5 Mar 2016 15:21:03 +0100 Subject: Append IPv6 option in CMake Project --- CMakeLists.txt | 11 +++++++++-- rfb/rfbconfig.h.cmake | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 168873f..c90fe54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,14 +133,21 @@ check_include_file("sys/time.h" LIBVNCSERVER_HAVE_SYS_TIME_H) check_include_file("sys/types.h" LIBVNCSERVER_HAVE_SYS_TYPES_H) check_include_file("sys/wait.h" LIBVNCSERVER_HAVE_SYS_WAIT_H) check_include_file("unistd.h" LIBVNCSERVER_HAVE_UNISTD_H) - -# headers needed for check_type_size() +check_include_file("vfork.h" LIBVNCSERVER_HAVE_VFORK_H) +check_include_file("ws2tcpip.h" LIBVNCSERVER_HAVE_WS2TCPIP_H) check_include_file("arpa/inet.h" HAVE_ARPA_INET_H) check_include_file("stdint.h" HAVE_STDINT_H) check_include_file("stddef.h" HAVE_STDDEF_H) check_include_file("sys/types.h" HAVE_SYS_TYPES_H) check_function_exists(gettimeofday LIBVNCSERVER_HAVE_GETTIMEOFDAY) +check_function_exists(vfork LIBVNCSERVER_HAVE_VFORK) +check_function_exists(vprintf LIBVNCSERVER_HAVE_VPRINTF) + + +if(LIBVNCSERVER_HAVE_WS2TCPIP_H AND LIBVNCSERVER_HAVE_VPRINTF) + option(LIBVNCSERVER_IPv6 "Enable IPv6 Support" ON) +endif() if(CMAKE_USE_PTHREADS_INIT) set(LIBVNCSERVER_HAVE_LIBPTHREAD 1) diff --git a/rfb/rfbconfig.h.cmake b/rfb/rfbconfig.h.cmake index 3e3155b..5bd6569 100644 --- a/rfb/rfbconfig.h.cmake +++ b/rfb/rfbconfig.h.cmake @@ -54,6 +54,27 @@ /* Define to 1 if you have the header file. */ #cmakedefine LIBVNCSERVER_HAVE_UNISTD_H 1 +/* Define to 1 if you have the `vfork' function. */ +#cmakedefine LIBVNCSERVER_HAVE_VFORK 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine LIBVNCSERVER_HAVE_VFORK_H 1 + +/* Define to 1 if you have the `vprintf' function. */ +#cmakedefine LIBVNCSERVER_HAVE_VPRINTF 1 + +/* Define to 1 if `fork' works. */ +#cmakedefine LIBVNCSERVER_HAVE_WORKING_FORK 1 + +/* Define to 1 if `vfork' works. */ +#cmakedefine LIBVNCSERVER_HAVE_WORKING_VFORK 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine LIBVNCSERVER_HAVE_WS2TCPIP_H 1 + +/* Enable IPv6 support */ +#cmakedefine LIBVNCSERVER_IPv6 1 + /* Need a typedef for in_addr_t */ #cmakedefine LIBVNCSERVER_NEED_INADDR_T 1 -- cgit v1.2.1 From e91132f6a99cb9055d3a7f5a6f5c7ec02bbeb809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Georges?= Date: Sat, 5 Mar 2016 15:36:18 +0100 Subject: re-up comment --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c90fe54..2495e73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,8 @@ check_include_file("sys/time.h" LIBVNCSERVER_HAVE_SYS_TIME_H) check_include_file("sys/types.h" LIBVNCSERVER_HAVE_SYS_TYPES_H) check_include_file("sys/wait.h" LIBVNCSERVER_HAVE_SYS_WAIT_H) check_include_file("unistd.h" LIBVNCSERVER_HAVE_UNISTD_H) + +# headers needed for check_type_size() check_include_file("vfork.h" LIBVNCSERVER_HAVE_VFORK_H) check_include_file("ws2tcpip.h" LIBVNCSERVER_HAVE_WS2TCPIP_H) check_include_file("arpa/inet.h" HAVE_ARPA_INET_H) -- cgit v1.2.1 From 6fabf75f9ce7adb565ca4c02d03ba3cccae36759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Georges?= Date: Sat, 5 Mar 2016 16:56:51 +0100 Subject: 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) --- CMakeLists.txt | 2 ++ libvncclient/tls_gnutls.c | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2495e73..aad3f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/libvncclient/tls_gnutls.c b/libvncclient/tls_gnutls.c index 3daa416..a5a5610 100644 --- a/libvncclient/tls_gnutls.c +++ b/libvncclient/tls_gnutls.c @@ -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; -- cgit v1.2.1