diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..e7c0f474 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,18 @@ +/.dir-locals.el export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.gitmodules export-ignore +/.indent.pro export-ignore +/.travis.yml export-ignore +/getdns.pmdoc export-ignore +/gldns/compare.sh export-ignore +/gldns/import.sh export-ignore +/project-doc export-ignore +/src/test/tpkg export-ignore +/src/test/README export-ignore +/src/tools/Dockerfile export-ignore +/src/tools/README.adoc export-ignore +/src/util/import.sh export-ignore +/src/mk-const-info.c.sh export-ignore +/src/mk-symfiles.sh export-ignore +/README export-ignore diff --git a/.gitignore b/.gitignore index def15ebb..3fe390fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *~ .DS_Store +build*/ +tests*/ getdns*.tar.gz *.o *.so diff --git a/.gitmodules b/.gitmodules index 26a1f354..28d6a265 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,5 +12,5 @@ branch = develop [submodule "src/ssl_dane"] path = src/ssl_dane - url = https://github.com/getdnsapi/ssl_dane - branch = getdns + url = https://github.com/banburybill/ssl_dane + branch = feature/windows-native-build diff --git a/.travis.yml b/.travis.yml index e4a2b9e6..7ea9244e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ sudo: false -dist: xenial +dist: bionic language: c compiler: - gcc @@ -9,7 +9,7 @@ addons: packages: - libssl-dev - libunbound-dev - - libidn11-dev + - libidn2-0-dev - libyaml-dev - check - libevent-dev @@ -23,4 +23,4 @@ script: - mkdir tests - cd tests - ../src/test/tpkg/run-all.sh -# - ../src/test/tpkg/run-one.sh 225-stub-only-valgrind-checks +# - ../src/test/tpkg/run-one.sh 275-server-capabilities.tpkg -V diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..7d22d3ca --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,1157 @@ +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) + +if (POLICY CMP0075) + cmake_policy(SET CMP0075 NEW) +endif () + +# The following must be set BEFORE doing project() or enable_language(). +if (NOT CMAKE_BUILD_TYPE) + message(STATUS "No build type defined; defaulting to 'Debug'") + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING + "The type of build. Possible values are: Debug, Release, RelWithDebInfo and MinSizeRel.") +endif () + +set(PACKAGE "getdns") +set(PACKAGE_NAME "getdns") +set(PACKAGE_VERSION "1.6.0") +set(PACKAGE_BUGREPORT "team@getdnsapi.net") +set(PACKAGE_URL "https://getdnsapi.net") + +# Dont forget to put a dash in front of the release candidate!!! +# That is how it is done with semantic versioning! +set(RELEASE_CANDIDATE "") + +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}${RELEASE_CANDIDATE}") +set(PACKAGE_TARNAME "${PACKAGE}-${PACKAGE_VERSION}${RELEASE_CANDIDATE}") + +set(GETDNS_VERSION "${PACKAGE_VERSION}${RELEASE_CANDIDATE}") +set(GETDNS_NUMERIC_VERSION 0x01060000) +set(API_VERSION "December 2015") +set(API_NUMERIC_VERSION 0x07df0c00) + + +# Library version +# --------------- +# current:revision:age +# (binary-api-number):(which-binary-api-version):(how-many-nrs-backwardscompat) +# if source code changes increment revision +# if any interfaces have been added/removed/changed since last update then +# increment current and set revision to 0 +# if any interfaces have been added since the last public release then increment age +# if any interfaces have been removed or changed since the last public release then +# set age to 0 +# +# getdns-0.1.4 had libversion 0:0:0 +# getdns-0.1.5 had libversion 1:0:0 +# getdns-0.1.6 had libversion 1:1:0 +# getdns-0.1.7 had libversion 1:2:1 (but should have had 2:0:1) +# getdns-0.1.8 had libversion 1:3:0 (but should have had 2:1:1) +# getdns-0.2.0 had libversion 2:2:1 +# getdns-0.3.0 had libversion 3:3:2 +# getdns-0.3.1 had libversion 3:4:2 +# getdns-0.3.2 had libversion 3:5:2 +# getdns-0.3.3 had libversion 3:6:2 +# getdns-0.5.0 had libversion 4:0:3 +# getdns-0.5.1 had libversion 4:1:3 (but should have been getdns-0.6.0) +# getdns-0.9.0 had libversion 5:0:4 +# getdns-1.0.0 had libversion 5:1:4 +# getdns-1.1.0 had libversion 6:0:0 +# getdns-1.1.1 had libversion 6:1:0 +# getdns-1.1.2 had libversion 7:0:1 +# getdns-1.1.3 had libversion 7:1:1 +# getdns-1.2.0 had libversion 8:0:2 +# getdns-1.2.1 had libversion 8:1:2 +# getdns-1.3.0 had libversion 9:0:3 +# getdns-1.4.0 had libversion 10:0:0 +# getdns-1.4.1 had libversion 10:1:0 +# getdns-1.4.2 had libversion 10:2:0 +# getdns-1.5.0 had libversion 11:0:1 +# getdns-1.5.1 had libversion 11:1:1 +# getdns-1.5.2 had libversion 11:2:1 +# getdns-1.6.0 has libversion 11:3:1 +set(GETDNS_VERSION_CURRENT 11) +set(GETDNS_VERSION_REVISION 3) +set(GETDNS_VERSION_AGE 1) + +project(getdns VERSION ${PACKAGE_VERSION} LANGUAGES C) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") + +include(CheckCSourceRuns) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckLibraryExists) +include(CheckSymbolExists) +include(CheckTypeSize) +include(CMakeDependentOption) +include(CTest) +include(GNUInstallDirs) +include(TestBigEndian) + +include(TargetSharedLibraryExports) +include(TargetSharedLibraryVersion) + +# Target Platform +if (WIN32 OR MINGW OR MSYS OR CYGWIN) + set(HOSTOS "windows") + set(GETDNS_ON_WINDOWS 1) + set(USE_WINSOCK 1) +elseif (APPLE) + set(HOSTOS "macos") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DARWIN_C_SOURCE") +elseif (UNIX) + set(HOSTOS "unix") + + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600") + endif () + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(LINUX 1) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -D_DEFAULT_SOURCE") + elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Solaris") + set(SOLARIS 1) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS_") + endif () +endif () + +test_big_endian(TARGET_IS_BIG_ENDIAN) +set(HAVE_TARGET_ENDIANNESS 1) + +# Options. +option(ENABLE_SHARED "Build shared libraries." ON) +option(ENABLE_STATIC "Build static libraries." ON) +if ((NOT ENABLE_SHARED) AND (NOT ENABLE_STATIC)) + message(FATAL_ERROR "You must build either static or shared libraries.") +endif () + +option(ENABLE_DEBUG_ALL "Enable all debugging messages.") +cmake_dependent_option(ENABLE_DEBUG_REQ "Enable request debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_SCHED "Enable scheduling debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_STUB "Enable stub debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_DAEMON "Enable daemon debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_DNSSEC "Enable DNSSEC debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_SERVER "Enable server debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) +cmake_dependent_option(ENABLE_DEBUG_ANCHOR "Enable anchor debugging messages." OFF "NOT ENABLE_DEBUG_ALL" ON) + +option(ENABLE_SHA1 "Enable SHA1 RRSIG support." ON) +option(ENABLE_SHA2 "Enable SHA256 and SHA512 RRSIG support." ON) +option(ENABLE_GOST "Enable GOST support." ON) +option(ENABLE_ECDSA "Enable ECDSA support." ON) +option(ENABLE_DSA "Enable DSA support." ON) +option(ENABLE_ED25519 "Enable ED25519 support." ON) +option(ENABLE_ED448 "Enable ED448 support." ON) + +option(ENABLE_DRAFT_MDNS_SUPPORT "Enable draft mdns client support.") +option(ENABLE_EDNS_COOKIES "Enable EDNS cookies." ON) +option(ENABLE_NATIVE_STUB_DNSSEC "Enable native stub DNSSEC support." ON) +option(ENABLE_POLL_EVENTLOOP "Enable default eventloop based on poll." ON) +if (WIN32) + option(ENABLE_STUB_ONLY "Restrict resolution modes to STUB." ON) +else() + option(ENABLE_STUB_ONLY "Restrict resolution modes to STUB." OFF) +endif() +option(ENABLE_TCP_FAST_OPEN "Enable use of TCP Fast Open." ON) +option(ENABLE_UNBOUND_EVENT_API "Enable usage of libunbound's event API." ON) + +option(BUILD_DOXYGEN "Build source documentation." OFF) +option(BUILD_EXAMPLES "Compile the example programs." OFF) +option(BUILD_GETDNS_QUERY "Compile and install the getdns_query tool." ON) +option(BUILD_GETDNS_SERVER_MON "Compile and install the getdns_server_mon tool." ON) +option(BUILD_STUBBY "Compile and install stubby, the (stub) resolver daemon." OFF) + +option(BUILD_LIBEV "Build libev support library if available." ON) +option(BUILD_LIBEVENT2 "Build libevent2 support library if available." ON) +option(BUILD_LIBUV "Build libuv support library available." ON) + +option(USE_LIBIDN2 "Use libidn2 if available." ON) +option(USE_GNUTLS "Use GnuTLS for TLS connections." OFF) + +# Above names chosen for user consistency. Now define substituted names. +set(REQ_DEBUG ${ENABLE_DEBUG_REQ}) +set(SCHED_DEBUG ${ENABLE_DEBUG_SCHED}) +set(STUB_DEBUG ${ENABLE_DEBUG_STUB}) +set(DAEMON_DEBUG ${ENABLE_DEBUG_DAEMON}) +set(SEC_DEBUG ${ENABLE_DEBUG_DNSSEC}) +set(SERVER_DEBUG ${ENABLE_DEBUG_SERVER}) +set(ANCHOR_DEBUG ${ENABLE_DEBUG_ANCHOR}) +set(EDNS_COOKIES ${ENABLE_EDNS_COOKIES}) + +set(USE_SHA1 ${ENABLE_SHA1}) +set(USE_SHA2 ${ENABLE_SHA2}) +set(USE_GOST ${ENABLE_GOST}) +set(USE_ECDSA ${ENABLE_ECDSA}) +set(USE_DSA ${ENABLE_DSA}) +set(USE_ED25519 ${ENABLE_ED25519}) +set(USE_ED448 ${ENABLE_ED448}) + +set(HAVE_MDNS_SUPPORT ${ENABLE_DRAFT_MDNS_SUPPORT}) +set(STUB_NATIVE_DNSSEC ${ENABLE_NATIVE_STUB_DNSSEC}) + +set(USE_LIBEV ${BUILD_LIBEV}) +set(USE_LIBEVENT2 ${BUILD_LIBEVENT2}) +set(USE_LIBUV ${BUILD_LIBUV}) + +option(ENABLE_DEBUG_KEEP_CONNECTIONS_OPEN "Disable connection idle timeout. Do not enable.") +mark_as_advanced(ENABLE_DEBUG_KEEP_CONNECTIONS_OPEN) +set(KEEP_CONNECTIONS_OPEN_DEBUG ${ENABLE_DEBUG_KEEP_CONNECTIONS_OPEN}) + +# Options variables. +string(TIMESTAMP timestamp "%Y-%m-%dT%H:%M:%SZ") +set(CURRENT_DATE "${timestamp}" CACHE STRING "Current date of the compilation, set to fixed date for reproducible builds.") +set(DNSSEC_ROADBLOCK_AVOIDANCE ON CACHE BOOL "Enable/disable DNSSEC roadblock avoidance.") +set(FD_SETSIZE "" CACHE STRING "Set maximum file descriptor number that can be used by select.") +set(MAX_UDP_BACKOFF 1000 CACHE STRING "Set the maximum number of messages that can be sent to other upstreams before the upstream which has previously timed out will be tried again.") +if (WIN32) + # BUG! Don't hardcode the Windows directory and drive. + set(hostsfile "C:/Windows/System32/Drivers/etc/hosts") +else () + set(hostsfile "/etc/hosts") +endif () +set(PATH_HOSTS "${hostsfile}" CACHE STRING "Set the static table lookup for hostnames path.") +set(PATH_RESOLVCONF "/etc/resolv.conf" CACHE STRING "Set the resolver configuration file path. Not used on Windows, where values are retrieved via GetNetworkParams().") +set(PATH_TRUST_ANCHOR_FILE "${CMAKE_INSTALL_FULL_SYSCONFDIR}/unbound/getdns-root.key" CACHE STRING "Default location of the trust anchor file.") + +# Ensure option variables in config.h that get values from the above are +# defined, and so will actually appear in config.h. +set(GETDNS_FN_HOSTS 1) +set(GETDNS_FN_RESOLVCONF 1) +set(TRUST_ANCHOR_FILE 1) +set(UDP_MAX_BACKOFF 1) + +# Options not exposed in autoconf. +set(DRAFT_RRTYPES 1) +set(EDNS_COOKIE_OPCODE 10) +set(EDNS_COOKIE_ROLLOVER_TIME "(24*60*60)") +set(EDNS_PADDING_OPCODE 12) +set(MAX_CNAME_REFERRALS 100) +set(MAXIMUM_UPSTREAM_OPTION_SPACE 3000) + +# Values derived from options. +set(GETDNS_COMPILATION_COMMENT "${PACKAGE_NAME} ${GETDNS_VERSION} configured on ${CURRENT_DATE} for the ${API_VERSION} version of the API") + +# Compiler flags +if (MSVC) + # The Visual Studio C compiler is C90 with some of C99 and C11. + # So full on warnings are not appropriate. + add_compile_options(/W2) +else () + add_compile_options(-Wall -Wextra -Wpedantic) +endif () + +# Windows. Uh-oh. +set(getdns_system_libs "") +set(static_lib_suffix "") +if (DEFINED GETDNS_ON_WINDOWS) + set(static_lib_suffix "_static") + list(APPEND getdns_system_libs + "ws2_32" + "crypt32" + "gdi32" + "iphlpapi" + "psapi" + "userenv" + ) +endif () + +# Check for include files +check_include_file(assert.h HAVE_ASSERT_H) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(limits.h HAVE_LIMITS_H) +check_include_file(sys/limits.h HAVE_SYS_LIMITS_H) +check_include_file(stdarg.h HAVE_STDARG_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stdio.h HAVE_STDIO_H) +check_include_file(stdlib.h HAVE_STDLIB_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(strings.h HAVE_STRINGS_H) +check_include_file(time.h HAVE_TIME_H) +check_include_file(unistd.h HAVE_UNISTD_H) + +check_include_file(fcntl.h HAVE_FCNTL_H) + +check_include_file(signal.h HAVE_SIGNAL_H) +check_include_file(sys/poll.h HAVE_SYS_POLL_H) +check_include_file(poll.h HAVE_POLL_H) +check_include_file(resource.h HAVE_RESOURCE_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(sys/stat.h HAVE_SYS_STAT_H) + +check_include_file(endian.h HAVE_ENDIAN_H) +check_include_file(netdb.h HAVE_NETDB_H) +check_include_file(arpa/inet.h HAVE_ARPA_INET_H) +check_include_file(netinet/in.h HAVE_NETINET_IN_H) +check_include_file(sys/select.h HAVE_SYS_SELECT_H) +check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) +check_include_file(sys/sysctl.h HAVE_SYS_SYSCTL_H) +check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(sys/wait.h HAVE_SYS_WAIT_H) + +check_include_file(windows.h HAVE_WINDOWS_H) +check_include_file(winsock.h HAVE_WINSOCK_H) +check_include_file(winsock2.h HAVE_WINSOCK2_H) +check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H) + +# Check for include declarations +check_symbol_exists(getentropy unistd.h HAVE_DECL_GETENTROPY) +if (DEFINED GETDNS_ON_WINDOWS) + set(CMAKE_REQUIRED_LIBRARIES ${getdns_system_libs}) + check_symbol_exists(inet_pton ws2tcpip.h HAVE_DECL_INET_PTON) + check_symbol_exists(inet_ntop ws2tcpip.h HAVE_DECL_INET_NTOP) +else () + check_symbol_exists(inet_pton arpa/inet.h HAVE_DECL_INET_PTON) + check_symbol_exists(inet_ntop arpa/inet.h HAVE_DECL_INET_NTOP) +endif () +check_symbol_exists(mkstemp stdlib.h HAVE_DECL_MKSTEMP) +check_symbol_exists(sigemptyset signal.h HAVE_DECL_SIGEMPTYSET) +check_symbol_exists(sigfillset signal.h HAVE_DECL_SIGFILLSET) +check_symbol_exists(sigaddset signal.h HAVE_DECL_SIGADDSET) +check_symbol_exists(strptime time.h HAVE_DECL_STRPTIME) + +# Check for functions +check_function_exists(fcntl HAVE_FCNTL) +check_function_exists(getauxval HAVE_GETAUXVAL) +check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) +check_function_exists(ioctlsocket HAVE_IOCTLSOCKET) +check_function_exists(sigemptyset HAVE_SIGEMPTYSET) +check_function_exists(sigfillset HAVE_SIGFILLSET) +check_function_exists(sigaddset HAVE_SIGADDSET) +check_function_exists(strptime HAVE_STRPTIME) + +# Check for types +check_type_size(sigset_t SIGSET_T) +check_type_size(_sigset_t _SIGSET_T) + +# SSL library +find_package(OpenSSL "1.0.2" REQUIRED) + +set(HAVE_SSL 1) +set(tlsdir "openssl") + +set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +check_include_file(openssl/ssl.h HAVE_OPENSSL_SSL_H) +check_include_file(openssl/evp.h HAVE_OPENSSL_EVP_H) +check_include_file(openssl/err.h HAVE_OPENSSL_ERR_H) +check_include_file(openssl/rand.h HAVE_OPENSSL_RAND_H) +check_include_file(openssl/conf.h HAVE_OPENSSL_CONF_H) +check_include_file(openssl/engine.h HAVE_OPENSSL_ENGINE_H) + +set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) +check_function_exists(DSA_SIG_set0 HAVE_DSA_SIG_SET0) +check_function_exists(DSA_set0_pqg HAVE_DSA_SET0_PQG) +check_function_exists(DSA_set0_key HAVE_DSA_SET0_KEY) + +check_function_exists(RSA_set0_key HAVE_RSA_SET0_KEY) + +check_function_exists(EVP_md5 HAVE_EVP_MD5) +check_function_exists(EVP_sha1 HAVE_EVP_SHA1) +check_function_exists(EVP_sha224 HAVE_EVP_SHA224) +check_function_exists(EVP_sha256 HAVE_EVP_SHA256) +check_function_exists(EVP_sha384 HAVE_EVP_SHA384) +check_function_exists(EVP_sha512 HAVE_EVP_SHA512) + +check_function_exists(EVP_dss1 HAVE_EVP_DSS1) +check_function_exists(EVP_DigestVerify HAVE_EVP_DIGESTVERIFY) + +check_function_exists(EVP_MD_CTX_new HAVE_EVP_MD_CTX_NEW) + +check_function_exists(HMAC_CTX_new HAVE_HMAC_CTX_NEW) + +check_function_exists(OpenSSL_version_num HAVE_OPENSSL_VERSION_NUM) +check_function_exists(OpenSSL_version HAVE_OPENSSL_VERSION) + +check_function_exists(SSL_CTX_dane_enable HAVE_SSL_CTX_DANE_ENABLE) + +check_function_exists(SSL_CTX_set_ciphersuites HAVE_SSL_CTX_SET_CIPHERSUITES) +check_function_exists(SSL_set_ciphersuites HAVE_SSL_SET_CIPHERSUITES) + +check_function_exists(OPENSSL_init_crypto HAVE_OPENSSL_INIT_CRYPTO) + +check_symbol_exists(SSL_dane_enable "openssl/ssl.h" HAVE_SSL_DANE_ENABLE) +check_symbol_exists(SSL_CTX_set1_curves_list "openssl/ssl.h" HAVE_DECL_SSL_CTX_SET1_CURVES_LIST) +check_symbol_exists(SSL_set1_curves_list "openssl/ssl.h" HAVE_DECL_SSL_SET1_CURVES_LIST) +check_symbol_exists(SSL_set_min_proto_version "openssl/ssl.h" HAVE_DECL_SSL_SET_MIN_PROTO_VERSION) +check_symbol_exists(TLS_client_method "openssl/ssl.h" HAVE_TLS_CLIENT_METHOD) +check_symbol_exists(X509_get_notAfter "openssl/x509.h" HAVE_X509_GET_NOTAFTER) +check_symbol_exists(X509_get0_notAfter "openssl/x509.h" HAVE_X509_GET0_NOTAFTER) + +check_symbol_exists(NID_ED25519 "openssl/obj_mac.h" HAVE_SSL_ED25519) +check_symbol_exists(NID_ED448 "openssl/obj_mac.h" HAVE_SSL_ED448) + +# Threading library +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + +if (CMAKE_USE_PTHREADS_INIT) + set(HAVE_PTHREAD 1) +elseif (CMAKE_USE_WIN32_THREADS_INIT) + set(HAVE_WINDOWS_THREADS 1) +else () + message(WARNING "Neither pthreads nor Windows threading available.") +endif () + +# Libidn2 +if (USE_LIBIDN2) + find_package(Libidn2 "2.0.0" REQUIRED) + if (Libidn2_FOUND) + set(HAVE_LIBIDN2 1) + else() + message(FATAL_ERROR "Libidn2 required but not found. Disable with USE_LIBIDN2 option.") + endif() +endif() + +# GnuTLS and Nettle. If using GnuTLS, we need the Nettle dev stuff to +# handle digital signature algorithms. GnuTLS uses Nettle internally. +if (USE_GNUTLS) + find_package(GnuTLS "3.5.0" REQUIRED) + find_package(Nettle "3.2" REQUIRED) + + set(tlsdir "gnutls") + set(HAVE_NETTLE 1) + + set(CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR}) +set(CMAKE_REQUIRED_LIBRARIES ${NETTLE_LIBRARIES}) + check_include_file(nettle/dsa-compat.h HAVE_NETTLE_DSA_COMPAT_H) + check_include_file(nettle/eddsa.h HAVE_NETTLE_EDDSA_H) + + # API change in Nettle 3.4. + check_symbol_exists(nettle_get_secp_256r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_256R1) + check_symbol_exists(nettle_get_secp_384r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_384R1) +endif() + +# Sort out what signature algorithms can be used. +if (USE_ED25519) + if (USE_GNUTLS) + if (NOT HAVE_NETTLE_EDDSA_H) + message(WARNING "ED25519 enabled and Nettle does not support it. Disabled.") + unset(USE_ED25519) + endif () + elseif (NOT HAVE_SSL_ED25519) + message(WARNING "ED25519 enabled and OpenSSL does not support it. Disabled.") + unset(USE_ED25519) + endif () +endif () + +if (USE_ED448) + if (USE_GNUTLS) + message(WARNING "ED448 enabled and Nettle support not implemented. Disabled.") + unset(USE_ED448) + elseif (NOT HAVE_SSL_ED448) + message(WARNING "ED448 enabled and OpenSSL does not support it. Disabled.") + unset(USE_ED448) + endif () +endif () + +# Stuff that might be in a BSD library +check_symbol_exists(strlcpy string.h HAVE_DECL_STRLCPY) +check_symbol_exists(arc4random stdlib.h HAVE_DECL_ARC4RANDOM) +check_symbol_exists(arc4random_uniform stdlib.h HAVE_DECL_ARC4RANDOM_UNIFORM) + +check_function_exists(strlcpy HAVE_STRLCPY) +check_function_exists(arc4random HAVE_ARC4RANDOM) +check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM) + +if (NOT + (HAVE_STRLCPY AND HAVE_DECL_STRLCPY AND + HAVE_ARC4RANDOM AND HAVE_DECL_ARC4RANDOM AND + HAVE_ARC4RANDOM_UNIFORM AND HAVE_DECL_ARC4RANDOM_UNIFORM)) + find_library(BSD_LIBRARY bsd) + if (BSD_LIBRARY) + unset(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_LIBRARIES ${BSD_LIBRARY}) + mark_as_advanced(BSD_LIBRARY) + list(APPEND getdns_system_libs ${BSD_LIBRARY}) + + check_include_file(bsd/stdlib.h HAVE_BSD_STDLIB_H) + check_include_file(bsd/string.h HAVE_BSD_STRING_H) + + check_symbol_exists(strlcpy "bsd/string.h" HAVE_BSD_DECL_STRLCPY) + set(HAVE_DECL_STRLCPY ${HAVE_BSD_DECL_STRLCPY}) + check_symbol_exists(arc4random "bsd/stdlib.h" HAVE_BSD_DECL_ARC4RANDOM) + set(HAVE_DECL_ARC4RANDOM ${HAVE_BSD_DECL_ARC4RANDOM}) + check_symbol_exists(arc4random_uniform "bsd/stdlib.h" HAVE_BSD_DECL_ARC4RANDOM_UNIFORM) + set(HAVE_DECL_ARC4RANDOM_UNIFORM ${HAVE_BSD_DECL_ARC4RANDOM_UNIFORM}) + + check_function_exists(strlcpy HAVE_BSD_STRLCPY) + set(HAVE_STRLCPY ${HAVE_BSD_STRLCPY}) + check_function_exists(arc4random HAVE_BSD_ARC4RANDOM) + set(HAVE_ARC4RANDOM ${HAVE_BSD_ARC4RANDOM}) + check_function_exists(arc4random_uniform HAVE_BSD_ARC4RANDOM_UNIFORM) + set(HAVE_ARC4RANDOM_UNIFORM ${HAVE_BSD_ARC4RANDOM_UNIFORM}) + endif () +endif () +mark_as_advanced(BSD_LIBRARY) + +# If we're not stub only, we need libunbound. +if (NOT ENABLE_STUB_ONLY) + find_package(Libunbound "1.5.9" REQUIRED) + set(HAVE_LIBUNBOUND 1) + list(APPEND getdns_system_libs Libunbound::Libunbound) + + set(CMAKE_REQUIRED_INCLUDES ${LIBUNBOUND_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${LIBUNBOUND_LIBRARIES}) + check_include_file(unbound-event.h HAVE_UNBOUND_EVENT_H) + check_symbol_exists(ub_ctx_create_ub_event "unbound-event.h" HAVE_UNBOUND_EVENT_API) + check_symbol_exists(ub_ctx_set_stub "unbound-event.h" HAVE_UB_CTX_SET_STUB) +endif () + +# Event loop extension +set(DEFAULT_EVENTLOOP "select_eventloop") +if (ENABLE_POLL_EVENTLOOP) + if (HAVE_SYS_POLL_H) + set(TEST_CFLAG "-DHAVE_SYS_POLL_H=1") + endif () + try_compile(USE_POLL_DEFAULT_EVENTLOOP + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/test_poll.c + COMPILE_DEFINITIONS "${TEST_CFLAG}" + ) + if (USE_POLL_DEFAULT_EVENTLOOP) + set(DEFAULT_EVENTLOOP "poll_eventloop") + endif () +endif () + +# Custom checks +set(STRPTIME_TEST_SOURCE "\n + #define _XOPEN_SOURCE 600\n + #include \n + int main(void) { struct tm tm; char *res;\n + res = strptime(\"2010-07-15T00:00:00+00:00\", \"%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t\", &tm);\n + if (!res) return 2;\n + res = strptime(\"20070207111842\", \"%Y%m%d%H%M%S\", &tm);\n + if (!res) return 1; return 0; }") + +if (HAVE_STRPTIME) + check_c_source_runs("${STRPTIME_TEST_SOURCE}" STRPTIME_WORKS) +endif () + +try_compile(HAVE___FUNC__ + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/test___func__.c +) + +# TCP Fast Open. +if (NOT ENABLE_TCP_FAST_OPEN) + message(WARNING "TCP Fast Open disabled.") +else () + if (APPLE AND HAVE_SYS_SOCKET_H) + check_symbol_exists(CONNECT_RESUME_ON_READ_WRITE "sys/socket.h" USE_OSX_TCP_FASTOPEN) + if (NOT USE_OSX_TCP_FASTOPEN) + message(WARNING "TCP Fast Open not available, continuing without.") + endif () + else () + check_include_file(netinet/tcp.h HAVE_NETINET_TCP_H) + check_symbol_exists(TCP_FASTOPEN "sys/socket.h;netinet/tcp.h" HAVE_DECL_TCP_FASTOPEN) + check_symbol_exists(TCP_FASTOPEN_CONNECT "sys/socket.h;netinet/tcp.h" HAVE_DECL_TCP_FASTOPEN_CONNECT) + check_symbol_exists(MSG_FASTOPEN "sys/socket.h;netinet/tcp.h" HAVE_DECL_MSG_FASTOPEN) + if (NOT HAVE_DECL_TCP_FASTOPEN) + message(WARNING "TCP Fast Open not available, continuing without.") + endif () + endif () +endif () + +# Main library +add_library(getdns_objects OBJECT + src/anchor.c + src/const-info.c + src/convert.c + src/context.c + src/dict.c + src/dnssec.c + src/general.c + src/list.c + src/request-internal.c + src/mdns.c + src/platform.c + src/pubkey-pinning.c + src/rr-dict.c + src/rr-iter.c + src/server.c + src/stub.c + src/sync.c + src/ub_loop.c + src/util-internal.c + + src/extension/${DEFAULT_EVENTLOOP}.c + + src/gldns/keyraw.c + src/gldns/gbuffer.c + src/gldns/wire2str.c + src/gldns/parse.c + src/gldns/parseutil.c + src/gldns/rrdef.c + src/gldns/str2wire.c + + src/util/rbtree.c + src/util/lruhash.c + src/util/lookup3.c + src/util/locks.c + + src/jsmn/jsmn.c + + src/yxml/yxml.c + + src/tls/val_secalgo.c + src/tls/anchor-internal.c + + src/${tlsdir}/tls.c + src/${tlsdir}/pubkey-pinning-internal.c + src/${tlsdir}/keyraw-internal.c + + ${CMAKE_CURRENT_BINARY_DIR}/version.c + ) +if (NOT HAVE_GETTIMEOFDAY) + target_sources(getdns_objects PRIVATE src/compat/gettimeofday.c) +endif () +if (NOT HAVE_DECL_INET_PTON) + target_sources(getdns_objects PRIVATE src/compat/inet_pton.c) +endif () +if (NOT HAVE_DECL_INET_NTOP) + target_sources(getdns_objects PRIVATE src/compat/inet_ntop.c) +endif () +if (NOT HAVE_DECL_MKSTEMP) + target_sources(getdns_objects PRIVATE src/compat/mkstemp.c) +endif () +if (NOT HAVE_DECL_STRLCPY) + target_sources(getdns_objects PRIVATE src/compat/strlcpy.c) +endif () +if (NOT HAVE_DECL_ARC4RANDOM) + target_sources(getdns_objects PRIVATE + src/compat/arc4random.c + src/compat/explicit_bzero.c + src/compat/arc4_lock.c + ) + + if (NOT HAVE_DECL_GETENTROPY) + if (DEFINED GETDNS_ON_WINDOWS) + target_sources(getdns_objects PRIVATE src/compat/getentropy_win.c) + elseif (APPLE) + target_sources(getdns_objects PRIVATE src/compat/getentropy_osx.c) + elseif (DEFINED LINUX) + target_sources(getdns_objects PRIVATE src/compat/getentropy_linux.c) + endif () + endif () +endif () +if (NOT HAVE_DECL_ARC4RANDOM_UNIFORM) + target_sources(getdns_objects PRIVATE src/compat/arc4random_uniform.c) +endif () +if (NOT STRPTIME_WORKS) + target_sources(getdns_objects PRIVATE src/compat/strptime.c) +endif () +target_include_directories(getdns_objects + PUBLIC + src + + PRIVATE + src/util/auxiliary + src/${tlsdir} + src/tls + src/yxml + + ${CMAKE_CURRENT_BINARY_DIR} + + # Note - CMake 3.5 doesn't like target_link_libraries on objects, + # which would be preferred way to add an include dependency. + ${OPENSSL_INCLUDE_DIR} + ) +target_compile_definitions(getdns_objects PRIVATE JSMN_GETDNS YXML_GETDNS) +if (NOT HAVE_SSL_DANE_ENABLE) + target_sources(getdns_objects PRIVATE src/ssl_dane/danessl.c) + target_include_directories(getdns_objects PRIVATE src/ssl_dane) + set(USE_DANESSL 1) +endif () +if (Libidn_FOUND) + target_include_directories(getdns_objects PRIVATE ${LIBIDN_INCLUDE_DIR}) +endif () +if (Libidn2_FOUND) + target_include_directories(getdns_objects PRIVATE ${LIBIDN2_INCLUDE_DIR}) +endif () +if (Libunbound_FOUND) + target_include_directories(getdns_objects PRIVATE ${LIBUNBOUND_INCLUDE_DIR}) +endif () +if (GnuTLS_FOUND) + target_include_directories(getdns_objects PRIVATE ${GNUTLS_INCLUDE_DIR}) +endif () + +# Don't compile separate objects for shared and static libraries. +# Yes, -fPIC is slightly suboptimal for static libraries, but it looks +# to me that it's the behaviour the autoconf build follows. +set_property(TARGET getdns_objects PROPERTY POSITION_INDEPENDENT_CODE 1) +set_property(TARGET getdns_objects PROPERTY C_STANDARD 11) + +# Static library version of main library. +if (ENABLE_STATIC) + add_library(getdns STATIC $) + target_include_directories(getdns PUBLIC + "$" + ${CMAKE_CURRENT_BINARY_DIR} + ) + target_link_libraries(getdns + PUBLIC + OpenSSL::SSL + OpenSSL::Crypto + Threads::Threads + ${getdns_system_libs} + ) + if (Libunbound_FOUND) + target_link_libraries(getdns PUBLIC Libunbound::Libunbound) + endif () + if (Libidn_FOUND) + target_link_libraries(getdns PUBLIC Libidn::Libidn) + endif () + if (Libidn2_FOUND) + target_link_libraries(getdns PUBLIC Libidn2::Libidn2) + endif () + if (GnuTLS_FOUND) + target_link_libraries(getdns PUBLIC GnuTLS::GnuTLS GnuTLS::Dane) + endif () + if (Nettle_FOUND) + target_link_libraries(getdns PUBLIC Nettle::Nettle Nettle::Hogweed) + endif () + set_target_properties(getdns PROPERTIES OUTPUT_NAME getdns${static_lib_suffix}) +endif () + +# Shared library version of main library. +if (ENABLE_SHARED) + add_library(getdns_shared SHARED $) + target_include_directories(getdns_shared PUBLIC + "$" + ${CMAKE_CURRENT_BINARY_DIR} + ) + target_link_libraries(getdns_shared + PUBLIC + OpenSSL::SSL + OpenSSL::Crypto + Threads::Threads + ${getdns_system_libs} + ) + if (Libunbound_FOUND) + target_link_libraries(getdns_shared PUBLIC Libunbound::Libunbound) + endif () + if (Libidn_FOUND) + target_link_libraries(getdns_shared PUBLIC Libidn::Libidn) + endif () + if (Libidn2_FOUND) + target_link_libraries(getdns_shared PUBLIC Libidn2::Libidn2) + endif () + if (GnuTLS_FOUND) + target_link_libraries(getdns_shared PUBLIC GnuTLS::GnuTLS GnuTLS::Dane) + endif () + if (Nettle_FOUND) + target_link_libraries(getdns_shared PUBLIC Nettle::Nettle Nettle::Hogweed) + endif () + set_target_properties(getdns_shared PROPERTIES OUTPUT_NAME getdns) + target_shared_library_version(getdns_shared ${GETDNS_VERSION_CURRENT} ${GETDNS_VERSION_REVISION} ${GETDNS_VERSION_AGE}) + + # Generate platform-specific link file with the export symbols. + file(STRINGS src/libgetdns.symbols symbols) + target_shared_library_exports(getdns_shared getdns "${symbols}") + + # If we're not building a static library, use this wherever we use + # the static library in tool and test builds. + if (NOT ENABLE_STATIC) + add_library(getdns ALIAS getdns_shared) + endif () +endif () + +# libev extension. +if (USE_LIBEV) + find_package(Libev) + if (Libev_FOUND) + # Copy module header to getdns include dir. + file(COPY src/getdns/getdns_ext_libev.h DESTINATION getdns) + + add_library(ev_objects OBJECT src/extension/libev.c) + target_include_directories(ev_objects + PRIVATE + src + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBEV_INCLUDE_DIR} + ) + set_property(TARGET ev_objects PROPERTY POSITION_INDEPENDENT_CODE 1) + set_property(TARGET ev_objects PROPERTY C_STANDARD 11) + if (ENABLE_STATIC) + add_library(getdns_ex_ev STATIC $) + target_include_directories(getdns_ex_ev PRIVATE Libev::Libev) + target_link_libraries(getdns_ex_ev PUBLIC getdns Libev::Libev) + if (Libunbound_FOUND) + target_link_libraries(getdns_ex_ev PUBLIC Libunbound::Libunbound) + endif () + set_target_properties(getdns_ex_ev PROPERTIES OUTPUT_NAME getdns_ex_ev${static_lib_suffix}) + endif () + if (ENABLE_SHARED) + add_library(getdns_ex_ev_shared SHARED $) + target_include_directories(getdns_ex_ev_shared PRIVATE Libev::Libev) + target_link_libraries(getdns_ex_ev_shared PUBLIC getdns_shared Libev::Libev) + if (Libunbound_FOUND) + target_link_libraries(getdns_ex_ev_shared PUBLIC Libunbound::Libunbound) + endif () + set_target_properties(getdns_ex_ev_shared PROPERTIES OUTPUT_NAME getdns_ex_ev) + target_shared_library_version(getdns_ex_ev_shared ${GETDNS_VERSION_CURRENT} ${GETDNS_VERSION_REVISION} ${GETDNS_VERSION_AGE}) + file(STRINGS src/extension/libev.symbols symbols) + target_shared_library_exports(getdns_ex_ev_shared getdns_ex_ev "${symbols}") + if (NOT ENABLE_STATIC) + add_library(getdns_ex_ev ALIAS getdns_ex_ev_shared) + endif () + endif () + else () + message(WARNING "Libev support library build requested, but libev not found. Disabled.") + unset(USE_LIBEV) + endif () +endif () + +# libevent2 extension. +if (USE_LIBEVENT2) + find_package(Libevent2) + if (Libevent2_FOUND) + # Given libevent2, set defines required by source. + set(HAVE_EVENT2_EVENT_H 1) + set(HAVE_EVENT_BASE_FREE 1) + set(HAVE_EVENT_BASE_NEW 1) + + # Copy module header to getdns include dir. + file(COPY src/getdns/getdns_ext_libevent.h DESTINATION getdns) + + add_library(event2_objects OBJECT src/extension/libevent.c) + target_include_directories(event2_objects + PRIVATE + src + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBEVENT2_INCLUDE_DIR} + ) + set_property(TARGET event2_objects PROPERTY POSITION_INDEPENDENT_CODE 1) + set_property(TARGET event2_objects PROPERTY C_STANDARD 11) + if (ENABLE_STATIC) + add_library(getdns_ex_event STATIC $) + target_include_directories(getdns_ex_event PRIVATE Libevent2::Libevent_code) + target_link_libraries(getdns_ex_event PUBLIC getdns Libevent2::Libevent_core) + if (Libunbound_FOUND) + target_link_libraries(getdns_ex_event PUBLIC Libunbound::Libunbound) + endif () + set_target_properties(getdns_ex_event PROPERTIES OUTPUT_NAME getdns_ex_event${static_lib_suffix}) + endif () + if (ENABLE_SHARED) + add_library(getdns_ex_event_shared SHARED $) + target_include_directories(getdns_ex_event_shared PRIVATE Libevent2::Libevent_code) + target_link_libraries(getdns_ex_event_shared PUBLIC getdns_shared Libevent2::Libevent_core) + if (Libunbound_FOUND) + target_link_libraries(getdns_ex_event_shared PUBLIC Libunbound::Libunbound) + endif () + set_target_properties(getdns_ex_event_shared PROPERTIES OUTPUT_NAME getdns_ex_event) + target_shared_library_version(getdns_ex_event_shared ${GETDNS_VERSION_CURRENT} ${GETDNS_VERSION_REVISION} ${GETDNS_VERSION_AGE}) + file(STRINGS src/extension/libevent.symbols symbols) + target_shared_library_exports(getdns_ex_event_shared getdns_ex_event "${symbols}") + if (NOT ENABLE_STATIC) + add_library(getdns_ex_event ALIAS getdns_ex_event_shared) + endif () + endif () + else () + message(WARNING "Libevent2 support library build requested, but libevent2 not found. Disabled.") + unset(USE_LIBEVENT2) + endif () +endif () + +# libuv extension. +if (USE_LIBUV) + find_package(Libuv) + if (Libuv_FOUND) + # Check for new-style callbacks. + try_compile(HAVE_NEW_UV_TIMER_CB + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/test_uv_cb.c + ) + + # Copy module header to getdns include dir. + file(COPY src/getdns/getdns_ext_libuv.h DESTINATION getdns) + + add_library(uv_objects OBJECT src/extension/libuv.c) + target_include_directories(uv_objects + PRIVATE + src + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBUV_INCLUDE_DIR} + ) + set_property(TARGET uv_objects PROPERTY POSITION_INDEPENDENT_CODE 1) + set_property(TARGET uv_objects PROPERTY C_STANDARD 11) + if (ENABLE_STATIC) + add_library(getdns_ex_uv STATIC $) + target_include_directories(getdns_ex_uv PRIVATE Libuv::Libuv) + target_link_libraries(getdns_ex_uv PUBLIC getdns Libuv::Libuv) + if (Libunbound_FOUND) + target_link_libraries(getdns_ex_uv PUBLIC Libunbound::Libunbound) + endif () + set_target_properties(getdns_ex_uv PROPERTIES OUTPUT_NAME getdns_ex_uv${static_lib_suffix}) + endif () + if (ENABLE_SHARED) + add_library(getdns_ex_uv_shared SHARED $) + target_include_directories(getdns_ex_uv_shared PRIVATE Libuv::Libuv) + target_link_libraries(getdns_ex_uv_shared PUBLIC getdns_shared Libuv::Libuv) + if (Libunbound_FOUND) + target_link_libraries(getdns_ex_uv_shared PUBLIC Libunbound::Libunbound) + endif () + set_target_properties(getdns_ex_uv_shared PROPERTIES OUTPUT_NAME getdns_ex_uv) + target_shared_library_version(getdns_ex_uv_shared ${GETDNS_VERSION_CURRENT} ${GETDNS_VERSION_REVISION} ${GETDNS_VERSION_AGE}) + file(STRINGS src/extension/libuv.symbols symbols) + target_shared_library_exports(getdns_ex_uv_shared getdns_ex_uv "${symbols}") + if (NOT ENABLE_STATIC) + add_library(getdns_ex_uv ALIAS getdns_ex_uv_shared) + endif () + endif () + else () + message(WARNING "Libuv support library build requested, but libuv not found. Disabled.") + unset(USE_LIBUV) + endif () +endif () + +# The tools. +if (BUILD_GETDNS_QUERY) + add_executable(getdns_query src/tools/getdns_query.c) + if (NOT HAVE_GETTIMEOFDAY) + target_sources(getdns_query PRIVATE src/compat/gettimeofday.c) + endif () + target_link_libraries(getdns_query PRIVATE getdns) + if (Libunbound_FOUND) + target_link_libraries(getdns_query PUBLIC Libunbound::Libunbound) + endif () + set_property(TARGET getdns_query PROPERTY C_STANDARD 11) +endif () + +if (BUILD_GETDNS_SERVER_MON) + add_executable(getdns_server_mon src/tools/getdns_server_mon.c) + target_link_libraries(getdns_server_mon + PUBLIC + OpenSSL::SSL + OpenSSL::Crypto + PRIVATE + getdns + ) + if (Libunbound_FOUND) + target_link_libraries(getdns_server_mon PUBLIC Libunbound::Libunbound) + endif () + set_property(TARGET getdns_server_mon PROPERTY C_STANDARD 11) +endif () + +if (BUILD_TESTING) + if (WIN32) + message(WARNING "Test programs require libcheck and so do not build on Windows, skipping.") + else () + find_package(Check "0.9.6" REQUIRED) + set(GETDNS_TEST_SOURCE_FILES + src/test/check_getdns_common.c + src/test/check_getdns_context_set_timeout.c + src/test/check_getdns_transport.c + src/test/check_getdns_selectloop.c + src/test/check_getdns.c) + set(GETDNS_TEST_LINK_LIBS + getdns + Check::Check + Threads::Threads) + + add_executable(check_getdns ${GETDNS_TEST_SOURCE_FILES}) + target_link_libraries(check_getdns PRIVATE ${GETDNS_TEST_LINK_LIBS}) + add_test(NAME test_noeventloop COMMAND check_getdns) + set_property(TEST test_noeventloop PROPERTY + ENVIRONMENT "GETDNS_TEST_PORT=43210;CK_TIMEOUT_MULTIPLIER=2;CK_LOG_FILE_NAME=check_getdns.log" + ) + + if (USE_LIBEVENT2) + add_executable(check_getdns_event ${GETDNS_TEST_SOURCE_FILES}) + target_link_libraries(check_getdns_event PRIVATE ${GETDNS_TEST_LINK_LIBS} getdns_ex_event) + add_test(NAME test_libevent COMMAND check_getdns_event) + set_property(TEST test_libevent PROPERTY + ENVIRONMENT "GETDNS_TEST_PORT=44321;CK_TIMEOUT_MULTIPLIER=2;CK_LOG_FILE_NAME=check_getdns_event.log" + ) + endif() + + if (USE_LIBEV) + add_executable(check_getdns_ev ${GETDNS_TEST_SOURCE_FILES}) + target_link_libraries(check_getdns_ev PRIVATE ${GETDNS_TEST_LINK_LIBS} getdns_ex_ev) + add_test(NAME test_libev COMMAND check_getdns_ev) + set_property(TEST test_libev PROPERTY + ENVIRONMENT "GETDNS_TEST_PORT=45321;CK_TIMEOUT_MULTIPLIER=2;CK_LOG_FILE_NAME=check_getdns_ev.log" + ) + endif() + + if (USE_LIBUV) + add_executable(check_getdns_uv ${GETDNS_TEST_SOURCE_FILES}) + target_link_libraries(check_getdns_uv PRIVATE ${GETDNS_TEST_LINK_LIBS} getdns_ex_uv) + add_test(NAME test_libuv COMMAND check_getdns_uv) + set_property(TEST test_libuv PROPERTY + ENVIRONMENT "GETDNS_TEST_PORT=46321;CK_TIMEOUT_MULTIPLIER=2;CK_LOG_FILE_NAME=check_getdns_uv.log" + ) + endif() + + add_executable(tests_dict + src/test/tests_dict.c + src/test/testmessages.c + ) + target_link_libraries(tests_dict PRIVATE getdns Check::Check) + + add_executable(tests_list + src/test/tests_list.c + src/test/testmessages.c + ) + target_link_libraries(tests_list PRIVATE getdns Check::Check) + + add_executable(tests_namespaces src/test/tests_namespaces.c) + target_link_libraries(tests_namespaces PRIVATE getdns Check::Check) + + add_executable(tests_stub_async + src/test/tests_stub_async.c + src/test/testmessages.c + ) + target_link_libraries(tests_stub_async PRIVATE getdns Check::Check) + + add_executable(tests_stub_sync src/test/tests_stub_sync.c) + target_link_libraries(tests_stub_sync PRIVATE getdns Check::Check) + endif() +endif () + +# Substitutions in files. +configure_file(cmake/include/cmakeconfig.h.in config.h) +configure_file(src/getdns/getdns.h.in getdns/getdns.h) +configure_file(src/getdns/getdns_extra.h.in getdns/getdns_extra.h) +configure_file(src/version.c.in version.c) + +set(version ${PACKAGE_VERSION}) +set(date ${API_VERSION}) +file(GLOB mans doc/*.3.in) +file(MAKE_DIRECTORY man3) +foreach (man ${mans}) + get_filename_component(out ${man} NAME_WE) + configure_file(${man} man3/${out}.3 @ONLY) + + # Look through the page and make copies of the page for all APIs + # defined in that page. Defined means listed in a line ".B " + # between lines ".SH NAME" and ".SH LIBRARY". Ignore terminating "," + # or spaces in .B line. + file(STRINGS ${man} manpage REGEX "^\\.(SH +NAME|SH +LIBRARY|B )") + set(in_list 0) + foreach (line ${manpage}) + if ("${line}" MATCHES "^\\.SH +NAME") + set(in_list 1) + elseif ("${line}" MATCHES "^\\.SH +LIBRARY") + set(in_list 0) + elseif (${in_list}) + string(REGEX REPLACE ".B +([^ ,]+).*" "\\1" alt "${line}") + configure_file(${man} man3/${alt}.3 @ONLY) + endif () + endforeach() +endforeach() + +set(prefix ${CMAKE_INSTALL_PREFIX}) +configure_file(getdns.pc.in getdns.pc @ONLY) + +# Installing. +if (ENABLE_STATIC) + install(TARGETS getdns LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + if (USE_LIBEV) + install(TARGETS getdns_ex_ev LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endif () + if (USE_LIBEVENT2) + install(TARGETS getdns_ex_event LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endif () + if (USE_LIBUV) + install(TARGETS getdns_ex_uv LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endif () +endif () +if (ENABLE_SHARED) + install(TARGETS getdns_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + if (USE_LIBEV) + install(TARGETS getdns_ex_ev_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endif () + if (USE_LIBEVENT2) + install(TARGETS getdns_ex_event_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endif () + if (USE_LIBUV) + install(TARGETS getdns_ex_uv_shared LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + endif () +endif () +if (BUILD_GETDNS_QUERY) + install(TARGETS getdns_query RUNTIME DESTINATION bin) +endif () +if (BUILD_GETDNS_SERVER_MON) + install(TARGETS getdns_server_mon RUNTIME DESTINATION bin) +endif () + +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/getdns DESTINATION include) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man3 DESTINATION share/man) + +set(docdir share/doc/getdns) +install(FILES AUTHORS ChangeLog COPYING LICENSE NEWS README.md DESTINATION ${docdir}) +install(FILES spec/index.html DESTINATION ${docdir}/spec) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/getdns.pc DESTINATION lib/pkgconfig) + +install(CODE "message(\"\ +***\n\ +*** !!! IMPORTANT !!!!\n\ +***\n\ +*** From release 1.2.0, getdns comes with built-in DNSSEC\n\ +*** trust anchor management. External trust anchor management,\n\ +*** for example with unbound-anchor, is no longer necessary\n\ +*** and no longer recommended.\n\ +***\n\ +*** Previously installed trust anchors, in the default location -\n\ +***\n\ +*** /etc/unbound/getdns-root.key\n\ +***\n\ +*** - will be preferred and used for DNSSEC validation, however\n\ +*** getdns will fallback to trust-anchors obtained via built-in\n\ +*** trust anchor management when the anchors from the default\n\ +*** location fail to validate the root DNSKEY rrset.\n\ +***\n\ +*** To prevent expired DNSSEC trust anchors to be used for\n\ +*** validation, we strongly recommend removing the trust anchors\n\ +*** on the default location when there is no active external\n\ +*** trust anchor management keeping it up-to-date.\n\ +***\")") + +if (BUILD_STUBBY) + add_subdirectory(stubby) +endif () + +if (BUILD_EXAMPLES) + add_executable(example-all-functions spec/example/example-all-functions.c) + target_include_directories(example-all-functions PRIVATE spec/example) + target_link_libraries(example-all-functions PRIVATE getdns) + set_property(TARGET example-all-functions PROPERTY C_STANDARD 11) + + add_executable(example-synchronous spec/example/example-synchronous.c) + target_include_directories(example-synchronous PRIVATE spec/example) + target_link_libraries(example-synchronous PRIVATE getdns) + set_property(TARGET example-synchronous PROPERTY C_STANDARD 11) + + if (USE_LIBEVENT2) + add_executable(example-simple-answers spec/example/example-simple-answers.c) + target_include_directories(example-simple-answers PRIVATE spec/example) + target_link_libraries(example-simple-answers PRIVATE getdns getdns_ex_event) + set_property(TARGET example-simple-answers PROPERTY C_STANDARD 11) + + add_executable(example-tree spec/example/example-tree.c) + target_include_directories(example-tree PRIVATE spec/example) + target_link_libraries(example-tree PRIVATE getdns getdns_ex_event) + set_property(TARGET example-tree PROPERTY C_STANDARD 11) + + add_executable(example-reverse spec/example/example-reverse.c) + target_include_directories(example-reverse PRIVATE spec/example) + target_link_libraries(example-reverse PRIVATE getdns getdns_ex_event) + set_property(TARGET example-reverse PROPERTY C_STANDARD 11) + else () + message(WARNING "\ +Three examples from the specification need libevent. \ +libevent was not found or usable at compile time. \ +To compile and run all examples from the spec, make sure \ +libevent is available and usable during configuration.") + endif () +endif () + +if (BUILD_DOXYGEN) + find_package(Doxygen REQUIRED) + + set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}/src) + configure_file(src/Doxyfile.in Doxyfile @ONLY) + add_custom_command(OUTPUT doc/html/index.html + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + MAIN_DEPENDENCY Doxyfile + COMMENT "Generating Doxygen docs.") + add_custom_target(doc ALL DEPENDS doc/html/index.html) +endif () diff --git a/ChangeLog b/ChangeLog index 2fb2fce3..a01dfc61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +* 2020-02-28: Version 1.6.0 + * Issues #457, #458, #461: New symbols with libnettle >= 3.4. + Thanks hanvinke & kometchtech for testing & reporting. + * Issue #432: answer_ipv4_address and answer_ipv6_address in reply + and response dicts. + * Issue #430: Record and guard UDP max payload size with servers. + * Issue #407: Run only offline-tests option with: + src/test/tpkg/run-offline-only.sh (only with git checkouts). + * Issue #175: Include the packet the stub resolver sent to the + upstream the call_reporting dict. Thanks Tom Pusateri + * Issue #169: Build eventloop support libraries if event libraries + are available. Thanks Tom Pusateri + +* 2019-12-20: Version 1.6.0-beta.1 + * Migration of build system to cmake. Build now works on Ubuntu, + Windows 10 and macOS. + Some notes on minor differences in the new cmake build: + * OpenSSL 1.0.2 or higher is now required + * libunbound 1.5.9 is now required + * Only libidn2 2.0.0 and later is supported (not libidn) + * Windows uses ENABLE_STUB_ONLY=ON as the default + * Unit and regression tests work on Linux/macOS + (but not Windows yet) + * 2019-04-03: Version 1.5.2 * PR #424: Two small trust anchor fetcher fixes Thanks Maciej S. Szmigiero diff --git a/INSTALL b/INSTALL deleted file mode 100644 index e45047b3..00000000 --- a/INSTALL +++ /dev/null @@ -1,401 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation, -Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -(Options specific to getdns are listed at the end of this document.) - -Basic Installation -================== - - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - - The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type `make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root - privileges. - - 5. Optionally, type `make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type `make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - -Installation Names -================== - - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - HP-UX `make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as `configure' are involved. Use GNU `make' -instead. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put `/usr/ucb' early in your `PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. - - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - - On Mac OSX getdns will not build against the version of OpenSSL shipped with -OSX. If you link against a self-complied version of OpenSSL then manual -configuration of certificates into the default OpenSSL directory -/usr/local/etc/openssl/certs is currently required for TLS authentication to work. -However if linking against the version of OpenSSL installed via Homebrew TLS -authentication will work out of the box. - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf limitation. Until the limitation is lifted, you can use -this workaround: - - CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - -getdns-specific Options -======================= - -`--with-libidn=pathname' - path to libidn (default: search /usr/local ..) - -`--with-libunbound=pathname' - path to libunbound (default: search /usr/local ..) - -`--with-libevent' - path to libevent (default: search /usr/local ..) - -`--with-libuv' - path to libuv (default: search /usr/local ..) - -`--with-libev' - path to libev (default: search /usr/local ..) - -`--with-trust-anchor=KEYFILE' - Default location of the trust anchor file. - [default=SYSCONFDIR/unbound/getdns-root.key] diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 0532bd08..00000000 --- a/Makefile.in +++ /dev/null @@ -1,328 +0,0 @@ -# -# @configure_input@ -# -# -# Copyright (c) 2013, Verisign, Inc., NLnet Labs -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the names of the copyright holders nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package = @PACKAGE_NAME@ -version = @PACKAGE_VERSION@@RELEASE_CANDIDATE@ -tarname = @PACKAGE_TARNAME@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -distdir = $(tarname)-$(version) -bintar = $(distdir)-bin.tar.gz - -prefix = @prefix@ -datarootdir=@datarootdir@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -docdir = @docdir@ -libdir = @libdir@ - -srcdir = @srcdir@ -INSTALL = @INSTALL@ - -all : default @GETDNS_QUERY@ @GETDNS_SERVER_MON@ - -everything: default - cd src/test && $(MAKE) - -default: - cd src && $(MAKE) $@ - -install-lib: - cd src && $(MAKE) install - -install: getdns.pc getdns_ext_event.pc install-lib @INSTALL_GETDNS_QUERY@ @INSTALL_GETDNS_SERVER_MON@ - $(INSTALL) -m 755 -d $(DESTDIR)$(docdir) - $(INSTALL) -m 644 $(srcdir)/AUTHORS $(DESTDIR)$(docdir) - $(INSTALL) -m 644 $(srcdir)/ChangeLog $(DESTDIR)$(docdir) - $(INSTALL) -m 644 $(srcdir)/COPYING $(DESTDIR)$(docdir) - $(INSTALL) -m 644 $(srcdir)/INSTALL $(DESTDIR)$(docdir) - $(INSTALL) -m 644 $(srcdir)/LICENSE $(DESTDIR)$(docdir) - $(INSTALL) -m 644 $(srcdir)/NEWS $(DESTDIR)$(docdir) - $(INSTALL) -m 644 $(srcdir)/README.md $(DESTDIR)$(docdir) - $(INSTALL) -m 755 -d $(DESTDIR)$(libdir)/pkgconfig - $(INSTALL) -m 644 getdns.pc $(DESTDIR)$(libdir)/pkgconfig - $(INSTALL) -m 644 getdns_ext_event.pc $(DESTDIR)$(libdir)/pkgconfig - $(INSTALL) -m 755 -d $(DESTDIR)$(docdir)/spec - $(INSTALL) -m 644 $(srcdir)/spec/index.html $(DESTDIR)$(docdir)/spec - cd doc && $(MAKE) install - @echo "***" - @echo "*** !!! IMPORTANT !!!!" - @echo "***" - @echo "*** From release 1.2.0, getdns comes with built-in DNSSEC" - @echo "*** trust anchor management. External trust anchor management," - @echo "*** for example with unbound-anchor, is no longer necessary" - @echo "*** and no longer recommended." - @echo "***" - @echo "*** Previously installed trust anchors, in the default location -" - @echo "***" - @echo "*** @TRUST_ANCHOR_FILE@" - @echo "***" - @echo "*** - will be preferred and used for DNSSEC validation, however" - @echo "*** getdns will fallback to trust-anchors obtained via built-in" - @echo "*** trust anchor management when the anchors from the default" - @echo "*** location fail to validate the root DNSKEY rrset." - @echo "***" - @echo "*** To prevent expired DNSSEC trust anchors to be used for" - @echo "*** validation, we strongly recommend removing the trust anchors" - @echo "*** on the default location when there is no active external" - @echo "*** trust anchor management keeping it up-to-date." - @echo "***" - -uninstall: @UNINSTALL_GETDNS_QUERY@ @UNINSTALL_GETDNS_SERVER_MON@ - rm -rf $(DESTDIR)$(docdir) - cd doc && $(MAKE) $@ - cd src && $(MAKE) $@ - -doc: FORCE - cd doc && $(MAKE) $@ - -example: - cd spec/example && $(MAKE) $@ - -test: default - cd src/test && $(MAKE) $@ - -getdns_query: default - cd src/tools && $(MAKE) $@ - -getdns_server_mon: default - cd src/tools && $(MAKE) $@ - -stubby: - cd src && $(MAKE) $@ - -scratchpad: default - cd src/test && $(MAKE) $@ - -pad: scratchpad - src/test/scratchpad || ./libtool exec gdb src/test/scratchpad - -install-getdns_query: install-lib - cd src/tools && $(MAKE) $@ - -uninstall-getdns_query: - cd src/tools && $(MAKE) $@ - -install-getdns_server_mon: install-lib @INSTALL_GETDNS_QUERY@ - cd src/tools && $(MAKE) $@ - -uninstall-getdns_server_mon: - cd src/tools && $(MAKE) $@ - -install-stubby: - cd src && $(MAKE) $@ - -uninstall-stubby: - cd src && $(MAKE) $@ - -clean: - cd src && $(MAKE) $@ - cd doc && $(MAKE) $@ - cd spec/example && $(MAKE) $@ - rm -f *.o *.pc - -depend: - cd src && $(MAKE) $@ - cd spec/example && $(MAKE) $@ - -distclean: - cd src && $(MAKE) $@ - rmdir src 2>/dev/null || true - cd doc && $(MAKE) $@ - rmdir doc 2>/dev/null || true - cd spec/example && $(MAKE) $@ - rmdir spec/example 2>/dev/null || true - rmdir spec 2>/dev/null || true - rm -f config.log config.status Makefile libtool getdns.pc getdns_ext_event.pc - rm -fR autom4te.cache - rm -f m4/libtool.m4 - rm -f m4/lt~obsolete.m4 - rm -f m4/ltoptions.m4 - rm -f m4/ltsugar.m4 - rm -f m4/ltversion.m4 - rm -f $(distdir).tar.gz $(distdir).tar.gz.sha256 $(distdir).tar.gz.sha1 - rm -f $(distdir).tar.gz.md5 $(distdir).tar.gz.asc - -megaclean: - cd $(srcdir) && rm -fr * .dir-locals.el .gitignore .indent.pro .travis.yml && git reset --hard && git submodule update --init - -autoclean: megaclean - libtoolize -ci - autoreconf -fi - -dist: $(distdir).tar.gz - -pub: $(distdir).tar.gz.sha256 $(distdir).tar.gz.md5 $(distdir).tar.gz.asc $(distdir).tar.gz.sha1 - -$(distdir).tar.gz.sha256: $(distdir).tar.gz - openssl sha256 $(distdir).tar.gz >$@ - -$(distdir).tar.gz.sha1: $(distdir).tar.gz - openssl sha1 $(distdir).tar.gz >$@ - -$(distdir).tar.gz.md5: $(distdir).tar.gz - openssl md5 $(distdir).tar.gz >$@ - -$(distdir).tar.gz.asc: $(distdir).tar.gz - gpg --armor --detach-sig $(distdir).tar.gz - -bindist: $(bintar) - -$(bintar): $(distdir) - chown -R 0:0 $(distdir) 2>/dev/null || true - cd $(distdir); ./configure; make - tar chof - $(distdir) | gzip -9 -c > $@ - rm -rf $(distdir) - -$(distdir).tar.gz: $(distdir) - chown -R 0:0 $(distdir) 2>/dev/null || true - tar chof - $(distdir) | gzip -9 -c > $@ - rm -rf $(distdir) - -$(distdir): - mkdir -p $(distdir)/m4 - mkdir -p $(distdir)/src - mkdir -p $(distdir)/src/getdns - mkdir -p $(distdir)/src/test - mkdir -p $(distdir)/src/extension - mkdir -p $(distdir)/src/compat - mkdir -p $(distdir)/src/util - mkdir -p $(distdir)/src/gldns - mkdir -p $(distdir)/src/tls/validator - mkdir -p $(distdir)/src/gnutls - mkdir -p $(distdir)/src/openssl - mkdir -p $(distdir)/src/tools - mkdir -p $(distdir)/src/jsmn - mkdir -p $(distdir)/src/yxml - mkdir -p $(distdir)/src/ssl_dane - mkdir -p $(distdir)/doc - mkdir -p $(distdir)/spec - mkdir -p $(distdir)/spec/example - mkdir -p $(distdir)/stubby - mkdir -p $(distdir)/stubby/src - mkdir -p $(distdir)/stubby/src/yaml - mkdir -p $(distdir)/stubby/doc - mkdir -p $(distdir)/stubby/systemd - mkdir -p $(distdir)/stubby/contrib/upstart - cp $(srcdir)/configure.ac $(distdir) - cp $(srcdir)/configure $(distdir) - cp $(srcdir)/AUTHORS $(distdir) - cp $(srcdir)/ChangeLog $(distdir) - cp $(srcdir)/COPYING $(distdir) - cp $(srcdir)/INSTALL $(distdir) - cp $(srcdir)/LICENSE $(distdir) - cp $(srcdir)/NEWS $(distdir) - cp $(srcdir)/README.md $(distdir) - cp $(srcdir)/Makefile.in $(distdir) - cp $(srcdir)/install-sh $(distdir) - cp $(srcdir)/config.sub $(distdir) - cp $(srcdir)/config.guess $(distdir) - cp $(srcdir)/getdns.pc.in $(distdir) - cp $(srcdir)/getdns_ext_event.pc.in $(distdir) - cp libtool $(distdir) - cp $(srcdir)/ltmain.sh $(distdir) - cp $(srcdir)/m4/*.m4 $(distdir)/m4 - cp $(srcdir)/src/*.in $(distdir)/src - cp $(srcdir)/src/*.[ch] $(distdir)/src - cp $(srcdir)/src/*.symbols $(distdir)/src - cp $(srcdir)/src/extension/*.[ch] $(distdir)/src/extension - cp $(srcdir)/src/extension/*.symbols $(distdir)/src/extension - cp $(srcdir)/src/getdns/*.in $(distdir)/src/getdns - cp $(srcdir)/src/getdns/getdns_*.h $(distdir)/src/getdns - cp $(srcdir)/src/test/Makefile.in $(distdir)/src/test - cp $(srcdir)/src/test/*.[ch] $(distdir)/src/test - cp $(srcdir)/src/test/*.sh $(distdir)/src/test - cp $(srcdir)/src/test/*.good $(distdir)/src/test - cp $(srcdir)/src/compat/*.[ch] $(distdir)/src/compat - cp $(srcdir)/src/util/*.[ch] $(distdir)/src/util - cp -r $(srcdir)/src/util/orig-headers $(distdir)/src/util - cp -r $(srcdir)/src/util/auxiliary $(distdir)/src/util - cp $(srcdir)/src/gldns/*.[ch] $(distdir)/src/gldns - cp $(srcdir)/src/tls/*.[ch] $(distdir)/src/tls - cp $(srcdir)/src/tls/validator/*.[ch] $(distdir)/src/tls/validator - cp $(srcdir)/src/gnutls/*.[ch] $(distdir)/src/gnutls - cp $(srcdir)/src/openssl/*.[ch] $(distdir)/src/openssl - cp $(srcdir)/doc/Makefile.in $(distdir)/doc - cp $(srcdir)/doc/*.in $(distdir)/doc - cp $(srcdir)/doc/manpgaltnames $(distdir)/doc - cp $(srcdir)/spec/*.html $(distdir)/spec - cp $(srcdir)/spec/example/Makefile.in $(distdir)/spec/example - cp $(srcdir)/spec/example/*.[ch] $(distdir)/spec/example - cp $(srcdir)/src/tools/Makefile.in $(distdir)/src/tools - cp $(srcdir)/src/tools/*.[ch] $(distdir)/src/tools - cp $(srcdir)/stubby/stubby.yml.example $(distdir)/stubby - cp $(srcdir)/stubby/macos/stubby-setdns-macos.sh $(distdir)/stubby - cp $(srcdir)/stubby/src/*.[ch] $(distdir)/stubby/src - cp $(srcdir)/stubby/src/yaml/*.[ch] $(distdir)/stubby/src/yaml - cp $(srcdir)/stubby/COPYING $(distdir)/stubby - cp $(srcdir)/stubby/README.md $(distdir)/stubby - cp $(srcdir)/stubby/doc/stubby.1.in $(distdir)/stubby/doc - cp $(srcdir)/stubby/systemd/README.md $(distdir)/stubby/systemd - cp $(srcdir)/stubby/systemd/stubby.conf $(distdir)/stubby/systemd - cp $(srcdir)/stubby/systemd/stubby.service $(distdir)/stubby/systemd - cp $(srcdir)/stubby/contrib/upstart/stubby.conf $(distdir)/stubby/contrib/upstart - cp $(srcdir)/src/jsmn/*.[ch] $(distdir)/src/jsmn - cp $(srcdir)/src/jsmn/LICENSE $(distdir)/src/jsmn - cp $(srcdir)/src/jsmn/README.md $(distdir)/src/jsmn - cp $(srcdir)/src/yxml/*.[ch] $(distdir)/src/yxml - cp $(srcdir)/src/yxml/COPYING $(distdir)/src/yxml - cp $(srcdir)/src/yxml/yxml.pod $(distdir)/src/yxml - cp $(srcdir)/src/ssl_dane/danessl.[ch] $(distdir)/src/ssl_dane - cp $(srcdir)/src/ssl_dane/README.md $(distdir)/src/ssl_dane - rm -f $(distdir)/Makefile $(distdir)/src/Makefile $(distdir)/src/getdns/getdns.h $(distdir)/spec/example/Makefile $(distdir)/src/test/Makefile $(distdir)/doc/Makefile $(distdir)/src/config.h - -distcheck: $(distdir).tar.gz - gzip -cd $(distdir).tar.gz | tar xvf - - cd $(distdir) && ./configure - cd $(distdir) && $(MAKE) all - cd $(distdir) && $(MAKE) check - cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst install - cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst uninstall - @remaining="`find $${PWD}/$(distdir)/_inst -type f | wc -l`"; \ - if test "$${remaining}" -ne 0; then - echo "@@@ $${remaining} file(s) remaining in stage directory!"; \ - exit 1; \ - fi - cd $(distdir) && $(MAKE) clean - rm -rf $(distdir) - @echo "*** Package $(distdir).tar.gz is ready for distribution" - -getdns.pc: $(srcdir)/getdns.pc.in - ./config.status $@ - -getdns_ext_event.pc: $(srcdir)/getdns_ext_event.pc.in - ./config.status $@ - -Makefile: $(srcdir)/Makefile.in config.status - ./config.status $@ - -configure.status: configure - ./config.status --recheck - -.PHONY: all distclean clean default doc test -FORCE: diff --git a/README.md b/README.md index c777f507..a388e060 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,10 @@ Obtaining and getting started with getdns ========================================= The project home page at [getdnsapi.net](https://getdnsapi.net) provides documentation, binary downloads, and news regarding the getdns API implementation. This README file captures the goals and direction of the project and the current state of the implementation. -If you are just getting started with the library take a look at the section below that describes building and handling external dependencies for the library. +If you are just getting started with the library take a look at the section below that describes building and handling external dependencies for the library. ### Examples -Once it is built you should take a look at src/examples to see how the library is used. +Once it is built you should take a look at `spec/example` to see how the library is used. # Download @@ -50,7 +50,7 @@ or from [getdnsapi.net](https://getdnsapi.net) and verify the download using the checksums (SHA1 or MD5) or using gpg to verify the signature. Our keys are available from the [pgp keyservers](https://keyserver.pgp.com) -* willem@nlnetlabs.nl, key id E5F8F8212F77A498 +* `willem@nlnetlabs.nl`, key id E5F8F8212F77A498 # Releases @@ -59,68 +59,96 @@ approach. The code is currently under active development. The following requirements were met as conditions for the present release: -* code compiles cleanly on at least the primary target platforms: OSX, RHEL/CentOS Linux, FreeBSD +* code compiles cleanly on at least the primary target platforms: OSX, Linux (RHEL/CentOS, Ubuntu), FreeBSD * examples must compile and run cleanly * there must be clear documentation of supported and unsupported elements of the API -# Building and External Dependencies +# External Dependencies -If you are installing from packages, you have to install the library and also the library-devel (or -dev) for your package management system to get the the necessary compile time files. +If you are installing from packages, you have to install the library and also the library-devel (or -dev) for your package management system to get the the necessary compile time files. -External dependencies are linked outside the getdns API build tree (we rely on configure to find them). We would like to keep the dependency tree short. Please refer to section for building on Windows for separate dependency and build instructions for that platform. +External dependencies are linked outside the getdns API build tree (we rely on CMake to find them). We would like to keep the dependency tree short, see [Minimising Dependancies](#minimizing-dependancies) for more details. -* [libunbound from NLnet Labs](https://unbound.net/) version 1.4.16 or later. -* [libidn from the FSF](https://www.gnu.org/software/libidn/) version 1 or 2 (from version 2.0.0 and higher). (Note that the libidn version means the conversions between A-labels and U-labels may permit conversion of formally invalid labels under IDNA2008.) -* [libssl and libcrypto from the OpenSSL Project](https://www.openssl.org/) version 0.9.7 or later. (Note: version 1.0.1 or later is required for TLS support, version 1.0.2 or later is required for TLS hostname authentication) -* Doxygen is used to generate documentation; while this is not technically necessary for the build it makes things a lot more pleasant. +Required for all builds: -For example, to build on a recent version of Ubuntu, you would need the following packages: +* [libssl and libcrypto from the OpenSSL Project](https://www.openssl.org/) version 1.0.2 or later. Using OpenSSL 1.1 is recommended due to TSL 1.3 support. - # apt install build-essential libunbound-dev libidn2-dev libssl-dev libtool m4 autoconf +Required for all builds that include recursive functionality: + +* [libunbound from NLnet Labs](https://unbound.net/) version 1.5.9 or later. (Note: linking to libunbound is not yet supported on Windows, see [Windows 10](#microsoft-windows-10)) + +Required for all builds that include IDN functionality: + +* [libidn2 from the FSF](https://www.gnu.org/software/libidn/) version 2.0.0 and higher. + +Required to build the documentation: + +* [Doxygen](http://www.doxygen.nl) is used to generate documentation; while this is not technically necessary for the build it makes things a lot more pleasant. + +For example, to build on Ubuntu 18.04 or later, you would need the following packages for a full build: + + # apt install build-essential libunbound-dev libidn2-dev libssl-dev cmake + +# Building If you are building from git, you need to do the following before building: - # git submodule update --init - # libtoolize -ci # (use glibtoolize for OS X, libtool is installed as glibtool to avoid name conflict on OS X) - # autoreconf -fi +From release 1.6.0 getdns uses CMake (previous versions used autoconf/libtool). To build from this release and later use: + # cmake . + # make -As well as building the getdns library three other tools may be installed: +If you are unfamiliar with CMake, see our [CMake Quick Start](https://getdnsapi.net/quick-start/cmake-quick-start/) for how to use CMake options to customise the getdns build. -* getdns_query: a command line test script wrapper for getdns -* stubby: an experimental DNS Privacy enabled client +As well as building the getdns library two other tools are installed by default: + +* getdns_query: a command line test script wrapper for getdns. This can be used to quickly check the functionality of the library, see (#using-getdnsquery) * getdns_server_mon: test DNS server function and capabilities -Note: If you only want to build stubby, then use the `--with-stubby` option when running 'configure'. +Additionally `Stubby` a DNS Privacy enabled client can also be built and installed by using the `BUILD_STUBBY` option when running `cmake`, see [Stubby](#stubby). ## Minimizing dependencies -* getdns can be configured for stub resolution mode only with the `--enable-stub-only` option to configure. This removes the dependency on `libunbound`. -* Currently getdns only offers two helper functions to deal with IDN: `getdns_convert_ulabel_to_alabel` and `getdns_convert_alabel_to_ulabel`. If you do not need these functions, getdns can be configured to compile without them with the `--without-libidn` and `--without-libidn2` options to configure. -* When `--enable-stub-only`, `--without-libidn` and `--without-libidn2` options are used, getdns has only one dependency left, which is OpenSSL. +* getdns can be configured for stub resolution mode only with the `ENABLE_STUB_ONLY` option to `cmake`. This removes the dependency on `libunbound`. +* Currently getdns only offers two helper functions to deal with IDN: `getdns_convert_ulabel_to_alabel` and `getdns_convert_alabel_to_ulabel`. If you do not need these functions, getdns can be configured to compile without them by setting the`USE_LIBIDN2` option to `cmake` to OFF. +* When `ENABLE_STUB_ONLY` is ON, and `USE_LIBIDN2` is OFF, getdns has only one dependency left, which is OpenSSL. ## Extensions and Event loop dependencies The implementation works with a variety of event loops, each built as a separate shared library. See [this Doxygen page](https://getdnsapi.net/doxygen/group__eventloops.html) and [this man page](https://getdnsapi.net/documentation/manpages/#ASYNCHRONOUS USE) for more details. -* [libevent](http://libevent.org). Note: the examples *require* this and should work with either libevent 1.x or 2.x. 2.x is preferred. -* [libuv](https://github.com/joyent/libuv) +* [libevent](http://libevent.org). Note: the examples *require* this. libevent 2.x is required. +* [libuv](https://libuv.org/) * [libev](http://software.schmorp.de/pkg/libev.html) +## Using getdns_query + +Example test queries using `getdns_query` (pointed at Google Public DNS) and requesting the `call_reporting` extension which provides information on the transport and query time: + + getdns_query -s example.com A @8.8.8.8 +return_call_reporting (UDP) + getdns_query -s example.com A @8.8.8.8 -T +return_call_reporting (TCP) + getdns_query -s example.com A @8.8.8.8 -L +return_call_reporting (TLS without authentication) + getdns_query -s getdnsapi.net A +dnssec_return_status +return_call_reporting (DNSSEC) + ## Stubby -* Stubby is an experimental implementation of a DNS Privacy enabled stub resolver than encrypts DNS queries using TLS. It is currently suitable for advanced/technical users - all feedback is welcome! +* Stubby is an implementation of a DNS Privacy enabled stub resolver that encrypts DNS queries using TLS. It is currently suitable for advanced/technical users - all feedback is welcome! * Details on how to use Stubby can be found in the [Stubby Reference Guide](https://dnsprivacy.org/wiki/x/JYAT). * Also see [dnsprivacy.org](https://dnsprivacy.org) for more information on DNS Privacy. +## Experimental support for GnuTLS + +A project to allow user selection of either OpenSSL or GnuTLS is currently a work in progress. At present a user may select to use GnuTLS for the majority of the supported functionality, however, OpenSSL is still required for some cryptographic functions. + ## Regression Tests A suite of regression tests are included with the library, if you make changes or just want to sanity check things on your system take a look at src/test. You will need to install [libcheck](https://libcheck.github.io/check/). The check library is also available from many of the package repositories for the more popular operating systems. +Note: The tests currently do not run on Windows because of a dependancy on bash. ## DNSSEC dependencies @@ -130,7 +158,7 @@ The library will try to load the root trust anchor from or more `DS` or `DNSKEY` resource records in presentation (i.e. zone file) format. Note that this is different than the format of BIND.keys. -##$ Zero configuration DNSSEC +## Zero configuration DNSSEC When the root trust anchor is not installed in the default location and a DNSSEC query is done, getdns will try to use the trust anchors published here: http://data.iana.org/root-anchors/root-anchors.xml . It will validate these anchors with the ICANN Certificate Authority certificate following the procedure described in [RFC7958]. @@ -146,9 +174,7 @@ Support ## Mailing lists -We have a [getdns users list](https://getdnsapi.net/mailman/listinfo/users) for this implementation. - -The [getdns-api mailing list](https://getdnsapi.net/mailman/listinfo/spec) is a good place to engage in discussions regarding the design of the API. +We have a [getdns users list](https://lists.getdnsapi.net/mailman/listinfo/users) for this implementation. ## Tickets and Bug Reports @@ -162,8 +188,8 @@ Features of this release The goals of this implementation of the getdns API are: * Provide an open source implementation, in C, of the formally described getdns API by getdns API team at -* Support FreeBSD, OSX, Linux (CentOS/RHEL, Ubuntu) via functional "configure" script -* Support Windows 8.1 +* Support FreeBSD, OSX, Linux (CentOS/RHEL, Ubuntu) +* Support Windows 10 * Include examples and tests as part of the build * Document code using doxygen * Leverage github as much as possible for project coordination @@ -204,69 +230,37 @@ Stub mode does not support: # Supported Platforms -The primary platforms targeted are Linux and FreeBSD, other platform are supported as we get time. The names listed here are intended to help ensure that we catch platform specific breakage, not to limit the work that folks are doing. +The platforms listed here are intended to help ensure that we catch platform specific breakage prior to release. -* RHEL/CentOS 6.4 -* OSX 10.8 -* Ubuntu 16.04 -* Microsoft Windows 8.1 - -We intend to add Android and other platforms to future releases as we have time to port it. +* Ubuntu 18.04 LTS and newer LTS releases +* Microsoft Windows 10 +* FreeBSD 11.3 and newer +* RHEL/CentOS 8 +* OSX 10.14 and 10.15 -## Platform Specific Build Reports +### Platform Specific Build Notes [![Build Status](https://travis-ci.org/getdnsapi/getdns.png?branch=master)](https://travis-ci.org/getdnsapi/getdns) -### FreeBSD +## FreeBSD If you're using [FreeBSD](https://www.freebsd.org/), you may install getdns via the [ports tree](https://www.freshports.org/dns/getdns/) by running: `cd /usr/ports/dns/getdns && make install clean` If you are using FreeBSD 10 getdns can be intalled via 'pkg install getdns'. -### CentOS and RHEL 6.5 +## Ubuntu -We rely on the most excellent package manager fpm to build the linux packages, which -means that the packaging platform requires ruby 2.1.0. There are other ways to -build the packages; this is simply the one we chose to use. +getdns should also work on Ubuntu 16.04, however if you require IDN functionality you will have to install a recent version of libidn2 via a ppa e.g. from https://launchpad.net/~ondrej/+archive/ubuntu/php - # cat /etc/redhat-release - CentOS release 6.5 (Final) - # uname -a - Linux host-10-1-1-6 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux - # cd getdns-0.2.0rc1 - # ./configure --prefix=/home/deploy/build - # make; make install - # cd /home/deploy/build - # mv lib lib64 - # . /usr/local/rvm/config/alias - # fpm -x "*.la" -a native -s dir -t rpm -n getdns -v 0.2.0rc1 -d "unbound" -d "libevent" -d "libidn" --prefix /usr --vendor "Verisign Inc., NLnet Labs" --license "BSD New" --url "https://getdnsapi.net" --description "Modern asynchronous API to the DNS" . +You will also have to build Unbound from source code to provide libunbound at version >= 1.5.9. -### OSX +## OSX - # sw_vers - ProductName: Mac OS X - ProductVersion: 10.8.5 - BuildVersion: 12F45 +A self-compiled version of OpenSSL or the version installed via Homebrew is required and the options OPENSSL_ROOT_DIR, OPENSSL_CRYPTO_LIBRARY and OPENSSL_SSL_LIBRARY can be used to specify the location of the libraries. +Note: If using a self-compiled version, manual configuration of certificates into /usr/local/etc/openssl/certs is required for TLS authentication to work. - Built using PackageMaker, libevent2. - - # ./configure --with-libevent --prefix=$HOME/getdnsosx/export - # make - # make install - - edit/fix hardcoded paths in lib/*.la to reference /usr/local - - update getdns.pmdoc to match release info - - build package using PackageMaker - - create dmg - - A self-compiled version of OpenSSL or the version installed via Homebrew is required. - Note: If using a self-compiled version, manual configuration of certificates into /usr/local/etc/openssl/certs is required for TLS authentication to work. - -#### Homebrew +### Homebrew If you're using [Homebrew](http://brew.sh/), you may run `brew install getdns`. By default, this will only build the core library without any 3rd party event loop support. @@ -274,48 +268,37 @@ To install the [event loop integration libraries](https://getdnsapi.net/doxygen/ Note that in order to compile the examples, the `--with-libevent` switch is required. -Additionally, the OpenSSL library installed by Homebrew is linked against. Note that the Homebrew OpenSSL installation clones the Keychain certificates to the default OpenSSL location so TLS certificate authentication should work out of the box. +Additionally, getdns is linked against the the OpenSSL library installed by Homebrew. Note that the Homebrew OpenSSL installation clones the Keychain certificates to the default OpenSSL location so TLS certificate authentication should work out of the box. -### Microsoft Windows 8.1 +## Microsoft Windows 10 -The build has been tested using the following: -32 bit only Mingw: [Mingw(3.21.0) and Msys 1.0](http://www.mingw.org/) on Windows 8.1 -32 bit build on a 64 bit Mingw [Download latest from: http://mingw-w64.org/doku.php/download/mingw-builds and http://msys2.github.io/]. IMPORTANT: Install tested ONLY on the "x86_64" for 64-bit installer of msys2. +You will need CMake for Windows. Installers can be downloaded from https://cmake.org/download/. -#### Dependencies -The following dependencies are -* openssl-1.0.2j -* libidn +Windows versions of the following libraries are available using [the vcpkg package manager](https://docs.microsoft.com/en-us/cpp/build/vcpkg). -Instructions to build openssl-1.0.2j: -Open the mingw32_shell.bat from msys2 in order to build: +* OpenSSL +* libevent +* libiconv (required for libidn2) +* libidn2 +* libyaml +* libuv -If necessary, install the following using pacman: +Once these are installed, set CMake variables CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH to the vcpkg include and library directories e.g. `../vcpkg/installed/x64-windows/include` and `../vcpkg/installed/x64-windows/lib`. - pacman -S pkg-config libtool automake - pacman -S autoconf automake-wrapper +To generate a project suitable for use in Visual Studio, select the appropriate Visual Studio generator in CMake. Once generated, the cmake-gui Open Project button can be used to load the project into Visual Studio. - tar -xvf openssl-1.0.2j.tar - cd openssl-1.0.2j/ - ./Configure --prefix=${LOCALDESTDIR} --openssldir=${LOCALDESTDIR}/etc/ssl --libdir=lib shared zlib-dynamic mingw - make - make install +### Limitations on Windows -To configure: - - ./configure --enable-stub-only --with-trust-anchor="c:\\\MinGW\\\msys\\\1.0\\\etc\\\unbound\\\getdns-root.key" --with-ssl= --with-getdns_query +Full support for Windows is a work in progress. The following limitations will be addresses in future: - The trust anchor is also installed by unbound on `c:\program Files (X86)\unbound\root.key` and can be referenced from there - or anywhere else that the user chooses to configure it. +* At present, no native Windows DLL version of libunbound exists; support for linking against libunbound is not currently available. The default build option for ENABLE_STUB_ONLY_ is ON for Windows. - After configuring, do a `make` and `make install` to build getdns for Windows. +* The getdns unit tests (built with `make test`) require libcheck which is not currently available for Windows and so cannot be built. + +* The getdns tpkg test suite is not currently supported on Windows. + +* The detection of the location of the `/etc/hosts` file should be optimised - it currently assumes Windows is installed in the default directory on the C: drive - Example test queries: - - ./getdns_query.exe -s gmadkat.com A @64.6.64.6 +return_call_reporting (UDP) - ./getdns_query.exe -s gmadkat.com A @64.6.64.6 -T +return_call_reporting (TCP) - ./getdns_query.exe -s gmadkat.com A -l L @185.49.141.37 +return_call_reporting (TLS without authentication) - ./getdns_query.exe -s www.huque.com A +dnssec_return_status +return_call_reporting (DNSSEC) Contributors ============ @@ -368,4 +351,4 @@ Contributors Acknowledgements ================ -The development team explicitly acknowledges Paul Hoffman for his initiative and efforts to develop a consensus based DNS API. We would like to thank the participants of the [mailing list](https://getdnsapi.net/mailman/listinfo/spec) for their contributions. +The development team explicitly acknowledges Paul Hoffman for his initiative and efforts to develop a consensus based DNS API. We would like to thank the participants of the getdns-api mailing list (discontinued) for their contributions. diff --git a/cmake/include/cmakeconfig.h.in b/cmake/include/cmakeconfig.h.in new file mode 100644 index 00000000..834a23cf --- /dev/null +++ b/cmake/include/cmakeconfig.h.in @@ -0,0 +1,528 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#cmakedefine PACKAGE "@PACKAGE@" +#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" +#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" +#cmakedefine PACKAGE_URL "@PACKAGE_URL@" +#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" + +#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" +#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@" + +#cmakedefine HAVE_ASSERT_H 1 +#cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_LIMITS_H 1 +#cmakedefine HAVE_SYS_LIMITS_H 1 +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_STDIO_H 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_TIME_H 1 +#cmakedefine HAVE_UNISTD_H 1 + +#cmakedefine HAVE_FCNTL_H 1 + +#cmakedefine HAVE_SIGNAL_H 1 +#cmakedefine HAVE_SYS_POLL_H 1 +#cmakedefine HAVE_POLL_H 1 +#cmakedefine HAVE_RESOURCE_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_SYS_STAT_H 1 + +#cmakedefine HAVE_ENDIAN_H 1 +#cmakedefine HAVE_NETDB_H 1 +#cmakedefine HAVE_ARPA_INET_H 1 +#cmakedefine HAVE_NETINET_IN_H 1 +#cmakedefine HAVE_NETINET_TCP_H 1 +#cmakedefine HAVE_SYS_SELECT_H 1 +#cmakedefine HAVE_SYS_SOCKET_H 1 +#cmakedefine HAVE_SYS_SYSCTL_H 1 +#cmakedefine HAVE_SYS_TIME_H 1 +#cmakedefine HAVE_SYS_WAIT_H 1 + +#cmakedefine HAVE_WINDOWS_H 1 +#cmakedefine HAVE_WINSOCK_H 1 +#cmakedefine HAVE_WINSOCK2_H 1 +#cmakedefine HAVE_WS2TCPIP_H 1 +#cmakedefine GETDNS_ON_WINDOWS 1 +#cmakedefine USE_WINSOCK 1 + +#cmakedefine HAVE_SSL 1 +#cmakedefine USE_DANESSL 1 + +#cmakedefine HAVE_OPENSSL_SSL_H 1 +#cmakedefine HAVE_OPENSSL_EVP_H 1 +#cmakedefine HAVE_OPENSSL_ERR_H 1 +#cmakedefine HAVE_OPENSSL_RAND_H 1 +#cmakedefine HAVE_OPENSSL_CONF_H 1 +#cmakedefine HAVE_OPENSSL_ENGINE_H 1 + +#cmakedefine HAVE_DSA_SIG_SET0 1 +#cmakedefine HAVE_DSA_SET0_PQG 1 +#cmakedefine HAVE_DSA_SET0_KEY 1 + +#cmakedefine HAVE_RSA_SET0_KEY 1 + +#cmakedefine HAVE_EVP_MD5 1 +#cmakedefine HAVE_EVP_SHA1 1 +#cmakedefine HAVE_EVP_SHA224 1 +#cmakedefine HAVE_EVP_SHA256 1 +#cmakedefine HAVE_EVP_SHA384 1 +#cmakedefine HAVE_EVP_SHA512 1 + +#cmakedefine HAVE_EVP_DSS1 1 +#cmakedefine HAVE_EVP_DIGESTVERIFY 1 + +#cmakedefine HAVE_EVP_MD_CTX_NEW 1 + +#cmakedefine HAVE_HMAC_CTX_NEW 1 + +#cmakedefine HAVE_NETTLE_GET_SECP_256R1 1 +#cmakedefine HAVE_NETTLE_GET_SECP_384R1 1 + +#cmakedefine HAVE_TLS_CLIENT_METHOD 1 + +#cmakedefine HAVE_OPENSSL_VERSION_NUM 1 +#cmakedefine HAVE_OPENSSL_VERSION 1 + +#cmakedefine HAVE_SSL_CTX_DANE_ENABLE 1 +#cmakedefine HAVE_SSL_CTX_SET_CIPHERSUITS 1 +#cmakedefine HAVE_SSL_SET_CIPHERSUITS 1 + +#cmakedefine HAVE_OPENSSL_INIT_CRYPTO 1 + +#cmakedefine HAVE_SSL_DANE_ENABLE 1 +#cmakedefine HAVE_DECL_SSL_CTX_SET1_CURVES_LIST 1 +#cmakedefine HAVE_DECL_SSL_SET1_CURVES_LIST 1 +#cmakedefine HAVE_DECL_SSL_SET_MIN_PROTO_VERSION 1 +#cmakedefine HAVE_X509_GET_NOTAFTER 1 +#cmakedefine HAVE_X509_GET0_NOTAFTER 1 + +#cmakedefine HAVE_PTHREAD 1 +#cmakedefine HAVE_WINDOWS_THREADS 1 + +#cmakedefine RUNSTATEDIR "@RUNSTATEDIR@" +#cmakedefine TRUST_ANCHOR_FILE "@PATH_TRUST_ANCHOR_FILE@" +#cmakedefine GETDNS_FN_RESOLVCONF "@PATH_RESOLVCONF@" +#cmakedefine GETDNS_FN_HOSTS "@PATH_HOSTS@" + +#cmakedefine DNSSEC_ROADBLOCK_AVOIDANCE 1 +#cmakedefine HAVE_MDNS_SUPPORT 1 +#cmakedefine STUB_NATIVE_DNSSEC 1 +#cmakedefine MAXIMUM_UPSTREAM_OPTION_SPACE @MAXIMUM_UPSTREAM_OPTION_SPACE@ +#cmakedefine EDNS_PADDING_OPCODE @EDNS_PADDING_OPCODE@ +#cmakedefine MAX_CNAME_REFERRALS @MAX_CNAME_REFERRALS@ +#cmakedefine DRAFT_RRTYPES @DRAFT_RRTYPES@ +#cmakedefine EDNS_COOKIES 1 +#cmakedefine EDNS_COOKIE_OPCODE @EDNS_COOKIE_OPCODE@ +#cmakedefine EDNS_COOKIE_ROLLOVER_TIME @EDNS_COOKIE_ROLLOVER_TIME@ +#cmakedefine UDP_MAX_BACKOFF @MAX_UDP_BACKOFF@ + +#cmakedefine HAVE_DECL_GETENTROPY 1 +#cmakedefine HAVE_DECL_INET_PTON 1 +#cmakedefine HAVE_DECL_INET_NTOP 1 +#cmakedefine HAVE_WIN_DECL_INET_PTON 1 +#cmakedefine HAVE_WIN_DECL_INET_NTOP 1 +#cmakedefine HAVE_DECL_MKSTEMP 1 +#cmakedefine HAVE_DECL_SIGEMPTYSET 1 +#cmakedefine HAVE_DECL_SIGFILLSET 1 +#cmakedefine HAVE_DECL_SIGADDSET 1 +#cmakedefine HAVE_DECL_STRPTIME 1 + +#cmakedefine HAVE_DECL_TCP_FASTOPEN 1 +#cmakedefine HAVE_DECL_TCP_FASTOPEN_CONNECT 1 +#cmakedefine HAVE_DECL_MSG_FASTOPEN 1 + +#if defined(HAVE_DECL_INET_PTON) || defined(HAVE_WIN_DECL_INET_PTON) +#undef HAVE_DECL_INET_PTON +#define HAVE_DECL_INET_PTON 1 +#endif +#if defined(HAVE_DECL_INET_NTOP) || defined(HAVE_WIN_DECL_INET_NTOP) +#undef HAVE_DECL_INET_NTOP +#define HAVE_DECL_INET_NTOP 1 +#endif + +#cmakedefine HAVE_FCNTL 1 +#cmakedefine HAVE_GETTIMEOFDAY 1 +#cmakedefine HAVE_IOCTLSOCKET 1 +#cmakedefine HAVE_SIGEMPTYSET 1 +#cmakedefine HAVE_SIGFILLSET 1 +#cmakedefine HAVE_SIGADDSET 1 +#cmakedefine HAVE_STRPTIME 1 + +#cmakedefine HAVE_SIGSET_T 1 +#cmakedefine HAVE__SIGSET_T 1 + +#cmakedefine HAVE_BSD_STDLIB_H 1 +#cmakedefine HAVE_BSD_STRING_H 1 + +#cmakedefine HAVE_DECL_STRLCPY 1 +#cmakedefine HAVE_DECL_ARC4RANDOM 1 +#cmakedefine HAVE_DECL_ARC4RANDOM_UNIFORM 1 +#cmakedefine HAVE_BSD_DECL_STRLCPY 1 +#cmakedefine HAVE_BSD_DECL_ARC4RANDOM 1 +#cmakedefine HAVE_BSD_DECL_ARC4RANDOM_UNIFORM 1 + +#cmakedefine HAVE_STRLCPY 1 +#cmakedefine HAVE_ARC4RANDOM 1 +#cmakedefine HAVE_ARC4RANDOM_UNIFORM 1 + +#cmakedefine HAVE_LIBUNBOUND 1 +#cmakedefine HAVE_UNBOUND_EVENT_H 1 +#cmakedefine HAVE_UNBOUND_EVENT_API 1 +#cmakedefine HAVE_UB_CTX_SET_STUB 1 + +#cmakedefine HAVE_LIBIDN 1 +#cmakedefine HAVE_LIBIDN2 1 + +#cmakedefine HAVE_NETTLE 1 +#cmakedefine HAVE_NETTLE_DSA_COMPAT_H 1 +#cmakedefine HAVE_NETTLE_EDDSA_H 1 + +#cmakedefine HAVE_EVENT2_EVENT_H 1 +#cmakedefine HAVE_EVENT_BASE_NEW 1 +#cmakedefine HAVE_EVENT_BASE_FREE 1 + +#cmakedefine DEFAULT_EVENTLOOP "@DEFAULT_EVENTLOOP@" +#cmakedefine USE_POLL_DEFAULT_EVENTLOOP 1 + +#cmakedefine STRPTIME_WORKS 1 + +#cmakedefine FD_SETSIZE @FD_SETSIZE@ + +#cmakedefine REQ_DEBUG 1 +#cmakedefine SCHED_DEBUG 1 +#cmakedefine STUB_DEBUG 1 +#cmakedefine DAEMON_DEBUG 1 +#cmakedefine SEC_DEBUG 1 +#cmakedefine SERVER_DEBUG 1 +#cmakedefine ANCHOR_DEBUG 1 +#cmakedefine KEEP_CONNECTIONS_OPEN_DEBUG 1 + +#cmakedefine USE_SHA1 1 +#cmakedefine USE_SHA2 1 +#cmakedefine USE_GOST 1 +#cmakedefine USE_ECDSA 1 +#cmakedefine USE_DSA 1 +#cmakedefine USE_ED25519 1 +#cmakedefine USE_ED448 1 + +#cmakedefine USE_OSX_TCP_FASTOPEN 1 + +#cmakedefine HAVE_NEW_UV_TIMER_CB 1 + +#cmakedefine HAVE_TARGET_ENDIANNESS +#cmakedefine TARGET_IS_BIG_ENDIAN + +#cmakedefine HAVE___FUNC__ 1 + +#ifdef HAVE___FUNC__ +#define __FUNC__ __func__ +#else +#define __FUNC__ __FUNCTION__ +#endif + +#ifdef GETDNS_ON_WINDOWS + /* On windows it is allowed to increase the FD_SETSIZE + * (and nescessary to make our custom eventloop work) + * See: https://support.microsoft.com/en-us/kb/111855 + */ +# ifndef FD_SETSIZE +# define FD_SETSIZE 1024 +# endif + +/* the version of the windows API enabled */ +# ifndef WINVER +# define WINVER 0x0600 // 0x0502 +# endif +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 // 0x0502 +# endif +# ifdef HAVE_WS2TCPIP_H +# include +# endif + +# ifdef _MSC_VER +# if _MSC_VER >= 1800 +# define PRIsz "zu" +# else +# define PRIsz "Iu" +# endif +# include + typedef SSIZE_T ssize_t; +# else +# define PRIsz "Iu" +# endif + +# ifdef HAVE_WINSOCK2_H +# include +# endif + +/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */ +# ifdef HAVE_WINSOCK2_H +# define FD_SET_T (u_int) +# else +# define FD_SET_T +# endif + + /* Windows wants us to use _strdup instead of strdup */ +# ifndef strdup +# define strdup _strdup +# endif + +/* Windows doesn't have strcasecmp and strncasecmp. */ +# define strcasecmp _stricmp +# define strncasecmp _strnicmp +#else +# define PRIsz "zu" +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_ASSERT_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_BSD_STDLIB_H +#include +#endif + +#ifdef HAVE_BSD_STRING_H +#include +#endif + +#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY || !defined(strlcpy) +size_t strlcpy(char *dst, const char *src, size_t siz); +#else +#ifndef __BSD_VISIBLE +#define __BSD_VISIBLE 1 +#endif +#endif +#if !defined(HAVE_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM +uint32_t arc4random(void); +#endif +#if !defined(HAVE_ARC4RANDOM_UNIFORM) || !HAVE_DECL_ARC4RANDOM_UNIFORM +uint32_t arc4random_uniform(uint32_t upper_bound); +#endif +#ifndef HAVE_ARC4RANDOM +void explicit_bzero(void* buf, size_t len); +int getentropy(void* buf, size_t len); +void arc4random_buf(void* buf, size_t n); +void _ARC4_LOCK(void); +void _ARC4_UNLOCK(void); +#endif +#ifdef COMPAT_SHA512 +#ifndef SHA512_DIGEST_LENGTH +#define SHA512_BLOCK_LENGTH 128 +#define SHA512_DIGEST_LENGTH 64 +#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) +typedef struct _SHA512_CTX { + uint64_t state[8]; + uint64_t bitcount[2]; + uint8_t buffer[SHA512_BLOCK_LENGTH]; +} SHA512_CTX; +#endif /* SHA512_DIGEST_LENGTH */ +void SHA512_Init(SHA512_CTX*); +void SHA512_Update(SHA512_CTX*, void*, size_t); +void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); +unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest); +#endif /* COMPAT_SHA512 */ + +#ifdef USE_WINSOCK +# ifndef _CUSTOM_VSNPRINTF +# define _CUSTOM_VSNPRINTF +static inline int _gldns_custom_vsnprintf(char *str, size_t size, const char *format, va_list ap) +{ int r = vsnprintf(str, size, format, ap); return r == -1 ? _vscprintf(format, ap) : r; } +# define vsnprintf _gldns_custom_vsnprintf +# endif +#endif + +#ifdef __cplusplus +} +#endif + +/** Use on-board gldns */ +#define USE_GLDNS 1 +#ifdef HAVE_SSL +# define GLDNS_BUILD_CONFIG_HAVE_SSL 1 +#endif + +#ifdef HAVE_STDARG_H +#include +#endif + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_NETINET_TCP_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_SIGNAL_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#ifdef HAVE_LIMITS_H +#include +#endif + +#ifdef HAVE_SYS_LIMITS_H +#include +#endif + +#ifdef PATH_MAX +#define _GETDNS_PATH_MAX PATH_MAX +#else +#define _GETDNS_PATH_MAX 2048 +#endif + +#ifndef PRIu64 +#define PRIu64 "llu" +#endif + +#ifdef HAVE_ATTR_FORMAT +# define ATTR_FORMAT(archetype, string_index, first_to_check) \ + __attribute__ ((format (archetype, string_index, first_to_check))) +#else /* !HAVE_ATTR_FORMAT */ +# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ +#endif /* !HAVE_ATTR_FORMAT */ + +#if defined(DOXYGEN) +# define ATTR_UNUSED(x) x +#elif defined(__cplusplus) +# define ATTR_UNUSED(x) +#elif defined(HAVE_ATTR_UNUSED) +# define ATTR_UNUSED(x) x __attribute__((unused)) +#else /* !HAVE_ATTR_UNUSED */ +# define ATTR_UNUSED(x) x +#endif /* !HAVE_ATTR_UNUSED */ + +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS) +#define strptime unbound_strptime +struct tm; +char *strptime(const char *s, const char *format, struct tm *tm); +#endif + +#if !defined(HAVE_SIGSET_T) && defined(HAVE__SIGSET_T) +typedef _sigset_t sigset_t; +#endif +#if !defined(HAVE_SIGEMPTYSET) +# define sigemptyset(pset) (*(pset) = 0) +#endif +#if !defined(HAVE_SIGFILLSET) +# define sigfillset(pset) (*(pset) = (sigset_t)-1) +#endif +#if !defined(HAVE_SIGADDSET) +# define sigaddset(pset, num) (*(pset) |= (1L<<(num))) +#endif + +#ifdef HAVE_LIBUNBOUND +# include +# ifdef HAVE_UNBOUND_EVENT_H +# include +# else +# ifdef HAVE_UNBOUND_EVENT_API +# ifndef _UB_EVENT_PRIMITIVES +# define _UB_EVENT_PRIMITIVES +struct ub_event_base; +struct ub_ctx* ub_ctx_create_ub_event(struct ub_event_base* base); +typedef void (*ub_event_callback_t)(void*, int, void*, int, int, char*); +int ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype, + int rrclass, void* mydata, ub_event_callback_t callback, int* async_id); +# endif +# endif +# endif +#endif + +#ifndef HAVE_DECL_INET_PTON +int inet_pton(int af, const char* src, void* dst); +#endif + +#ifndef HAVE_DECL_INET_NTOP +const char *inet_ntop(int af, const void *src, char *dst, size_t size); +#endif + +#ifndef HAVE_DECL_MKSTEMP +int mkstemp(char *template); +#endif + +#ifndef HAVE_GETTIMEOFDAY +int gettimeofday(struct timeval* tv, void* tz); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CONFIG_H */ diff --git a/cmake/include/getdns_shared_version.rc.in b/cmake/include/getdns_shared_version.rc.in new file mode 100644 index 00000000..d69a36d6 --- /dev/null +++ b/cmake/include/getdns_shared_version.rc.in @@ -0,0 +1,19 @@ +1 VERSIONINFO + FILEVERSION @version_current@,@version_revision@,@version_age@,0 + PRODUCTVERSION @version_current@,@version_revision@,0,0 + FILEOS 4 + FILETYPE 2 + FILESUBTYPE 0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "getdns project\0" + VALUE "ProductName", "getdns\0" + VALUE "FileVersion", "@version_current@.@version_revision@\0" + VALUE "ProductVersion", "@version_current@.@version_revision@\0" + VALUE "LegalCopyright", "NLnet Labs, Sinodun, No Mountain Software. New BSD licence.\0" + END + END +END diff --git a/cmake/modules/FindCheck.cmake b/cmake/modules/FindCheck.cmake new file mode 100644 index 00000000..81872b8b --- /dev/null +++ b/cmake/modules/FindCheck.cmake @@ -0,0 +1,98 @@ +#[=======================================================================[.rst: +FindCheck +-------- + +Find the Check (Unit Testing Framework for C) library + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Check::Check`` + The Check library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``Check_FOUND`` + If false, do not try to use Check. +``CHECK_INCLUDE_DIR`` + where to find check.h, etc. +``CHECK_LIBRARIES`` + the libraries needed to use Check. +``CHECK_VERSION`` + the version of the Check library found + +#]=======================================================================] + +find_path(CHECK_INCLUDE_DIR check.h + HINTS + "${CHECK_DIR}" + "${CHECK_DIR}/include" + ) + +# Check for PIC and non-PIC libraries. If PIC present, use that +# in preference (as per Debian check.pc). +find_library(CHECK_LIBRARY NAMES check_pic libcheck_pic + HINTS + "${CHECK_DIR}" + "${CHECK_DIR}/lib" + ) + +if (NOT CHECK_LIBRARY) + find_library(CHECK_LIBRARY NAMES check libcheck + HINTS + "${CHECK_DIR}" + "${CHECK_DIR}/lib" + ) +endif () + +set(CHECK_LIBRARIES "") + +# Check may need the math, subunit and rt libraries on Unix +if (UNIX) + find_library(CHECK_MATH_LIBRARY m) + find_library(CHECK_RT_LIBRARY rt) + find_library(CHECK_SUBUNIT_LIBRARY subunit) + + if (CHECK_MATH_LIBRARY) + list(APPEND CHECK_LIBRARIES "${CHECK_MATH_LIBRARY}") + endif () + if (CHECK_RT_LIBRARY) + list(APPEND CHECK_LIBRARIES "${CHECK_RT_LIBRARY}") + endif () + if (CHECK_SUBUNIT_LIBRARY) + list(APPEND CHECK_LIBRARIES "${CHECK_SUBUNIT_LIBRARY}") + endif () +endif() + +if (CHECK_INCLUDE_DIR AND CHECK_LIBRARY) + if (NOT TARGET Check::Check) + add_library(Check::Check UNKNOWN IMPORTED) + set_target_properties(Check::Check PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CHECK_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${CHECK_LIBRARIES}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${CHECK_LIBRARY}" + ) + endif () + + if (NOT CHECK_VERSION AND CHECK_INCLUDE_DIR AND EXISTS "${CHECK_INCLUDE_DIR}/check.h") + file(STRINGS "${CHECK_INCLUDE_DIR}/check.h" CHECK_H REGEX "^#define CHECK_M[A-Z]+_VERSION") + string(REGEX REPLACE "^.*\(([0-9]+)\).*\(([0-9]+)\).*\(([0-9]+)\).*$" "\\1.\\2.\\3" CHECK_VERSION "${CHECK_H}") + endif () +endif() + +list(APPEND CHECK_LIBRARIES "${CHECK_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Check + REQUIRED_VARS CHECK_LIBRARIES CHECK_INCLUDE_DIR + VERSION_VAR CHECK_VERSION + ) + +mark_as_advanced(CHECK_INCLUDE_DIR CHECK_LIBRARIES CHECK_LIBRARY + CHECK_MATH_LIBRARY CHECK_RT_LIBRARY CHECK_SUBUNIT_LIBRARY) diff --git a/cmake/modules/FindGnuTLS.cmake b/cmake/modules/FindGnuTLS.cmake new file mode 100644 index 00000000..961aa088 --- /dev/null +++ b/cmake/modules/FindGnuTLS.cmake @@ -0,0 +1,85 @@ +#[=======================================================================[.rst: +FindGnuTLS +---------- + +Find the GnuTLS library. + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``GnuTLS::GnuTLS`` + The GnuTLS library, if found. +``GnuTLS::Dane`` + The GnuTLS DANE library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``GnuTLS_FOUND`` + If false, do not try to use GnuTLS. +``GNUTLS_INCLUDE_DIR`` + where to find GnuTLS headers. +``GNUTLS_LIBRARIES`` + the libraries needed to use GnuTLS. +``GNUTLS_VERSION`` + the version of the GnuTLS library found + +#]=======================================================================] + +find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h + HINTS + "${GNUTLS_DIR}" + "${GNUTLS_DIR}/include" +) + +find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls + HINTS + "${GNUTLS_DIR}" + "${GNUTLS_DIR}/lib" +) + +find_library(GNUTLS_DANE_LIBRARY NAMES gnutls-dane libgnutls-dane + HINTS + "${GNUTLS_DIR}" + "${GNUTLS_DIR}/lib" +) + +set(GNUTLS_LIBRARIES "") + +if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY AND GNUTLS_DANE_LIBRARY) + if (NOT TARGET GnuTLS::GnuTLS) + add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED) + set_target_properties(GnuTLS::GnuTLS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${GNUTLS_LIBRARY}" + ) + endif () + if (NOT TARGET GnuTLS::Dane) + add_library(GnuTLS::Dane UNKNOWN IMPORTED) + set_target_properties(GnuTLS::Dane PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${GNUTLS_DANE_LIBRARY}" + ) + endif () + + if (NOT GNUTLS_VERSION AND GNUTLS_INCLUDE_DIR) + file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VER_H REGEX "^#define GNUTLS_VERSION_(MAJOR|MINOR|PATCH) ") + string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3c" GNUTLS_VERSION "${GNUTLS_VER_H}") + endif () +endif() + +list(APPEND GNUTLS_LIBRARIES "${GNUTLS_LIBRARY}" "${GNUTLS_DANE_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GnuTLS + REQUIRED_VARS GNUTLS_LIBRARIES GNUTLS_INCLUDE_DIR + VERSION_VAR GNUTLS_VERSION + ) + +mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARIES GNUTLS_LIBRARY GNUTLS_DANE_LIBRARY) diff --git a/cmake/modules/FindLibev.cmake b/cmake/modules/FindLibev.cmake new file mode 100644 index 00000000..b84a7f47 --- /dev/null +++ b/cmake/modules/FindLibev.cmake @@ -0,0 +1,63 @@ +#[=======================================================================[.rst: +FindLibev +--------- + +Find the Libev library. + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Libev::Libev`` + The Libev library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``Libev_FOUND`` + If false, do not try to use Libev. +``LIBEV_INCLUDE_DIR`` + where to find libev headers. +``LIBEV_LIBRARIES`` + the libraries needed to use Libev. +``LIBEV_VERSION`` + the version of the Libev library found + +#]=======================================================================] + +find_path(LIBEV_INCLUDE_DIR ev.h + HINTS + "${LIBEV_DIR}" + "${LIBEV_DIR}/include" +) + +find_library(LIBEV_LIBRARY NAMES ev libev + HINTS + "${LIBEV_DIR}" + "${LIBEV_DIR}/lib" +) + +set(LIBEV_LIBRARIES "") + +if (LIBEV_INCLUDE_DIR AND LIBEV_LIBRARY) + if (NOT TARGET Libev::Libev) + add_library(Libev::Libev UNKNOWN IMPORTED) + set_target_properties(Libev::Libev PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBEV_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LIBEV_LIBRARY}" + ) + endif () +endif() + +list(APPEND LIBEV_LIBRARIES "${LIBEV_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libev + REQUIRED_VARS LIBEV_LIBRARIES LIBEV_INCLUDE_DIR + ) + +mark_as_advanced(LIBEV_INCLUDE_DIR LIBEV_LIBRARIES LIBEV_LIBRARY) diff --git a/cmake/modules/FindLibevent2.cmake b/cmake/modules/FindLibevent2.cmake new file mode 100644 index 00000000..9b9f2bb4 --- /dev/null +++ b/cmake/modules/FindLibevent2.cmake @@ -0,0 +1,69 @@ +#[=======================================================================[.rst: +FindLibevent2 +------------- + +Find the Libevent2 library. For now this finds the core library only. + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Libevent2::Libevent_core`` + The Libevent2 library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``Libevent2_FOUND`` + If false, do not try to use Libevent2. +``LIBEVENT2_INCLUDE_DIR`` + where to find libevent headers. +``LIBEVENT2_LIBRARIES`` + the libraries needed to use Libevent2. +``LIBEVENT2_VERSION`` + the version of the Libevent2 library found + +#]=======================================================================] + +find_path(LIBEVENT2_INCLUDE_DIR event2/event.h + HINTS + "${LIBEVENT2_DIR}" + "${LIBEVENT2_DIR}/include" +) + +find_library(LIBEVENT2_LIBRARY NAMES event_core libevent_core + HINTS + "${LIBEVENT2_DIR}" + "${LIBEVENT2_DIR}/lib" +) + +set(LIBEVENT2_LIBRARIES "") + +if (LIBEVENT2_INCLUDE_DIR AND LIBEVENT2_LIBRARY) + if (NOT TARGET Libevent2::Libevent_core) + add_library(Libevent2::Libevent_core UNKNOWN IMPORTED) + set_target_properties(Libevent2::Libevent_core PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT2_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LIBEVENT2_LIBRARY}" + ) + endif () + + if (NOT LIBEVENT2_VERSION AND LIBEVENT2_INCLUDE_DIR AND EXISTS "${LIBEVENT2_INCLUDE_DIR}/event2/event.h") + file(STRINGS "${LIBEVENT2_INCLUDE_DIR}/event2/event-config.h" LIBEVENT2_H REGEX "^#define _?EVENT_+VERSION ") + string(REGEX REPLACE "^.*EVENT_+VERSION \"([^\"]+)\".*$" "\\1" LIBEVENT2_VERSION "${LIBEVENT2_H}") + endif () +endif() + +list(APPEND LIBEVENT2_LIBRARIES "${LIBEVENT2_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libevent2 + REQUIRED_VARS LIBEVENT2_LIBRARIES LIBEVENT2_INCLUDE_DIR + VERSION_VAR LIBEVENT2_VERSION + ) + +mark_as_advanced(LIBEVENT2_INCLUDE_DIR LIBEVENT2_LIBRARIES LIBEVENT2_LIBRARY) diff --git a/cmake/modules/FindLibidn2.cmake b/cmake/modules/FindLibidn2.cmake new file mode 100644 index 00000000..4ea374f5 --- /dev/null +++ b/cmake/modules/FindLibidn2.cmake @@ -0,0 +1,69 @@ +#[=======================================================================[.rst: +FindLibidn2 +----------- + +Find the Libidn2 library + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Libidn2::Libidn2`` + The Libidn2 library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``Libidn2_FOUND`` + If false, do not try to use Libidn2. +``LIBIDN2_INCLUDE_DIR`` + where to find libidn2 headers. +``LIBIDN2_LIBRARIES`` + the libraries needed to use Libidn2. +``LIBIDN2_VERSION`` + the version of the Libidn2 library found + +#]=======================================================================] + +find_path(LIBIDN2_INCLUDE_DIR idn2.h + HINTS + "${LIBIDN2_DIR}" + "${LIBIDN2_DIR}/include" +) + +find_library(LIBIDN2_LIBRARY NAMES idn2 libidn2 + HINTS + "${LIBIDN2_DIR}" + "${LIBIDN2_DIR}/lib" +) + +set(LIBIDN2_LIBRARIES "") + +if (LIBIDN2_INCLUDE_DIR AND LIBIDN2_LIBRARY) + if (NOT TARGET Libidn2::Libidn2) + add_library(Libidn2::Libidn2 UNKNOWN IMPORTED) + set_target_properties(Libidn2::Libidn2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBIDN2_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LIBIDN2_LIBRARY}" + ) + endif () + + if (NOT LIBIDN2_VERSION AND LIBIDN2_INCLUDE_DIR AND EXISTS "${LIBIDN2_INCLUDE_DIR}/unbound.h") + file(STRINGS "${LIBIDN2_INCLUDE_DIR}/idn2.h" LIBIDN2_H REGEX "^#define IDN2_VERSION ") + string(REGEX REPLACE "^.*IDN2_VERSION \"([0-9.]+)\".*$" "\\1" LIBIDN2_VERSION "${LIBIDN2_H}") + endif () +endif() + +list(APPEND LIBIDN2_LIBRARIES "${LIBIDN2_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libidn2 + REQUIRED_VARS LIBIDN2_LIBRARIES LIBIDN2_INCLUDE_DIR + VERSION_VAR LIBIDN2_VERSION + ) + +mark_as_advanced(LIBIDN2_INCLUDE_DIR LIBIDN2_LIBRARIES LIBIDN2_LIBRARY) diff --git a/cmake/modules/FindLibunbound.cmake b/cmake/modules/FindLibunbound.cmake new file mode 100644 index 00000000..bdef88be --- /dev/null +++ b/cmake/modules/FindLibunbound.cmake @@ -0,0 +1,90 @@ +#[=======================================================================[.rst: +FindLibunbound +-------------- + +Find the Libunbound library + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Libunbound::Libunbound`` + The Libunbound library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``Libunbound_FOUND`` + If false, do not try to use Libunbound. +``LIBUNBOUND_INCLUDE_DIR`` + where to find libunbound headers. +``LIBUNBOUND_LIBRARIES`` + the libraries needed to use Libunbound. +``LIBUNBOUND_VERSION`` + the version of the Libunbound library found + +#]=======================================================================] + +find_path(LIBUNBOUND_INCLUDE_DIR unbound.h + HINTS + "${LIBUNBOUND_DIR}" + "${LIBUNBOUND_DIR}/include" +) + +find_library(LIBUNBOUND_LIBRARY NAMES unbound + HINTS + "${LIBUNBOUND_DIR}" + "${LIBUNBOUND_DIR}/lib" +) + +set(LIBUNBOUND_LIBRARIES "") + +if (UNIX) + find_package(Threads REQUIRED) + find_package(OpenSSL REQUIRED) + + list(APPEND LIBUNBOUND_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") + list(APPEND LIBUNBOUND_LIBRARIES "${OPENSSL_LIBRARIES}") +endif() + +if (LIBUNBOUND_INCLUDE_DIR AND LIBUNBOUND_LIBRARY) + if (NOT TARGET Libunbound::Libunbound) + add_library(Libunbound::Libunbound UNKNOWN IMPORTED) + set_target_properties(Libunbound::Libunbound PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBUNBOUND_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LIBUNBOUND_LIBRARY}" + ) + + if(UNIX AND TARGET Threads::Threads) + set_property(TARGET Libunbound::Libunbound APPEND PROPERTY + INTERFACE_LINK_LIBRARIES Threads::Threads) + endif () + if(UNIX AND TARGET OpenSSL::SSL) + set_property(TARGET Libunbound::Libunbound APPEND PROPERTY + INTERFACE_LINK_LIBRARIES OpenSSL::SSL) + endif () + if(UNIX AND TARGET OpenSSL::Crypto) + set_property(TARGET Libunbound::Libunbound APPEND PROPERTY + INTERFACE_LINK_LIBRARIES OpenSSL::Crypto) + endif () + endif () + + if (NOT LIBUNBOUND_VERSION AND LIBUNBOUND_INCLUDE_DIR AND EXISTS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h") + file(STRINGS "${LIBUNBOUND_INCLUDE_DIR}/unbound.h" LIBUNBOUND_H REGEX "^#define UNBOUND_VERSION_M[A-Z]+") + string(REGEX REPLACE "^.*MAJOR ([0-9]+).*MINOR ([0-9]+).*MICRO ([0-9]+).*$" "\\1.\\2.\\3" LIBUNBOUND_VERSION "${LIBUNBOUND_H}") + endif () +endif() + +list(APPEND LIBUNBOUND_LIBRARIES "${LIBUNBOUND_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libunbound + REQUIRED_VARS LIBUNBOUND_LIBRARIES LIBUNBOUND_INCLUDE_DIR + VERSION_VAR LIBUNBOUND_VERSION + ) + +mark_as_advanced(LIBUNBOUND_INCLUDE_DIR LIBUNBOUND_LIBRARIES LIBUNBOUND_LIBRARY) diff --git a/cmake/modules/FindLibuv.cmake b/cmake/modules/FindLibuv.cmake new file mode 100644 index 00000000..749697aa --- /dev/null +++ b/cmake/modules/FindLibuv.cmake @@ -0,0 +1,73 @@ +#[=======================================================================[.rst: +FindLibuv +--------- + +Find the Libuv library. + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Libuv::Libuv`` + The Libuv library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``Libuv_FOUND`` + If false, do not try to use Libuv. +``LIBUV_INCLUDE_DIR`` + where to find libuv headers. +``LIBUV_LIBRARIES`` + the libraries needed to use Libuv. +``LIBUV_VERSION`` + the version of the Libuv library found + +#]=======================================================================] + +find_path(LIBUV_INCLUDE_DIR uv.h + HINTS + "${LIBUV_DIR}" + "${LIBUV_DIR}/include" +) + +find_library(LIBUV_LIBRARY NAMES uv libuv + HINTS + "${LIBUV_DIR}" + "${LIBUV_DIR}/lib" +) + +set(LIBUV_LIBRARIES "") + +if (LIBUV_INCLUDE_DIR AND LIBUV_LIBRARY) + if (NOT TARGET Libuv::Libuv) + add_library(Libuv::Libuv UNKNOWN IMPORTED) + set_target_properties(Libuv::Libuv PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBUV_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${LIBUV_LIBRARY}" + ) + endif () + + if (NOT LIBUV_VERSION AND LIBUV_INCLUDE_DIR) + if (EXISTS "${LIBUV_INCLUDE_DIR}/uv-version.h") + file(STRINGS "${LIBUV_INCLUDE_DIR}/uv-version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") + elseif (EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h") + file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" LIBUV_VER_H REGEX "^#define UV_VERSION_(MAJOR|MINOR|PATCH) ") + endif () + string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*_PATCH ([0-9]+).*$" "\\1.\\2.\\3" LIBUV_VERSION "${LIBUV_VER_H}") + endif () +endif() + +list(APPEND LIBUV_LIBRARIES "${LIBUV_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libuv + REQUIRED_VARS LIBUV_LIBRARIES LIBUV_INCLUDE_DIR + VERSION_VAR LIBUV_VERSION + ) + +mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARIES LIBUV_LIBRARY) diff --git a/cmake/modules/FindNettle.cmake b/cmake/modules/FindNettle.cmake new file mode 100644 index 00000000..3303b4b5 --- /dev/null +++ b/cmake/modules/FindNettle.cmake @@ -0,0 +1,95 @@ +#[=======================================================================[.rst: +FindNettle +---------- + +Find the Nettle library. + +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` targets: + +``Nettle::Nettle`` + The Nettle library, if found. +``Nettle::Hogweed`` + The Hogweed library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``Nettle_FOUND`` + If false, do not try to use Nettle. +``NETTLE_INCLUDE_DIR`` + where to find Nettle headers. +``NETTLE_LIBRARIES`` + the libraries needed to use Nettle. +``NETTLE_VERSION`` + the version of the Nettle library found + +#]=======================================================================] + +find_path(NETTLE_INCLUDE_DIR nettle/version.h + HINTS + "${NETTLE_DIR}" + "${NETTLE_DIR}/include" +) + +find_library(NETTLE_LIBRARY NAMES nettle libnettle + HINTS + "${NETTLE_DIR}" + "${NETTLE_DIR}/lib" +) + +find_library(HOGWEED_LIBRARY NAMES hogweed libhogweed + HINTS + "${NETTLE_DIR}" + "${NETTLE_DIR}/lib" +) + +set(NETTLE_LIBRARIES "") + +# May need gmp library on Unix. +if (UNIX) + find_library(NETTLE_GMP_LIBRARY gmp) + + if (NETTLE_GMP_LIBRARY) + list(APPEND NETTLE_LIBRARIES "${NETTLE_GMP_LIBRARY}") + endif () +endif () + +if (NETTLE_INCLUDE_DIR AND NETTLE_LIBRARY AND HOGWEED_LIBRARY) + if (NOT TARGET Nettle::Nettle) + add_library(Nettle::Nettle UNKNOWN IMPORTED) + set_target_properties(Nettle::Nettle PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${NETTLE_LIBRARIES}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${NETTLE_LIBRARY}" + ) + endif () + if (NOT TARGET Nettle::Hogweed) + add_library(Nettle::Hogweed UNKNOWN IMPORTED) + set_target_properties(Nettle::Hogweed PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${NETTLE_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${HOGWEED_LIBRARY}" + ) + endif () + + if (NOT NETTLE_VERSION AND NETTLE_INCLUDE_DIR) + file(STRINGS "${NETTLE_INCLUDE_DIR}/nettle/version.h" NETTLE_VER_H REGEX "^#define NETTLE_VERSION_(MAJOR|MINOR) ") + string(REGEX REPLACE "^.*_MAJOR ([0-9]+).*_MINOR ([0-9]+).*$" "\\1.\\2" NETTLE_VERSION "${NETTLE_VER_H}") + endif () +endif() + +list(APPEND NETTLE_LIBRARIES "${NETTLE_LIBRARY}" "${HOGWEED_LIBRARY}") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Nettle + REQUIRED_VARS NETTLE_LIBRARIES NETTLE_INCLUDE_DIR + VERSION_VAR NETTLE_VERSION + ) + +mark_as_advanced(NETTLE_INCLUDE_DIR NETTLE_LIBRARIES NETTLE_LIBRARY HOGWEED_LIBRARY) diff --git a/cmake/modules/TargetSharedLibraryExports.cmake b/cmake/modules/TargetSharedLibraryExports.cmake new file mode 100644 index 00000000..ab3f960e --- /dev/null +++ b/cmake/modules/TargetSharedLibraryExports.cmake @@ -0,0 +1,27 @@ +# Export only named entry points from shared library. +function(target_shared_library_exports lib libname symbols) + if (WIN32) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${libname}.def" "LIBRARY ${libname}\n EXPORTS\n") + foreach (symbol IN LISTS symbols) + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/${libname}.def" " ${symbol}\n") + endforeach () + target_sources(${lib} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${libname}.def") + elseif (APPLE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${libname}.syms" "") + foreach (symbol IN LISTS symbols) + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/${libname}.syms" "_${symbol}\n") + endforeach () + target_sources(${lib} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${libname}.syms") + target_link_libraries(${lib} PRIVATE "-exported_symbols_list ${libname}.syms") + elseif (UNIX) + # Assume GNU ld. + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${libname}.ver" "{ global:\n") + foreach (symbol IN LISTS symbols) + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/${libname}.ver" " ${symbol};\n") + endforeach () + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/${libname}.ver" "local:\n *;\n};\n") + target_link_libraries(${lib} PRIVATE "-Wl,--version-script=getdns.ver") + else () + message(WARNING "Unknown platform, ${lib} exports not set.") + endif () +endfunction () diff --git a/cmake/modules/TargetSharedLibraryVersion.cmake b/cmake/modules/TargetSharedLibraryVersion.cmake new file mode 100644 index 00000000..a8a5f1b7 --- /dev/null +++ b/cmake/modules/TargetSharedLibraryVersion.cmake @@ -0,0 +1,25 @@ +# Add version to given shared library linkage. +function(target_shared_library_version lib version_current version_revision version_age) + if (APPLE) + # Follow libtool. Add one to major version, as version 0 doesn't work. + # But tag dynlib name with current-age. + math(EXPR major_version "${version_current}+1") + math(EXPR dynlib_version "${version_current}-${version_age}") + set_target_properties(${lib} PROPERTIES VERSION "${dynlib_version}") + target_link_libraries(${lib} PRIVATE "-compatibility_version ${major_version}") + target_link_libraries(${lib} PRIVATE "-current_version ${major_version}.${version_revision}") + elseif (UNIX OR MINGW OR MSYS OR CYGWIN) + # Assume GNU ld, and again follow libtool. Major version is current-age. + math(EXPR compat_version "${version_current}-${version_age}") + set_target_properties(${lib} PROPERTIES VERSION "${compat_version}.${version_age}.${version_revision}" SOVERSION "${compat_version}") + elseif (WIN32) + set(rc_template "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include/${lib}_version.rc.in") + if (EXISTS ${rc_template}) + configure_file(${rc_template} ${lib}.rc @ONLY) + target_sources(${lib} PRIVATE ${lib}.rc) + endif () + target_link_libraries(${lib} PRIVATE "-VERSION:${version_current}.${version_revision}") + else () + message(WARNING "Unknown platform, ${lib} will not be versioned.") + endif () +endfunction () diff --git a/cmake/tests/test___func__.c b/cmake/tests/test___func__.c new file mode 100644 index 00000000..6613c98b --- /dev/null +++ b/cmake/tests/test___func__.c @@ -0,0 +1,4 @@ +int main (int ac, char *av[]) +{ + char *s = __func__; +} diff --git a/cmake/tests/test_poll.c b/cmake/tests/test_poll.c new file mode 100644 index 00000000..d710a5a4 --- /dev/null +++ b/cmake/tests/test_poll.c @@ -0,0 +1,11 @@ +#ifdef HAVE_SYS_POLL_H +#include +#else +#include +#endif + +int main (int ac, char *av[]) +{ + int rc; + rc = poll((struct pollfd *)(0), 0, 0); +} diff --git a/cmake/tests/test_uv_cb.c b/cmake/tests/test_uv_cb.c new file mode 100644 index 00000000..72524291 --- /dev/null +++ b/cmake/tests/test_uv_cb.c @@ -0,0 +1,12 @@ +#include + +void test_cb(uv_timer_t *handle) +{ + (void) handle; +} + +int main(int ac, char *av[]) +{ + uv_timer_cb cb = test_cb; + (*cb)(0); +} diff --git a/configure.ac b/configure.ac deleted file mode 100644 index dd8ff09f..00000000 --- a/configure.ac +++ /dev/null @@ -1,1888 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. -# known to work with autconf version: autoconf (GNU Autoconf) 2.69 -# -# @configure_input@ -# -# Copyright (c) 2013, Verisign, Inc., NLnet Labs -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the names of the copyright holders nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -AC_PREREQ([2.68]) -AC_CONFIG_MACRO_DIRS([m4]) -sinclude(./m4/acx_openssl.m4) -sinclude(./m4/acx_getaddrinfo.m4) -sinclude(./m4/ac_lib_nettle.m4) -sinclude(./m4/ax_check_compile_flag.m4) -sinclude(./m4/pkg.m4) - -AC_INIT([getdns], [1.5.2], [team@getdnsapi.net], [getdns], [https://getdnsapi.net]) - -# Autoconf 2.70 will have set up runstatedir. 2.69 is frequently (Debian) -# patched to do the same, but frequently (MacOS) not. So add a with option -# for pid file location, and default it to runstatedir if present. -default_piddir=${runstatedir:-"${localstatedir}/run"} -AC_ARG_WITH([piddir], - [AS_HELP_STRING([--with-piddir=DIR], - [directory for pid files @<:@default=RUNSTATEDIR or LOCALSTATEDIR/run@:>@])], - [], - [with_piddir=${default_piddir}]) -AC_SUBST([runstatedir], [$with_piddir]) - -# Don't forget to put a dash in front of the release candidate!!! -# That is how it is done with semantic versioning! -# -AC_SUBST(RELEASE_CANDIDATE, []) -AC_SUBST(STUBBY_RELEASE_CANDIDATE, []) - -# Set current date from system if not set -AC_ARG_WITH([current-date], - [AS_HELP_STRING([--with-current-date] - [current date of the compilation, set to fixed date for reproducible builds @<:@default=system@:>@])], - [CURRENT_DATE="$with_current_date"], - [CURRENT_DATE="`date -u +%Y-%m-%dT%H:%M:%SZ`"]) - -AC_SUBST(GETDNS_VERSION, ["AC_PACKAGE_VERSION$RELEASE_CANDIDATE"]) -AC_SUBST(GETDNS_NUMERIC_VERSION, [0x01050200]) -AC_SUBST(API_VERSION, ["December 2015"]) -AC_SUBST(API_NUMERIC_VERSION, [0x07df0c00]) -GETDNS_COMPILATION_COMMENT="AC_PACKAGE_NAME $GETDNS_VERSION configured on $CURRENT_DATE for the $API_VERSION version of the API" - -AC_DEFINE_UNQUOTED([STUBBY_PACKAGE], ["stubby"], [Stubby package]) -AC_DEFINE_UNQUOTED([STUBBY_PACKAGE_STRING], ["0.2.6$STUBBY_RELEASE_CANDIDATE"], [Stubby package string]) - -# Library version -# --------------- -# current:revision:age -# (binary-api-number):(which-binary-api-version):(how-many-nrs-backwardscompat) -# if source code changes increment revision -# if any interfaces have been added/removed/changed since last update then -# increment current and set revision to 0 -# if any interfaces have been added since the last public release then increment age -# if any interfaces have been removed or changed since the last public release then -# set age to 0 -# -# getdns-0.1.4 had libversion 0:0:0 -# getdns-0.1.5 had libversion 1:0:0 -# getdns-0.1.6 had libversion 1:1:0 -# getdns-0.1.7 had libversion 1:2:1 (but should have had 2:0:1) -# getdns-0.1.8 had libversion 1:3:0 (but should have had 2:1:1) -# getdns-0.2.0 had libversion 2:2:1 -# getdns-0.3.0 had libversion 3:3:2 -# getdns-0.3.1 had libversion 3:4:2 -# getdns-0.3.2 had libversion 3:5:2 -# getdns-0.3.3 had libversion 3:6:2 -# getdns-0.5.0 had libversion 4:0:3 -# getdns-0.5.1 had libversion 4:1:3 (but should have been getdns-0.6.0) -# getdns-0.9.0 had libversion 5:0:4 -# getdns-1.0.0 had libversion 5:1:4 -# getdns-1.1.0 had libversion 6:0:0 -# getdns-1.1.1 had libversion 6:1:0 -# getdns-1.1.2 had libversion 7:0:1 -# getdns-1.1.3 had libversion 7:1:1 -# getdns-1.2.0 had libversion 8:0:2 -# getdns-1.2.1 had libversion 8:1:2 -# getdns-1.3.0 had libversion 9:0:3 -# getdns-1.4.0 had libversion 10:0:0 -# getdns-1.4.1 had libversion 10:1:0 -# getdns-1.4.2 had libversion 10:2:0 -# getdns-1.5.0 had libversion 11:0:1 -# getdns-1.5.1 had libversion 11:1:1 -# getdns-1.5.2 has libversion 11:2:1 -GETDNS_LIBVERSION=11:2:1 - -AC_SUBST(GETDNS_COMPILATION_COMMENT) -AC_SUBST(GETDNS_LIBVERSION) -AC_CONFIG_SRCDIR([src/getdns/getdns.h.in]) -# AM_INIT_AUTOMAKE -# LT_INIT -AC_CONFIG_MACRO_DIR([m4]) - -AC_PROG_CC -AC_PROG_CPP - -# Checks for programs. -HOSTOS="unix" -AC_CANONICAL_HOST -case "${host_os}" in -cygwin*|mingw*) - HOSTOS=windows - ;; -darwin*) - HOSTOS=macos - ;; -esac -AC_SUBST(HOSTOS) - - -CFLAGS="$CFLAGS" -WPEDANTICFLAG="" -WNOERRORFLAG="" -AC_PROG_CC_C99 -AX_CHECK_COMPILE_FLAG([-xc99],[CFLAGS="$CFLAGS -xc99"],[],[]) -AX_CHECK_COMPILE_FLAG([-Wall],[CFLAGS="$CFLAGS -Wall"],[],[]) -AX_CHECK_COMPILE_FLAG([-Wextra],[CFLAGS="$CFLAGS -Wextra"],[],[]) -AX_CHECK_COMPILE_FLAG([-Wpedantic],[WPEDANTICFLAG="-Wpedantic"],[],[]) -AX_CHECK_COMPILE_FLAG([-Wno-error=unused-parameter],[WNOERRORFLAG="-Wno-error=unused-parameter"],[],[]) -AX_CHECK_COMPILE_FLAG([-Wno-unused-parameter],[WNOERRORFLAG="$WNOERRORFLAG -Wno-unused-parameter"],[],[]) -AC_SUBST(WPEDANTICFLAG) -AC_SUBST(WNOERRORFLAG) - -case "$host_os" in - linux* ) CFLAGS="$CFLAGS -D_BSD_SOURCE -D_DEFAULT_SOURCE" - ;; - solaris* ) CFLAGS="$CFLAGS -D__EXTENSIONS__" # for strdup() from - ;; - darwin* ) CFLAGS="$CFLAGS -D_DARWIN_C_SOURCE" # for strlcpy() from - ;; -esac - -# always use ./libtool unless override from commandline (libtool=mylibtool) -if test -z "$libtool"; then - libtool="`pwd`/libtool" -fi -AC_SUBST(libtool) -AC_PROG_LIBTOOL -AC_PROG_INSTALL - - -initial_LIBS="$LIBS" -initial_LDFLAGS="$LDFLAGS" - -dnl Add option to disable the evil rpath. Check whether to use rpath or not. -dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool. -AC_DEFUN([ACX_ARG_RPATH], -[ -AC_ARG_ENABLE(rpath, - [ --disable-rpath disable hardcoded rpath (default=enabled)], - enable_rpath="$enableval", enable_rpath=yes) -if test "x$enable_rpath" = xno; then - dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.]) - AC_CONFIG_COMMANDS([disable-rpath], [ - sed < libtool > libtool-2 \ - 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' - mv libtool-2 libtool - chmod 755 libtool - libtool="./libtool" - ]) -fi -]) -ACX_ARG_RPATH - -AC_ARG_ENABLE(debug-req, AC_HELP_STRING([--enable-debug-req], [Enable request debugging])) -AC_ARG_ENABLE(debug-sched, AC_HELP_STRING([--enable-debug-sched], [Enable scheduling debugging messages])) -AC_ARG_ENABLE(debug-stub, AC_HELP_STRING([--enable-debug-stub], [Enable stub debugging messages])) -AC_ARG_ENABLE(debug-daemon, AC_HELP_STRING([--enable-debug-daemon], [Enable daemon debugging messages])) -AC_ARG_ENABLE(debug-sec, AC_HELP_STRING([--enable-debug-sec], [Enable dnssec debugging messages])) -AC_ARG_ENABLE(debug-server, AC_HELP_STRING([--enable-debug-server], [Enable server debugging messages])) -AC_ARG_ENABLE(debug-anchor, AC_HELP_STRING([--enable-debug-anchor], [Enable anchor debugging messages])) -AC_ARG_ENABLE(all-debugging, AC_HELP_STRING([--enable-all-debugging], [Enable scheduling, stub and dnssec debugging])) -case "$enable_all_debugging" in - yes) - enable_debug_req=yes - enable_debug_sched=yes - enable_debug_stub=yes - enable_debug_daemon=yes - enable_debug_sec=yes - enable_debug_server=yes - enable_debug_anchor=yes - ;; - no|*) - ;; -esac -case "$enable_debug_req" in - yes) - AC_DEFINE_UNQUOTED([REQ_DEBUG], [1], [Define this to enable printing of request debugging messages.]) - ;; - no|*) - ;; -esac -case "$enable_debug_sched" in - yes) - AC_DEFINE_UNQUOTED([SCHED_DEBUG], [1], [Define this to enable printing of scheduling debugging messages.]) - ;; - no|*) - ;; -esac -case "$enable_debug_stub" in - yes) - AC_DEFINE_UNQUOTED([STUB_DEBUG], [1], [Define this to enable printing of stub debugging messages.]) - ;; - no|*) - ;; -esac -case "$enable_debug_daemon" in - yes) - AC_DEFINE_UNQUOTED([DAEMON_DEBUG], [1], [Define this to enable printing of daemon debugging messages.]) - ;; - no|*) - ;; -esac -case "$enable_debug_sec" in - yes) - AC_DEFINE_UNQUOTED([SEC_DEBUG], [1], [Define this to enable printing of dnssec debugging messages.]) - ;; - no|*) - ;; -esac -case "$enable_debug_server" in - yes) - AC_DEFINE_UNQUOTED([SERVER_DEBUG], [1], [Define this enable printing of server debugging messages.]) - ;; - no|*) - ;; -esac -case "$enable_debug_anchor" in - yes) - AC_DEFINE_UNQUOTED([ANCHOR_DEBUG], [1], [Define this enable printing of anchor debugging messages.]) - ;; - no|*) - ;; -esac - - -dnl Hidden debugging options -dnl -AC_ARG_ENABLE(debug-keep-connections-open,[]) -case "$enable_debug_keep_connections_open" in - yes) - AC_DEFINE_UNQUOTED([KEEP_CONNECTIONS_OPEN_DEBUG], [1], [Do not set this]) - ;; - no) - ;; -esac - - -DEFAULT_EVENTLOOP=select_eventloop -AC_CHECK_HEADERS([signal.h sys/poll.h poll.h sys/resource.h sys/types.h sys/stat.h],,, [AC_INCLUDES_DEFAULT]) -AC_ARG_ENABLE(poll-eventloop, AC_HELP_STRING([--disable-poll-eventloop], [Disable default eventloop based on poll (default=enabled if available)])) -case "$enable_poll_eventloop" in - no) - ;; - yes|*) -AC_MSG_CHECKING(for poll) -AC_LINK_IFELSE([AC_LANG_PROGRAM([ -#ifdef HAVE_SYS_POLL_H -#include -#else -#include -#endif -], [int rc; rc = poll((struct pollfd *)(0), 0, 0);])], [ -AC_MSG_RESULT(yes) -AC_DEFINE_UNQUOTED([USE_POLL_DEFAULT_EVENTLOOP], [1], [Define this to enable a default eventloop based on poll().]) -DEFAULT_EVENTLOOP=poll_eventloop -],[AC_MSG_RESULT(no)]) - ;; -esac -AC_SUBST(DEFAULT_EVENTLOOP) - -AC_ARG_ENABLE(tcp-fastopen, AC_HELP_STRING([--disable-tcp-fastopen], Disable TCP Fast Open (default=enabled if available)), - enable_tcp_fastopen="$enableval", enable_tcp_fastopen=yes) -if test "x$enable_tcp_fastopen" = xno; then - AC_MSG_WARN([TCP Fast Open is disabled]) -else - case `uname` in - Darwin) AC_CHECK_DECL([CONNECT_RESUME_ON_READ_WRITE], [AC_DEFINE_UNQUOTED([USE_OSX_TCP_FASTOPEN], [1], [Define this to enable TCP fast open.])], - [AC_MSG_WARN([TCP Fast Open is not available, continuing without])], [#include ]) - ;; - *) - AC_CHECK_HEADERS([sys/socket.h netinet/tcp.h],,, [AC_INCLUDES_DEFAULT]) - AC_CHECK_DECL([TCP_FASTOPEN], [ - AC_DEFINE_UNQUOTED([USE_TCP_FASTOPEN], [1], [Define this to enable TCP fast open.]) - AC_CHECK_DECLS([TCP_FASTOPEN,MSG_FASTOPEN,TCP_FASTOPEN_CONNECT], [], [], [AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_NETINET_TCP_H -# include -#endif -]) - ], [ - AC_MSG_WARN([TCP Fast Open is not available, continuing without]) - ], [AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_NETINET_TCP_H -# include -#endif -]) - ;; - esac -fi - -AC_ARG_ENABLE(native-stub-dnssec, AC_HELP_STRING([--disable-native-stub-dnssec], [Disable native stub DNSSEC support])) -case "$enable_native_stub_dnssec" in - no) - ;; - yes|*) - AC_DEFINE_UNQUOTED([STUB_NATIVE_DNSSEC], [1], [Define this to enable native stub DNSSEC support.]) - ;; -esac - -# check wether strptime also works -AC_DEFUN([AC_CHECK_STRPTIME_WORKS], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(whether strptime works) -if test c${cross_compiling} = cno; then -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#define _XOPEN_SOURCE 600 -#include -int main(void) { struct tm tm; char *res; -res = strptime("2010-07-15T00:00:00+00:00", "%t%Y%t-%t%m%t-%t%d%tT%t%H%t:%t%M%t:%t%S%t", &tm); -if (!res) return 2; -res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm); -if (!res) return 1; return 0; } -]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"]) -else -eval "ac_cv_c_strptime_works=maybe" -fi -AC_MSG_RESULT($ac_cv_c_strptime_works) -if test $ac_cv_c_strptime_works = no; then -AC_LIBOBJ(strptime) -else -AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.]) -fi -])dnl - -AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])]) - -# search to set include and library paths right -# find libidn (no libidn on windows though) -AC_CHECK_HEADERS([windows.h winsock.h stdio.h winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) -ACX_CHECK_GETADDRINFO_WITH_INCLUDES - -AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=PATH], - [Set the resolver configuration file path. Defaults to /etc/resolv.conf or values retrieved via GetNetworkParams() on Windows]), - [], [withval="/etc/resolv.conf"]) -AC_DEFINE_UNQUOTED([GETDNS_FN_RESOLVCONF], ["$withval"], [Path to resolver configuration file]) - -AC_ARG_WITH(hosts, AS_HELP_STRING([--with-hosts=PATH], - [Set the static table lookup for hostnames path. Defaults to /etc/hosts or C:\Windows\System32\Drivers\etc\hosts on Windows]), - [], [ -if test "$USE_WINSOCK" = 1; then - withval="C:\\\\Windows\\\\System32\\\\Drivers\\\\etc\\\\hosts" -else - withval="/etc/hosts" -fi -]) -AC_DEFINE_UNQUOTED([GETDNS_FN_HOSTS], ["$withval"], [Path to static table lookup for hostnames]) - -AC_ARG_WITH(fd-setsize, AS_HELP_STRING([--with-fd-setsize=size], - [Set maximum file descriptor number that can be used by select]), - [], [withval="no"]) -case "$withval" in -no) - ;; -*) - AC_DEFINE_UNQUOTED([FD_SETSIZE], [$withval], [Alternate value for the FD_SETSIZE]) - my_enable_unbound_event_api=1 - ;; -esac - -AC_ARG_WITH(max-udp-backoff, AS_HELP_STRING([--with-max-udp-backoff=], - [Set the maximum number of messages that can be sent to other upstreams before the upstream which has previously timed out will be tried again. (defaults to 1000)]),, [withval="1000"]) -AC_DEFINE_UNQUOTED([UDP_MAX_BACKOFF], [$withval], [Maximum number of queries an failed UDP upstream passes before it will retry]) - -#---- check for pthreads library -AC_ARG_WITH(libpthread, AS_HELP_STRING([--without-libpthread], - [Disable libpthread (default is autodetect)]), - [], [withval="yes"]) - -case "$withval" in -yes) - AC_SEARCH_LIBS([pthread_mutex_init],[pthread], [ - AC_DEFINE([HAVE_PTHREAD], [1], [Have pthreads library]) - LIBS="-lpthread $LIBS" - ], [AC_MSG_WARN([pthreads not available])]) - ;; -*) - ;; -esac - -USE_NSS="no" -dnl AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path], -dnl [use libnss instead of openssl, installed at path.]), -dnl [ -dnl USE_NSS="yes" -dnl AC_DEFINE(HAVE_NSS, 1, [Use libnss for crypto]) -dnl if test "$withval" != "" -a "$withval" != "yes"; then -dnl CPPFLAGS="$CPPFLAGS -I$withval/include/nss3" -dnl LDFLAGS="$LDFLAGS -L$withval/lib" -dnl ACX_RUNTIME_PATH_ADD([$withval/lib]) -dnl CPPFLAGS="-I$withval/include/nspr4 $CPPFLAGS" -dnl else -dnl CPPFLAGS="$CPPFLAGS -I/usr/include/nss3" -dnl CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS" -dnl fi -dnl LIBS="$LIBS -lnss3 -lnspr4" -dnl SSLLIB="" -dnl ] -dnl ) - -# libnettle -USE_NETTLE="no" -dnl AC_ARG_WITH([nettle], AC_HELP_STRING([--with-nettle=path], -dnl [use libnettle as crypto library, installed at path.]), -dnl [ -dnl USE_NETTLE="yes" -dnl AC_DEFINE(HAVE_NETTLE, 1, [Use libnettle for crypto]) -dnl AC_CHECK_HEADERS([nettle/dsa-compat.h],,, [AC_INCLUDES_DEFAULT]) -dnl if test "$withval" != "" -a "$withval" != "yes"; then -dnl CPPFLAGS="$CPPFLAGS -I$withval/include/nettle" -dnl LDFLAGS="$LDFLAGS -L$withval/lib" -dnl ACX_RUNTIME_PATH_ADD([$withval/lib]) -dnl else -dnl CPPFLAGS="$CPPFLAGS -I/usr/include/nettle" -dnl fi -dnl LIBS="$LIBS -lhogweed -lnettle -lgmp" -dnl SSLLIB="" -dnl ] -dnl ) - -# Which TLS and crypto libs to use. -AC_ARG_WITH([gnutls], - [AS_HELP_STRING([--with-gnutls], - [use GnuTLS instead of OpenSSL])], - [ - PKG_CHECK_MODULES([libgnutls], [gnutls >= 3.5.0]) - PKG_CHECK_MODULES([libgnutlsdane], [gnutls-dane >= 3.5.0]) - LIBS="$libgnutls_LIBS $libgnutlsdane_LIBS $LIBS" - CFLAGS="$libgnutls_CFLAGS $libgnutlsdane_CFLAGS $CFLAGS" - AC_SUBST([TLSDIR], 'gnutls') - AC_DEFINE([USE_GNUTLS], [1], [Use the GnuTLS library]) - if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then - - AX_LIB_NETTLE(yes) - USE_NETTLE="yes" - AC_DEFINE(HAVE_NETTLE, 1, [Use libnettle for crypto]) - AC_CHECK_HEADERS([nettle/dsa-compat.h],,, [AC_INCLUDES_DEFAULT]) - fi - # Zero configuration DNSSEC we still need libcrypto - AC_CHECK_HEADERS([openssl/x509.h],,, [AC_INCLUDES_DEFAULT]) - AC_CHECK_LIB([crypto], [X509_STORE_new], [ - AC_DEFINE_UNQUOTED([HAVE_LIBCRYPTO], [2], [Define to 1 if you have the `crypto' library (-lcrypto).]) dnl - LIBS="-lcrypto $LIBS" - ], [ - AC_MSG_ERROR([libcrypto still needed for Zero configuration DNSSEC]) - ]) - ], - [ - if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then - ACX_WITH_SSL - fi - ACX_LIB_SSL - AC_SUBST([TLSDIR], 'openssl') - - # Verify OpenSSL is at least version 1.0.2. - # We also check it's not LibreSSL, but that's a little later, not here. - AC_CHECK_FUNCS([X509_check_host SSL_dane_enable]) - if test "x$ac_cv_func_X509_check_host" != xyes; then - AC_MSG_ERROR([getdns requires OpenSSL version 1.0.2 or later]) - fi - - AC_MSG_CHECKING([whether we need to compile/link DANE support]) - DANESSL_XTRA_OBJS="" - if test "x$ac_cv_func_SSL_dane_enable" = xyes; then - AC_MSG_RESULT([no]) - else - AC_MSG_RESULT([yes]) - AC_DEFINE([USE_DANESSL], [1], [Define this to use DANE functions from the ssl_dane/danessl library.]) - DANESSL_XTRA_OBJS="danessl.lo" - fi - AC_SUBST(DANESSL_XTRA_OBJS) - ]) - - -# openssl -if test $USE_NSS = "no" -a $USE_NETTLE = "no" ; then -AC_MSG_CHECKING([for LibreSSL]) -if grep VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then - AC_MSG_RESULT([yes]) - AC_MSG_ERROR([getdns does not support LibreSSL]) -else - AC_MSG_RESULT([no]) -fi -AC_CHECK_HEADERS([openssl/conf.h openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/bn.h openssl/rsa.h openssl/dsa.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_FUNCS([OPENSSL_config EVP_md5 EVP_sha1 EVP_sha224 EVP_sha256 EVP_sha384 EVP_sha512 FIPS_mode ENGINE_load_cryptodev EVP_PKEY_keygen ECDSA_SIG_get0 EVP_MD_CTX_new EVP_PKEY_base_id HMAC_CTX_new HMAC_CTX_free TLS_client_method DSA_SIG_set0 EVP_dss1 EVP_DigestVerify OpenSSL_version_num OpenSSL_version SSL_CTX_dane_enable SSL_dane_enable SSL_dane_tlsa_add X509_check_host X509_get_notAfter X509_get0_notAfter SSL_CTX_set_ciphersuites SSL_set_ciphersuites OPENSSL_init_crypto DSA_set0_pqg DSA_set0_key RSA_set0_key]) -AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free,SSL_CTX_set_ecdh_auto,SSL_CTX_set1_curves_list,SSL_set1_curves_list,SSL_set_min_proto_version,SSL_get_min_proto_version], [], [], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_OPENSSL_ERR_H -#include -#endif - -#ifdef HAVE_OPENSSL_RAND_H -#include -#endif - -#ifdef HAVE_OPENSSL_CONF_H -#include -#endif - -#ifdef HAVE_OPENSSL_ENGINE_H -#include -#endif -#include -#include -]) -fi - -AC_ARG_ENABLE(sha1, AC_HELP_STRING([--disable-sha1], [Disable SHA1 RRSIG support, does not disable nsec3 support])) - case "$enable_sha1" in - no) - ;; - yes|*) - AC_DEFINE([USE_SHA1], [1], [Define this to enable SHA1 support.]) - ;; -esac - -AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) -case "$enable_sha2" in - no) - ;; - yes|*) - AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) - ;; -esac - -# check wether gost also works -AC_DEFUN([AC_CHECK_GOST_WORKS], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING([if GOST works]) -if test c${cross_compiling} = cno; then -BAKCFLAGS="$CFLAGS" -if test -n "$ssldir"; then - CFLAGS="$CFLAGS -Wl,-rpath,$ssldir/lib" -fi -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include -#include -#include -/* routine to load gost (from gldns) */ -int load_gost_id(void) -{ - static int gost_id = 0; - const EVP_PKEY_ASN1_METHOD* meth; - ENGINE* e; - - if(gost_id) return gost_id; - - /* see if configuration loaded gost implementation from other engine*/ - meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1); - if(meth) { - EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); - return gost_id; - } - - /* see if engine can be loaded already */ - e = ENGINE_by_id("gost"); - if(!e) { - /* load it ourself, in case statically linked */ - ENGINE_load_builtin_engines(); - ENGINE_load_dynamic(); - e = ENGINE_by_id("gost"); - } - if(!e) { - /* no gost engine in openssl */ - return 0; - } - if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { - ENGINE_finish(e); - ENGINE_free(e); - return 0; - } - - meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1); - if(!meth) { - /* algo not found */ - ENGINE_finish(e); - ENGINE_free(e); - return 0; - } - EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); - return gost_id; -} -int main(void) { - EVP_MD_CTX* ctx; - const EVP_MD* md; - unsigned char digest[64]; /* its a 256-bit digest, so uses 32 bytes */ - const char* str = "Hello world"; - const unsigned char check[] = { - 0x40 , 0xed , 0xf8 , 0x56 , 0x5a , 0xc5 , 0x36 , 0xe1 , - 0x33 , 0x7c , 0x7e , 0x87 , 0x62 , 0x1c , 0x42 , 0xe0 , - 0x17 , 0x1b , 0x5e , 0xce , 0xa8 , 0x46 , 0x65 , 0x4d , - 0x8d , 0x3e , 0x22 , 0x9b , 0xe1 , 0x30 , 0x19 , 0x9d - }; - OPENSSL_config(NULL); - (void)load_gost_id(); - md = EVP_get_digestbyname("md_gost94"); - if(!md) return 1; - memset(digest, 0, sizeof(digest)); - ctx = EVP_MD_CTX_create(); - if(!ctx) return 2; - if(!EVP_DigestInit_ex(ctx, md, NULL)) return 3; - if(!EVP_DigestUpdate(ctx, str, 10)) return 4; - if(!EVP_DigestFinal_ex(ctx, digest, NULL)) return 5; - /* uncomment to see the hash calculated. - {int i; - for(i=0; i<32; i++) - printf(" %2.2x", (int)digest[i]); - printf("\n");} - */ - if(memcmp(digest, check, sizeof(check)) != 0) - return 6; - return 0; -} -]])] , [eval "ac_cv_c_gost_works=yes"], [eval "ac_cv_c_gost_works=no"]) -CFLAGS="$BAKCFLAGS" -else -eval "ac_cv_c_gost_works=maybe" -fi -AC_MSG_RESULT($ac_cv_c_gost_works) -])dnl - -AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) -use_gost="no" -if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then -case "$enable_gost" in - no) - ;; - *) - AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])]) - AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])]) - AC_CHECK_GOST_WORKS - if test "$ac_cv_c_gost_works" != no; then - use_gost="yes" - AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.]) - fi - ;; -esac -fi dnl !USE_NSS && !USE_NETTLE - -AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support])) -use_ecdsa="no" -case "$enable_ecdsa" in - no) - ;; - *) - if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then - AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])]) - AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])]) - AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curves: please upgrade or rerun with --disable-ecdsa])], [AC_INCLUDES_DEFAULT -#include - ]) - # see if OPENSSL 1.0.0 or later (has EVP MD and Verify independency) - AC_MSG_CHECKING([if openssl supports SHA2 and ECDSA with EVP]) - if grep OPENSSL_VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "OpenSSL" >/dev/null; then - if grep OPENSSL_VERSION_NUMBER $ssldir/include/openssl/opensslv.h | grep 0x0 >/dev/null; then - AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED([USE_ECDSA_EVP_WORKAROUND], [1], [Define this to enable an EVP workaround for older openssl]) - else - AC_MSG_RESULT([yes]) - fi - else - # not OpenSSL, thus likely LibreSSL, which supports it - AC_MSG_RESULT([yes]) - fi - fi - # we now know we have ECDSA and the required curves. - AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) - use_ecdsa="yes" - ;; -esac - -AC_ARG_ENABLE(dsa, AC_HELP_STRING([--disable-dsa], [Disable DSA support])) -case "$enable_dsa" in - no) - ;; - *) dnl default - # detect if DSA is supported, and turn it off if not. - if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then - AC_CHECK_FUNC(DSA_SIG_new, [ - AC_CHECK_TYPE(DSA_SIG*, [ - AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.]) - ], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.]) - fi ], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_OPENSSL_ENGINE_H -# include -#endif - -#ifdef HAVE_OPENSSL_RAND_H -#include -#endif - -#ifdef HAVE_OPENSSL_CONF_H -#include -#endif - -#ifdef HAVE_OPENSSL_ENGINE_H -#include -#endif -]) - ], [if test "x$enable_dsa" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support DSA and you used --enable-dsa.]) - fi ]) - else - AC_DEFINE_UNQUOTED([USE_DSA], [1], [Define this to enable DSA support.]) - fi - ;; -esac - -AC_ARG_ENABLE(ed25519, AC_HELP_STRING([--disable-ed25519], [Disable ED25519 support])) -use_ed25519="no" -case "$enable_ed25519" in - no) - ;; - *) - if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then - AC_CHECK_DECLS([NID_ED25519], [ - use_ed25519="yes" - ], [ if test "x$enable_ed25519" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support ED25519 and you used --enable-ed25519.]) - fi ], [AC_INCLUDES_DEFAULT -#include - ]) - fi - if test $USE_NETTLE = "yes"; then - AC_CHECK_HEADERS([nettle/eddsa.h], use_ed25519="yes",, [AC_INCLUDES_DEFAULT]) - fi - if test $use_ed25519 = "yes"; then - AC_DEFINE_UNQUOTED([USE_ED25519], [1], [Define this to enable ED25519 support.]) - fi - ;; -esac - -AC_ARG_ENABLE(ed448, AC_HELP_STRING([--disable-ed448], [Disable ED448 support])) -use_ed448="no" -case "$enable_ed448" in - no) - ;; - *) - if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then - AC_CHECK_DECLS([NID_ED448], [ - use_ed448="yes" - ], [ if test "x$enable_ed448" = "xyes"; then AC_MSG_ERROR([OpenSSL does not support ED448 and you used --enable-ed448.]) - fi ], [AC_INCLUDES_DEFAULT -#include - ]) - fi - if test $use_ed448 = "yes"; then - AC_DEFINE_UNQUOTED([USE_ED448], [1], [Define this to enable ED448 support.]) - fi - ;; -esac - -AC_ARG_ENABLE(all-drafts, AC_HELP_STRING([--enable-all-drafts], [Enables the draft mdns client support])) -case "$enable_all_drafts" in - yes) - AC_DEFINE_UNQUOTED([HAVE_MDNS_SUPPORT], [1], [Define this to enable the draft mdns client support.]) - ;; - no|*) - ;; -esac -AC_ARG_ENABLE(dnssec-roadblock-avoidance, AC_HELP_STRING([--disable-dnssec-roadblock-avoidance], [Disable dnssec roadblock avoidance])) -case "$enable_dnssec_roadblock_avoidance" in - no) - ;; - yes|*) - AC_DEFINE_UNQUOTED([DNSSEC_ROADBLOCK_AVOIDANCE], [1], [Define this to enable the experimental dnssec roadblock avoidance.]) - ;; -esac - -AC_ARG_ENABLE(edns-cookies, AC_HELP_STRING([--disable-edns-cookies], [Disable edns cookies])) -case "$enable_edns_cookies" in - no) - ;; - yes|*) - if test "x_$HAVE_SSL" != "x_yes" -a $USE_NETTLE = "no"; then - AC_MSG_ERROR([edns cookies needs crypto library which is not available, please rerun with --disable-edns-cookies]) - fi - AC_DEFINE_UNQUOTED([EDNS_COOKIES], [1], [Define this to enable the experimental edns cookies.]) - ;; -esac -AC_DEFINE_UNQUOTED([EDNS_COOKIE_OPCODE], [10], [The edns cookie option code.]) -AC_DEFINE_UNQUOTED([EDNS_COOKIE_ROLLOVER_TIME], [(24 * 60 * 60)], [How often the edns client cookie is refreshed.]) - -AC_DEFINE_UNQUOTED([MAXIMUM_UPSTREAM_OPTION_SPACE], [3000], [limit for dynamically-generated DNS options]) -AC_DEFINE_UNQUOTED([EDNS_PADDING_OPCODE], [12], [The edns padding option code.]) - -AC_ARG_ENABLE(draft-mdns-support, AC_HELP_STRING([--enable-draft-mdns-support], [Enable draft mdns client support])) -case "$enable_draft_mdns_support" in - yes) - AC_DEFINE_UNQUOTED([HAVE_MDNS_SUPPORT], [1], [Define this to enable the draft mdns client support.]) - ;; - no|*) - ;; -esac - -my_with_libunbound=1 -AC_ARG_ENABLE(stub-only, AC_HELP_STRING([--enable-stub-only], [Restricts resolution modes to STUB (which will be the default mode). Removes the libunbound dependency.])) -case "$enable_stub_only" in - yes) - my_with_libunbound=0 - ;; - no|*) - ;; -esac - -my_with_yaml=0 -AC_ARG_ENABLE(yaml-config,) -case "$enable_yaml_config" in - yes) - AC_DEFINE_UNQUOTED([USE_YAML_CONFIG], [1], [Define this to enable YAML config support.]) - AC_DEFINE_UNQUOTED([HAVE_GETDNS_YAML2DICT], [1], [Define this to enable getdns_yaml2dict function.]) - - GETDNS_XTRA_OBJS="convert_yaml_to_json.lo" - my_with_yaml=1 - ;; - no|*) - GETDNS_XTRA_OBJS="" - ;; -esac -AC_SUBST(GETDNS_XTRA_OBJS) - -if test "$USE_WINSOCK" = 1; then - AC_MSG_NOTICE([ Building on Windows ... YES! ]) - AC_DEFINE_UNQUOTED([GETDNS_ON_WINDOWS], [1], [Define this to enable Windows build.]) - AC_DEFINE_UNQUOTED([STUB_NATIVE_DNSSEC], [1]) - LIBS="$LIBS -lgdi32 -liphlpapi" -fi - -dnl sigset_t or _sigset_t? MinGW is latter by default. -AC_CHECK_TYPES([sigset_t], - [], - [AC_CHECK_TYPES([_sigset_t], - [], - [AC_MSG_ERROR([Can't find type `sigset_t' or type `_sigset_t'])], - [AC_INCLUDES_DEFAULT -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif - ]) - ], - [AC_INCLUDES_DEFAULT -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -]) -AC_CHECK_FUNCS(sigemptyset sigfillset sigaddset) - -my_with_libidn=1 -AC_ARG_WITH(libidn, AS_HELP_STRING([--with-libidn=pathname], - [path to libidn (default: search /usr/local ..)]), - [], [withval="yes"]) -if test x_$withval = x_yes; then - for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do - if test -f "$dir/include/idna.h"; then - CFLAGS="$CFLAGS -I$dir/include" - LDFLAGS="$LDFLAGS -L$dir/lib" - AC_MSG_NOTICE([Found libidn in $dir]) - break - fi - if test -f "$dir/include/idn/idna.h"; then - CFLAGS="$CFLAGS -I$dir/include/idn" - LDFLAGS="$LDFLAGS -L$dir/lib" - AC_MSG_NOTICE([Found libidn in $dir]) - break - fi - done - if test -f "/usr/include/idn/idna.h"; then - CFLAGS="$CFLAGS -I/usr/include/idn" - #LDFLAGS="$LDFLAGS -L/usr/lib" - AC_MSG_NOTICE([Found libidn in /usr]) - fi -else - if test x_$withval != x_no; then - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - else - my_with_libidn=0 - fi -fi - -my_with_libidn2=1 -AC_ARG_WITH(libidn2, AS_HELP_STRING([--with-libidn2=pathname], - [path to libidn2 (default: search /usr/local ..)]), - [], [withval="yes"]) -if test x_$withval = x_yes; then - for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do - if test -f "$dir/include/idn2.h"; then - CFLAGS="$CFLAGS -I$dir/include" - LDFLAGS="$LDFLAGS -L$dir/lib" - AC_MSG_NOTICE([Found libidn2 in $dir]) - break - fi - if test -f "$dir/include/idn2/idn2.h"; then - CFLAGS="$CFLAGS -I$dir/include/idn2" - LDFLAGS="$LDFLAGS -L$dir/lib" - AC_MSG_NOTICE([Found libidn2 in $dir]) - break - fi - done - if test -f "/usr/include/idn2/idn2.h"; then - CFLAGS="$CFLAGS -I/usr/include/idn2" - #LDFLAGS="$LDFLAGS -L/usr/lib" - AC_MSG_NOTICE([Found libidn2 in /usr]) - fi -else - if test x_$withval != x_no; then - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - else - my_with_libidn2=0 - fi -fi - -if test $my_with_libunbound = 1 -then - # find libunbound - AC_ARG_WITH(libunbound, AS_HELP_STRING([--with-libunbound=pathname], - [path to libunbound (default: search /usr/local ..)]), - [], [withval="yes"]) - if test x_$withval = x_yes; then - for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do - if test -f "$dir/include/unbound.h"; then - CFLAGS="$CFLAGS -I$dir/include" - LDFLAGS="$LDFLAGS -L$dir/lib" - AC_MSG_NOTICE([Found libunbound in $dir]) - break - fi - done - else - if test x_$withval != x_no; then - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - else - AC_DEFINE_UNQUOTED([DISABLE_RESOLUTION_RECURSING], [1], [Define this to disable recursing resolution type.]) - my_with_libunbound=0 - fi - fi -fi - -# Checks for libraries. -found_all_libs=1 -MISSING_DEPS="" -MISSING_SEP="" - -working_libidn2=0 -if test $my_with_libidn2 = 1 -then - AC_MSG_NOTICE([Checking for dependency libidn2]) - AC_CHECK_LIB([idn2], [idn2_to_unicode_8z8z], [ - working_libidn2=1 - LIBS="-lidn2 $LIBS" - AC_DEFINE_UNQUOTED([HAVE_LIBIDN2], [1], [Define to 1 if you have the `idn2' library (-lidn).]) dnl ` - ], [ - MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libidn2 (version 2.0.0 or higher)" - MISSING_SEP=", " - ]) -fi -if test $working_libidn2 = 0 -then - if test $my_with_libidn = 1 - then - AC_MSG_NOTICE([Checking for dependency libidn]) - AC_CHECK_LIB([idn], [idna_to_ascii_8z], [], [ - MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libidn" - MISSING_SEP=", " - found_all_libs=0 - ]) - else - if test $my_with_libidn2 = 1 - then - found_all_libs=0 - fi - fi -fi - -AC_ARG_ENABLE(unbound-event-api, AC_HELP_STRING([--disable-unbound-event-api], [Disable usage of libunbounds event API])) -case "$enable_unbound_event_api" in - no) - my_enable_unbound_event_api=0 - ;; - yes|*) - my_enable_unbound_event_api=1 - ;; -esac - - -if test $my_with_libunbound = 1 -then - AC_CHECK_HEADERS([unbound-event.h],,, [AC_INCLUDES_DEFAULT]) - AC_MSG_NOTICE([Checking for dependency libunbound]) - AC_CHECK_LIB([unbound], [ub_fd], [ - AC_DEFINE_UNQUOTED([HAVE_LIBUNBOUND], [1], [Define to 1 if you have the `unbound' library (-lunbound).]) dnl ` - LIBS="-lunbound $LIBS" - - if test $my_enable_unbound_event_api = 1 - then - AC_CHECK_FUNC([ub_ctx_create_ub_event], [ - AC_DEFINE_UNQUOTED([HAVE_UNBOUND_EVENT_API], [1], [Define this when libunbound is compiled with the --enable-event-api option.]) - ]) - fi - AC_CHECK_FUNCS([ub_ctx_set_stub]) - ], [ - MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libunbound" - MISSING_SEP=", " - found_all_libs=0 - ]) -fi - -AC_PATH_PROG([DOXYGEN], [doxygen]) -if test -z "$DOXYGEN"; - then AC_MSG_WARN([doxygen not found, continuing without]) -fi - -# Checks for header files. -AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h],,, [AC_INCLUDES_DEFAULT]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_SIZE_T -AC_TYPE_UINT16_T -AC_TYPE_UINT32_T -AC_TYPE_UINT64_T -AC_TYPE_UINT8_T -AC_CHECK_TYPES([u_char]) - -AC_CHECK_FUNCS([fcntl]) -# check ioctlsocket -AC_MSG_CHECKING(for ioctlsocket) -AC_LINK_IFELSE([AC_LANG_PROGRAM([ -#ifdef HAVE_WINSOCK2_H -#include -#endif -], [ - (void)ioctlsocket(0, 0, NULL); -])], [ -AC_MSG_RESULT(yes) -AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available]) -],[AC_MSG_RESULT(no)]) - - -# Check for libraries for other things than libgetdns after this point, -# so the getdns libraries can be reset with: -# -# LIBS="$getdns_LIBS" -# LDFLAGS="$getdns_LDFLAGS" -# -# afterwards. -getdns_LIBS="$LIBS" -getdns_LDFLAGS="$LDFLAGS" -getdns_CFLAGS="$CFLAGS" - -#-------------------- libraries needed for libcheck -LIBS="$initial_LIBS" - -CHECK_GETDNS="" -CHECK_LIBS="" -CHECK_CFLAGS="" - -PKG_CHECK_MODULES([CHECK],[check >= 0.9.6],[CHECK_GETDNS="check_getdns"],[ -AC_SEARCH_LIBS([floor], [m]) -AC_SEARCH_LIBS([timer_create], [rt]) -AC_SEARCH_LIBS([pthread_create], [pthread]) -AC_SEARCH_LIBS([srunner_create],[check check_pic],[ -CHECK_GETDNS="check_getdns" -CHECK_LIBS="$LIBS"],[ -AC_SUBST(NOLIBCHECK, [nolibcheck]) -AC_MSG_WARN([libcheck not found or usable; unit tests will not be compiled and run])])]) - -LIBS="$getdns_LIBS" - -AC_SUBST([CHECK_GETDNS]) -AC_SUBST([CHECK_LIBS]) -AC_SUBST([CHECK_CFLAGS]) -# end libraries needed for libcheck - -#-------------------- libevent extension -AC_ARG_WITH([libevent], - [AS_HELP_STRING([--with-libevent], [path to libevent (default: search /usr/local ..)])], - [with_libevent=search], - [withval=no]) - -# libevent 1.x requires a u_char typedef which is not always available -# on some systems so our check is a little complicated -# we further need to ensure that this is included in the getdns headers -# that get installed later so some users may not be building in an -# environment that has the generated config.h SO we need to generate -# this one extra header in that case - -have_libevent=0 -EXTENSION_LIBEVENT_EXT_LIBS="" -EXTENSION_LIBEVENT_LIB="" -EXTENSION_LIBEVENT_LDFLAGS="" -CHECK_EVENT_PROG="" -AS_IF([test x_$withval = x_no], - [], - [AS_IF([test x_$withval = x_yes], - [AC_SEARCH_LIBS([event_loop], - [event_core event], - [AC_CHECK_FUNCS([event_base_new event_base_free])] - [AC_CHECK_HEADERS([event2/event.h], - [have_libevent=1] - [AS_IF([test "x_$ac_cv_search_event_loop" = "x_none required"],[],[EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"])], - [AC_CHECK_HEADERS([event.h], - [have_libevent=1] - [AS_IF([test "x_$ac_cv_search_event_loop" = "x_none required"],[],[EXTENSION_LIBEVENT_EXT_LIBS="$ac_cv_search_event_loop"])], - [AC_MSG_ERROR([event2/event.h and event.h missing, try without libevent])] - [have_libevent=0], - [AC_INCLUDES_DEFAULT] - [#ifndef HAVE_U_CHAR - typedef unsigned char u_char; - #endif])], - [AC_INCLUDES_DEFAULT])], - [AC_MSG_ERROR([libevent missing, try without libevent])] - )], - [have_libevent=1] - [AC_MSG_NOTICE([assuming libevent in $withval])] - [CFLAGS="$CFLAGS -I$withval/include"] - [EXTENSION_LIBEVENT_LDFLAGS="-L$withval/lib"] - [EXTENSION_LIBEVENT_EXT_LIBS="-levent"])] - ) - -AS_IF([test x_$have_libevent = x_1], - [EXTENSION_LIBEVENT_LIB="libgetdns_ext_event.la"] - [CHECK_EVENT_PROG=check_getdns_event] -# libunbound version 1.4.22 and older, not linked against libevent, on FreeBSD, -# ============================================================================= -# cannot be linked against a program that also links libevent, because of -# symbol clash. Libunbound has a libevent clone (called mini_event) build when -# not linked against libevent that uses the same symbols as libevent. - -# First detect if the libevent symbols are visible when linking with libunbound - [LIBS="$getdns_LIBS"] - [LDFLAGS="$getdns_LDFLAGS"] - [AC_MSG_CHECKING([if event_get_version symbol is leaking from libunbound])] - [AC_LANG_PUSH(C)] - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[const char *event_get_version(void);]], - [[const char *v = event_get_version();]]) - ],[[AC_MSG_RESULT([yes])] - [AC_MSG_CHECKING([if libunbound is linked against libevent])] - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[const char *event_get_version(void);]], - [[const char *v = event_get_version();] - [return v@<:@0@:>@ == 'm' && v@<:@1@:>@ == 'i' && - v@<:@2@:>@ == 'n' && v@<:@3@:>@ == 'i' ? 1 : 0;]]) - ],[[AC_MSG_RESULT([yes])] - ],[[AC_MSG_RESULT([no])] - [AC_MSG_FAILURE([ -*** -*** On this system, when using libevent, libunbound must -*** also have been compiled with libevent. Please recompile -*** libunbound with libevent, or configure --without-libevent. -***])] - ] - ) - ],[[AC_MSG_RESULT([no])] - ] - ) - [AC_LANG_POP(C)]) - -AC_SUBST(have_libevent) -AC_SUBST(EXTENSION_LIBEVENT_LIB) -AC_SUBST(EXTENSION_LIBEVENT_EXT_LIBS) -AC_SUBST(EXTENSION_LIBEVENT_LDFLAGS) -AS_IF([test "x$have_libcheck" = x1], [AC_SUBST(CHECK_EVENT_PROG)]) - -LIBS="$getdns_LIBS" -LDFLAGS="$getdns_LDFLAGS" -# end libevent extension - -#-------------------- libuv extension -# if user says nothing about libuv, or specifies --with-libuv=no or --without-libuv -# then we do not want libuv extensions built -# if user specifies --with-libuv then search for it -# if user specifies --with-libuv=/path then check the lib at that path -AC_ARG_WITH([libuv], - [AS_HELP_STRING([--with-libuv], [path to libuv (default: search /usr/local ..)])], - [with_libuv=search], - [withval=no]) - -have_libuv=0 -EXTENSION_LIBUV_EXT_LIBS="" -EXTENSION_LIBUV_LIB="" -EXTENSION_LIBUV_LDFLAGS="" -CHECK_UV_PROG="" -AS_IF([test x_$withval = x_no], - [], - [AS_IF([test x_$withval = x_yes], - [AC_SEARCH_LIBS([uv_run], - [uv], - [AC_CHECK_HEADERS([uv.h], - [have_libuv=1] - [EXTENSION_LIBUV_EXT_LIBS="$ac_cv_search_uv_run"], - [AC_MSG_ERROR([uv.h missing, try without libuv])] - [have_libuv=0], - [AC_INCLUDES_DEFAULT])], - [AC_MSG_ERROR([libuv missing, try without libuv])] - )], - [have_libuv=1] - [AC_MSG_NOTICE([assuming libuv in $withval])] - [CFLAGS="$CFLAGS -I$withval/include"] - [EXTENSION_LIBUV_LDFLAGS="-L$withval/lib"] - [EXTENSION_LIBUV_EXT_LIBS="-luv"])] - ) - -AS_IF([test x_$have_libuv = x_1], - [EXTENSION_LIBUV_LIB="libgetdns_ext_uv.la"] - [CHECK_UV_PROG=check_getdns_uv] - [AC_MSG_CHECKING([for new signature of uv_timer_cb]) - AC_LANG_PUSH(C) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include ] - [void test_cb(uv_timer_t *handle);]], - [[uv_timer_cb cb = test_cb;] - [(*cb)(0);]]) - ],[AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_NEW_UV_TIMER_CB, [1], [Does libuv have the new uv_time_cb signature]) - ],[AC_MSG_RESULT([no]) - ]) - AC_LANG_POP(C)] -) - -AC_SUBST(have_libuv) -AC_SUBST(EXTENSION_LIBUV_LIB) -AC_SUBST(EXTENSION_LIBUV_EXT_LIBS) -AC_SUBST(EXTENSION_LIBUV_LDFLAGS) -AS_IF([test "x$have_libcheck" = x1], [AC_SUBST(CHECK_UV_PROG)]) - -LIBS="$getdns_LIBS" -LDFLAGS="$getdns_LDFLAGS" -# end libuv extension - -#-------------------- libev extension -AC_ARG_WITH([libev], - [AS_HELP_STRING([--with-libev], [path to libev (default: search /usr/local ..)])], - [with_libev=search], - [withval=no]) - -have_libev=0 -EXTENSION_LIBEV_EXT_LIBS="" -EXTENSION_LIBEV_LIB="" -EXTENSION_LIBEV_LDFLAGS="" -CHECK_EV_PROG="" -AS_IF([test x_$withval = x_no], - [], - [AS_IF([test x_$withval = x_yes], - [AC_SEARCH_LIBS([ev_run], - [ev], - [AC_CHECK_HEADERS([ev.h], - [have_libev=1] - [EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"], - [AC_CHECK_HEADERS([libev/ev.h], - [have_libev=1] - [EXTENSION_LIBEV_EXT_LIBS="$ac_cv_search_ev_run"], - [AC_MSG_ERROR([ev.h missing, try without libev])] - [have_libev=0], - [AC_INCLUDES_DEFAULT]) - ], - [AC_INCLUDES_DEFAULT]) - ], - [AC_MSG_ERROR([libev missing, try without libev])] - )], - [have_libev=1] - [AC_MSG_NOTICE([assuming libev in $withval])] - [CFLAGS="$CFLAGS -I$withval/include"] - [EXTENSION_LIBEV_LDFLAGS="-L$withval/lib"] - [EXTENSION_LIBEV_EXT_LIBS="-lev"])] - ) - -AS_IF([test x_$have_libev = x_1], - [EXTENSION_LIBEV_LIB="libgetdns_ext_ev.la"] - [CHECK_EV_PROG=check_getdns_ev]) - -AC_SUBST(have_libev) -AC_SUBST(EXTENSION_LIBEV_LIB) -AC_SUBST(EXTENSION_LIBEV_EXT_LIBS) -AC_SUBST(EXTENSION_LIBEV_LDFLAGS) -AS_IF([test "x$have_libcheck" = x1], [AC_SUBST(CHECK_EV_PROG)]) - -LIBS="$getdns_LIBS" -LDFLAGS="$getdns_LDFLAGS" -# end libev extension - -# --with-trust-anchor= -AC_DEFINE([SYSCONFDIR], [sysconfdir], [System configuration dir]) -AC_ARG_WITH(trust-anchor, AS_HELP_STRING([--with-trust-anchor=KEYFILE], [Default location of the trust anchor file. [default=SYSCONFDIR/unbound/getdns-root.key]]), [ - TRUST_ANCHOR_FILE="$withval" -],[ - if test "x$TRUST_ANCHOR_FILE" = "x"; then - if test "x$sysconfdir" = 'x${prefix}/etc' ; then - if test "x$prefix" = 'xNONE' ; then - TRUST_ANCHOR_FILE="/etc/unbound/getdns-root.key" - else - TRUST_ANCHOR_FILE="${prefix}/etc/unbound/getdns-root.key" - fi - else - TRUST_ANCHOR_FILE="${sysconfdir}/unbound/getdns-root.key" - fi - fi -]) -AC_DEFINE_UNQUOTED([TRUST_ANCHOR_FILE], ["$TRUST_ANCHOR_FILE"], [Default trust anchor file]) -AC_SUBST(TRUST_ANCHOR_FILE) -AC_MSG_NOTICE([Default trust anchor: $TRUST_ANCHOR_FILE]) - -AC_ARG_WITH(getdns_query, AS_HELP_STRING([--without-getdns_query], - [Do not compile and install the getdns_query tool]), - [], [withval="yes"]) -if test x_$withval = x_no; then - GETDNS_QUERY="" - INSTALL_GETDNS_QUERY="" - UNINSTALL_GETDNS_QUERY="" -else - GETDNS_QUERY="getdns_query" - INSTALL_GETDNS_QUERY="install-getdns_query" - UNINSTALL_GETDNS_QUERY="uninstall-getdns_query" -fi -AC_SUBST(GETDNS_QUERY) -AC_SUBST(INSTALL_GETDNS_QUERY) -AC_SUBST(UNINSTALL_GETDNS_QUERY) - -AC_ARG_WITH(getdns_server_mon, AS_HELP_STRING([--without-getdns_server_mon], - [Do not compile and install the getdns_server_mon tool]), - [], [withval="yes"]) -if test x_$withval = x_no; then - GETDNS_SERVER_MON="" - INSTALL_GETDNS_SERVER_MON="" - UNINSTALL_GETDNS_SERVER_MON="" -else - GETDNS_SERVER_MON="getdns_server_mon" - INSTALL_GETDNS_SERVER_MON="install-getdns_server_mon" - UNINSTALL_GETDNS_SERVER_MON="uninstall-getdns_server_mon" -fi -AC_SUBST(GETDNS_SERVER_MON) -AC_SUBST(INSTALL_GETDNS_SERVER_MON) -AC_SUBST(UNINSTALL_GETDNS_SERVER_MON) - -stubby_with_yaml=0 -AC_ARG_WITH(stubby, AS_HELP_STRING([--with-stubby], - [Compile and install stubby, the (stub) resolver daemon]), - [], [withval="no"]) -if test x_$withval = x_yes; then - STUBBY="stubby" - INSTALL_STUBBY="install-stubby" - UNINSTALL_STUBBY="uninstall-stubby" - if test $my_with_yaml = 0 - then - STUBBY_XTRA_OBJS="convert_yaml_to_json.lo gbuffer.lo" - stubby_with_yaml=1 - my_with_yaml=1 - fi -else - STUBBY="" - INSTALL_STUBBY="" - UNINSTALL_STUBBY="" - STUBBY_XTRA_OBJS="" -fi -AC_SUBST(STUBBY) -AC_SUBST(INSTALL_STUBBY) -AC_SUBST(UNINSTALL_STUBBY) -AC_SUBST(STUBBY_XTRA_OBJS) - -STUBBY_LIBS="" -STUBBY_LDFLAGS="" - -if test $my_with_yaml = 1 -then - if test $stubby_with_yaml = 1 - then - getdns_LIBS="$LIBS" - getdns_LDFLAGS="$LDFLAGS" - LIBS="$initial_LIBS" - LDFLAGS="$initial_LDFLAGS" - fi - AC_ARG_WITH(libyaml, AS_HELP_STRING([--with-libyaml=pathname], - [path to libyaml (default: search /usr/local ..)]), - [], [withval="yes"]) - if test x_$withval = x_yes; then - for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do - if test -f "$dir/include/yaml.h"; then - CFLAGS="$CFLAGS -I$dir/include" - LDFLAGS="$LDFLAGS -L$dir/lib" - AC_MSG_NOTICE([Found libyaml in $dir]) - break - fi - done - else - if test x_$withval != x_no; then - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - else - if test $stubby_with_yaml = 1 - then - AC_MSG_ERROR([libyaml required for building Stubby]) - fi - my_with_yaml=0 - fi - fi - if test $my_with_yaml = 1 - then - AC_MSG_NOTICE([Checking for dependency libyaml]) - AC_CHECK_LIB([yaml], [yaml_parser_parse], [], [ - MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libyaml" - MISSING_SEP=", " - found_all_libs=0 - ]) - fi - if test $stubby_with_yaml = 1 - then - STUBBY_LDFLAGS="$LDFLAGS" - STUBBY_LIBS="$LIBS" - LIBS="$getdns_LIBS" - LDFLAGS="$getdns_LDFLAGS" - fi -fi -AC_SUBST(STUBBY_LDFLAGS) -AC_SUBST(STUBBY_LIBS) - -if test $found_all_libs = 0 -then - AC_MSG_ERROR([Missing dependencies: $MISSING_DEPS]) -fi - -AC_CONFIG_FILES([Makefile src/Makefile src/version.c src/getdns/getdns.h src/getdns/getdns_extra.h spec/example/Makefile src/test/Makefile src/tools/Makefile doc/Makefile getdns.pc getdns_ext_event.pc]) -if [ test -n "$DOXYGEN" ] - then AC_CONFIG_FILES([src/Doxyfile]) -fi - -AC_MSG_CHECKING([whether the C compiler (${CC-cc}) supports the __func__ variable]) -AC_LANG_PUSH(C) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[char*s=__func__;]],[[]])], - [AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE___FUNC__, [1], [Whether the C compiler support the __func__ variable])], - [AC_MSG_RESULT([no])]) -AC_LANG_POP(C) - -dnl ----- -dnl ----- Start of "Things needed for gldns" section -dnl ----- -dnl --------------------------------------------------------------------------- - -AC_CHECK_HEADERS([stdarg.h stdint.h netinet/in.h arpa/inet.h netdb.h sys/socket.h time.h sys/time.h sys/select.h endian.h limits.h sys/limits.h],,, [AC_INCLUDES_DEFAULT]) - -dnl Check the printf-format attribute (if any) -dnl result in HAVE_ATTR_FORMAT. -dnl -AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute) -AC_CACHE_VAL(ac_cv_c_format_attribute, -[ac_cv_c_format_attribute=no -AC_TRY_COMPILE( -[#include -void f (char *format, ...) __attribute__ ((format (printf, 1, 2))); -void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2))); -], [ - f ("%s", "str"); -], -[ac_cv_c_format_attribute="yes"], -[ac_cv_c_format_attribute="no"]) -]) -AC_MSG_RESULT($ac_cv_c_format_attribute) -if test $ac_cv_c_format_attribute = yes; then - AC_DEFINE(HAVE_ATTR_FORMAT, 1, [Whether the C compiler accepts the "format" attribute]) -fi - -AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute) -AC_CACHE_VAL(ac_cv_c_unused_attribute, -[ac_cv_c_unused_attribute=no -AC_TRY_COMPILE( -[#include -void f (char *u __attribute__((unused))); -], [ - f ("x"); -], -[ac_cv_c_unused_attribute="yes"], -[ac_cv_c_unused_attribute="no"]) -]) -AC_MSG_RESULT($ac_cv_c_unused_attribute) -if test $ac_cv_c_unused_attribute = yes; then - AC_DEFINE(HAVE_ATTR_UNUSED, 1, [Whether the C compiler accepts the "unused" attribute]) -fi -# Check for libbsd, so that the next function checks pick it as their -# system implementation. -PKG_CHECK_MODULES([LIBBSD],[libbsd-overlay],[ -LIBS="$LIBS $LIBBSD_LIBS" -STUBBY_LIBS="$STUBBY_LIBS $LIBBSD_LIBS" -CFLAGS="$CFLAGS $LIBBSD_CFLAGS" -],[ -AC_MSG_WARN([libbsd not found or usable; using embedded code instead]) -]) -AC_CHECK_DECLS([inet_pton,inet_ntop,strlcpy,arc4random,arc4random_uniform], [], [], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_WS2TCPIP_H -#include -#endif -]) -AS_IF([test "x$ac_cv_have_decl_inet_pton" = xyes], - [], - [AC_REPLACE_FUNCS(inet_pton)] -) -AS_IF([test "x$ac_cv_have_decl_inet_ntop" = xyes], - [], - [AC_REPLACE_FUNCS(inet_ntop)] -) -AC_REPLACE_FUNCS(strlcpy) -AC_REPLACE_FUNCS(arc4random) -AC_REPLACE_FUNCS(arc4random_uniform) -if test "$ac_cv_func_arc4random" = "no"; then - AC_LIBOBJ(explicit_bzero) - AC_LIBOBJ(arc4_lock) - AC_CHECK_FUNCS([getentropy],,[ - if test "$USE_WINSOCK" = 1; then - AC_LIBOBJ(getentropy_win) - else - case `uname` in - Darwin) - AC_LIBOBJ(getentropy_osx) - ;; - SunOS) - AC_LIBOBJ(getentropy_solaris) - AC_CHECK_HEADERS([sys/sha2.h],, [ - AC_CHECK_FUNCS([SHA512_Update],,[ - AC_LIBOBJ(sha512) - ]) - ], [AC_INCLUDES_DEFAULT]) - if test "$ac_cv_header_sys_sha2_h" = "yes"; then - # this lib needed for sha2 on solaris - LIBS="$LIBS -lmd" - fi - AC_SEARCH_LIBS([clock_gettime], [rt]) - ;; - Linux|*) - AC_LIBOBJ(getentropy_linux) - dnl AC_CHECK_FUNCS([SHA512_Update],,[ - dnl AC_DEFINE([COMPAT_SHA512], [1], [Do sha512 definitions in config.h]) - dnl AC_LIBOBJ(sha512) - dnl]) - AC_CHECK_HEADERS([sys/sysctl.h],,, [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS([getauxval]) - AC_SEARCH_LIBS([clock_gettime], [rt]) - ;; - esac - fi - ]) -fi - -AC_TYPE_SIGNAL - -case `uname` in -FreeBSD) - C99COMPATFLAGS="" -;; -*) - C99COMPATFLAGS="-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600" -;; -esac -AC_SUBST(C99COMPATFLAGS) - -AC_DEFINE_UNQUOTED([MAX_CNAME_REFERRALS], [100], [The maximum number of cname referrals.]) -AC_DEFINE_UNQUOTED([DRAFT_RRTYPES], [1], [Define this to enable all rrtypes in gldns.]) - -AH_BOTTOM([ - -#ifdef HAVE___FUNC__ -#define __FUNC__ __func__ -#else -#define __FUNC__ __FUNCTION__ -#endif - -#ifdef GETDNS_ON_WINDOWS - /* On windows it is allowed to increase the FD_SETSIZE - * (and necessary to make our custom eventloop work) - * See: https://support.microsoft.com/en-us/kb/111855 - */ -# ifndef FD_SETSIZE -# define FD_SETSIZE 1024 -# endif - -/* the version of the windows API enabled */ -# ifndef WINVER -# define WINVER 0x0600 // 0x0502 -# endif -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 // 0x0502 -# endif -# ifdef HAVE_WS2TCPIP_H -# include -# endif - -# ifdef _MSC_VER -# if _MSC_VER >= 1800 -# define PRIsz "zu" -# else -# define PRIsz "Iu" -# endif -# else -# define PRIsz "Iu" -# endif - -# ifdef HAVE_WINSOCK2_H -# include -# endif - -/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */ -# ifdef HAVE_WINSOCK2_H -# define FD_SET_T (u_int) -# else -# define FD_SET_T -# endif - - /* Windows wants us to use _strdup instead of strdup */ -# ifndef strdup -# define strdup _strdup -# endif -#else -# define PRIsz "zu" -#endif - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if STDC_HEADERS -#include -#include -#endif - -#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY || !defined(strlcpy) -size_t strlcpy(char *dst, const char *src, size_t siz); -#else -#ifndef __BSD_VISIBLE -#define __BSD_VISIBLE 1 -#endif -#endif -#if !defined(HAVE_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM -uint32_t arc4random(void); -#endif -#if !defined(HAVE_ARC4RANDOM_UNIFORM) || !HAVE_DECL_ARC4RANDOM_UNIFORM -uint32_t arc4random_uniform(uint32_t upper_bound); -#endif -#ifndef HAVE_ARC4RANDOM -void explicit_bzero(void* buf, size_t len); -int getentropy(void* buf, size_t len); -void arc4random_buf(void* buf, size_t n); -void _ARC4_LOCK(void); -void _ARC4_UNLOCK(void); -#endif -#ifdef COMPAT_SHA512 -#ifndef SHA512_DIGEST_LENGTH -#define SHA512_BLOCK_LENGTH 128 -#define SHA512_DIGEST_LENGTH 64 -#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) -typedef struct _SHA512_CTX { - uint64_t state[8]; - uint64_t bitcount[2]; - uint8_t buffer[SHA512_BLOCK_LENGTH]; -} SHA512_CTX; -#endif /* SHA512_DIGEST_LENGTH */ -void SHA512_Init(SHA512_CTX*); -void SHA512_Update(SHA512_CTX*, void*, size_t); -void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); -unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest); -#endif /* COMPAT_SHA512 */ - -#ifndef HAVE_DECL_INET_PTON -int inet_pton(int af, const char* src, void* dst); -#endif /* HAVE_INET_PTON */ - -#ifndef HAVE_DECL_INET_NTOP -const char *inet_ntop(int af, const void *src, char *dst, size_t size); -#endif - -#ifdef USE_WINSOCK -# ifndef _CUSTOM_VSNPRINTF -# define _CUSTOM_VSNPRINTF -static inline int _gldns_custom_vsnprintf(char *str, size_t size, const char *format, va_list ap) -{ int r = vsnprintf(str, size, format, ap); return r == -1 ? _vscprintf(format, ap) : r; } -# define vsnprintf _gldns_custom_vsnprintf -# endif -#endif - -#ifdef __cplusplus -} -#endif - -/** Use on-board gldns */ -#define USE_GLDNS 1 -#ifdef HAVE_SSL -# define GLDNS_BUILD_CONFIG_HAVE_SSL 1 -#endif - -#ifdef HAVE_STDARG_H -#include -#endif - -#include - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_TCP_H -#include -#endif - -#ifdef HAVE_SYS_SELECT_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_INTTYPES_H -#include -#endif - -#ifdef HAVE_LIMITS_H -#include -#endif - -#ifdef HAVE_SYS_LIMITS_H -#include -#endif - -#ifdef PATH_MAX -#define _GETDNS_PATH_MAX PATH_MAX -#else -#define _GETDNS_PATH_MAX 2048 -#endif - -#ifndef PRIu64 -#define PRIu64 "llu" -#endif - -#ifdef HAVE_ATTR_FORMAT -# define ATTR_FORMAT(archetype, string_index, first_to_check) \ - __attribute__ ((format (archetype, string_index, first_to_check))) -#else /* !HAVE_ATTR_FORMAT */ -# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ -#endif /* !HAVE_ATTR_FORMAT */ - -#if defined(DOXYGEN) -# define ATTR_UNUSED(x) x -#elif defined(__cplusplus) -# define ATTR_UNUSED(x) -#elif defined(HAVE_ATTR_UNUSED) -# define ATTR_UNUSED(x) x __attribute__((unused)) -#else /* !HAVE_ATTR_UNUSED */ -# define ATTR_UNUSED(x) x -#endif /* !HAVE_ATTR_UNUSED */ - -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS) -#define strptime unbound_strptime -struct tm; -char *strptime(const char *s, const char *format, struct tm *tm); -#endif - -#if !defined(HAVE_SIGSET_T) && defined(HAVE__SIGSET_T) -typedef _sigset_t sigset_t; -#endif -#if !defined(HAVE_SIGEMPTYSET) -# define sigemptyset(pset) (*(pset) = 0) -#endif -#if !defined(HAVE_SIGFILLSET) -# define sigfillset(pset) (*(pset) = (sigset_t)-1) -#endif -#if !defined(HAVE_SIGADDSET) -# define sigaddset(pset, num) (*(pset) |= (1L<<(num))) -#endif - -#ifdef HAVE_LIBUNBOUND -# include -# ifdef HAVE_UNBOUND_EVENT_H -# include -# else -# ifdef HAVE_UNBOUND_EVENT_API -# ifndef _UB_EVENT_PRIMITIVES -# define _UB_EVENT_PRIMITIVES -struct ub_event_base; -struct ub_ctx* ub_ctx_create_ub_event(struct ub_event_base* base); -typedef void (*ub_event_callback_t)(void*, int, void*, int, int, char*); -int ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype, - int rrclass, void* mydata, ub_event_callback_t callback, int* async_id); -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -} -#endif -]) - -dnl --------------------------------------------------------------------------- -dnl ----- -dnl ----- End of "Things needed for gldns" section -dnl ----- - - -AC_CONFIG_HEADER([src/config.h]) -AC_OUTPUT diff --git a/doc/Makefile.in b/doc/Makefile.in deleted file mode 100644 index 94770c77..00000000 --- a/doc/Makefile.in +++ /dev/null @@ -1,93 +0,0 @@ -# -# @configure_input@ -# -# -# Copyright (c) 2013, Verisign, Inc., NLnet Labs -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the names of the copyright holders nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package = @PACKAGE_NAME@ -version = @PACKAGE_VERSION@ -tarname = @PACKAGE_TARNAME@ -distdir = $(tarname)-$(version) - -api_version = @API_VERSION@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -# datarootdir is here to please some checkers -datarootdir=@datarootdir@ -mandir = @mandir@ -INSTALL = @INSTALL@ - -srcdir = @srcdir@ -VPATH = @srcdir@ - -EDITS=-e 's/@''version@/$(version)/g' -DOXYGEN = @DOXYGEN@ - -DOCDIRS = html latex man -MANPAGES3 = libgetdns.3 getdns_address.3 getdns_cancel_callback.3 getdns_context.3 getdns_context_set.3 getdns_context_set_context_update_callback.3 getdns_convert.3 getdns_dict.3 getdns_dict_get.3 getdns_dict_set.3 getdns_display_ip_address.3 getdns_general.3 getdns_hostname.3 getdns_list.3 getdns_list_get.3 getdns_list_set.3 getdns_pretty_print_dict.3 getdns_root_trust_anchor.3 getdns_service.3 getdns_validate_dnssec.3 - -default: all - -all: doc - -doc: $(MANPAGES3) - if test x_$(DOXYGEN) != x_ ; then cd ../src; doxygen; fi - -.SUFFIXES: .3.in .3 -.3.in.3: - sed $(EDITS) -e "s/@date@/$(api_version)/g" $< > $@ - -# we assume that we want a separate file for each "name" specified for each man page -# and consider these "alternate names" simple copies of the main man page -install: $(MANPAGES3) - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir) - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3 - for x in $(MANPAGES3); do echo $(INSTALL) -m 644 $$x $(DESTDIR)$(mandir)/man3; $(INSTALL) -m 644 $$x $(DESTDIR)$(mandir)/man3; for altpg in $$($(srcdir)/manpgaltnames $$x); do cp $$x $$altpg; echo $(INSTALL) -m 644 $$altpg $(DESTDIR)$(mandir)/man3; $(INSTALL) -m 644 $$altpg $(DESTDIR)$(mandir)/man3; done; done - -check: $(MANPAGES3) - for x in $(MANPAGES3); do LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z $$x 2>&1 >/dev/null | awk "-vpage=$$x" '{printf("%s: ", page);print}'; if ! lexgrog $$x >/dev/null 2>&1 ; then echo $$x: manpage-has-bad-whatis-entry; fi; done - -uninstall: - for x in $(MANPAGES3); do echo rm -f $(DESTDIR)$(mandir)/man3/$$x; rm -f $(DESTDIR)$(mandir)/man3/$$x; for altpg in $$($(srcdir)/manpgaltnames $$x); do echo rm -f $(DESTDIR)$(mandir)/man3/$$altpg; rm -f $(DESTDIR)$(mandir)/man3/$$altpg; done; done - -clean: - for x in $(MANPAGES3); do rm -f $$($(srcdir)/manpgaltnames $$x); done - rm -f tagfile - rm -rf $(DOCDIRS) $(MANPAGES3) - -distclean : clean - rm -f Makefile config.status config.log - rm -Rf autom4te.cache - -Makefile: Makefile.in ../config.status - cd .. && ./config.status $@ - -configure.status: configure - cd .. && ./config.status --recheck - -.PHONY: clean $(DOC) diff --git a/m4/acx_getaddrinfo.m4 b/m4/acx_getaddrinfo.m4 deleted file mode 100644 index a4af9e1d..00000000 --- a/m4/acx_getaddrinfo.m4 +++ /dev/null @@ -1,81 +0,0 @@ -# Taken from acx_nlnetlabs.m4 - common macros for configure checks -# Copyright 2009, Wouter Wijngaards, NLnet Labs. -# BSD licensed. -# - -dnl Check getaddrinfo. -dnl Works on linux, solaris, bsd and windows(links winsock). -dnl defines HAVE_GETADDRINFO, USE_WINSOCK. -AC_DEFUN([ACX_CHECK_GETADDRINFO_WITH_INCLUDES], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(for getaddrinfo) -ac_cv_func_getaddrinfo=no -AC_LINK_IFELSE( -[AC_LANG_SOURCE([[ -#ifdef __cplusplus -extern "C" -{ -#endif -char* getaddrinfo(); -char* (*f) () = getaddrinfo; -#ifdef __cplusplus -} -#endif -int main() { - ; - return 0; -} -]])], -dnl this case on linux, solaris, bsd -[ac_cv_func_getaddrinfo="yes" -dnl see if on windows -if test "$ac_cv_header_windows_h" = "yes"; then - AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used]) - USE_WINSOCK="1" - LIBS="$LIBS -lws2_32 -lcrypt32" -fi -], -dnl no quick getaddrinfo, try mingw32 and winsock2 library. -ORIGLIBS="$LIBS" -LIBS="$LIBS -lws2_32 -lcrypt32" -AC_LINK_IFELSE( -[AC_LANG_PROGRAM( -[ -#define _WIN32_WINNT 0x0501 -#ifdef HAVE_WINDOWS_H -#include -#endif -#ifdef HAVE_WINSOCK_H -#include -#endif -#ifdef HAVE_WINSOCK2_H -#include -#endif -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -], -[ - (void)getaddrinfo(NULL, NULL, NULL, NULL); -] -)], -[ -ac_cv_func_getaddrinfo="yes" -dnl already: LIBS="$LIBS -lws2_32 -lcrypt32" -AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used]) -USE_WINSOCK="1" -], -[ -ac_cv_func_getaddrinfo="no" -LIBS="$ORIGLIBS" -]) -) - -AC_MSG_RESULT($ac_cv_func_getaddrinfo) -if test $ac_cv_func_getaddrinfo = yes; then - AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) -fi -])dnl Endof AC_CHECK_GETADDRINFO_WITH_INCLUDES - -dnl End of file diff --git a/m4/acx_openssl.m4 b/m4/acx_openssl.m4 deleted file mode 100644 index fc3b4dde..00000000 --- a/m4/acx_openssl.m4 +++ /dev/null @@ -1,164 +0,0 @@ -# Taken from acx_nlnetlabs.m4 - common macros for configure checks -# Copyright 2009, Wouter Wijngaards, NLnet Labs. -# BSD licensed. -# -dnl Add a -R to the RUNTIME_PATH. Only if rpath is enabled and it is -dnl an absolute path. -dnl $1: the pathname to add. -AC_DEFUN([ACX_RUNTIME_PATH_ADD], [ - if test "x$enable_rpath" = xyes; then - if echo "$1" | grep "^/" >/dev/null; then - RUNTIME_PATH="$RUNTIME_PATH -R$1" - fi - fi -]) -dnl Common code for both ACX_WITH_SSL and ACX_WITH_SSL_OPTIONAL -dnl Takes one argument; the withval checked in those 2 functions -dnl sets up the environment for the given openssl path -AC_DEFUN([ACX_SSL_CHECKS], [ - withval=$1 - if test x_$withval != x_no; then - AC_MSG_CHECKING(for SSL) - if test x_$withval = x_ -o x_$withval = x_yes; then - withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" - fi - for dir in $withval; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl="yes" - AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) - dnl assume /usr/include is already in the include-path. - if test "$ssldir" != "/usr"; then - CPPFLAGS="$CPPFLAGS -I$ssldir/include" - LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" - fi - break; - fi - done - if test x_$found_ssl != x_yes; then - AC_MSG_ERROR(Cannot find the SSL libraries in $withval) - else - AC_MSG_RESULT(found in $ssldir) - HAVE_SSL=yes - dnl assume /usr is already in the lib and dynlib paths. - if test "$ssldir" != "/usr" -a "$ssldir" != ""; then - LDFLAGS="$LDFLAGS -L$ssldir/lib" - LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" - ACX_RUNTIME_PATH_ADD([$ssldir/lib]) - fi - - AC_MSG_CHECKING([for HMAC_Update in -lcrypto]) - LIBS="-lssl -lcrypto $LIBS" - LIBSSL_LIBS="-lssl -lcrypto $LIBSSL_LIBS" - AC_TRY_LINK(, [ - int HMAC_Update(void); - (void)HMAC_Update(); - ], [ - AC_DEFINE([HAVE_HMAC_UPDATE], 1, - [If you have HMAC_Update]) - AC_MSG_RESULT(yes) - ], [ - AC_MSG_RESULT(no) - # check if -lwsock32 or -lgdi32 are needed. - BAKLIBS="$LIBS" - BAKSSLLIBS="$LIBSSL_LIBS" - LIBS="$LIBS -lgdi32" - LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" - AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) - AC_TRY_LINK([], [ - int HMAC_Update(void); - (void)HMAC_Update(); - ],[ - AC_DEFINE([HAVE_HMAC_UPDATE], 1, - [If you have HMAC_Update]) - AC_MSG_RESULT(yes) - ],[ - AC_MSG_RESULT(no) - LIBS="$BAKLIBS" - LIBSSL_LIBS="$BAKSSLLIBS" - LIBS="$LIBS -ldl" - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - AC_MSG_CHECKING([if -lcrypto needs -ldl]) - AC_TRY_LINK([], [ - int HMAC_Update(void); - (void)HMAC_Update(); - ],[ - AC_DEFINE([HAVE_HMAC_UPDATE], 1, - [If you have HMAC_Update]) - AC_MSG_RESULT(yes) - ],[ - AC_MSG_RESULT(no) - AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) - ]) - ]) - ]) - fi - AC_SUBST(HAVE_SSL) - AC_SUBST(RUNTIME_PATH) - fi -AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) - -dnl TLS v1.2 requires OpenSSL 1.0.1 -AC_CHECK_FUNC(TLSv1_2_client_method,AC_DEFINE([HAVE_TLS_v1_2], [1], - [Define if you have libssl with tls 1.2]),[AC_MSG_WARN([Cannot find TLSv1_2_client_method in libssl library. TLS will not be available.])]) - -dnl Native OpenSSL hostname verification requires OpenSSL 1.0.2 -AC_CHECK_FUNC(SSL_CTX_get0_param,AC_DEFINE([HAVE_SSL_HN_AUTH], [1], - [Define if you have libssl with host name verification]),[AC_MSG_WARN([Cannot find SSL_CTX_get0_param in libssl library. TLS hostname verification will not be available.])]) -]) - -dnl Check for SSL, where SSL is mandatory -dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found -dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. -dnl Checks main header files of SSL. -dnl -AC_DEFUN([ACX_WITH_SSL], -[ -AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], - [enable SSL (will check /usr/local/ssl - /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ - ],[ - withval="yes" - ]) - if test x_$withval = x_no; then - AC_MSG_ERROR([Need SSL library to do digital signature cryptography]) - fi - ACX_SSL_CHECKS($withval) -])dnl End of ACX_WITH_SSL - -dnl Check for SSL, where ssl is optional (--without-ssl is allowed) -dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found -dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. -dnl Checks main header files of SSL. -dnl -AC_DEFUN([ACX_WITH_SSL_OPTIONAL], -[ -AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], - [enable SSL (will check /usr/local/ssl - /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ - ],[ - withval="yes" - ]) - ACX_SSL_CHECKS($withval) -])dnl End of ACX_WITH_SSL_OPTIONAL - -dnl Setup to use -lssl -dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one). -AC_DEFUN([ACX_LIB_SSL], -[ -# check if libssl needs libdl -BAKLIBS="$LIBS" -LIBS="-lssl $LIBS" -AC_MSG_CHECKING([if libssl needs libdl]) -AC_TRY_LINK_FUNC([SSL_CTX_new], [ - AC_MSG_RESULT([no]) - LIBS="$BAKLIBS" -] , [ - AC_MSG_RESULT([yes]) - LIBS="$BAKLIBS" - AC_SEARCH_LIBS([dlopen], [dl]) -]) ])dnl End of ACX_LIB_SSL - - diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 deleted file mode 100644 index 51df0c09..00000000 --- a/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,74 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# 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 . -# -# 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 3 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_lib_nettle.m4 b/m4/ax_lib_nettle.m4 deleted file mode 100644 index e0ba1eac..00000000 --- a/m4/ax_lib_nettle.m4 +++ /dev/null @@ -1,80 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lib_nettle.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LIB_NETTLE([yes|no|auto]) -# -# DESCRIPTION -# -# Searches for the 'nettle' library with the --with... option. -# -# If found, define HAVE_NETTLE and macro NETTLE_LIBS. Also defines -# NETTLE_WITH_ for the algorithms found available. Possible -# algorithms: AES ARCTWO BLOWFISH CAST128 DES DES3 SERPENT TWOFISH MD2 MD4 -# MD5 SHA1 SHA256. -# -# The argument is used if no --with...-nettle option is set. Value "yes" -# requires the configuration by default. Value "no" does not require it by -# default. Value "auto" configures the library only if available. -# -# See also AX_LIB_BEECRYPT, AX_LIB_CRYPTO, and AX_LIB_GCRYPT. -# -# LICENSE -# -# Copyright (c) 2009 Fabien Coelho -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 10 - -# AX_CHECK_NETTLE_ALGO([name],[function]) -AC_DEFUN([AX_CHECK_NETTLE_ALGO],[ - AC_CHECK_LIB([nettle], [nettle_$2], - AC_DEFINE([NETTLE_WITH_$1],[1],[Algorithm $1 in nettle library])) -]) - -# AX_LIB_NETTLE([yes|no|auto]) -AC_DEFUN([AX_LIB_NETTLE],[ - AC_MSG_CHECKING([whether nettle is enabled]) - AC_ARG_WITH([nettle], - AC_HELP_STRING([--with-nettle], [Require nettle library (required with GnuTLS)]),[ - AC_MSG_RESULT([$withval]) - ax_with_nettle=$withval - ],[ - AC_MSG_RESULT([$1]) - ax_with_nettle=$1 - ]) - if test "$ax_with_nettle" = "yes" -o "$ax_with_nettle" = "auto" ; then - AC_CHECK_HEADERS([nettle/nettle-meta.h],[ - AC_CHECK_LIB([nettle],[nettle_base64_encode_final],[ - AC_DEFINE([HAVE_NETTLE],[1],[Nettle library is available]) - HAVE_NETTLE=1 - AC_SUBST([NETTLE_LIBS],[-lnettle]) - # ciphers - AX_CHECK_NETTLE_ALGO([AES],[aes_encrypt]) - AX_CHECK_NETTLE_ALGO([ARCTWO],[arctwo_encrypt]) - AX_CHECK_NETTLE_ALGO([BLOWFISH],[blowfish_encrypt]) - AX_CHECK_NETTLE_ALGO([CAST128],[cast128_encrypt]) - AX_CHECK_NETTLE_ALGO([DES],[des_encrypt]) - AX_CHECK_NETTLE_ALGO([DES3],[des3_encrypt]) - AX_CHECK_NETTLE_ALGO([SERPENT],[serpent_encrypt]) - AX_CHECK_NETTLE_ALGO([TWOFISH],[twofish_encrypt]) - # digests - AX_CHECK_NETTLE_ALGO([MD2],[md2_digest]) - AX_CHECK_NETTLE_ALGO([MD4],[md4_digest]) - AX_CHECK_NETTLE_ALGO([MD5],[md5_digest]) - AX_CHECK_NETTLE_ALGO([SHA1],[sha1_digest]) - AX_CHECK_NETTLE_ALGO([SHA256],[sha256_digest]) - ]) - ]) - # complain only if explicitly required - if test "$ax_with_nettle" = "yes" -a "x$HAVE_NETTLE" = "x" ; then - AC_MSG_ERROR([cannot configure required nettle library]) - fi - fi -]) diff --git a/m4/pkg.m4 b/m4/pkg.m4 deleted file mode 100644 index c5b26b52..00000000 --- a/m4/pkg.m4 +++ /dev/null @@ -1,214 +0,0 @@ -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG - -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED - - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])# PKG_CHECK_MODULES - - -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR - - -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR - - -# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------- -# Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])# PKG_CHECK_VAR diff --git a/CodingStyle b/project-doc/CodingStyle similarity index 100% rename from CodingStyle rename to project-doc/CodingStyle diff --git a/doc/check_getdns_testcases.doc b/project-doc/check_getdns_testcases.doc similarity index 100% rename from doc/check_getdns_testcases.doc rename to project-doc/check_getdns_testcases.doc diff --git a/project-doc/freebsd-tests-notes.txt b/project-doc/freebsd-tests-notes.txt new file mode 100644 index 00000000..fd336c0c --- /dev/null +++ b/project-doc/freebsd-tests-notes.txt @@ -0,0 +1,10 @@ +pkg update +pkg upgrade +pkg install -y gawk unbound valgrind bash check cmake git libyaml libevent libuv +git clone git@github.com:getdnsapi/getdns.git +cd getdns/ +git checkout remotes/origin/release/1.6.0-beta.1 +mkdir test +cd test/ +../src/test/tpkg/run-all.sh + diff --git a/project-doc/makedist.sh b/project-doc/makedist.sh new file mode 100755 index 00000000..55816195 --- /dev/null +++ b/project-doc/makedist.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +[ ! -f git-archive-all.sh ] && wget "https://raw.githubusercontent.com/meitar/git-archive-all.sh/master/git-archive-all.sh" +[ ! -x git-archive-all.sh ] && chmod +x git-archive-all.sh +[ ! -f git-archive-all.sh ] && exit 1 +GIT_ARCHIVE="`pwd`/git-archive-all.sh" +git submodule update --init +GIT_ROOT=`git rev-parse --show-toplevel` +version=`awk '/^set\(PACKAGE_VERSION/{V=$2} + /^set\(RELEASE_CANDIDATE/{RC=$2} + END{print V""RC}' "$GIT_ROOT/CMakeLists.txt" | sed 's/[")]//g'` +output_file="getdns-${version}.tar.gz" +( cd "$GIT_ROOT" \ + && "$GIT_ARCHIVE" --prefix "getdns-$version/" --format tar.gz \ + --worktree-attributes -- - ) > "$output_file" +openssl md5 "$output_file" > "${output_file}.md5" +openssl sha1 "$output_file" > "${output_file}.sha1" +openssl sha256 "$output_file" > "${output_file}.sha256" +gpg --armor --detach-sig "$output_file" +[ -f "$output_file" -a -f "${output_file}.md5" -a -f "${output_file}.sha1" -a -f "${output_file}.sha256" -a -f "${output_file}.asc" ] \ +&& rm git-archive-all.sh diff --git a/project-doc/packages.txt b/project-doc/packages.txt index 7e40a201..25e1c79b 100644 --- a/project-doc/packages.txt +++ b/project-doc/packages.txt @@ -15,3 +15,6 @@ https://github.com/astlinux-project/astlinux/tree/master/package/getdns For Genode, created and maintained by Emery Hemingway (ehmry) https://github.com/genodelabs/genode/blob/master/repos/ports/ports/getdns.port + +For Gentoo, created and maintained by CaseOf (Quentin R.?) +https://packages.gentoo.org/packages/net-dns/getdns diff --git a/spec/example/Makefile.in b/spec/example/Makefile.in deleted file mode 100644 index 8ff7f2d1..00000000 --- a/spec/example/Makefile.in +++ /dev/null @@ -1,172 +0,0 @@ -# -# @configure_input@ -# -# Copyright (c) 2013, Verisign, Inc., NLNet Labs -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the names of the copyright holders nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package = @PACKAGE_NAME@ -version = @PACKAGE_VERSION@ -tarname = @PACKAGE_TARNAME@ -distdir = $(tarname)-$(version) - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -LIBTOOL = ../../libtool - -srcdir = @srcdir@ - -EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@ -EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@ -EXTENSION_LIBEVENT_LIB=../../src/libgetdns_ext_event.la - -CC=@CC@ -CFLAGS=-I$(srcdir) -I$(srcdir)/../../src -I../../src @CFLAGS@ -LDFLAGS=@LDFLAGS@ -L../../src -LDLIBS=../../src/libgetdns.la @LIBS@ - - -OBJS=example-all-functions.lo example-simple-answers.lo example-tree.lo example-synchronous.lo example-reverse.lo - -PROGRAMS=example-all-functions example-synchronous example-simple-answers example-tree example-reverse - -.SUFFIXES: .c .o .a .lo .h - -.c.o: - $(CC) $(CFLAGS) -c $< -o $@ - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -default: all -example: all - -all: $(PROGRAMS) - -$(OBJS): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@ - -example-all-functions: example-all-functions.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example-all-functions.lo - -example-synchronous: example-synchronous.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example-synchronous.lo - -$(EXTENSION_LIBEVENT_LIB): - @echo "***" - @echo "*** Three examples from the specification need libevent." - @echo "*** libevent was not found or usable at configure time." - @echo "*** To compile and run all examples from the spec, make sure" - @echo "*** libevent is available and usable during configuration." - @echo "***" - @false - -example-simple-answers: example-simple-answers.lo $(EXTENSION_LIBEVENT_LIB) - $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ example-simple-answers.lo - -example-tree: example-tree.lo $(EXTENSION_LIBEVENT_LIB) - $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ example-tree.lo - -example-reverse: example-reverse.lo $(EXTENSION_LIBEVENT_LIB) - $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ example-reverse.lo - -clean: - rm -f *.o *.lo $(PROGRAMS) - rm -rf .libs - -distclean : clean - rm -f Makefile config.status config.log - rm -Rf autom4te.cache - -$(distdir): FORCE - mkdir -p $(distdir)/src - cp configure.ac $(distdir) - cp configure $(distdir) - cp Makefile.in $(distdir) - cp src/Makefile.in $(distdir)/src - -distcheck: $(distdir).tar.gz - gzip -cd $(distdir).tar.gz | tar xvf - - cd $(distdir) && ./configure - cd $(distdir) && $(MAKE) all - cd $(distdir) && $(MAKE) check - cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst install - cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst uninstall - @remaining="`find $${PWD}/$(distdir)/_inst -type f | wc -l`"; \ - if test "$${remaining}" -ne 0; then - echo "@@@ $${remaining} file(s) remaining in stage directory!"; \ - exit 1; \ - fi - cd $(distdir) && $(MAKE) clean - rm -rf $(distdir) - @echo "*** Package $(distdir).tar.gz is ready for distribution" - -Makefile: $(srcdir)/Makefile.in ../../config.status - cd ../.. && ./config.status spec/example/Makefile - -configure.status: configure - cd ../.. && ./config.status --recheck - -.PHONY: clean - -depend: - (cd $(srcdir) ; awk 'BEGIN{P=1}{if(P)print}/^# Dependencies/{P=0}' Makefile.in > Makefile.in.new ) - (blddir=`pwd`; cd $(srcdir) ; gcc -MM -I. -I../../src -I"$$blddir"/../../src *.c | \ - sed -e "s? $$blddir/? ?g" \ - -e 's? \([a-z_-]*\)\.\([ch]\)? $$(srcdir)/\1.\2?g' \ - -e 's? \$$(srcdir)/\.\./\.\./src/config\.h? ../../src/config.h?g' \ - -e 's? $$(srcdir)/\.\./\.\./src/getdns/getdns_extra\.h? ../../src/getdns/getdns_extra.h?g' \ - -e 's? \.\./\.\./src/getdns/getdns_ext_libevent\.h? $$(srcdir)/../../src/getdns/getdns_ext_libevent.h?g' \ - -e 's? \.\./\.\./src/getdns/getdns_ext_libev\.h? $$(srcdir)/../../src/getdns/getdns_ext_libev.h?g' \ - -e 's? \.\./\.\./src/getdns/getdns_ext_libuv\.h? $$(srcdir)/../../src/getdns/getdns_ext_libuv.h?g' \ - -e 's? \.\./\.\./src/debug\.h? $$(srcdir)/../../src/debug.h?g' \ - -e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' >> Makefile.in.new ) - (cd $(srcdir) ; diff Makefile.in.new Makefile.in && rm Makefile.in.new \ - || mv Makefile.in.new Makefile.in ) - - -# Dependencies for the examples -example-all-functions.lo example-all-functions.o: $(srcdir)/example-all-functions.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ - ../../src/getdns/getdns_extra.h -example-reverse.lo example-reverse.o: $(srcdir)/example-reverse.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ - ../../src/getdns/getdns_extra.h -example-simple-answers.lo example-simple-answers.o: $(srcdir)/example-simple-answers.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ - ../../src/getdns/getdns_extra.h -example-synchronous.lo example-synchronous.o: $(srcdir)/example-synchronous.c $(srcdir)/getdns_core_only.h \ - ../../src/getdns/getdns.h -example-tree.lo example-tree.o: $(srcdir)/example-tree.c $(srcdir)/getdns_libevent.h \ - ../../src/config.h \ - ../../src/getdns/getdns.h \ - $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ - ../../src/getdns/getdns_extra.h diff --git a/src/Doxyfile.in b/src/Doxyfile.in index 925dd994..b43e9448 100644 --- a/src/Doxyfile.in +++ b/src/Doxyfile.in @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ../doc +OUTPUT_DIRECTORY = doc # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and diff --git a/src/Makefile.in b/src/Makefile.in deleted file mode 100644 index 9b206491..00000000 --- a/src/Makefile.in +++ /dev/null @@ -1,612 +0,0 @@ -# -# @configure_input@ -# -# Copyright (c) 2013, Verisign, Inc., NLnet Labs -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the names of the copyright holders nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package = @PACKAGE_NAME@ -version = @PACKAGE_VERSION@ -tarname = @PACKAGE_TARNAME@ -distdir = $(tarname)-$(version) -libversion = @GETDNS_LIBVERSION@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -sbindir = @sbindir@ -libdir = @libdir@ -includedir = @includedir@ -sysconfdir = @sysconfdir@ -localstatedir = @localstatedir@ -runstatedir = @runstatedir@ -stubbyconfdir = $(sysconfdir)/stubby -have_libevent = @have_libevent@ -have_libuv = @have_libuv@ -have_libev = @have_libev@ -# datarootdir is here to please some checkers -datarootdir=@datarootdir@ -mandir=@mandir@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ - -srcdir = @srcdir@ -tlsdir = @TLSDIR@ -stubbysrcdir = $(srcdir)/../stubby -LIBTOOL = ../libtool - -CC=@CC@ -CFLAGS=-I$(srcdir) -I. -I$(srcdir)/util/auxiliary -I$(srcdir)/tls -I$(srcdir)/$(tlsdir) -I$(stubbysrcdir)/src @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS) -WPEDANTICFLAG=@WPEDANTICFLAG@ -WNOERRORFLAG=@WNOERRORFLAG@ -LDFLAGS=@LDFLAGS@ @LIBS@ - -STUBBY_LDFLAGS=@STUBBY_LDFLAGS@ @STUBBY_LIBS@ - -EXTENSION_LIBEVENT_LIB=@EXTENSION_LIBEVENT_LIB@ -EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@ -EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@ -EXTENSION_LIBEV_LIB=@EXTENSION_LIBEV_LIB@ -EXTENSION_LIBEV_EXT_LIBS=@EXTENSION_LIBEV_EXT_LIBS@ -EXTENSION_LIBEV_LDFLAGS=@EXTENSION_LIBEV_LDFLAGS@ -EXTENSION_LIBUV_LIB=@EXTENSION_LIBUV_LIB@ -EXTENSION_LIBUV_EXT_LIBS=@EXTENSION_LIBUV_EXT_LIBS@ -EXTENSION_LIBUV_LDFLAGS=@EXTENSION_LIBUV_LDFLAGS@ - -C99COMPATFLAGS=@C99COMPATFLAGS@ - -DEFAULT_EVENTLOOP_OBJ=@DEFAULT_EVENTLOOP@.lo - -GETDNS_OBJ=const-info.lo convert.lo dict.lo dnssec.lo general.lo \ - list.lo request-internal.lo platform.lo rr-dict.lo \ - rr-iter.lo server.lo stub.lo sync.lo ub_loop.lo util-internal.lo \ - mdns.lo pubkey-pinning.lo - -GLDNS_OBJ=keyraw.lo gbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo \ - str2wire.lo - -PROGRAMS=@STUBBY@ - -LIBOBJDIR= -LIBOBJS=@LIBOBJS@ -COMPAT_OBJ=$(LIBOBJS:.o=.lo) - -UTIL_OBJ=rbtree.lo lruhash.lo lookup3.lo locks.lo - -JSMN_OBJ=jsmn.lo -TLS_OBJ=tls.lo pubkey-pinning-internal.lo keyraw-internal.lo -TLS_COMMON_OBJ=val_secalgo.lo anchor-internal.lo -YXML_OBJ=yxml.lo - -YAML_OBJ=convert_yaml_to_json.lo -DANESSL_OBJ=danessl.lo - -GETDNS_XTRA_OBJS=@GETDNS_XTRA_OBJS@ @DANESSL_XTRA_OBJS@ -STUBBY_XTRA_OBJS=@STUBBY_XTRA_OBJS@ - -EXTENSION_OBJ=$(DEFAULT_EVENTLOOP_OBJ) libevent.lo libev.lo - -NON_C99_OBJS=libuv.lo context.lo anchor.lo - -.SUFFIXES: .c .o .a .lo .h - -.c.o: - $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@ - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@ - -default: all - -all: libgetdns.la $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBUV_LIB) $(EXTENSION_LIBEV_LIB) $(PROGRAMS) - -$(GETDNS_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/$(@:.lo=.c) -o $@ - -$(GLDNS_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/gldns/$(@:.lo=.c) -o $@ - -$(COMPAT_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/compat/$(@:.lo=.c) -o $@ - -$(UTIL_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WNOERRORFLAG) -c $(srcdir)/util/$(@:.lo=.c) -o $@ - -$(JSMN_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -DJSMN_GETDNS -c $(srcdir)/jsmn/$(@:.lo=.c) -o $@ - -$(TLS_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(tlsdir)/$(@:.lo=.c) -o $@ - -$(TLS_COMMON_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/tls/$(@:.lo=.c) -o $@ - -$(YAML_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(stubbysrcdir)/src/yaml/$(@:.lo=.c) -o $@ - -$(DANESSL_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WNOERRORFLAG) -c $(srcdir)/ssl_dane/$(@:.lo=.c) -o $@ - -$(YXML_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -I$(srcdir)/yxml -DYXML_GETDNS -Wno-unused-parameter -c $(srcdir)/yxml/$(@:.lo=.c) -o $@ - -$(EXTENSION_OBJ): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/extension/$(@:.lo=.c) -o $@ - -anchor.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/anchor.c -o anchor.lo - -context.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/context.c -o context.lo - -libuv.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/extension/libuv.c -o libuv.lo - -install-headers: getdns/getdns.h getdns/getdns_extra.h - $(INSTALL) -m 755 -d $(DESTDIR)$(includedir) - $(INSTALL) -m 755 -d $(DESTDIR)$(includedir)/getdns - $(INSTALL) -m 644 getdns/getdns.h $(DESTDIR)$(includedir)/getdns/getdns.h - $(INSTALL) -m 644 getdns/getdns_extra.h $(DESTDIR)$(includedir)/getdns/getdns_extra.h - if test $(have_libevent) = 1 ; then $(INSTALL) -m 644 $(srcdir)/getdns/getdns_ext_libevent.h $(DESTDIR)$(includedir)/getdns/ ; fi - if test $(have_libuv) = 1 ; then $(INSTALL) -m 644 $(srcdir)/getdns/getdns_ext_libuv.h $(DESTDIR)$(includedir)/getdns/ ; fi - if test $(have_libev) = 1 ; then $(INSTALL) -m 644 $(srcdir)/getdns/getdns_ext_libev.h $(DESTDIR)$(includedir)/getdns/ ; fi - -uninstall-headers: - rm -rf $(DESTDIR)$(includedir)/getdns - -install-libs: libgetdns.la $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBUV_LIB) $(EXTENSION_LIBEV_LIB) - $(INSTALL) -m 755 -d $(DESTDIR)$(libdir) - $(LIBTOOL) --mode=install cp libgetdns.la $(DESTDIR)$(libdir) - if test $(have_libevent) = 1 ; then $(LIBTOOL) --mode=install cp $(EXTENSION_LIBEVENT_LIB) $(DESTDIR)$(libdir) ; fi - if test $(have_libuv) = 1 ; then $(LIBTOOL) --mode=install cp $(EXTENSION_LIBUV_LIB) $(DESTDIR)$(libdir) ; fi - if test $(have_libev) = 1 ; then $(LIBTOOL) --mode=install cp $(EXTENSION_LIBEV_LIB) $(DESTDIR)$(libdir) ; fi - $(LIBTOOL) --mode=finish $(DESTDIR)$(libdir) - -uninstall-libs: - if test $(have_libevent) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBEVENT_LIB) ; fi - if test $(have_libuv) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBUV_LIB) ; fi - if test $(have_libev) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBEV_LIB) ; fi - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libgetdns.la - -install: install-libs install-headers @INSTALL_STUBBY@ - -uninstall: @UNINSTALL_STUBBY@ uninstall-headers uninstall-libs - -libgetdns_ext_event.la: libgetdns.la libevent.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libevent.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libevent.symbols - -libgetdns_ext_uv.la: libgetdns.la libuv.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libuv.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libuv.symbols - - -libgetdns_ext_ev.la: libgetdns.la libev.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libev.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libev.symbols - -libgetdns.la: $(GETDNS_OBJ) version.lo context.lo anchor.lo $(DEFAULT_EVENTLOOP_OBJ) $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(TLS_OBJ) $(TLS_COMMON_OBJ) $(YXML_OBJ) $(GETDNS_XTRA_OBJS) - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(GETDNS_OBJ) version.lo context.lo anchor.lo $(DEFAULT_EVENTLOOP_OBJ) $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(JSMN_OBJ) $(TLS_OBJ) $(TLS_COMMON_OBJ) $(YXML_OBJ) $(GETDNS_XTRA_OBJS) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/libgetdns.symbols - -test: default - cd test && $(MAKE) $@ - -getdns_query: default - cd tools && $(MAKE) $@ - -getdns_server_mon: default - cd tools && $(MAKE) $@ - -stubby.1: $(stubbysrcdir)/doc/stubby.1.in - sed -e "s|@ETCDIR@|$(stubbyconfdir)|g" $(stubbysrcdir)/doc/stubby.1.in > $@ - -stubby.lo: $(stubbysrcdir)/src/stubby.c - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -DSTUBBYCONFDIR='"$(sysconfdir)/stubby"' -DRUNSTATEDIR='"$(runstatedir)"' -c $(stubbysrcdir)/src/stubby.c -o $@ - -stubby: stubby.lo libgetdns.la $(STUBBY_XTRA_OBJS) - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ stubby.lo $(STUBBY_XTRA_OBJS) $(STUBBY_LDFLAGS) libgetdns.la - -install-stubby-files-unix: $(stubbysrcdir)/stubby.yml.example - $(INSTALL) -m 755 -d $(DESTDIR)$(stubbyconfdir) - test -f $(DESTDIR)$(stubbyconfdir)/stubby.yml || \ - $(INSTALL_DATA) $(stubbysrcdir)/stubby.yml.example $(DESTDIR)$(stubbyconfdir)/stubby.yml - -install-stubby-files-macos: $(stubbysrcdir)/macos/stubby-setdns-macos.sh install-stubby-files-unix - $(INSTALL) -m 755 -d $(DESTDIR)$(sbindir) - $(INSTALL) -m 755 $(stubbysrcdir)/macos/stubby-setdns-macos.sh $(DESTDIR)$(sbindir) - -stubby.yml.windows: $(stubbysrcdir)/stubby.yml.example - awk "{sub(/$$/,\"\r\")}1" $(stubbysrcdir)/stubby.yml.example > stubby.yml.windows - -install-stubby-files-windows: stubby.yml.windows - $(INSTALL) -m 755 -d $(DESTDIR)$(stubbyconfdir) - test -f $(DESTDIR)$(stubbyconfdir)/stubby.yml || \ - $(INSTALL_DATA) stubby.yml.windows $(DESTDIR)$(stubbyconfdir)/stubby.yml - -install-stubby: stubby stubby.1 install-stubby-files-@HOSTOS@ - $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) - $(LIBTOOL) --mode=install cp stubby $(DESTDIR)$(bindir) - $(INSTALL) -m 755 -d $(DESTDIR)$(runstatedir) - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir) - $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 - $(INSTALL) -m 644 stubby\.1 $(DESTDIR)$(mandir)/man1 - -uninstall-stubby: - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/stubby - rm -f $(DESTDIR)$(sbindir)/stubby-setdns-macos.sh - rm -f $(DESTDIR)$(mandir)/man1/stubby.1 - -scratchpad: default - cd test && $(MAKE) $@ - -pad: scratchpad - -clean: - cd tools && $(MAKE) $@ - cd test && $(MAKE) $@ - rm -f *.o *.lo extension/*.lo extension/*.o $(PROGRAMS) libgetdns.la libgetdns_ext_*.la - rm -rf .libs extension/.libs - -distclean : clean - cd tools && $(MAKE) $@ - cd test && $(MAKE) $@ - rmdir test 2>/dev/null || true - rm -f Makefile config.status config.log Doxyfile config.h version.c getdns/Makefile getdns/getdns.h getdns/getdns_extra.h - rmdir getdns 2>/dev/null || true - rmdir extension 2>/dev/null || true - rm -Rf autom4te.cache - -Makefile: $(srcdir)/Makefile.in ../config.status - cd .. && ./config.status src/Makefile - -depend: - (cd $(srcdir) ; awk 'BEGIN{P=1}{if(P)print}/^# Dependencies/{P=0}' Makefile.in > Makefile.in.new ) - - (blddir=`pwd`; cd $(srcdir) ; gcc -MM -I. -I"$$blddir" -Itls -I$(tlsdir) -Iyxml -Iutil/auxiliary -I../stubby/src *.c gldns/*.c compat/*.c util/*.c jsmn/*.c $(tlsdir)/*.c yxml/*.c extension/*.c ../stubby/src/*.c | \ - sed -e "s? $$blddir/? ?g" \ - -e 's? gldns/? $$(srcdir)/gldns/?g' \ - -e 's? compat/? $$(srcdir)/compat/?g' \ - -e 's? util/auxiliary/util/? $$(srcdir)/util/auxiliary/util/?g' \ - -e 's? util/? $$(srcdir)/util/?g' \ - -e 's? jsmn/? $$(srcdir)/jsmn/?g' \ - -e 's? tls/? $$(srcdir)/tls/?g' \ - -e 's? $(tlsdir)/? $$(srcdir)/$$(tlsdir)/?g' \ - -e 's? yxml/? $$(srcdir)/yxml/?g' \ - -e 's? extension/? $$(srcdir)/extension/?g' \ - -e 's? \.\./stubby/? $$(stubbysrcdir)/?g' \ - -e 's? \([a-z_-]*\)\.\([ch]\)? $$(srcdir)/\1.\2?g' \ - -e 's? \$$(srcdir)/config\.h? config.h?g' \ - -e 's? \$$(srcdir)/getdns/getdns_extra\.h? getdns/getdns_extra.h?g' \ - -e 's? \$$(srcdir)/version\.c? version.c?g' \ - -e 's? getdns/getdns_ext_libevent\.h? $$(srcdir)/getdns/getdns_ext_libevent.h?g' \ - -e 's? getdns/getdns_ext_libev\.h? $$(srcdir)/getdns/getdns_ext_libev.h?g' \ - -e 's? getdns/getdns_ext_libuv\.h? $$(srcdir)/getdns/getdns_ext_libuv.h?g' \ - -e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' >> Makefile.in.new ) - (cd $(srcdir) ; diff Makefile.in.new Makefile.in && rm Makefile.in.new \ - || mv Makefile.in.new Makefile.in ) - cd tools && $(MAKE) $@ - cd test && $(MAKE) $@ - -.PHONY: clean test -FORCE: - -# Dependencies for gldns, utils, the extensions and compat functions -anchor.lo anchor.o: $(srcdir)/anchor.c \ - config.h $(srcdir)/debug.h \ - $(srcdir)/anchor.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/types-internal.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/context.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h $(srcdir)/yxml/yxml.h $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/str2wire.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/keyraw.h $(srcdir)/$(tlsdir)/keyraw-internal.h \ - $(srcdir)/general.h $(srcdir)/util-internal.h $(srcdir)/platform.h -const-info.lo const-info.o: $(srcdir)/const-info.c \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/const-info.h -context.lo context.o: $(srcdir)/context.c \ - config.h $(srcdir)/anchor.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/types-internal.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/debug.h $(srcdir)/gldns/str2wire.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/tls.h \ - $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/util-internal.h $(srcdir)/platform.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h \ - $(srcdir)/stub.h $(srcdir)/list.h $(srcdir)/dict.h $(srcdir)/pubkey-pinning.h $(srcdir)/const-info.h -convert.lo convert.o: $(srcdir)/convert.c \ - config.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h \ - $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h \ - $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h \ - $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h \ - $(srcdir)/gldns/parseutil.h $(srcdir)/const-info.h $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/jsmn/jsmn.h $(srcdir)/convert.h -dict.lo dict.o: $(srcdir)/dict.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/const-info.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/parseutil.h -dnssec.lo dnssec.o: $(srcdir)/dnssec.c \ - config.h $(srcdir)/debug.h \ - getdns/getdns.h \ - $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/util-internal.h \ - $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h \ - $(srcdir)/gldns/keyraw.h $(srcdir)/$(tlsdir)/keyraw-internal.h $(srcdir)/gldns/parseutil.h $(srcdir)/general.h \ - $(srcdir)/dict.h $(srcdir)/list.h $(srcdir)/util/val_secalgo.h $(srcdir)/gldns/gbuffer.h -general.lo general.o: $(srcdir)/general.c \ - config.h $(srcdir)/general.h \ - getdns/getdns.h \ - $(srcdir)/types-internal.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/ub_loop.h $(srcdir)/debug.h \ - $(srcdir)/gldns/wire2str.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h $(srcdir)/stub.h $(srcdir)/dict.h $(srcdir)/mdns.h -list.lo list.o: $(srcdir)/list.c $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/util-internal.h \ - config.h $(srcdir)/context.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/list.h $(srcdir)/dict.h -mdns.lo mdns.o: $(srcdir)/mdns.c \ - config.h $(srcdir)/debug.h \ - $(srcdir)/context.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/general.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/util-internal.h $(srcdir)/platform.h $(srcdir)/mdns.h -platform.lo platform.o: $(srcdir)/platform.c $(srcdir)/platform.h \ - config.h -pubkey-pinning.lo pubkey-pinning.o: $(srcdir)/pubkey-pinning.c \ - config.h $(srcdir)/debug.h \ - getdns/getdns.h \ - $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/util-internal.h \ - $(srcdir)/gldns/parseutil.h $(srcdir)/pubkey-pinning.h $(srcdir)/tls/pubkey-pinning-internal.h -request-internal.lo request-internal.o: $(srcdir)/request-internal.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/util-internal.h $(srcdir)/context.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/dict.h $(srcdir)/convert.h $(srcdir)/general.h -rr-dict.lo rr-dict.o: $(srcdir)/rr-dict.c $(srcdir)/rr-dict.h \ - config.h \ - getdns/getdns.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/util-internal.h $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/gldns/pkthdr.h \ - $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/dict.h -rr-iter.lo rr-iter.o: $(srcdir)/rr-iter.c $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - config.h \ - getdns/getdns.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/gldns/rrdef.h -server.lo server.o: $(srcdir)/server.c \ - config.h \ - getdns/getdns_extra.h \ - getdns/getdns.h \ - $(srcdir)/context.h $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/util-internal.h $(srcdir)/platform.h -stub.lo stub.o: $(srcdir)/stub.c \ - config.h $(srcdir)/debug.h \ - $(srcdir)/stub.h \ - getdns/getdns.h \ - $(srcdir)/types-internal.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/rr-iter.h \ - $(srcdir)/rr-dict.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/server.h $(srcdir)/anchor.h \ - $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/util-internal.h $(srcdir)/platform.h $(srcdir)/general.h \ - $(srcdir)/pubkey-pinning.h -sync.lo sync.o: $(srcdir)/sync.c \ - getdns/getdns.h \ - config.h $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/general.h $(srcdir)/util-internal.h $(srcdir)/dnssec.h $(srcdir)/gldns/rrdef.h $(srcdir)/stub.h $(srcdir)/gldns/wire2str.h -ub_loop.lo ub_loop.o: $(srcdir)/ub_loop.c $(srcdir)/ub_loop.h \ - config.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/debug.h -util-internal.lo util-internal.o: $(srcdir)/util-internal.c \ - config.h \ - getdns/getdns.h \ - $(srcdir)/dict.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/types-internal.h \ - getdns/getdns_extra.h \ - $(srcdir)/list.h $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/extension/default_eventloop.h \ - $(srcdir)/extension/poll_eventloop.h $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h \ - $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h \ - $(srcdir)/$(tlsdir)/tls-internal.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/dnssec.h \ - $(srcdir)/gldns/rrdef.h -gbuffer.lo gbuffer.o: $(srcdir)/gldns/gbuffer.c \ - config.h \ - $(srcdir)/gldns/gbuffer.h -keyraw.lo keyraw.o: $(srcdir)/gldns/keyraw.c \ - config.h \ - $(srcdir)/gldns/keyraw.h $(srcdir)/$(tlsdir)/keyraw-internal.h $(srcdir)/gldns/rrdef.h -parse.lo parse.o: $(srcdir)/gldns/parse.c \ - config.h \ - $(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/gbuffer.h -parseutil.lo parseutil.o: $(srcdir)/gldns/parseutil.c \ - config.h \ - $(srcdir)/gldns/parseutil.h -rrdef.lo rrdef.o: $(srcdir)/gldns/rrdef.c \ - config.h \ - $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/parseutil.h -str2wire.lo str2wire.o: $(srcdir)/gldns/str2wire.c \ - config.h \ - $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/gbuffer.h \ - $(srcdir)/gldns/parse.h $(srcdir)/gldns/parseutil.h -wire2str.lo wire2str.o: $(srcdir)/gldns/wire2str.c \ - config.h \ - $(srcdir)/gldns/wire2str.h $(srcdir)/gldns/str2wire.h $(srcdir)/gldns/rrdef.h $(srcdir)/gldns/pkthdr.h \ - $(srcdir)/gldns/parseutil.h $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/keyraw.h \ - $(srcdir)/$(tlsdir)/keyraw-internal.h -arc4_lock.lo arc4_lock.o: $(srcdir)/compat/arc4_lock.c \ - config.h -arc4random.lo arc4random.o: $(srcdir)/compat/arc4random.c \ - config.h \ - $(srcdir)/compat/chacha_private.h -arc4random_uniform.lo arc4random_uniform.o: $(srcdir)/compat/arc4random_uniform.c \ - config.h -explicit_bzero.lo explicit_bzero.o: $(srcdir)/compat/explicit_bzero.c \ - config.h -getentropy_linux.lo getentropy_linux.o: $(srcdir)/compat/getentropy_linux.c \ - config.h -getentropy_osx.lo getentropy_osx.o: $(srcdir)/compat/getentropy_osx.c \ - config.h -getentropy_solaris.lo getentropy_solaris.o: $(srcdir)/compat/getentropy_solaris.c \ - config.h -getentropy_win.lo getentropy_win.o: $(srcdir)/compat/getentropy_win.c -gettimeofday.lo gettimeofday.o: $(srcdir)/compat/gettimeofday.c \ - config.h -inet_ntop.lo inet_ntop.o: $(srcdir)/compat/inet_ntop.c \ - config.h -inet_pton.lo inet_pton.o: $(srcdir)/compat/inet_pton.c \ - config.h -sha512.lo sha512.o: $(srcdir)/compat/sha512.c \ - config.h -strlcpy.lo strlcpy.o: $(srcdir)/compat/strlcpy.c \ - config.h -strptime.lo strptime.o: $(srcdir)/compat/strptime.c \ - config.h -locks.lo locks.o: $(srcdir)/util/locks.c \ - config.h $(srcdir)/util/locks.h \ - $(srcdir)/util/orig-headers/locks.h $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h -lookup3.lo lookup3.o: $(srcdir)/util/lookup3.c \ - config.h \ - $(srcdir)/util/auxiliary/util/storage/lookup3.h $(srcdir)/util/lookup3.h \ - $(srcdir)/util/orig-headers/lookup3.h -lruhash.lo lruhash.o: $(srcdir)/util/lruhash.c \ - config.h \ - $(srcdir)/util/auxiliary/util/storage/lruhash.h $(srcdir)/util/lruhash.h \ - $(srcdir)/util/orig-headers/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/orig-headers/locks.h \ - $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h $(srcdir)/util/auxiliary/util/fptr_wlist.h -rbtree.lo rbtree.o: $(srcdir)/util/rbtree.c \ - config.h \ - $(srcdir)/util/auxiliary/log.h $(srcdir)/util/auxiliary/util/log.h $(srcdir)/debug.h \ - $(srcdir)/util/auxiliary/fptr_wlist.h $(srcdir)/util/auxiliary/util/fptr_wlist.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h -jsmn.lo jsmn.o: $(srcdir)/jsmn/jsmn.c $(srcdir)/jsmn/jsmn.h -keyraw-internal.lo keyraw-internal.o: $(srcdir)/$(tlsdir)/keyraw-internal.c \ - config.h \ - $(srcdir)/gldns/keyraw.h $(srcdir)/$(tlsdir)/keyraw-internal.h $(srcdir)/gldns/rrdef.h -pubkey-pinning-internal.lo pubkey-pinning-internal.o: $(srcdir)/$(tlsdir)/pubkey-pinning-internal.c \ - config.h $(srcdir)/debug.h \ - getdns/getdns.h \ - $(srcdir)/context.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/util-internal.h $(srcdir)/context.h $(srcdir)/tls/pubkey-pinning-internal.h -tls.lo tls.o: $(srcdir)/$(tlsdir)/tls.c \ - config.h $(srcdir)/debug.h \ - $(srcdir)/context.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/const-info.h $(srcdir)/tls.h -yxml.lo yxml.o: $(srcdir)/yxml/yxml.c $(srcdir)/yxml/yxml.h -libev.lo libev.o: $(srcdir)/extension/libev.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/getdns/getdns_ext_libev.h -libevent.lo libevent.o: $(srcdir)/extension/libevent.c \ - config.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/getdns/getdns_ext_libevent.h -libuv.lo libuv.o: $(srcdir)/extension/libuv.c \ - config.h $(srcdir)/debug.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/getdns/getdns_ext_libuv.h -poll_eventloop.lo poll_eventloop.o: $(srcdir)/extension/poll_eventloop.c \ - config.h \ - $(srcdir)/util-internal.h $(srcdir)/context.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/types-internal.h $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h \ - $(srcdir)/extension/default_eventloop.h $(srcdir)/extension/poll_eventloop.h \ - $(srcdir)/types-internal.h $(srcdir)/ub_loop.h $(srcdir)/debug.h $(srcdir)/server.h $(srcdir)/rr-iter.h $(srcdir)/rr-dict.h \ - $(srcdir)/gldns/gbuffer.h $(srcdir)/gldns/pkthdr.h $(srcdir)/anchor.h $(srcdir)/tls.h $(srcdir)/$(tlsdir)/tls-internal.h \ - $(srcdir)/platform.h $(srcdir)/debug.h -select_eventloop.lo select_eventloop.o: $(srcdir)/extension/select_eventloop.c \ - config.h $(srcdir)/debug.h \ - $(srcdir)/types-internal.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/orig-headers/rbtree.h $(srcdir)/platform.h \ - $(srcdir)/extension/select_eventloop.h -stubby.lo stubby.o: $(stubbysrcdir)/src/stubby.c \ - config.h \ - getdns/getdns.h \ - getdns/getdns_extra.h \ - $(stubbysrcdir)/src/yaml/convert_yaml_to_json.h diff --git a/src/anchor.c b/src/anchor.c index 16fd8042..f50c4a3d 100644 --- a/src/anchor.c +++ b/src/anchor.c @@ -33,7 +33,7 @@ #include "debug.h" #include "anchor.h" #include -#include +#include #include #include "types-internal.h" #include "context.h" @@ -1228,7 +1228,7 @@ void _getdns_start_fetching_ta( { getdns_return_t r; size_t scheduled; - char tas_hostname[256]; + char tas_hostname[256] = ""; const char *verify_CA; const char *verify_email; diff --git a/src/compat/arc4random.c b/src/compat/arc4random.c index 3ba57dc1..a5382077 100644 --- a/src/compat/arc4random.c +++ b/src/compat/arc4random.c @@ -31,11 +31,11 @@ #endif #include #include +#ifndef GETDNS_ON_WINDOWS #include #include #include #include -#ifndef GETDNS_ON_WINDOWS #include #endif #if defined(GETDNS_ON_WINDOWS) && !defined(MAP_INHERIT_ZERO) @@ -212,7 +212,7 @@ _rs_stir(void) static inline void _rs_stir_if_needed(size_t len) { -#ifndef MAP_INHERIT_ZERO +#if !defined(GETDNS_ON_WINDOWS) && !defined(MAP_INHERIT_ZERO) static pid_t _rs_pid = 0; pid_t pid = getpid(); diff --git a/src/compat/explicit_bzero.c b/src/compat/explicit_bzero.c index a3ba2798..f657627b 100644 --- a/src/compat/explicit_bzero.c +++ b/src/compat/explicit_bzero.c @@ -6,17 +6,12 @@ #include "config.h" #include -__attribute__((weak)) void -__explicit_bzero_hook(void *ATTR_UNUSED(buf), size_t ATTR_UNUSED(len)) -{ -} - void explicit_bzero(void *buf, size_t len) { -#ifdef UB_ON_WINDOWS +#ifdef GETDNS_ON_WINDOWS SecureZeroMemory(buf, len); -#endif +#else memset(buf, 0, len); - __explicit_bzero_hook(buf, len); +#endif } diff --git a/src/compat/gettimeofday.c b/src/compat/gettimeofday.c index d8fe91bc..a417562d 100644 --- a/src/compat/gettimeofday.c +++ b/src/compat/gettimeofday.c @@ -21,8 +21,9 @@ */ #include "config.h" -#ifdef GETDNS_ON_WINDOWS -int gettimeofday(struct timeval* tv, struct timezone* tz) +#ifndef HAVE_GETTIMEOFDAY + +int gettimeofday(struct timeval* tv, void* tz) { FILETIME ft; uint64_t now = 0; @@ -70,4 +71,4 @@ int gettimeofday(struct timeval* tv, struct timezone* tz) return 0; } -#endif /* GETDNS_ON_WINDOWS */ \ No newline at end of file +#endif /* HAVE_GETTIMEOFDAY */ diff --git a/src/compat/inet_ntop.c b/src/compat/inet_ntop.c index bd418ae7..5f072c89 100644 --- a/src/compat/inet_ntop.c +++ b/src/compat/inet_ntop.c @@ -19,8 +19,6 @@ #include -#ifndef HAVE_INET_NTOP - #include #include #ifdef HAVE_SYS_SOCKET_H @@ -214,5 +212,3 @@ inet_ntop6(const u_char *src, char *dst, size_t size) strlcpy(dst, tmp, size); return (dst); } - -#endif /* !HAVE_INET_NTOP */ diff --git a/src/compat/inet_pton.c b/src/compat/inet_pton.c index 15780d0b..1a8bbff7 100644 --- a/src/compat/inet_pton.c +++ b/src/compat/inet_pton.c @@ -17,7 +17,6 @@ */ #include - #include #include #include diff --git a/src/compat/mkstemp.c b/src/compat/mkstemp.c new file mode 100644 index 00000000..4d5acc8f --- /dev/null +++ b/src/compat/mkstemp.c @@ -0,0 +1,43 @@ +/** + * \file mkstemp.c + * @brief Implementation of mkstemp for Windows. + */ + +/* + * Copyright (c) 2019 Sinodun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the names of the copyright holders nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +int mkstemp(char *template) +{ + if (_mktemp_s(template, strlen(template) + 1) != 0) + return -1; + return open(template, _O_CREAT | _O_EXCL, _S_IWRITE); +} diff --git a/src/compat/strlcpy.c b/src/compat/strlcpy.c index acd306a1..dd02cb4a 100644 --- a/src/compat/strlcpy.c +++ b/src/compat/strlcpy.c @@ -18,7 +18,6 @@ /* OPENBSD ORIGINAL: lib/libc/string/strlcpy.c */ #include -#ifndef HAVE_STRLCPY #include #include @@ -53,5 +52,3 @@ strlcpy(char *dst, const char *src, size_t siz) return(s - src - 1); /* count does not include NUL */ } - -#endif /* !HAVE_STRLCPY */ diff --git a/src/context.c b/src/context.c index 0a0e4456..6264ae99 100644 --- a/src/context.c +++ b/src/context.c @@ -55,7 +55,6 @@ typedef unsigned short in_port_t; #include #include -#include #include #include @@ -926,6 +925,7 @@ upstream_init(getdns_upstream *upstream, /* For sharing a socket to this upstream with TCP */ upstream->fd = -1; + upstream->expires = 0; upstream->tls_obj = NULL; upstream->tls_session = NULL; upstream->tls_cipher_list = NULL; @@ -1113,6 +1113,12 @@ set_os_defaults_windows(getdns_context *context) return GETDNS_RETURN_GOOD; } /* set_os_defaults_windows */ +getdns_return_t +getdns_context_set_resolvconf(getdns_context *context, const char *resolvconf) +{ + return GETDNS_RETURN_NOT_IMPLEMENTED; +} + #else getdns_return_t @@ -1161,7 +1167,7 @@ getdns_context_set_resolvconf(getdns_context *context, const char *resolvconf) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ - hints.ai_socktype = 0; /* Datagram socket */ + hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */ hints.ai_flags = AI_NUMERICHOST; /* No reverse name lookups */ hints.ai_protocol = 0; /* Any protocol */ hints.ai_canonname = NULL; @@ -2390,7 +2396,15 @@ getdns_context_set_dns_root_servers( { #ifdef HAVE_LIBUNBOUND # ifndef HAVE_UB_CTX_SET_STUB - char tmpfn[FILENAME_MAX] = P_tmpdir "/getdns-root-dns-servers-XXXXXX"; + char tmpfn[FILENAME_MAX]; + +# ifdef USE_WINSOCK + GetTempPathA(FILENAME_MAX, tmpfn); + strncat_s(tmpfn, FILENAME_MAX, "/getdns-root-dns-servers-XXXXXX", _TRUNCATE); +# else + strlcpy(tmpfn, P_tmpdir "/getdns-root-dns-servers-XXXXXX", FILENAME_MAX); +# endif + FILE *fh; int fd; size_t dst_len; @@ -2736,7 +2750,7 @@ getdns_context_set_upstream_recursive_servers(struct getdns_context *context, } memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ - hints.ai_socktype = 0; /* Datagram socket */ + hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */ hints.ai_flags = AI_NUMERICHOST; /* No reverse name lookups */ hints.ai_protocol = 0; /* Any protocol */ hints.ai_canonname = NULL; @@ -3473,7 +3487,7 @@ static getdns_return_t ub_setup_recursing(struct ub_ctx *ctx, getdns_context *context) { _getdns_rr_iter rr_spc, *rr; - char ta_str[8192]; + char ta_str[8192] = ""; int r; if ((r = ub_ctx_set_fwd(ctx, NULL))) { diff --git a/src/context.h b/src/context.h index eb42382f..f97884d3 100644 --- a/src/context.h +++ b/src/context.h @@ -209,7 +209,10 @@ typedef struct getdns_upstream { _getdns_tls_session* tls_session; getdns_tls_hs_state_t tls_hs_state; getdns_auth_state_t tls_auth_state; - + uint64_t expires; /* Expire time of waiting netreqs. + * This is how long a handshake may + * take. + */ /* TLS settings */ char *tls_cipher_list; char *tls_ciphersuites; diff --git a/src/convert.c b/src/convert.c index 42365c84..55426da0 100644 --- a/src/convert.c +++ b/src/convert.c @@ -41,9 +41,6 @@ #endif #if defined(HAVE_LIBIDN2) #include -#elif defined(HAVE_LIBIDN) -#include -#include #endif #include "getdns/getdns.h" #include "getdns/getdns_extra.h" @@ -124,32 +121,6 @@ getdns_convert_ulabel_to_alabel(const char *ulabel) if (idn2_lookup_u8((uint8_t *)ulabel, &alabel, IDN2_TRANSITIONAL) == IDN2_OK) return (char *)alabel; - -#elif defined(HAVE_LIBIDN) - char *alabel; - char *prepped; - char prepped2[BUFSIZ]; - - if (!ulabel) return NULL; - - setlocale(LC_ALL, ""); - if ((prepped = stringprep_locale_to_utf8(ulabel))) { - if(strlen(prepped)+1 > BUFSIZ) { - free(prepped); - return NULL; - } - memcpy(prepped2, prepped, strlen(prepped)+1); - free(prepped); - - /* convert to utf8 fails, which it can, but continue anyway */ - } else if (strlen(ulabel)+1 > BUFSIZ) - return NULL; - else - memcpy(prepped2, ulabel, strlen(ulabel)+1); - - if (stringprep(prepped2, BUFSIZ, 0, stringprep_nameprep) == STRINGPREP_OK - && idna_to_ascii_8z(prepped2, &alabel, 0) == IDNA_SUCCESS) - return alabel; #else (void)ulabel; #endif @@ -170,16 +141,12 @@ getdns_convert_ulabel_to_alabel(const char *ulabel) char * getdns_convert_alabel_to_ulabel(const char *alabel) { -#if defined(HAVE_LIBIDN2) || defined(HAVE_LIBIDN) +#if defined(HAVE_LIBIDN2) char *ulabel; if (!alabel) return NULL; -# if defined(HAVE_LIBIDN2) if (idn2_to_unicode_8z8z(alabel, &ulabel, 0) == IDN2_OK) -# else - if (idna_to_unicode_8z8z(alabel, &ulabel, 0) == IDNA_SUCCESS) -# endif return ulabel; #else (void)alabel; @@ -460,7 +427,7 @@ getdns_rr_dict2str_scan( prev_str_len = *str_len; sz = (size_t)*str_len; sz_needed = gldns_wire2str_rr_scan( - &scan_buf, &scan_sz, str, &sz, NULL, 0); + &scan_buf, &scan_sz, str, &sz, NULL, 0, NULL); if (sz_needed > prev_str_len) { *str = prev_str + sz_needed; @@ -1389,7 +1356,7 @@ static int _jsmn_get_int(const char *js, jsmntok_t *t, uint32_t *value) static int _jsmn_get_const(const char *js, jsmntok_t *t, uint32_t *value) { - char value_str[80]; + char value_str[80] = ""; int size = t->end - t->start; if (size <= 0 || size >= (int)sizeof(value_str)) diff --git a/src/convert.h b/src/convert.h index 5b66412c..6b16f757 100644 --- a/src/convert.h +++ b/src/convert.h @@ -38,6 +38,10 @@ #include "types-internal.h" #include +getdns_return_t +_getdns_wire2msg_dict_scan(struct mem_funcs *mf, + const uint8_t **wire, size_t *wire_len, getdns_dict **msg_dict); + getdns_return_t _getdns_wire2rr_dict(struct mem_funcs *mf, const uint8_t *wire, size_t wire_len, getdns_dict **rr_dict); diff --git a/src/dict.c b/src/dict.c index f1ccb1a4..66eabd46 100644 --- a/src/dict.c +++ b/src/dict.c @@ -83,7 +83,7 @@ static char *_json_ptr_first(const struct mem_funcs *mf, static struct getdns_dict_item * _find_dict_item(const getdns_dict *dict, const char *jptr) { - char first_spc[1024], *first; + char first_spc[1024] = "", *first; struct getdns_dict_item *d; first = _json_ptr_first(&dict->mf, jptr, @@ -1149,7 +1149,9 @@ getdns_pp_dict(gldns_buffer * buf, size_t indent, case t_bindata: if ((strcmp(item->node.key, "address_data") == 0 || strcmp(item->node.key, "ipv4_address") == 0 || - strcmp(item->node.key, "ipv6_address") == 0 ) && + strcmp(item->node.key, "ipv6_address") == 0 || + strcmp(item->node.key, "answer_ipv4_address") == 0 || + strcmp(item->node.key, "answer_ipv6_address") == 0) && (item->i.data.bindata->size == 4 || item->i.data.bindata->size == 16 )) { diff --git a/src/dnssec.c b/src/dnssec.c index ab4aa8a0..25bdb2d0 100644 --- a/src/dnssec.c +++ b/src/dnssec.c @@ -192,7 +192,6 @@ #include "debug.h" #include #include -#include #include #include "getdns/getdns.h" #include "context.h" @@ -399,7 +398,7 @@ static inline void debug_sec_print_rr(const char *msg, _getdns_rr_iter *rr) } (void) gldns_wire2str_rr_scan( (UNCONST_UINT8_p *) &data, &data_len, &str, &str_len, - (UNCONST_UINT8_p) rr->pkt, rr->pkt_end - rr->pkt); + (UNCONST_UINT8_p) rr->pkt, rr->pkt_end - rr->pkt, NULL); DEBUG_SEC("%s%s", msg, str_spc); } static inline void debug_sec_print_dname(const char *msg, const uint8_t *label) diff --git a/src/extension/libevent.c b/src/extension/libevent.c index d096d347..5f5b6221 100644 --- a/src/extension/libevent.c +++ b/src/extension/libevent.c @@ -33,7 +33,11 @@ #include "config.h" #include "types-internal.h" +#ifndef USE_WINSOCK #include +#else +#include +#endif #include "getdns/getdns_ext_libevent.h" #ifdef HAVE_EVENT2_EVENT_H diff --git a/src/general.c b/src/general.c index 3ed067ba..682ebc62 100644 --- a/src/general.c +++ b/src/general.c @@ -651,6 +651,8 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop, req->is_dns_request = 0; _getdns_call_user_callback ( req, localnames_response); + if (return_netreq_p) + *return_netreq_p = NULL; break; } #ifdef HAVE_MDNS_SUPPORT diff --git a/src/getdns/getdns_extra.h.in b/src/getdns/getdns_extra.h.in index a11b52ea..d515ef08 100644 --- a/src/getdns/getdns_extra.h.in +++ b/src/getdns/getdns_extra.h.in @@ -36,10 +36,14 @@ #define _GETDNS_EXTRA_H_ #include -#include -#include -#include #include +#include +#if defined(_WIN32) +/* For struct timeval, see getdns_context_get_num_pending_requests */ +#include +#else +#include +#endif #ifdef __cplusplus extern "C" { diff --git a/src/gldns/compare.sh b/src/gldns/compare.sh index 86207bb9..4f632b0d 100755 --- a/src/gldns/compare.sh +++ b/src/gldns/compare.sh @@ -3,7 +3,7 @@ # Meant to be run from this directory rm -fr gldns mkdir gldns -svn co https://nlnetlabs.nl/svn/unbound/trunk/sldns/ +svn co https://github.com/NLnetLabs/unbound/trunk/sldns/ mv gbuffer.h sbuffer.h mv gbuffer.c sbuffer.c for f in sldns/*.[ch] diff --git a/src/gldns/gbuffer.c b/src/gldns/gbuffer.c index 3b39f438..5bf3fc6d 100644 --- a/src/gldns/gbuffer.c +++ b/src/gldns/gbuffer.c @@ -14,6 +14,7 @@ #include "config.h" #include "gldns/gbuffer.h" #include +#include gldns_buffer * gldns_buffer_new(size_t capacity) diff --git a/src/gldns/gbuffer.h b/src/gldns/gbuffer.h index e04aa23a..a8588348 100644 --- a/src/gldns/gbuffer.h +++ b/src/gldns/gbuffer.h @@ -13,6 +13,12 @@ #ifndef GLDNS_SBUFFER_H #define GLDNS_SBUFFER_H +#include +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/src/gldns/import.sh b/src/gldns/import.sh index b9f3cfdd..bbab505a 100755 --- a/src/gldns/import.sh +++ b/src/gldns/import.sh @@ -16,16 +16,5 @@ then mv sbuffer.h gbuffer.h mv sbuffer.c gbuffer.c else - svn co https://nlnetlabs.nl/svn/unbound/trunk/sldns/ - for f in ldns/*.[ch] - do - sed -e 's/sldns_/gldns_/g' \ - -e 's/LDNS_/GLDNS_/g' \ - -e 's/include "sldns/include "gldns/g' \ - -e 's///g' \ - -e 's/sbuffer\.h/gbuffer.h/g' $f > ${f#ldns/} - done - mv sbuffer.h gbuffer.h - mv sbuffer.c gbuffer.c - rm -fr sldns + echo Run compare first fi diff --git a/src/gldns/parse.c b/src/gldns/parse.c index a353c503..59d83b86 100644 --- a/src/gldns/parse.c +++ b/src/gldns/parse.c @@ -13,7 +13,10 @@ #include "gldns/gbuffer.h" #include +#include +#ifdef HAVE_STRINGS_H #include +#endif gldns_lookup_table gldns_directive_types[] = { { GLDNS_DIR_TTL, "$TTL" }, @@ -325,8 +328,14 @@ gldns_bget_token_par(gldns_buffer *b, char *token, const char *delim, if (c == '\n' && p != 0) { /* in parentheses */ /* do not write ' ' if we want to skip spaces */ - if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' ')))) + if(!(skipw && (strchr(skipw, c)||strchr(skipw, ' ')))) { + /* check for space for the space character */ + if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { + *t = '\0'; + return -1; + } *t++ = ' '; + } lc = c; continue; } diff --git a/src/gldns/parseutil.c b/src/gldns/parseutil.c index bc4738b9..043fcfcd 100644 --- a/src/gldns/parseutil.c +++ b/src/gldns/parseutil.c @@ -14,8 +14,12 @@ #include "config.h" #include "gldns/parseutil.h" +#ifdef HAVE_SYS_TIME_H #include +#endif +#ifdef HAVE_TIME_H #include +#endif #include gldns_lookup_table * diff --git a/src/gldns/rrdef.c b/src/gldns/rrdef.c index 114f807e..881b3425 100644 --- a/src/gldns/rrdef.c +++ b/src/gldns/rrdef.c @@ -16,6 +16,8 @@ #include "gldns/rrdef.h" #include "gldns/parseutil.h" +#include + /* classes */ static gldns_lookup_table gldns_rr_classes_data[] = { { GLDNS_RR_CLASS_IN, "IN" }, @@ -248,7 +250,7 @@ static const gldns_rdf_type type_amtrelay_wireformat[] = { */ static gldns_rr_descriptor rdata_field_descriptors[] = { /* 0 */ - { 0, NULL, 0, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, + {(enum gldns_enum_rr_type)0, NULL, 0, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 1 */ {GLDNS_RR_TYPE_A, "A", 1, 1, type_a_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 2 */ @@ -356,7 +358,7 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { /* 53 */ {GLDNS_RR_TYPE_SMIMEA, "SMIMEA", 4, 4, type_tlsa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 54 */ -{GLDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE54", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 55 * Hip ends with 0 or more Rendezvous Servers represented as dname's. * Hence the GLDNS_RDF_TYPE_DNAME _variable field and the _maximum field @@ -370,8 +372,8 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { /* 57 */ {GLDNS_RR_TYPE_RKEY, "RKEY", 4, 4, type_key_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, #else -{GLDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE56", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE57", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, #endif /* 58 */ {GLDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 2 }, @@ -386,53 +388,53 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { {GLDNS_RR_TYPE_CSYNC, "CSYNC", 3, 3, type_csync_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 63 */ {GLDNS_RR_TYPE_ZONEMD, "ZONEMD", 4, 4, type_zonemd_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE64", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE65", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE66", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE67", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE68", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE69", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE70", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE71", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE72", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE73", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE74", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE75", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE76", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE77", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE78", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE79", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE80", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE81", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE82", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE83", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE84", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE85", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE86", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE87", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE88", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE89", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE90", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE91", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE92", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE93", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE94", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE95", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE64", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE65", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE66", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE67", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE68", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE69", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE70", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE71", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE72", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE73", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE74", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE75", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE76", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE77", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE78", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE79", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE80", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE81", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE82", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE83", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE84", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE85", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE86", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE87", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE88", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE89", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE90", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE91", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE92", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE93", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE94", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE95", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE96", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE97", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE98", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 99 */ {GLDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, GLDNS_RDF_TYPE_STR, GLDNS_RR_NO_COMPRESS, 0 }, /* UINFO [IANA-Reserved] */ -{GLDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE100", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* UID [IANA-Reserved] */ -{GLDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE101", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* GID [IANA-Reserved] */ -{GLDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE102", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* UNSPEC [IANA-Reserved] */ -{GLDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE103", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 104 */ {GLDNS_RR_TYPE_NID, "NID", 2, 2, type_nid_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, @@ -448,145 +450,145 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { /* 109 */ {GLDNS_RR_TYPE_EUI64, "EUI64", 1, 1, type_eui64_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE113", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE114", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE115", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE116", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE117", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE118", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE119", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE120", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE121", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE122", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE123", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE124", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE125", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE126", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE127", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE128", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE129", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE130", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE131", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE132", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE133", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE134", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE135", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE136", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE137", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE138", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE139", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE140", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE141", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE142", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE143", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE144", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE145", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE146", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE147", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE148", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE149", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE150", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE151", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE152", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE153", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE154", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE155", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE156", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE157", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE158", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE159", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE160", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE161", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE162", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE163", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE164", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE165", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE166", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE167", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE168", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE169", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE170", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE171", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE172", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE173", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE174", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE175", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE176", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE177", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE178", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE179", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE180", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE181", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE182", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE183", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE184", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE185", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE186", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE187", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE188", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE189", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE190", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE191", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE192", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE193", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE194", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE195", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE196", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE197", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE198", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE199", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE200", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE201", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE202", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE203", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE204", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE205", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE206", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE207", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE208", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE209", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE210", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE211", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE212", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE213", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE214", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE215", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE216", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE217", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE218", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE219", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE220", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE221", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE222", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE223", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE224", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE225", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE226", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE227", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE228", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE229", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE230", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE231", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE232", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE233", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE234", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE235", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE236", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE237", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE238", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE239", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE240", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE241", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE242", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE243", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE244", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE245", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE110", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE111", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE112", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE113", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE114", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE115", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE116", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE117", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE118", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE119", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE120", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE121", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE122", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE123", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE124", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE125", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE126", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE127", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE128", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE129", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE130", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE131", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE132", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE133", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE134", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE135", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE136", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE137", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE138", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE139", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE140", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE141", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE142", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE143", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE144", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE145", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE146", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE147", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE148", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE149", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE150", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE151", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE152", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE153", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE154", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE155", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE156", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE157", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE158", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE159", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE160", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE161", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE162", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE163", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE164", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE165", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE166", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE167", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE168", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE169", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE170", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE171", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE172", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE173", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE174", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE175", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE176", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE177", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE178", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE179", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE180", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE181", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE182", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE183", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE184", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE185", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE186", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE187", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE188", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE189", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE190", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE191", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE192", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE193", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE194", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE195", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE196", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE197", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE198", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE199", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE200", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE201", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE202", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE203", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE204", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE205", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE206", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE207", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE208", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE209", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE210", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE211", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE212", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE213", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE214", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE215", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE216", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE217", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE218", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE219", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE220", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE221", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE222", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE223", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE224", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE225", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE226", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE227", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE228", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE229", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE230", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE231", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE232", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE233", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE234", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE235", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE236", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE237", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE238", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE239", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE240", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE241", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE242", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE243", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE244", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE245", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE246", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE247", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE248", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* GLDNS_RDF_TYPE_INT16_DATA takes two fields (length and data) as one. * So, unlike RFC 2930 spec, we have 7 min/max rdf's i.s.o. 8/9. @@ -622,9 +624,9 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { /* 260 */ {GLDNS_RR_TYPE_AMTRELAY, "AMTRELAY", 1, 0, type_amtrelay_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, #else -{GLDNS_RR_TYPE_NULL, "TYPE258", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE259", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, -{GLDNS_RR_TYPE_NULL, "TYPE260", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE258", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE259", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE260", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, #endif /* split in array, no longer contiguous */ @@ -633,7 +635,7 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { /* 32768 */ {GLDNS_RR_TYPE_TA, "TA", 4, 4, type_ds_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, #else -{GLDNS_RR_TYPE_NULL, "TYPE32768", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +{(enum gldns_enum_rr_type)0, "TYPE32768", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, #endif /* 32769 */ {GLDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 } @@ -729,18 +731,18 @@ gldns_get_rr_type_by_name(const char *name) /* special cases for query types */ if (strlen(name) == 4 && strncasecmp(name, "IXFR", 4) == 0) { - return 251; + return GLDNS_RR_TYPE_IXFR; } else if (strlen(name) == 4 && strncasecmp(name, "AXFR", 4) == 0) { - return 252; + return GLDNS_RR_TYPE_AXFR; } else if (strlen(name) == 5 && strncasecmp(name, "MAILB", 5) == 0) { - return 253; + return GLDNS_RR_TYPE_MAILB; } else if (strlen(name) == 5 && strncasecmp(name, "MAILA", 5) == 0) { - return 254; + return GLDNS_RR_TYPE_MAILA; } else if (strlen(name) == 3 && strncasecmp(name, "ANY", 3) == 0) { - return 255; + return GLDNS_RR_TYPE_ANY; } - return 0; + return (enum gldns_enum_rr_type)0; } gldns_rr_class diff --git a/src/gldns/str2wire.c b/src/gldns/str2wire.c index 708df50e..29de56d8 100644 --- a/src/gldns/str2wire.c +++ b/src/gldns/str2wire.c @@ -24,6 +24,7 @@ #ifdef HAVE_NETDB_H #include #endif +#include /** return an error */ #define RET_ERR(e, off) ((int)((e)|((off)< 0) { + if((unsigned)dlen >= 0x00ffffffU || + (unsigned)origin_len >= 0x00ffffffU) + /* guard against integer overflow in addition */ + return RET_ERR(GLDNS_WIREPARSE_ERR_GENERAL, *len); if(dlen + origin_len - 1 > GLDNS_MAX_DOMAINLEN) return RET_ERR(GLDNS_WIREPARSE_ERR_DOMAINNAME_OVERFLOW, GLDNS_MAX_DOMAINLEN); @@ -168,7 +173,9 @@ uint8_t* gldns_str2wire_dname(const char* str, size_t* len) uint8_t dname[GLDNS_MAX_DOMAINLEN+1]; *len = sizeof(dname); if(gldns_str2wire_dname_buf(str, dname, len) == 0) { - uint8_t* r = (uint8_t*)malloc(*len); + uint8_t* r; + if(*len > sizeof(dname)) return NULL; + r = (uint8_t*)malloc(*len); if(r) return memcpy(r, dname, *len); } *len = 0; @@ -187,7 +194,10 @@ rrinternal_get_owner(gldns_buffer* strbuf, uint8_t* rr, size_t* len, gldns_buffer_position(strbuf)); } - if(strcmp(token, "@") == 0) { + if(token_len < 2) /* make sure there is space to read "@" or "" */ + return RET_ERR(GLDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, + gldns_buffer_position(strbuf)); + if(token[0]=='@' && token[1]=='\0') { uint8_t* tocopy; if (origin) { *dname_len = origin_len; @@ -727,7 +737,7 @@ gldns_str2wire_rr_buf_internal(const char* str, uint8_t* rr, size_t* len, { int status; int not_there = 0; - char token[GLDNS_MAX_RDFLEN+1]; + char token[GLDNS_MAX_RDFLEN+1] = ""; uint32_t ttl = 0; uint16_t tp = 0, cl = 0; size_t ddlen = 0; @@ -1096,7 +1106,7 @@ int gldns_str2wire_str_buf(const char* str, uint8_t* rd, size_t* len) while(gldns_parse_char(&ch, &s)) { if(sl >= 255) return RET_ERR(GLDNS_WIREPARSE_ERR_INVALID_STR, s-str); - if(*len < sl+1) + if(*len < sl+2) return RET_ERR(GLDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL, s-str); rd[++sl] = ch; @@ -2097,6 +2107,8 @@ int gldns_str2wire_int16_data_buf(const char* str, uint8_t* rd, size_t* len) char* s; int n; n = strtol(str, &s, 10); + if(n < 0) /* negative number not allowed */ + return GLDNS_WIREPARSE_ERR_SYNTAX; if(*len < ((size_t)n)+2) return GLDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL; if(n > 65535) diff --git a/src/gldns/wire2str.c b/src/gldns/wire2str.c index 28b7863b..427b156c 100644 --- a/src/gldns/wire2str.c +++ b/src/gldns/wire2str.c @@ -25,7 +25,9 @@ #ifdef HAVE_TIME_H #include #endif +#ifdef HAVE_SYS_TIME_H #include +#endif #include #include #ifdef HAVE_NETDB_H @@ -252,13 +254,13 @@ int gldns_wire2str_pkt_buf(uint8_t* d, size_t dlen, char* s, size_t slen) int gldns_wire2str_rr_buf(uint8_t* d, size_t dlen, char* s, size_t slen) { /* use arguments as temporary variables */ - return gldns_wire2str_rr_scan(&d, &dlen, &s, &slen, NULL, 0); + return gldns_wire2str_rr_scan(&d, &dlen, &s, &slen, NULL, 0, NULL); } int gldns_wire2str_rrquestion_buf(uint8_t* d, size_t dlen, char* s, size_t slen) { /* use arguments as temporary variables */ - return gldns_wire2str_rrquestion_scan(&d, &dlen, &s, &slen, NULL, 0); + return gldns_wire2str_rrquestion_scan(&d, &dlen, &s, &slen, NULL, 0, NULL); } int gldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str, @@ -266,13 +268,13 @@ int gldns_wire2str_rdata_buf(uint8_t* rdata, size_t rdata_len, char* str, { /* use arguments as temporary variables */ return gldns_wire2str_rdata_scan(&rdata, &rdata_len, &str, &str_len, - rrtype, NULL, 0); + rrtype, NULL, 0, NULL); } int gldns_wire2str_rr_unknown_buf(uint8_t* d, size_t dlen, char* s, size_t slen) { /* use arguments as temporary variables */ - return gldns_wire2str_rr_unknown_scan(&d, &dlen, &s, &slen, NULL, 0); + return gldns_wire2str_rr_unknown_scan(&d, &dlen, &s, &slen, NULL, 0, NULL); } int gldns_wire2str_rr_comment_buf(uint8_t* rr, size_t rrlen, size_t dname_len, @@ -310,7 +312,7 @@ int gldns_wire2str_opcode_buf(int opcode, char* s, size_t slen) int gldns_wire2str_dname_buf(uint8_t* d, size_t dlen, char* s, size_t slen) { /* use arguments as temporary variables */ - return gldns_wire2str_dname_scan(&d, &dlen, &s, &slen, NULL, 0); + return gldns_wire2str_dname_scan(&d, &dlen, &s, &slen, NULL, 0, NULL); } int gldns_str_vprint(char** str, size_t* slen, const char* format, va_list args) @@ -365,7 +367,7 @@ static int print_remainder_hex(const char* pref, uint8_t** d, size_t* dlen, int gldns_wire2str_pkt_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) { - int w = 0; + int w = 0, comprloop = 0; unsigned qdcount, ancount, nscount, arcount, i; uint8_t* pkt = *d; size_t pktlen = *dlen; @@ -382,25 +384,25 @@ int gldns_wire2str_pkt_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) w += gldns_str_print(s, slen, ";; QUESTION SECTION:\n"); for(i=0; i 4) + maxcompr = 4; /* just don't want to spend time, any more */ + } if(*dlen == 0) return gldns_str_print(s, slen, "ErrorMissingDname"); if(*pos == 0) { (*d)++; (*dlen)--; return gldns_str_print(s, slen, "."); } - while(*pos) { + while((!pkt || pos < pkt+pktlen) && *pos) { /* read label length */ uint8_t labellen = *pos++; if(in_buf) { (*d)++; (*dlen)--; } @@ -928,14 +939,14 @@ int gldns_wire2str_ttl_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen) } int gldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen, - int rdftype, uint8_t* pkt, size_t pktlen) + int rdftype, uint8_t* pkt, size_t pktlen, int* comprloop) { if(*dlen == 0) return 0; switch(rdftype) { case GLDNS_RDF_TYPE_NONE: return 0; case GLDNS_RDF_TYPE_DNAME: - return gldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen); + return gldns_wire2str_dname_scan(d, dlen, s, slen, pkt, pktlen, comprloop); case GLDNS_RDF_TYPE_INT8: return gldns_wire2str_int8_scan(d, dlen, s, slen); case GLDNS_RDF_TYPE_INT16: @@ -987,7 +998,7 @@ int gldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen, return gldns_wire2str_atma_scan(d, dlen, s, slen); case GLDNS_RDF_TYPE_IPSECKEY: return gldns_wire2str_ipseckey_scan(d, dlen, s, slen, pkt, - pktlen); + pktlen, comprloop); case GLDNS_RDF_TYPE_HIP: return gldns_wire2str_hip_scan(d, dlen, s, slen); case GLDNS_RDF_TYPE_INT16_DATA: @@ -1006,7 +1017,7 @@ int gldns_wire2str_rdf_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen, return gldns_wire2str_long_str_scan(d, dlen, s, slen); case GLDNS_RDF_TYPE_AMTRELAY: return gldns_wire2str_amtrelay_scan(d, dlen, s, slen, pkt, - pktlen); + pktlen, comprloop); case GLDNS_RDF_TYPE_TSIGERROR: return gldns_wire2str_tsigerror_scan(d, dlen, s, slen); } @@ -1532,7 +1543,7 @@ int gldns_wire2str_atma_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) /* internal scan routine that can modify arguments on failure */ static int gldns_wire2str_ipseckey_scan_internal(uint8_t** d, size_t* dl, - char** s, size_t* sl, uint8_t* pkt, size_t pktlen) + char** s, size_t* sl, uint8_t* pkt, size_t pktlen, int* comprloop) { /* http://www.ietf.org/internet-drafts/draft-ietf-ipseckey-rr-12.txt*/ uint8_t precedence, gateway_type, algorithm; @@ -1560,7 +1571,7 @@ static int gldns_wire2str_ipseckey_scan_internal(uint8_t** d, size_t* dl, w += gldns_wire2str_aaaa_scan(d, dl, s, sl); break; case 3: /* dname */ - w += gldns_wire2str_dname_scan(d, dl, s, sl, pkt, pktlen); + w += gldns_wire2str_dname_scan(d, dl, s, sl, pkt, pktlen, comprloop); break; default: /* unknown */ return -1; @@ -1574,12 +1585,12 @@ static int gldns_wire2str_ipseckey_scan_internal(uint8_t** d, size_t* dl, } int gldns_wire2str_ipseckey_scan(uint8_t** d, size_t* dl, char** s, size_t* sl, - uint8_t* pkt, size_t pktlen) + uint8_t* pkt, size_t pktlen, int* comprloop) { uint8_t* od = *d; char* os = *s; size_t odl = *dl, osl = *sl; - int w=gldns_wire2str_ipseckey_scan_internal(d, dl, s, sl, pkt, pktlen); + int w=gldns_wire2str_ipseckey_scan_internal(d, dl, s, sl, pkt, pktlen, comprloop); if(w == -1) { *d = od; *s = os; @@ -1712,7 +1723,7 @@ int gldns_wire2str_long_str_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) /* internal scan routine that can modify arguments on failure */ static int gldns_wire2str_amtrelay_scan_internal(uint8_t** d, size_t* dl, - char** s, size_t* sl, uint8_t* pkt, size_t pktlen) + char** s, size_t* sl, uint8_t* pkt, size_t pktlen, int* comprloop) { /* https://www.ietf.org/id/draft-ietf-mboned-driad-amt-discovery-01.txt */ uint8_t precedence, discovery_optional, relay_type; @@ -1739,7 +1750,7 @@ static int gldns_wire2str_amtrelay_scan_internal(uint8_t** d, size_t* dl, w += gldns_wire2str_aaaa_scan(d, dl, s, sl); break; case 3: /* dname */ - w += gldns_wire2str_dname_scan(d, dl, s, sl, pkt, pktlen); + w += gldns_wire2str_dname_scan(d, dl, s, sl, pkt, pktlen, comprloop); break; default: /* unknown */ return -1; @@ -1748,12 +1759,12 @@ static int gldns_wire2str_amtrelay_scan_internal(uint8_t** d, size_t* dl, } int gldns_wire2str_amtrelay_scan(uint8_t** d, size_t* dl, char** s, size_t* sl, - uint8_t* pkt, size_t pktlen) + uint8_t* pkt, size_t pktlen, int* comprloop) { uint8_t* od = *d; char* os = *s; size_t odl = *dl, osl = *sl; - int w=gldns_wire2str_amtrelay_scan_internal(d, dl, s, sl, pkt, pktlen); + int w=gldns_wire2str_amtrelay_scan_internal(d, dl, s, sl, pkt, pktlen, comprloop); if(w == -1) { *d = od; *s = os; @@ -1966,8 +1977,8 @@ int gldns_wire2str_edns_subnet_print(char** s, size_t* sl, uint8_t* data, return w; } -int gldns_wire2str_edns_keepalive_print(char** s, size_t* sl, uint8_t* data, - size_t len) +static int gldns_wire2str_edns_keepalive_print(char** s, size_t* sl, + uint8_t* data, size_t len) { int w = 0; uint16_t timeout; diff --git a/src/gldns/wire2str.h b/src/gldns/wire2str.h index 99a737a1..62a11a2a 100644 --- a/src/gldns/wire2str.h +++ b/src/gldns/wire2str.h @@ -156,10 +156,11 @@ int gldns_wire2str_pkt_scan(uint8_t** data, size_t* data_len, char** str, * @param str_len: length of string buffer. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: if pkt, bool detects compression loops. * @return number of characters (except null) needed to print. */ int gldns_wire2str_rr_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, uint8_t* pkt, size_t pktlen); + size_t* str_len, uint8_t* pkt, size_t pktlen, int* comprloop); /** * Scan wireformat question rr to string, with user buffers. @@ -170,10 +171,11 @@ int gldns_wire2str_rr_scan(uint8_t** data, size_t* data_len, char** str, * @param str_len: length of string buffer. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: if pkt, bool detects compression loops. * @return number of characters (except null) needed to print. */ int gldns_wire2str_rrquestion_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, uint8_t* pkt, size_t pktlen); + size_t* str_len, uint8_t* pkt, size_t pktlen, int* comprloop); /** * Scan wireformat RR to string in unknown RR format, with user buffers. @@ -184,10 +186,11 @@ int gldns_wire2str_rrquestion_scan(uint8_t** data, size_t* data_len, char** str, * @param str_len: length of string buffer. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: if pkt, bool detects compression loops. * @return number of characters (except null) needed to print. */ int gldns_wire2str_rr_unknown_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, uint8_t* pkt, size_t pktlen); + size_t* str_len, uint8_t* pkt, size_t pktlen, int* comprloop); /** * Print to string the RR-information comment in default format, @@ -228,10 +231,12 @@ int gldns_wire2str_header_scan(uint8_t** data, size_t* data_len, char** str, * @param rrtype: RR type of Rdata, host format. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: if pkt, bool detects compression loops. * @return number of characters (except null) needed to print. */ int gldns_wire2str_rdata_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, uint16_t rrtype, uint8_t* pkt, size_t pktlen); + size_t* str_len, uint16_t rrtype, uint8_t* pkt, size_t pktlen, + int* comprloop); /** * Scan wireformat rdata to string in unknown format, with user buffers. @@ -254,10 +259,17 @@ int gldns_wire2str_rdata_unknown_scan(uint8_t** data, size_t* data_len, * @param str_len: length of string buffer. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: inout bool, that is set true if compression loop failure + * happens. Pass in 0, if passsed in as true, a lower bound is set + * on compression loops to stop arbitrary long packet parse times. + * This is meant so you can set it to 0 at the start of a list of dnames, + * and then scan all of them in sequence, if a loop happens, it becomes + * true and then it becomes more strict for the next dnames in the list. + * You can leave it at NULL if there is no pkt (pkt is NULL too). * @return number of characters (except null) needed to print. */ int gldns_wire2str_dname_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, uint8_t* pkt, size_t pktlen); + size_t* str_len, uint8_t* pkt, size_t pktlen, int* comprloop); /** * Scan wireformat rr type to string, with user buffers. @@ -492,11 +504,13 @@ int gldns_wire2str_dname_buf(uint8_t* dname, size_t dname_len, char* str, * @param rdftype: the type of the rdata field, enum gldns_rdf_type. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: if pkt, bool detects compression loops. * @return number of characters (except null) needed to print. * Can return -1 on failure. */ int gldns_wire2str_rdf_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, int rdftype, uint8_t* pkt, size_t pktlen); + size_t* str_len, int rdftype, uint8_t* pkt, size_t pktlen, + int* comprloop); /** * Scan wireformat int8 field to string, with user buffers. @@ -793,11 +807,12 @@ int gldns_wire2str_atma_scan(uint8_t** data, size_t* data_len, char** str, * @param str_len: length of string buffer. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: if pkt, bool detects compression loops. * @return number of characters (except null) needed to print. * Can return -1 on failure. */ int gldns_wire2str_ipseckey_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, uint8_t* pkt, size_t pktlen); + size_t* str_len, uint8_t* pkt, size_t pktlen, int* comprloop); /** * Scan wireformat HIP (algo, HIT, pubkey) field to string, with user buffers. @@ -925,11 +940,12 @@ int gldns_wire2str_long_str_scan(uint8_t** data, size_t* data_len, char** str, * @param str_len: length of string buffer. * @param pkt: packet for decompression, if NULL no decompression. * @param pktlen: length of packet buffer. + * @param comprloop: if pkt, bool detects compression loops. * @return number of characters (except null) needed to print. * Can return -1 on failure. */ int gldns_wire2str_amtrelay_scan(uint8_t** data, size_t* data_len, char** str, - size_t* str_len, uint8_t* pkt, size_t pktlen); + size_t* str_len, uint8_t* pkt, size_t pktlen, int* comprloop); /** * Print EDNS LLQ option data to string. User buffers, moves string pointers. diff --git a/src/gnutls/tls-internal.h b/src/gnutls/tls-internal.h index 4f7f24f8..bfc563ef 100644 --- a/src/gnutls/tls-internal.h +++ b/src/gnutls/tls-internal.h @@ -53,7 +53,8 @@ #define HAVE_TLS_CTX_CURVES_LIST 0 #define HAVE_TLS_CONN_CURVES_LIST 0 -typedef struct getdns_log_config getdns_log_config; +/* Forward declare type. */ +struct getdns_log_config; typedef struct _getdns_tls_context { struct mem_funcs* mfs; @@ -64,7 +65,7 @@ typedef struct _getdns_tls_context { gnutls_protocol_t max_tls; char* ca_trust_file; char* ca_trust_path; - const getdns_log_config* log; + const struct getdns_log_config* log; } _getdns_tls_context; typedef struct _getdns_tls_connection { @@ -81,7 +82,7 @@ typedef struct _getdns_tls_connection { dane_query_t dane_query; dane_state_t dane_state; char* tlsa; - const getdns_log_config* log; + const struct getdns_log_config* log; } _getdns_tls_connection; typedef struct _getdns_tls_session { diff --git a/src/install-sh b/src/install-sh deleted file mode 100755 index 377bb868..00000000 --- a/src/install-sh +++ /dev/null @@ -1,527 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2011-11-20.07; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/src/jsmn b/src/jsmn index c831c386..686a240c 160000 --- a/src/jsmn +++ b/src/jsmn @@ -1 +1 @@ -Subproject commit c831c3869f56a571a79a3cbf58e0a366e588e256 +Subproject commit 686a240cc8186a9a799ebafb0b32e67991b5abfc diff --git a/src/openssl/tls-internal.h b/src/openssl/tls-internal.h index 615f79e3..fc3d48e5 100644 --- a/src/openssl/tls-internal.h +++ b/src/openssl/tls-internal.h @@ -54,20 +54,21 @@ #define GETDNS_TLS_MAX_DIGEST_LENGTH (EVP_MAX_MD_SIZE) -typedef struct sha256_pin sha256_pin_t; -typedef struct getdns_log_config getdns_log_config; +/* Forward declare type. */ +struct sha256_pin; +struct getdns_log_config; typedef struct _getdns_tls_context { SSL_CTX* ssl; - const getdns_log_config* log; + const struct getdns_log_config* log; } _getdns_tls_context; typedef struct _getdns_tls_connection { SSL* ssl; - const getdns_log_config* log; + const struct getdns_log_config* log; #if defined(USE_DANESSL) const char* auth_name; - const sha256_pin_t* pinset; + const struct sha256_pin* pinset; #endif } _getdns_tls_connection; diff --git a/src/platform.h b/src/platform.h index ddfb9575..c7ac17c2 100644 --- a/src/platform.h +++ b/src/platform.h @@ -62,10 +62,10 @@ typedef u_short sa_family_t; const char *_getdns_strerror(DWORD errnum); #else /* USE_WINSOCK */ -#ifdef HAVE_SYS_POLL_H -# include -#else +#ifndef HAVE_SYS_POLL_H # include +#else +# include #endif #define _getdns_EINTR (EINTR) diff --git a/src/server.c b/src/server.c index 4339d593..a7054955 100644 --- a/src/server.c +++ b/src/server.c @@ -102,6 +102,8 @@ struct connection { struct sockaddr_storage remote_in; socklen_t addrlen; + size_t max_udp_size; + connection *next; connection **prev_next; }; @@ -326,6 +328,17 @@ getdns_reply(getdns_context *context, else if (conn->l->transport == GETDNS_TRANSPORT_UDP) { listener *l = conn->l; + if (len > conn->max_udp_size) { + _getdns_rr_iter qi_spc, *qi; + + (void)memset(buf + 6, 0, 6); + GLDNS_TC_SET(buf); + if ((qi = _getdns_rr_iter_init(&qi_spc, buf, len))) { + DEBUG_SERVER("Truncating reply to: %d\n", + (int)(qi->nxt - buf)); + len = qi->nxt - buf; + } + } if (conn->l->fd >= 0 && sendto(conn->l->fd, (void *)buf, len, 0, (struct sockaddr *)&conn->remote_in, conn->addrlen) == -1) { /* TODO: handle _getdns_socketerror_wants_retry() */ @@ -545,6 +558,7 @@ static void tcp_accept_cb(void *userarg) return; (void) memset(conn, 0, sizeof(tcp_connection)); + conn->super.max_udp_size = 65536; conn->super.l = l; conn->super.addrlen = sizeof(conn->super.remote_in); if ((conn->fd = accept(l->fd, (struct sockaddr *) @@ -629,6 +643,7 @@ static void udp_read_cb(void *userarg) conn->l = l; conn->addrlen = sizeof(conn->remote_in); + conn->max_udp_size = 512; if ((len = recvfrom(l->fd, (void *)buf, sizeof(buf), 0, (struct sockaddr *)&conn->remote_in, &conn->addrlen)) == -1) { if ( _getdns_socketerror_wants_retry() && @@ -713,6 +728,8 @@ static void udp_read_cb(void *userarg) ; /* FROMERR on input, ignore */ else { + uint32_t max_udp_size = 512; + /* Insert connection */ conn->super.key = conn; if (!_getdns_rbtree_insert( @@ -723,6 +740,15 @@ static void udp_read_cb(void *userarg) } DEBUG_SERVER("[connection add] count: %d\n", (int)l->set->connections_set.count); + + if (!getdns_dict_get_int(request_dict, + "/additional/0/udp_payload_size", &max_udp_size)) + conn->max_udp_size = max_udp_size; + + else if (!getdns_dict_get_int(request_dict, + "/additional/1/udp_payload_size", &max_udp_size)) + conn->max_udp_size = max_udp_size; + if ((conn->next = l->connections)) conn->next->prev_next = &conn->next; conn->prev_next = &l->connections; @@ -978,6 +1004,7 @@ getdns_return_t getdns_context_set_listen_addresses( (void) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_NUMERICHOST; for (i = 0; !r && i < new_set_count; i++) { diff --git a/src/ssl_dane b/src/ssl_dane index dd093e58..18783810 160000 --- a/src/ssl_dane +++ b/src/ssl_dane @@ -1 +1 @@ -Subproject commit dd093e585a237e0321d303ec35e84c393ef739f4 +Subproject commit 187838104f3cfc9634148ae41a717e00c0d68e67 diff --git a/src/stub.c b/src/stub.c index 2547d10f..5f52b866 100644 --- a/src/stub.c +++ b/src/stub.c @@ -68,7 +68,8 @@ #define STUB_TCP_ERROR -2 /* Don't currently have access to the context whilst doing handshake */ -#define TIMEOUT_TLS 2500 +#define MIN_TLS_HS_TIMEOUT 2500 +#define MAX_TLS_HS_TIMEOUT 7500 /* Arbritray number of message for EDNS keepalive resend*/ #define EDNS_KEEPALIVE_RESEND 5 @@ -241,7 +242,7 @@ match_edns_opt_rr(uint16_t code, uint8_t *response, size_t response_len, uint8_t *data = (uint8_t *)rr_iter->pos; size_t data_len = rr_iter->nxt - rr_iter->pos; (void) gldns_wire2str_rr_scan( - &data, &data_len, &str, &str_len, (uint8_t *)rr_iter->pkt, rr_iter->pkt_end - rr_iter->pkt); + &data, &data_len, &str, &str_len, (uint8_t *)rr_iter->pkt, rr_iter->pkt_end - rr_iter->pkt, NULL); DEBUG_STUB("%s %-35s: OPT RR: %s", STUB_DEBUG_READ, __FUNC__, str_spc); #endif @@ -455,7 +456,8 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport) GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_WARNING, "%-40s : Upstream : Could not setup TCP TFO\n", upstream->addr_str); - +# else + (void)transport; # endif/* HAVE_DECL_TCP_FASTOPEN*/ # endif /* HAVE_DECL_TCP_FASTOPEN_CONNECT */ #endif /* USE_OSX_TCP_FASTOPEN */ @@ -980,13 +982,23 @@ tls_do_handshake(getdns_upstream *upstream) int r; while ((r = _getdns_tls_connection_do_handshake(upstream->tls_obj)) != GETDNS_RETURN_GOOD) { + uint64_t timeout_tls = _getdns_ms_until_expiry(upstream->expires); + + if (timeout_tls < MIN_TLS_HS_TIMEOUT) + timeout_tls = MIN_TLS_HS_TIMEOUT; + else if (timeout_tls > MAX_TLS_HS_TIMEOUT) + timeout_tls = MAX_TLS_HS_TIMEOUT; + + DEBUG_STUB("%s %-35s: FD: %d, do_handshake -> %d (timeout: %d)\n", + STUB_DEBUG_SETUP_TLS, __FUNC__, upstream->fd, r, (int)timeout_tls); + switch (r) { case GETDNS_RETURN_TLS_WANT_READ: GETDNS_CLEAR_EVENT(upstream->loop, &upstream->event); upstream->event.read_cb = upstream_read_cb; upstream->event.write_cb = NULL; GETDNS_SCHEDULE_EVENT(upstream->loop, - upstream->fd, TIMEOUT_TLS, &upstream->event); + upstream->fd, timeout_tls, &upstream->event); upstream->tls_hs_state = GETDNS_HS_READ; return STUB_TCP_RETRY; case GETDNS_RETURN_TLS_WANT_WRITE: @@ -994,7 +1006,7 @@ tls_do_handshake(getdns_upstream *upstream) upstream->event.read_cb = NULL; upstream->event.write_cb = upstream_write_cb; GETDNS_SCHEDULE_EVENT(upstream->loop, - upstream->fd, TIMEOUT_TLS, &upstream->event); + upstream->fd, timeout_tls, &upstream->event); upstream->tls_hs_state = GETDNS_HS_WRITE; return STUB_TCP_RETRY; default: @@ -1198,7 +1210,12 @@ stub_tls_write(getdns_upstream *upstream, getdns_tcp_state *tcp, _getdns_tls_connection* tls_obj = upstream->tls_obj; uint16_t padding_sz; - int q = tls_connected(upstream); + int q; + + if (netreq->owner->expires > upstream->expires) + upstream->expires = netreq->owner->expires; + + q = tls_connected(upstream); if (q != 0) return q; /* This is the case where the upstream is connected but it isn't an authenticated @@ -2225,8 +2242,16 @@ upstream_schedule_netreq(getdns_upstream *upstream, getdns_network_req *netreq) /* Set a timeout on the upstream so we can catch failed setup*/ upstream->event.timeout_cb = upstream_setup_timeout_cb; GETDNS_SCHEDULE_EVENT(upstream->loop, upstream->fd, - _getdns_ms_until_expiry(netreq->owner->expires)/2, + _getdns_ms_until_expiry(netreq->owner->expires)/5*4, &upstream->event); +#if defined(HAVE_DECL_TCP_FASTOPEN) && HAVE_DECL_TCP_FASTOPEN \ + && !(defined(HAVE_DECL_TCP_FASTOPEN_CONNECT) && HAVE_DECL_TCP_FASTOPEN_CONNECT) \ + && !(defined(HAVE_DECL_MSG_FASTOPEN) && HAVE_DECL_MSG_FASTOPEN) + if (upstream->transport == GETDNS_TRANSPORT_TCP) { + /* Write immediately! */ + upstream_write_cb(upstream); + } +#endif } else { GETDNS_SCHEDULE_EVENT(upstream->loop, upstream->fd, TIMEOUT_FOREVER, &upstream->event); @@ -2292,78 +2317,14 @@ _getdns_submit_stub_request(getdns_network_req *netreq, uint64_t *now_ms) case GETDNS_TRANSPORT_TLS: case GETDNS_TRANSPORT_TCP: - upstream_schedule_netreq(netreq->upstream, netreq); - /* For TLS, set a short timeout to catch setup problems. This is reset - when the connection is successful.*/ GETDNS_CLEAR_EVENT(dnsreq->loop, &netreq->event); - /************************************************************* - ****** ***** - ****** Scheduling differences of ***** - ****** synchronous and asynchronous requests ***** - ****** ***** - ************************************************************* - * - * Besides the asynchronous event loop, which is typically - * shared with the application, every getdns context also - * has another event loop (not registered by the user) which - * is used specifically and only for synchronous requests: - * context->sync_eventloop. - * - * We do not use the asynchronous loop for the duration of the - * synchronous query, because: - * - Callbacks for outstanding (and thus asynchronous) queries - * might fire as a side effect. - * - But worse, since the asynchronous loop is created and - * managed by the user, which may well have her own non-dns - * related events scheduled against it, they will fire as - * well as a side effect of doing the synchronous request! - * - * - * Transports that keep connections open, have their own event - * structure to keep their connection state. The event is - * associated with the upstream struct. Note that there is a - * separate upstream struct for each state full transport, so - * each upstream has multiple transport structs! - * - * side note: The upstream structs have their own reference - * to the "context's" event loop so they can, - * in theory, be detached (to finish running - * queries for example). - * - * If a synchronous request is scheduled for such a transport, - * then the sync-loop temporarily has to "run" that - * upstream/transport's event! Outstanding requests for that - * upstream/transport might come in while processing the - * synchronous call. When this happens, they are queued up - * (at upstream->finished_queue) and an timeout event of 1 - * will be scheduled against the asynchronous loop to start - * processing those received request as soon as the - * asynchronous loop will be run. - * - * - * When getdns is linked with libunbound 1.5.8 or older, then - * when a RECURSING synchronous request is made then - * outstanding asynchronously scheduled RECURSING requests - * may fire as a side effect, as we reuse the same code path - * For both synchronous and asynchronous calls, - * ub_resolve_async() is used under the hood. - * - * With libunbound versions newer than 1.5.8, libunbound will - * share the event loops used with getdns which will prevent - * these side effects from happening. - * - * - * The event loop used for a specific request is in - * dnsreq->loop. The asynchronous is always also available - * at the upstream as upstream->loop. - */ GETDNS_SCHEDULE_EVENT( dnsreq->loop, -1, _getdns_ms_until_expiry2(dnsreq->expires, now_ms), getdns_eventloop_event_init( &netreq->event, netreq, NULL, NULL, stub_timeout_cb)); - + upstream_schedule_netreq(netreq->upstream, netreq); return GETDNS_RETURN_GOOD; default: return GETDNS_RETURN_GENERIC_ERROR; diff --git a/src/test/Makefile.in b/src/test/Makefile.in deleted file mode 100644 index 9d4dad00..00000000 --- a/src/test/Makefile.in +++ /dev/null @@ -1,314 +0,0 @@ -# -# @configure_input@ -# -# Copyright (c) 2013, Verisign, Inc., NLNet Labs -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the names of the copyright holders nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package = @PACKAGE_NAME@ -version = @PACKAGE_VERSION@ -tarname = @PACKAGE_TARNAME@ -distdir = $(tarname)-$(version) - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -INSTALL = @INSTALL@ -LIBTOOL = ../../libtool - -srcdir = @srcdir@ - -have_libevent = @have_libevent@ -have_libuv = @have_libuv@ -have_libev = @have_libev@ -NOLIBCHECK = @NOLIBCHECK@ - -EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@ -EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@ -EXTENSION_LIBUV_EXT_LIBS=@EXTENSION_LIBUV_EXT_LIBS@ -EXTENSION_LIBUV_LDFLAGS=@EXTENSION_LIBUV_LDFLAGS@ -EXTENSION_LIBEV_EXT_LIBS=@EXTENSION_LIBEV_EXT_LIBS@ -EXTENSION_LIBEV_LDFLAGS=@EXTENSION_LIBEV_LDFLAGS@ - -CHECK_GETDNS=@CHECK_GETDNS@ -CHECK_UV_PROG=@CHECK_UV_PROG@ -CHECK_EVENT_PROG=@CHECK_EVENT_PROG@ -CHECK_EV_PROG=@CHECK_EV_PROG@ - -CC=@CC@ -CFLAGS=-I$(srcdir)/.. -I$(srcdir) -I.. $(cflags) @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS) -WPEDANTICFLAG=@WPEDANTICFLAG@ -LDFLAGS=-L.. @LDFLAGS@ -LDLIBS=../libgetdns.la @LIBS@ -CHECK_LIBS=@CHECK_LIBS@ -CHECK_CFLAGS=@CHECK_CFLAGS@ - -CHECK_OBJS=check_getdns_common.lo check_getdns_context_set_timeout.lo \ - check_getdns.lo check_getdns_transport.lo - -ALL_OBJS=$(CHECK_OBJS) check_getdns_libevent.lo check_getdns_libev.lo \ - check_getdns_selectloop.lo scratchpad.lo \ - testmessages.lo tests_dict.lo tests_list.lo tests_namespaces.lo \ - tests_stub_async.lo tests_stub_sync.lo - -NON_C99_OBJS=check_getdns_libuv.lo - -PROGRAMS=tests_dict tests_list tests_namespaces tests_stub_async tests_stub_sync $(CHECK_GETDNS) $(CHECK_EV_PROG) $(CHECK_EVENT_PROG) $(CHECK_UV_PROG) - - -.SUFFIXES: .c .o .a .lo .h - -.c.o: - $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@ - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@ - -default: all - -all: $(PROGRAMS) - -$(ALL_OBJS): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/$(@:.lo=.c) -o $@ - -$(NON_C99_OBJS): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -c $(srcdir)/$(@:.lo=.c) -o $@ - -tests_dict: tests_dict.lo testmessages.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_dict.lo testmessages.lo - -tests_list: tests_list.lo testmessages.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.lo testmessages.lo - -tests_namespaces: tests_namespaces.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_namespaces.lo - -tests_stub_async: tests_stub_async.lo testmessages.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.lo testmessages.lo - -tests_stub_sync: tests_stub_sync.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.lo - -check_getdns_common: check_getdns_common.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ check_getdns_common.lo - -check_getdns: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo - -check_getdns_event: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo ../libgetdns_ext_event.la - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_event.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) - -check_getdns_uv: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo ../libgetdns_ext_uv.la - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_uv.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) - -check_getdns_ev: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo ../libgetdns_ext_ev.la - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_ev.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) - -scratchpad: scratchpad.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ scratchpad.lo $(LDFLAGS) $(LDLIBS) - -scratchpad.lo: scratchpad.c - -$(srcdir)/scratchpad.c: scratchpad.template.c - [ ! -f $(srcdir)/scratchpad.c ] && cp -p $(srcdir)/scratchpad.template.c $(srcdir)/scratchpad.c || true - -install: - echo nothing to install - -uninstall: - echo nothing to uninstall - -nolibcheck: - @echo "***" - @echo "*** Cannot run unit tests, because they could not be compiled," - @echo "*** because libcheck was not found or usable at configure time." - @echo "*** To compile and run unit tests make sure libcheck is available" - @echo "*** and usable during configuration" - @echo "***" - @false - -test_noeventloop: $(NOLIBCHECK) all - rm -f $(CHECK_GETDNS).failed - GETDNS_TEST_PORT=43210 CK_TIMEOUT_MULTIPLIER=2 CK_LOG_FILE_NAME="$(CHECK_GETDNS).log" ./$(CHECK_GETDNS) || echo "$(CHECK_GETDNS) failed" >> $(CHECK_GETDNS).failed - -test_libevent: $(NOLIBCHECK) all - rm -f $(CHECK_EVENT_PROG).failed - if test $(have_libevent) = 1 ; then GETDNS_TEST_PORT=44321 CK_TIMEOUT_MULTIPLIER=2 CK_LOG_FILE_NAME="$(CHECK_EVENT_PROG).log" ./$(CHECK_EVENT_PROG) || echo "$(CHECK_EVENT_PROG) failed" >> $(CHECK_EVENT_PROG).failed; fi - -test_libev: $(NOLIBCHECK) all - rm -f $(CHECK_EV_PROG).failed - if test $(have_libev) = 1 ; then GETDNS_TEST_PORT=45432 CK_TIMEOUT_MULTIPLIER=2 CK_LOG_FILE_NAME="$(CHECK_EV_PROG).log" ./$(CHECK_EV_PROG) || echo "$(CHECK_EV_PROG) failed" >> $(CHECK_EV_PROG).failed; fi - -test_libuv: $(NOLIBCHECK) all - rm -f $(CHECK_UV_PROG).failed - if test $(have_libev) = 1 ; then GETDNS_TEST_PORT=46543 CK_TIMEOUT_MULTIPLIER=2 CK_LOG_FILE_NAME="$(CHECK_UV_PROG).log" ./$(CHECK_UV_PROG) || echo "$(CHECK_UV_PROG) failed" >> $(CHECK_UV_PROG).failed; fi - -test: test_noeventloop test_libevent test_libev test_libuv - rm -f fails - if test -f $(CHECK_GETDNS).failed ; then cat $(CHECK_GETDNS).failed >> fails ; fi - if test -f $(CHECK_EVENT_PROG).failed ; then cat $(CHECK_EVENT_PROG).failed >> fails ; fi - if test -f $(CHECK_EV_PROG).failed ; then cat $(CHECK_EV_PROG).failed >> fails ; fi - if test -f $(CHECK_UV_PROG).failed ; then cat $(CHECK_UV_PROG).failed >> fails ; fi - test ! -e fails - @echo "All tests OK" - -clean: - rm -f *.o *.lo $(PROGRAMS) scratchpad - rm -rf .libs - rm -f check_getdns.log check_getdns_event.log check_getdns_ev.log check_getdns_uv.log - -distclean : clean - rm -f scratchpad.c - rm -f Makefile config.status config.log - rm -f check_getdns_uv.core check_getdns.core check_getdns_event.core - rm -Rf autom4te.cache - -$(distdir): FORCE - mkdir -p $(distdir)/src - cp configure.ac $(distdir) - cp configure $(distdir) - cp Makefile.in $(distdir) - cp src/Makefile.in $(distdir)/src - -distcheck: $(distdir).tar.gz - gzip -cd $(distdir).tar.gz | tar xvf - - cd $(distdir) && ./configure - cd $(distdir) && $(MAKE) all - cd $(distdir) && $(MAKE) check - cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst install - cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst uninstall - @remaining="`find $${PWD}/$(distdir)/_inst -type f | wc -l`"; \ - if test "$${remaining}" -ne 0; then - echo "@@@ $${remaining} file(s) remaining in stage directory!"; \ - exit 1; \ - fi - cd $(distdir) && $(MAKE) clean - rm -rf $(distdir) - @echo "*** Package $(distdir).tar.gz is ready for distribution" - -Makefile: $(srcdir)/Makefile.in ../../config.status - cd ../.. && ./config.status src/test/Makefile - -configure.status: configure - cd ../.. && ./config.status --recheck - -depend: - (cd $(srcdir) ; awk 'BEGIN{P=1}{if(P)print}/^# Dependencies/{P=0}' Makefile.in > Makefile.in.new ) - (blddir=`pwd`; cd $(srcdir) ; gcc -MM -I. -I.. -I"$$blddir"/.. *.c | \ - sed -e "s? $$blddir/? ?g" \ - -e 's? \([a-z0-9_-]*\)\.\([ch]\)? $$(srcdir)/\1.\2?g' \ - -e 's? \.\./\([a-z0-9_-]*\)\.h? $$(srcdir)/../\1.h?g' \ - -e 's? \.\./\([a-z0-9_-]*\)/\([a-z0-9_-]*\)\.h? $$(srcdir)/../\1/\2.h?g' \ - -e 's? \$$(srcdir)/config\.h? ../config.h?g' \ - -e 's? \$$(srcdir)/\.\./config\.h? ../config.h?g' \ - -e 's? \$$(srcdir)/\.\./getdns/getdns\.h? ../getdns/getdns.h?g' \ - -e 's? \$$(srcdir)/\.\./getdns/getdns_extra\.h? ../getdns/getdns_extra.h?g' \ - -e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' >> Makefile.in.new ) - (cd $(srcdir) ; diff Makefile.in.new Makefile.in && rm Makefile.in.new \ - || mv Makefile.in.new Makefile.in ) - -.PHONY: clean test - -# Dependencies for the unit tests -check_getdns.lo check_getdns.o: $(srcdir)/check_getdns.c \ - ../getdns/getdns.h \ - $(srcdir)/check_getdns_common.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_address.h $(srcdir)/check_getdns_address_sync.h \ - $(srcdir)/check_getdns_cancel_callback.h $(srcdir)/check_getdns_context_create.h \ - $(srcdir)/check_getdns_context_destroy.h \ - $(srcdir)/check_getdns_context_set_context_update_callback.h \ - $(srcdir)/check_getdns_context_set_dns_transport.h \ - $(srcdir)/check_getdns_context_set_timeout.h \ - $(srcdir)/check_getdns_context_set_upstream_recursive_servers.h \ - $(srcdir)/check_getdns_convert_alabel_to_ulabel.h \ - $(srcdir)/check_getdns_convert_ulabel_to_alabel.h $(srcdir)/check_getdns_dict_destroy.h \ - $(srcdir)/check_getdns_dict_get_bindata.h $(srcdir)/check_getdns_dict_get_data_type.h \ - $(srcdir)/check_getdns_dict_get_dict.h $(srcdir)/check_getdns_dict_get_int.h \ - $(srcdir)/check_getdns_dict_get_list.h $(srcdir)/check_getdns_dict_get_names.h \ - $(srcdir)/check_getdns_dict_set_bindata.h $(srcdir)/check_getdns_dict_set_dict.h \ - $(srcdir)/check_getdns_dict_set_int.h $(srcdir)/check_getdns_dict_set_list.h \ - $(srcdir)/check_getdns_display_ip_address.h $(srcdir)/check_getdns_general.h \ - $(srcdir)/check_getdns_general_sync.h $(srcdir)/check_getdns_hostname.h \ - $(srcdir)/check_getdns_hostname_sync.h $(srcdir)/check_getdns_list_get_bindata.h \ - $(srcdir)/check_getdns_list_get_data_type.h $(srcdir)/check_getdns_list_get_dict.h \ - $(srcdir)/check_getdns_list_get_int.h $(srcdir)/check_getdns_list_get_length.h \ - $(srcdir)/check_getdns_list_get_list.h $(srcdir)/check_getdns_pretty_print_dict.h \ - $(srcdir)/check_getdns_service.h $(srcdir)/check_getdns_service_sync.h \ - $(srcdir)/check_getdns_transport.h -check_getdns_common.lo check_getdns_common.o: $(srcdir)/check_getdns_common.c \ - ../getdns/getdns.h \ - ../config.h \ - $(srcdir)/check_getdns_common.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_eventloop.h -check_getdns_context_set_timeout.lo check_getdns_context_set_timeout.o: $(srcdir)/check_getdns_context_set_timeout.c \ - $(srcdir)/check_getdns_context_set_timeout.h $(srcdir)/check_getdns_common.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h -check_getdns_libev.lo check_getdns_libev.o: $(srcdir)/check_getdns_libev.c $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ - $(srcdir)/../getdns/getdns_ext_libev.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_common.h -check_getdns_libevent.lo check_getdns_libevent.o: $(srcdir)/check_getdns_libevent.c $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ - $(srcdir)/../getdns/getdns_ext_libevent.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_libevent.h $(srcdir)/check_getdns_common.h -check_getdns_libuv.lo check_getdns_libuv.o: $(srcdir)/check_getdns_libuv.c $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ - $(srcdir)/../getdns/getdns_ext_libuv.h \ - ../getdns/getdns_extra.h \ - $(srcdir)/check_getdns_common.h -check_getdns_selectloop.lo check_getdns_selectloop.o: $(srcdir)/check_getdns_selectloop.c \ - $(srcdir)/check_getdns_eventloop.h \ - ../config.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h -check_getdns_transport.lo check_getdns_transport.o: $(srcdir)/check_getdns_transport.c \ - $(srcdir)/check_getdns_transport.h $(srcdir)/check_getdns_common.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h -scratchpad.template.lo scratchpad.template.o: scratchpad.template.c \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h -testmessages.lo testmessages.o: $(srcdir)/testmessages.c $(srcdir)/testmessages.h -tests_dict.lo tests_dict.o: $(srcdir)/tests_dict.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h -tests_list.lo tests_list.o: $(srcdir)/tests_list.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h -tests_namespaces.lo tests_namespaces.o: $(srcdir)/tests_namespaces.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h -tests_stub_async.lo tests_stub_async.o: $(srcdir)/tests_stub_async.c \ - ../config.h \ - $(srcdir)/testmessages.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h -tests_stub_sync.lo tests_stub_sync.o: $(srcdir)/tests_stub_sync.c $(srcdir)/testmessages.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h diff --git a/src/test/check_getdns_address.h b/src/test/check_getdns_address.h index a4eaad71..22d1d1eb 100644 --- a/src/test/check_getdns_address.h +++ b/src/test/check_getdns_address.h @@ -224,7 +224,9 @@ EVENT_BASE_CREATE; - ASSERT_RC(getdns_address(context, "hostnamedoesntexist.", NULL, + // Ubuntu 18.04 system resolver - does not foward single labels, returns + // SERVFAIL so this must be a multilabel name + ASSERT_RC(getdns_address(context, "hostname.doesntexist.", NULL, &fn_ref, &transaction_id, callbackfn), GETDNS_RETURN_GOOD, "Return code from getdns_address()"); @@ -237,7 +239,8 @@ { assert_nxdomain(ex_response); assert_nodata(ex_response); - assert_soa_in_authority(ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(ex_response); } diff --git a/src/test/check_getdns_address_sync.h b/src/test/check_getdns_address_sync.h index c5c4ae92..fd1e22ef 100644 --- a/src/test/check_getdns_address_sync.h +++ b/src/test/check_getdns_address_sync.h @@ -145,7 +145,7 @@ START_TEST (getdns_address_sync_6) { /* - * name = "willem.getdnsapi.net" need to replace this with domain from unbound zone + * name = "d2a8n3.rootcanary.net" need to replace this with domain from unbound zone * expect: NOERROR/NODATA response: * status = GETDNS_RESPSTATUS_NO_DATA * rcode = 0 @@ -156,7 +156,7 @@ CONTEXT_CREATE(TRUE); - ASSERT_RC(getdns_address_sync(context, "willem.getdnsapi.net", NULL, &response), + ASSERT_RC(getdns_address_sync(context, "d2a8n3.rootcanary.net", NULL, &response), GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()"); EXTRACT_RESPONSE; diff --git a/src/test/check_getdns_context_set_dns_transport.h b/src/test/check_getdns_context_set_dns_transport.h index 07dce329..8178f0c5 100644 --- a/src/test/check_getdns_context_set_dns_transport.h +++ b/src/test/check_getdns_context_set_dns_transport.h @@ -474,6 +474,7 @@ TCase *tc_pos = tcase_create("Positive"); /* TODO: Test which specific lists are supported */ tcase_add_test(tc_pos, getdns_context_set_dns_transport_stub_5); + tcase_set_timeout(tc_pos, 6.0); /* test 6 times out after 5 secs */ tcase_add_test(tc_pos, getdns_context_set_dns_transport_recursing_6); tcase_add_test(tc_pos, getdns_context_set_dns_transport_recursing_7); tcase_add_test(tc_pos, getdns_context_set_dns_transport_recursing_8); diff --git a/src/test/check_getdns_context_set_upstream_recursive_servers.h b/src/test/check_getdns_context_set_upstream_recursive_servers.h index 85089e3c..d7949e39 100644 --- a/src/test/check_getdns_context_set_upstream_recursive_servers.h +++ b/src/test/check_getdns_context_set_upstream_recursive_servers.h @@ -427,7 +427,7 @@ EXTRACT_RESPONSE; - printf("the resp is %s\n", getdns_pretty_print_dict(response)); + //printf("the resp is %s\n", getdns_pretty_print_dict(response)); assert_noerror(&ex_response); diff --git a/src/test/check_getdns_general.h b/src/test/check_getdns_general.h index 23bb7e77..d35ecf1e 100644 --- a/src/test/check_getdns_general.h +++ b/src/test/check_getdns_general.h @@ -140,6 +140,7 @@ } END_TEST +#if 0 START_TEST (getdns_general_6) { /* @@ -155,29 +156,30 @@ struct getdns_context *context = NULL; \ void* eventloop = NULL; \ getdns_transaction_t transaction_id = 0; - + CONTEXT_CREATE(TRUE); EVENT_BASE_CREATE; - + ASSERT_RC(getdns_general(context, "google.com", 0, NULL, &fn_ref, &transaction_id, callbackfn), GETDNS_RETURN_GOOD, "Return code from getdns_general()"); - + RUN_EVENT_LOOP; CONTEXT_DESTROY; } END_TEST - + void verify_getdns_general_6(struct extracted_response *ex_response) { assert_noerror(ex_response); assert_nodata(ex_response); } +#endif START_TEST (getdns_general_7) { /* - * name = "google.com" + * name = "nlnetlabs.nl" * request_type = 65279 (maximum unassigned RRTYPE) * expect: NOERROR/NODATA response: * status = GETDNS_RESPSTATUS_NO_NAME @@ -193,7 +195,7 @@ CONTEXT_CREATE(TRUE); EVENT_BASE_CREATE; - ASSERT_RC(getdns_general(context, "google.com", 65279, NULL, + ASSERT_RC(getdns_general(context, "nlnetlabs.nl", 65279, NULL, &fn_ref, &transaction_id, callbackfn), GETDNS_RETURN_GOOD, "Return code from getdns_general()"); @@ -313,13 +315,14 @@ { assert_nxdomain(ex_response); assert_nodata(ex_response); - assert_soa_in_authority(ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(ex_response); } START_TEST (getdns_general_11) { /* - * name = "willem.getdnsapi.net" and unbound zone + * name = "d2a8n3.rootcanary.net" and unbound zone * request_type = GETDNS_RRTYPE_MX * expect: NOERROR/NODATA response: * status = GETDNS_RESPSTATUS_NO_NAME @@ -335,7 +338,7 @@ CONTEXT_CREATE(TRUE); EVENT_BASE_CREATE; - ASSERT_RC(getdns_general(context, "willem.getdnsapi.net", GETDNS_RRTYPE_MX, NULL, + ASSERT_RC(getdns_general(context, "d2a8n3.rootcanary.net", GETDNS_RRTYPE_MX, NULL, &fn_ref, &transaction_id, callbackfn), GETDNS_RETURN_GOOD, "Return code from getdns_general()"); @@ -401,7 +404,8 @@ /* Positive test cases */ TCase *tc_pos = tcase_create("Positive"); - tcase_add_test(tc_pos, getdns_general_6); + // Ubuntu 18.04 system resolver returns FORMERR for this query + //tcase_add_test(tc_pos, getdns_general_6); tcase_add_test(tc_pos, getdns_general_7); tcase_add_test(tc_pos, getdns_general_8); tcase_add_test(tc_pos, getdns_general_9); diff --git a/src/test/check_getdns_general_sync.h b/src/test/check_getdns_general_sync.h index 52eacaff..e69a2855 100644 --- a/src/test/check_getdns_general_sync.h +++ b/src/test/check_getdns_general_sync.h @@ -122,37 +122,37 @@ } END_TEST - START_TEST (getdns_general_sync_6) - { - /* - * name = "google.com" - * request_type = 0 (minimum valid RRTYPE) - * expect: NOERROR/NODATA response: - * status = GETDNS_RESPSTATUS_NO_NAME - * rcode = 0 - * ancount = 0 (number of records in ANSWER section) - */ - struct getdns_context *context = NULL; - struct getdns_dict *response = NULL; - - CONTEXT_CREATE(TRUE); - - ASSERT_RC(getdns_general_sync(context, "google.com", 0, NULL, &response), - GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()"); - - EXTRACT_RESPONSE; - - assert_noerror(&ex_response); - assert_nodata(&ex_response); - - CONTEXT_DESTROY; - } - END_TEST + // START_TEST (getdns_general_sync_6) + // { + // /* + // * name = "google.com" + // * request_type = 0 (minimum valid RRTYPE) + // * expect: NOERROR/NODATA response: + // * status = GETDNS_RESPSTATUS_NO_NAME + // * rcode = 0 + // * ancount = 0 (number of records in ANSWER section) + // */ + // struct getdns_context *context = NULL; + // struct getdns_dict *response = NULL; + // + // CONTEXT_CREATE(TRUE); + // + // ASSERT_RC(getdns_general_sync(context, "google.com", 0, NULL, &response), + // GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()"); + // + // EXTRACT_RESPONSE; + // + // assert_noerror(&ex_response); + // assert_nodata(&ex_response); + // + // CONTEXT_DESTROY; + // } + // END_TEST START_TEST (getdns_general_sync_7) { /* - * name = "google.com" + * name = "nlnetlabs.nl" * request_type = 65279 (maximum unassigned RRTYPE) * expect: NOERROR/NODATA response: * status = GETDNS_RESPSTATUS_NO_NAME @@ -164,7 +164,7 @@ CONTEXT_CREATE(TRUE); - ASSERT_RC(getdns_general_sync(context, "google.com", 65279, NULL, &response), + ASSERT_RC(getdns_general_sync(context, "nlnetlabs.nl", 65279, NULL, &response), GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()"); EXTRACT_RESPONSE; @@ -257,7 +257,8 @@ assert_nxdomain(&ex_response); assert_nodata(&ex_response); - assert_soa_in_authority(&ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(&ex_response); CONTEXT_DESTROY; } @@ -266,7 +267,7 @@ START_TEST (getdns_general_sync_11) { /* - * name = "willem.getdnsapi.net" an unbound zone (as in no MX) + * name = "d2a8n3.rootcanary.net" an unbound zone (as in no MX) * request_type = GETDNS_RRTYPE_MX * expect: NOERROR/NODATA response: * status = GETDNS_RESPSTATUS_NO_NAME @@ -278,7 +279,7 @@ CONTEXT_CREATE(TRUE); - ASSERT_RC(getdns_general_sync(context, "willem.getdnsapi.net", GETDNS_RRTYPE_MX, NULL, &response), + ASSERT_RC(getdns_general_sync(context, "d2a8n3.rootcanary.net", GETDNS_RRTYPE_MX, NULL, &response), GETDNS_RETURN_GOOD, "Return code from getdns_general_sync()"); EXTRACT_RESPONSE; @@ -334,7 +335,8 @@ /* Positive test cases */ TCase *tc_pos = tcase_create("Positive"); - tcase_add_test(tc_pos, getdns_general_sync_6); + // Ubuntu 18.04 system resolver returns FORMERR for this query + //tcase_add_test(tc_pos, getdns_general_sync_6); tcase_add_test(tc_pos, getdns_general_sync_7); tcase_add_test(tc_pos, getdns_general_sync_8); tcase_add_test(tc_pos, getdns_general_sync_9); diff --git a/src/test/check_getdns_hostname.h b/src/test/check_getdns_hostname.h index d5e6bf8e..8847eb4a 100644 --- a/src/test/check_getdns_hostname.h +++ b/src/test/check_getdns_hostname.h @@ -361,7 +361,7 @@ struct getdns_context *context = NULL; struct getdns_dict *address = NULL; struct getdns_bindata address_type = { 5, (void *)"IPv4" }; - struct getdns_bindata address_data = { 4, (void *)"\xb9\x31\x8c\x00" }; + struct getdns_bindata address_data = { 4, (void *)"\x08\x08\x08\x00" }; void* eventloop = NULL; getdns_transaction_t transaction_id = 0; @@ -390,7 +390,8 @@ { assert_nxdomain(ex_response); assert_nodata(ex_response); - assert_soa_in_authority(ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(ex_response); } START_TEST (getdns_hostname_12) @@ -478,7 +479,8 @@ { assert_nxdomain(ex_response); assert_nodata(ex_response); - assert_soa_in_authority(ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(ex_response); } Suite * diff --git a/src/test/check_getdns_hostname_sync.h b/src/test/check_getdns_hostname_sync.h index 38a33fb2..fd957dd5 100644 --- a/src/test/check_getdns_hostname_sync.h +++ b/src/test/check_getdns_hostname_sync.h @@ -304,7 +304,7 @@ struct getdns_context *context = NULL; struct getdns_dict *address = NULL; struct getdns_bindata address_type = { 5, (void *)"IPv4" }; - struct getdns_bindata address_data = { 4, (void *)"\xb9\x31\x8c\x00" }; + struct getdns_bindata address_data = { 4, (void *)"\x08\x08\x08\x00" }; struct getdns_dict *response = NULL; CONTEXT_CREATE(TRUE); @@ -322,7 +322,8 @@ assert_nxdomain(&ex_response); assert_nodata(&ex_response); - assert_soa_in_authority(&ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(&ex_response); DICT_DESTROY(address); CONTEXT_DESTROY; @@ -392,7 +393,8 @@ assert_nxdomain(&ex_response); assert_nodata(&ex_response); - assert_soa_in_authority(&ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(&ex_response); DICT_DESTROY(address); CONTEXT_DESTROY; diff --git a/src/test/check_getdns_service.h b/src/test/check_getdns_service.h index c93cab0e..12300c2f 100644 --- a/src/test/check_getdns_service.h +++ b/src/test/check_getdns_service.h @@ -170,7 +170,8 @@ { assert_nxdomain(ex_response); assert_nodata(ex_response); - assert_soa_in_authority(ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(ex_response); } diff --git a/src/test/check_getdns_service_sync.h b/src/test/check_getdns_service_sync.h index 17273e24..9889f900 100644 --- a/src/test/check_getdns_service_sync.h +++ b/src/test/check_getdns_service_sync.h @@ -135,7 +135,8 @@ assert_nxdomain(&ex_response); assert_nodata(&ex_response); - assert_soa_in_authority(&ex_response); + // Ubuntu 18.04 system resolver does not return an SOA + //assert_soa_in_authority(&ex_response); } END_TEST diff --git a/src/test/tpkg/100-compile.tpkg/100-compile.dsc b/src/test/tpkg/100-compile.tpkg/100-compile.dsc index 8f73a87f..7718b6d6 100644 --- a/src/test/tpkg/100-compile.tpkg/100-compile.dsc +++ b/src/test/tpkg/100-compile.tpkg/100-compile.dsc @@ -9,7 +9,6 @@ CmdDepends: Depends: Help: Pre: 100-compile.pre -Post: 100-compile.post Test: 100-compile.test AuxFiles: Passed: diff --git a/src/test/tpkg/100-compile.tpkg/100-compile.post b/src/test/tpkg/100-compile.tpkg/100-compile.post deleted file mode 100644 index 7744f6e7..00000000 --- a/src/test/tpkg/100-compile.tpkg/100-compile.post +++ /dev/null @@ -1,20 +0,0 @@ -# #-- 100-compile.post --# -# source the master var file when it's there -if [ -f ../.tpkg.var.master ] -then - source ../.tpkg.var.master -else - ( - cd .. - [ -f "${TPKG_SRCDIR}/setup-env.sh" ] \ - && sh "${TPKG_SRCDIR}/setup-env.sh" - ) && source ../.tpkg.var.master -fi -# use .tpkg.var.test for in test variable passing -[ -f .tpkg.var.test ] && source .tpkg.var.test - -for f in `cat restore-srcdir-configure-settings` -do - mv "${SRCROOT}/${f}.build" "${SRCROOT}/${f}" -done - diff --git a/src/test/tpkg/100-compile.tpkg/100-compile.pre b/src/test/tpkg/100-compile.tpkg/100-compile.pre index 6b76edba..9b1e8135 100644 --- a/src/test/tpkg/100-compile.tpkg/100-compile.pre +++ b/src/test/tpkg/100-compile.tpkg/100-compile.pre @@ -13,16 +13,8 @@ fi # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -echo "" > restore-srcdir-configure-settings -for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'` -do - if [ -f "${SRCROOT}/$f" ] - then - mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build" && \ - echo "$f" >> restore-srcdir-configure-settings - fi -done rm -fr "${BUILDDIR}/build" mkdir "${BUILDDIR}/build" cd "${BUILDDIR}/build" -"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" +rm -f CMakeCache.txt +cmake -E env CXXFLAGS="-g" cmake -DCMAKE_INSTALL_PREFIX=../install $* ${SRCROOT} diff --git a/src/test/tpkg/105-install.tpkg/105-install.test b/src/test/tpkg/105-install.tpkg/105-install.test index bdf883af..ac24f46b 100644 --- a/src/test/tpkg/105-install.tpkg/105-install.test +++ b/src/test/tpkg/105-install.tpkg/105-install.test @@ -6,5 +6,5 @@ cd "${BUILDDIR}/build" make -j 4 install \ - && echo "export GETDNS_QUERY=\"${BUILDDIR}/build/src/tools/getdns_query\"" \ + && echo "export GETDNS_QUERY=\"${BUILDDIR}/build/getdns_query\"" \ >> ../.tpkg.var.master diff --git a/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.parse_valgrind_suppressions.sh b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.parse_valgrind_suppressions.sh new file mode 100755 index 00000000..94c2be8a --- /dev/null +++ b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.parse_valgrind_suppressions.sh @@ -0,0 +1,57 @@ +#! /usr/local/bin/gawk -f +# A script to extract the actual suppression info from the output of (for example) valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all ./minimal +# The desired bits are between ^{ and ^} (including the braces themselves). +# The combined output should either be appended to /usr/lib/valgrind/default.supp, or placed in a .supp of its own +# If the latter, either tell valgrind about it each time with --suppressions=, or add that line to ~/.valgrindrc + +# NB This script uses the |& operator, which I believe is gawk-specific. In case of failure, check that you're using gawk rather than some other awk + +# The script looks for suppressions. When it finds one it stores it temporarily in an array, +# and also feeds it line by line to the external app 'md5sum' which generates a unique checksum for it. +# The checksum is used as an index in a different array. If an item with that index already exists the suppression must be a duplicate and is discarded. + +BEGIN { suppression=0; md5sum = "md5" } + # If the line begins with '{', it's the start of a supression; so set the var and initialise things + /^{/ { + suppression=1; i=0; next + } + # If the line begins with '}' its the end of a suppression + /^}/ { + if (suppression) + { suppression=0; + close(md5sum, "to") # We've finished sending data to md5sum, so close that part of the pipe + ProcessInput() # Do the slightly-complicated stuff in functions + delete supparray # We don't want subsequent suppressions to append to it! + } + } + # Otherwise, it's a normal line. If we're inside a supression, store it, and pipe it to md5sum. Otherwise it's cruft, so ignore it + { if (suppression) + { + supparray[++i] = $0 + print |& md5sum + } + } + + + function ProcessInput() + { + # Pipe the result from md5sum, then close it + md5sum |& getline result + close(md5sum) + # gawk can't cope with enormous ints like $result would be, so stringify it first by prefixing a definite string + resultstring = "prefix"result + + if (! (resultstring in chksum_array) ) + { chksum_array[resultstring] = 0; # This checksum hasn't been seen before, so add it to the array + OutputSuppression() # and output the contents of the suppression + } + } + + function OutputSuppression() + { + # A suppression is surrounded by '{' and '}'. Its data was stored line by line in the array + print "{" + for (n=1; n <= i; ++n) + { print supparray[n] } + print "}" + } diff --git a/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.queries b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.queries new file mode 100644 index 00000000..760ff905 --- /dev/null +++ b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.queries @@ -0,0 +1,14 @@ +NS . +localhost +localhost. +A localhost. +-A getdnsapi.net +qwerlkjhasdfpuiqwyerm.1234kjhrqwersv.com +localhost. +-G TXT bogus.nlnetlabs.nl +-H 8.8.8.8 +-H 2a04:b900:0:100::37 +-a -A -x www.microsoft.com +-s +-S +-X diff --git a/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.supp b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.supp new file mode 100644 index 00000000..6ac49f58 --- /dev/null +++ b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.supp @@ -0,0 +1,80 @@ +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:__gmp_default_allocate + fun:_nettle_gmp_alloc_limbs + fun:nettle_ecc_point_init + obj:/usr/lib/x86_64-linux-gnu/libunbound.so.2.5.6 +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:pthread_attr_init + obj:/usr/local/lib/libunbound.so.8.1.5 +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:/lib/libc.so.7 + obj:* + obj:/lib/libc.so.7 + obj:* + obj:/lib/libc.so.7 + obj:/lib/libc.so.7 + obj:/lib/libc.so.7 + obj:/root/getdns/tests/build/getdns_query + obj:/lib/libc.so.7 +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + fun:_getdns_submit_netreq + fun:getdns_general_ns +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + fun:_getdns_submit_netreq +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 +} diff --git a/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.test b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.test index 4ea22337..d8cd7837 100644 --- a/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.test +++ b/src/test/tpkg/125-valgrind-checks.tpkg/125-valgrind-checks.test @@ -4,24 +4,17 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -cat >queries < new_supps +# cat ${PKG_NAME}.supp new_supps > tmp_supps +# mv tmp_supps ${PKG_NAME}.supp +# + ( - if ! "${BUILDDIR}/build/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "${GETDNS_QUERY}" -F queries -f "${TPKG_NAME}.ds" +dnssec_return_validation_chain + if ! valgrind -v --log-file=valgrind.log --suppressions="${TPKG_NAME}.supp" --leak-check=full --error-exitcode=1 --track-origins=yes "${GETDNS_QUERY}" -F "${TPKG_NAME}.queries" -f "${TPKG_NAME}.ds" +dnssec_return_validation_chain then exit 1 fi diff --git a/src/test/tpkg/130-run-unit-tests.tpkg/130-run-unit-tests.test b/src/test/tpkg/130-run-unit-tests.tpkg/130-run-unit-tests.test index 541936dd..fe43df5d 100644 --- a/src/test/tpkg/130-run-unit-tests.tpkg/130-run-unit-tests.test +++ b/src/test/tpkg/130-run-unit-tests.tpkg/130-run-unit-tests.test @@ -5,4 +5,4 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test cd "${BUILDDIR}/build" -make test +CTEST_OUTPUT_ON_FAILURE=1 make test diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc index 0888f7ff..5c3177da 100644 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc +++ b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc @@ -9,7 +9,6 @@ CmdDepends: Depends: Help: Pre: 200-stub-only-compile-install.pre -Post: 200-stub-only-compile-install.post Test: 200-stub-only-compile-install.test AuxFiles: Passed: diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.post b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.post deleted file mode 100644 index 0a681250..00000000 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.post +++ /dev/null @@ -1,20 +0,0 @@ -# #-- 200-stub-only-compile.post --# -# source the master var file when it's there -if [ -f ../.tpkg.var.master ] -then - source ../.tpkg.var.master -else - ( - cd .. - [ -f "${TPKG_SRCDIR}/setup-env.sh" ] \ - && sh "${TPKG_SRCDIR}/setup-env.sh" - ) && source ../.tpkg.var.master -fi -# use .tpkg.var.test for in test variable passing -[ -f .tpkg.var.test ] && source .tpkg.var.test - -for f in `cat restore-srcdir-configure-settings` -do - mv "${SRCROOT}/${f}.build-stub-only" "${SRCROOT}/${f}" -done - diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre index 587b4fed..2f541a53 100644 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre +++ b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre @@ -13,16 +13,8 @@ fi # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -echo "" > restore-srcdir-configure-settings -for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'` -do - if [ -f "${SRCROOT}/$f" ] - then - mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build-stub-only" && \ - echo "$f" >> restore-srcdir-configure-settings - fi -done rm -fr "${BUILDDIR}/build-stub-only" mkdir "${BUILDDIR}/build-stub-only" cd "${BUILDDIR}/build-stub-only" -"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install-stub-only" --enable-stub-only --enable-debug-server --enable-debug-anchor +rm -f CMakeCache.txt +cmake -E env CXXFLAGS="-g" cmake -DENABLE_STUB_ONLY=ON -DENABLE_DEBUG_SERVER=ON -DENABLE_DEBUG_ANCHOR=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only $* ${SRCROOT} diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test index 53b8d656..c6842723 100644 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test +++ b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test @@ -6,5 +6,5 @@ cd "${BUILDDIR}/build-stub-only" make XTRA_CFLAGS='-g -Werror' -j 4 install \ - && echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/src/tools/getdns_query\"" \ + && echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/getdns_query\"" \ >> ../.tpkg.var.master diff --git a/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.parse_valgrind_suppressions.sh b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.parse_valgrind_suppressions.sh new file mode 100755 index 00000000..94c2be8a --- /dev/null +++ b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.parse_valgrind_suppressions.sh @@ -0,0 +1,57 @@ +#! /usr/local/bin/gawk -f +# A script to extract the actual suppression info from the output of (for example) valgrind --leak-check=full --show-reachable=yes --error-limit=no --gen-suppressions=all ./minimal +# The desired bits are between ^{ and ^} (including the braces themselves). +# The combined output should either be appended to /usr/lib/valgrind/default.supp, or placed in a .supp of its own +# If the latter, either tell valgrind about it each time with --suppressions=, or add that line to ~/.valgrindrc + +# NB This script uses the |& operator, which I believe is gawk-specific. In case of failure, check that you're using gawk rather than some other awk + +# The script looks for suppressions. When it finds one it stores it temporarily in an array, +# and also feeds it line by line to the external app 'md5sum' which generates a unique checksum for it. +# The checksum is used as an index in a different array. If an item with that index already exists the suppression must be a duplicate and is discarded. + +BEGIN { suppression=0; md5sum = "md5" } + # If the line begins with '{', it's the start of a supression; so set the var and initialise things + /^{/ { + suppression=1; i=0; next + } + # If the line begins with '}' its the end of a suppression + /^}/ { + if (suppression) + { suppression=0; + close(md5sum, "to") # We've finished sending data to md5sum, so close that part of the pipe + ProcessInput() # Do the slightly-complicated stuff in functions + delete supparray # We don't want subsequent suppressions to append to it! + } + } + # Otherwise, it's a normal line. If we're inside a supression, store it, and pipe it to md5sum. Otherwise it's cruft, so ignore it + { if (suppression) + { + supparray[++i] = $0 + print |& md5sum + } + } + + + function ProcessInput() + { + # Pipe the result from md5sum, then close it + md5sum |& getline result + close(md5sum) + # gawk can't cope with enormous ints like $result would be, so stringify it first by prefixing a definite string + resultstring = "prefix"result + + if (! (resultstring in chksum_array) ) + { chksum_array[resultstring] = 0; # This checksum hasn't been seen before, so add it to the array + OutputSuppression() # and output the contents of the suppression + } + } + + function OutputSuppression() + { + # A suppression is surrounded by '{' and '}'. Its data was stored line by line in the array + print "{" + for (n=1; n <= i; ++n) + { print supparray[n] } + print "}" + } diff --git a/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.queries b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.queries new file mode 100644 index 00000000..da6d6535 --- /dev/null +++ b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.queries @@ -0,0 +1,7 @@ +NS . +-A getdnsapi.net +qwerlkjhasdfpuiqwyerm.1234kjhrqwersv.com +-G TXT bogus.nlnetlabs.nl +-H 8.8.8.8 +-H 2a04:b900:0:100::37 +-A _acme-challenge.getdnsapi.net diff --git a/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.supp b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.supp new file mode 100644 index 00000000..f9654d70 --- /dev/null +++ b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.supp @@ -0,0 +1,102 @@ + +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:/lib/libc.so.7 + obj:* + obj:/lib/libc.so.7 + obj:* + obj:/lib/libc.so.7 + obj:/lib/libc.so.7 + obj:/lib/libc.so.7 + obj:/root/getdns/tests/build-stub-only/getdns_query + obj:/lib/libc.so.7 +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + obj:/lib/libc.so.7 +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + fun:strcpytrunc + fun:ta_iter_next + fun:ta_iter_init + fun:_getdns_parse_xml_trust_anchors_buf + fun:_getdns_context_equip_with_anchor + fun:getdns_general_ns + fun:_getdns_general_loop + fun:getdns_general_sync + fun:do_the_call + fun:read_line_cb +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + fun:strcpytrunc + fun:ta_iter_next + fun:_getdns_parse_xml_trust_anchors_buf + fun:_getdns_context_equip_with_anchor + fun:getdns_general_ns + fun:_getdns_general_loop + fun:getdns_general_sync + fun:do_the_call + fun:read_line_cb + fun:poll_read_cb +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + fun:_getdns_submit_netreq + fun:getdns_general_ns +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + fun:_getdns_submit_netreq +} +{ + + Memcheck:Cond + obj:/lib/libc.so.7 + obj:* + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 + obj:/usr/local/lib/libunbound.so.8.1.5 +} diff --git a/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.test b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.test index 1c957404..0165ac9c 100644 --- a/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.test +++ b/src/test/tpkg/225-stub-only-valgrind-checks.tpkg/225-stub-only-valgrind-checks.test @@ -4,17 +4,17 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -cat >queries < new_supps +# cat ${TPKG_NAME}.supp new_supps > tmp_supps +# mv tmp_supps ${TPKG_NAME}.supp +# + ( - if ! "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "${GETDNS_STUB_QUERY}" -F queries -f "${TPKG_NAME}.ds" +dnssec_return_validation_chain + if ! valgrind -v --log-file=valgrind.log --suppressions="${TPKG_NAME}.supp" --leak-check=full --error-exitcode=1 --track-origins=yes "${GETDNS_STUB_QUERY}" -F "${TPKG_NAME}.queries" +dnssec_return_validation_chain then exit 1 fi diff --git a/src/test/tpkg/230-stub-only-run-unit-tests.tpkg/230-stub-only-run-unit-tests.test b/src/test/tpkg/230-stub-only-run-unit-tests.tpkg/230-stub-only-run-unit-tests.test index 5122d39a..439e1147 100644 --- a/src/test/tpkg/230-stub-only-run-unit-tests.tpkg/230-stub-only-run-unit-tests.test +++ b/src/test/tpkg/230-stub-only-run-unit-tests.tpkg/230-stub-only-run-unit-tests.test @@ -5,4 +5,4 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test cd "${BUILDDIR}/build-stub-only" -make -j 4 test +CTEST_OUTPUT_ON_FAILURE=1 make -j 4 test diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.Makefile b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.cmake b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.cmake new file mode 100644 index 00000000..a649082e --- /dev/null +++ b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre index 55d1c0d0..3cbed5cb 100644 --- a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre +++ b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre @@ -5,10 +5,11 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt +fi \ No newline at end of file diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test index dca4965d..4e9eb615 100644 --- a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test +++ b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test @@ -4,4 +4,4 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" +cmake . && make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.Makefile b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.c b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.c deleted file mode 100644 index 4dd335fc..00000000 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.c +++ /dev/null @@ -1,111 +0,0 @@ -#include -#include -#include -#include - -int main(int ac, char *av[]) -{ - FILE *f; - char *buf = NULL; - size_t len; - ssize_t bytes_read; - - f = fopen(av[1], "r"); - if (!f) { - fprintf(stderr, "Could not open %s", av[1]); - exit(EXIT_FAILURE); - } - - bytes_read = getdelim(&buf, &len, '\0', f); - fclose(f); - - if (bytes_read == -1) { - fprintf(stderr, "Could not read %s", av[1]); - exit(EXIT_FAILURE); - } - - buf = realloc(buf, bytes_read + 1); - if (!buf) { - fprintf(stderr, "Could not grow buffer"); - exit(EXIT_FAILURE); - } - buf[bytes_read] = '\0'; - - getdns_dict *dict = NULL; - getdns_list *list = NULL; - getdns_bindata *bindata = NULL; - getdns_return_t r; - - if (!(dict = getdns_dict_create())) { - fprintf(stderr, "Could not create dict"); - goto fail; - } - - r = getdns_yaml2dict(buf, &dict); - if (r) { - fprintf(stderr, "Error setting dict data: %s", getdns_get_errorstr_by_id(r)); - goto fail; - } - - /* - * Now add a list, bindata and int to the dict by hand to check - * the other yaml2* functions work. - */ - if (!(list = getdns_list_create())) { - fprintf(stderr, "Could not create list"); - goto fail; - } - - r = getdns_str2list("[\"One\", \"two\", \"three\"]", &list); - if (r) { - fprintf(stderr, "Error setting list data: %s", getdns_get_errorstr_by_id(r)); - goto fail; - } - - r = getdns_dict_set_list(dict, "List entry", list); - if (r) { - fprintf(stderr, "Error adding list to dict: %s", getdns_get_errorstr_by_id(r)); - goto fail; - } - - r = getdns_str2bindata("2001:7fd::1", &bindata); - if (r) { - fprintf(stderr, "Error setting bindata: %s", getdns_get_errorstr_by_id(r)); - goto fail; - } - - r = getdns_dict_set_bindata(dict, "Bindata entry", bindata); - if (r) { - fprintf(stderr, "Error adding list to dict: %s", getdns_get_errorstr_by_id(r)); - goto fail; - } - - uint32_t intval; - r = getdns_str2int("32767", &intval); - if (r) { - fprintf(stderr, "Error setting int: %s", getdns_get_errorstr_by_id(r)); - goto fail; - } - if (intval != 32767) { - fprintf(stderr, "Error reading int: wrong value"); - goto fail; - } - - char *dict_str = getdns_pretty_print_dict(dict); - if (!dict_str) { - fprintf(stderr, "Could not convert dict to string"); - goto fail; - } - - printf("%s\n", dict_str); - free(dict_str); - getdns_dict_destroy(dict); - exit(EXIT_SUCCESS); - -fail: - if (dict) - getdns_dict_destroy(dict); - if (list) - getdns_list_destroy(list); - exit(EXIT_FAILURE); -} diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.dsc b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.dsc deleted file mode 100644 index 906681b2..00000000 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.dsc +++ /dev/null @@ -1,16 +0,0 @@ -BaseName: 255-yaml-config -Version: 1.0 -Description: Test YAML configuration -CreationDate: Wed 13 Sep 2017 12:42:32 BST -Maintainer: Jim Hague -Category: -Component: -CmdDepends: -Depends: 200-stub-only-compile-install.tpkg -Help: -Pre: 255-yaml-config.pre -Post: -Test: 255-yaml-config.test -AuxFiles: -Passed: -Failure: diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.good b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.good deleted file mode 100644 index 2703569c..00000000 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.good +++ /dev/null @@ -1,87 +0,0 @@ -{ - "Bindata entry": , - "List entry": - [ - , - , - - ], - "dnssec_return_status": 1000, - "upstream_recursive_servers": - [ - { - "address_data": , - "tls_auth_name": , - "tls_pubkey_pinset": - [ - { - "digest": , - "value": - } - ] - }, - { - "address_data": , - "tls_auth_name": , - "tls_pubkey_pinset": - [ - { - "digest": , - "value": - } - ] - }, - { - "address_data": , - "tls_auth_name": , - "tls_pubkey_pinset": - [ - { - "digest": , - "value": - } - ] - }, - { - "address_data": , - "tls_auth_name": - }, - { - "address_data": , - "tls_auth_name": , - "tls_pubkey_pinset": - [ - { - "digest": , - "value": - } - ] - }, - { - "address_data": , - "tls_auth_name": , - "tls_pubkey_pinset": - [ - { - "digest": , - "value": - } - ] - }, - { - "address_data": , - "tls_auth_name": , - "tls_pubkey_pinset": - [ - { - "digest": , - "value": - } - ] - }, - { - "address_data": , - "tls_auth_name": - } - ] -} diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.input b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.input deleted file mode 100644 index 68e4460f..00000000 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.input +++ /dev/null @@ -1,47 +0,0 @@ -upstream_recursive_servers: -# IPv4 addresses -# The Surfnet/Sinodun servers - - address_data: 145.100.185.15 - tls_auth_name: "dnsovertls.sinodun.com" - tls_pubkey_pinset: - - digest: "sha256" - value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4= - - address_data: 145.100.185.16 - tls_auth_name: "dnsovertls1.sinodun.com" - tls_pubkey_pinset: - - digest: "sha256" - value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA= -# The getdnsapi.net server - - address_data: 185.49.141.37 - tls_auth_name: "getdnsapi.net" - tls_pubkey_pinset: - - digest: "sha256" - value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q= -# The uncensored DNS servers (no SPKI available) - - address_data: 184.105.193.78 - tls_auth_name: "unicast.censurfridns.dk" -# IPv6 addresses -# The Surfnet/Sinodun servers - - address_data: 2001:610:1:40ba:145:100:185:15 - tls_auth_name: "dnsovertls.sinodun.com" - tls_pubkey_pinset: - - digest: "sha256" - value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4= - - address_data: 2001:610:1:40ba:145:100:185:16 - tls_auth_name: "dnsovertls1.sinodun.com" - tls_pubkey_pinset: - - digest: "sha256" - value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA= -# The getdnsapi.net server - - address_data: 2a04:b900:0:100::38 - tls_auth_name: "getdnsapi.net" - tls_pubkey_pinset: - - digest: "sha256" - value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q= -# The uncensored DNS server (no SPKI available) - - address_data: 2620:ff:c000:0:1::64:25 - tls_auth_name: "unicast.censurfridns.dk" - -# Require DNSSEC validation. For releases earlier than 1.2 a trust anchor must -# be configured configured manually. This can be done with unbound-anchor. -dnssec_return_status: GETDNS_EXTENSION_TRUE diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.pre b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.pre deleted file mode 100644 index 802443c2..00000000 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.pre +++ /dev/null @@ -1,14 +0,0 @@ -# #-- 255-yaml-config.test --# -# source the master var file when it's there -[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master -# use .tpkg.var.test for in test variable passing -[ -f .tpkg.var.test ] && source .tpkg.var.test - -( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` - sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.Makefile b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.cmake b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.cmake new file mode 100644 index 00000000..a649082e --- /dev/null +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre index e9880779..db9c9807 100644 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre @@ -5,10 +5,11 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt +fi \ No newline at end of file diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test index 91f6787a..0f3e4ede 100644 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test @@ -4,7 +4,7 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -if ! make +if ! (cmake . && make) then exit 1 elif ! ( "./${TPKG_NAME}" "${TPKG_NAME}.net-dns.org" | tee out ) diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.Makefile b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.cmake b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.cmake new file mode 100644 index 00000000..a649082e --- /dev/null +++ b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre index 98ee2c32..8427873d 100644 --- a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre +++ b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre @@ -5,10 +5,11 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt +fi \ No newline at end of file diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test index 4be307ed..30636390 100644 --- a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test +++ b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test @@ -4,7 +4,7 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -if ! make +if ! (cmake . && make) then exit 1 elif ! ( "./${TPKG_NAME}" "${TPKG_NAME}.net-dns.org" | tee out ) diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.Makefile b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.cmake b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.cmake new file mode 100644 index 00000000..a649082e --- /dev/null +++ b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.good b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.good index bd3d1b62..61a10b84 100644 --- a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.good +++ b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.good @@ -1,4 +1,5 @@ { + "answer_ipv4_address": , "answer_type": GETDNS_NAMETYPE_DNS, "canonical_name": , "replies_tree": @@ -6,6 +7,7 @@ { "additional": [], "answer": [], + "answer_ipv4_address": , "answer_type": GETDNS_NAMETYPE_DNS, "authority": [], "header": diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre index f6db2030..8cce3b54 100644 --- a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre +++ b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre @@ -5,10 +5,11 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt +fi \ No newline at end of file diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test index b9f372ac..7f0dcc32 100644 --- a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test +++ b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test @@ -4,4 +4,4 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" +cmake . && make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.Makefile b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.Makefile deleted file mode 100644 index 64f2f68d..00000000 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.Makefile +++ /dev/null @@ -1,17 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-Wall -Wextra -I$(builddir)/src -g -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - -clean: - rm -f $(testname).lo $(testname).o $(testname) diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.c b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.c index 3e817834..c43e70c1 100644 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.c +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.c @@ -92,8 +92,8 @@ int main(int argc, char **argv) uint32_t port1 = 18000; uint32_t port2 = 18000; getdns_return_t r; - char listenliststr[1024]; - char listendictstr[1024]; + char listenliststr[1024] = ""; + char listendictstr[1024] = ""; if (argc != 2) { fprintf(stderr, "usage: %s \n", argv[0]); diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.clean.sh b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.clean.sh index 223c6928..76a94810 100755 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.clean.sh +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.clean.sh @@ -1,4 +1,4 @@ #!/bin/sh make clean || true -rm -fr .libs Makefile *_out valgrind.log +rm -fr CMakeCache.txt *_out valgrind.log diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.cmake b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.cmake new file mode 100644 index 00000000..a649082e --- /dev/null +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.dsc b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.dsc index a5665693..a5097a11 100644 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.dsc +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.dsc @@ -5,7 +5,7 @@ CreationDate: wo 19 apr 2017 10:01:58 CEST Maintainer: Hoda Rohani Category: Component: -CmdDepends: +CmdDepends: valgrind Depends: 200-stub-only-compile-install.tpkg Help: Pre: 275-server-capabilities.pre diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre index 3339477b..0c40f19f 100644 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre @@ -5,10 +5,11 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt +fi \ No newline at end of file diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test index 3569346b..ffc63f50 100644 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test @@ -5,19 +5,19 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A localhost. -J \ - | awk -F: '/\"address_data\".*\"127/{print $2}' \ + | awk -F: '/\"address_data\".*\"127/{print $2;exit}' \ | sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'` echo "localhost: $LOCALHOST" -make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | ( +cmake . && make && valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | ( read PORT read PORT2 ${GETDNS_STUB_QUERY} -s -t 1000 @${LOCALHOST}:$PORT TXT cancel. +return_call_reporting 2>&1 > time_out - ${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT test +return_call_reporting 2>&1 > tcp_out + ${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT test. +return_call_reporting 2>&1 > tcp_out - ${GETDNS_STUB_QUERY} -s -U @${LOCALHOST}:$PORT2 TXT test +return_call_reporting 2>&1 > udp_out + ${GETDNS_STUB_QUERY} -s -U @${LOCALHOST}:$PORT2 TXT test. +return_call_reporting 2>&1 > udp_out ${GETDNS_STUB_QUERY} -s -q @${LOCALHOST}:$PORT TXT quit. ) diff --git a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.Makefile b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.Makefile deleted file mode 100644 index 70d86616..00000000 --- a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-Wall -Wextra -I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.c b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.c index 8337caf4..a445905d 100644 --- a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.c +++ b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.c @@ -114,7 +114,7 @@ int main(int argc, char **argv) getdns_dict *address = NULL; uint32_t port = 18000; getdns_return_t r; - char listenliststr[1024]; + char listenliststr[1024] = ""; if (argc != 2) { fprintf(stderr, "usage: %s \n", argv[0]); diff --git a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.cmake b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.cmake new file mode 100644 index 00000000..a649082e --- /dev/null +++ b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.dsc b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.dsc index 881977b7..8c08cb06 100644 --- a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.dsc +++ b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.dsc @@ -5,7 +5,7 @@ CreationDate: Tue Mar 14 10:43:45 CET 2017 Maintainer: Willem Toorop Category: Resource depletion Component: -CmdDepends: +CmdDepends: valgrind Depends: 200-stub-only-compile-install.tpkg Help: Pre: 280-limit_outstanding_queries.pre diff --git a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.pre b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.pre index b4ee91ac..9063d28c 100644 --- a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.pre +++ b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.pre @@ -5,10 +5,11 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt +fi \ No newline at end of file diff --git a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.test b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.test index f8d5d556..548bb0fa 100644 --- a/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.test +++ b/src/test/tpkg/280-limit_outstanding_queries.tpkg/280-limit_outstanding_queries.test @@ -6,7 +6,7 @@ LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A localhost. -J \ - | awk -F: '/\"address_data\".*\"127/{print $2}' \ + | awk -F: '/\"address_data\".*\"127/{print $2;exit}' \ | sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'` echo "localhost: $LOCALHOST" @@ -19,7 +19,7 @@ echo "# queries: $NQUERIES" # which is smaller than 5 seconds default query timeout value, # so the test should succeed. -make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | ( +cmake . && make && valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | ( read PORT ${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT \ -a -F "./${TPKG_NAME}.queries" \ diff --git a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.Makefile b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.Makefile deleted file mode 100644 index 70d86616..00000000 --- a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-Wall -Wextra -I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.c b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.c index 88ecaf20..f9f4e052 100644 --- a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.c +++ b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.c @@ -119,7 +119,7 @@ int main(int argc, char **argv) getdns_dict *address = NULL; uint32_t port = 18000; getdns_return_t r; - char listenliststr[1024]; + char listenliststr[1024] = ""; if (argc != 2) { fprintf(stderr, "usage: %s \n", argv[0]); diff --git a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.cmake b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.cmake new file mode 100644 index 00000000..a649082e --- /dev/null +++ b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.dsc b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.dsc index b7322cc7..71983d67 100644 --- a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.dsc +++ b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.dsc @@ -5,7 +5,7 @@ CreationDate: ma 20 mrt 2017 15:17:45 CET Maintainer: Willem Toorop Category: Resource depletion Component: -CmdDepends: +CmdDepends: valgrind Depends: 200-stub-only-compile-install.tpkg Help: Pre: 285-out_of_filedescriptors.pre diff --git a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.pre b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.pre index 6e7ff3ff..f4f0167d 100644 --- a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.pre +++ b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.pre @@ -5,10 +5,11 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt +fi diff --git a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.test b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.test index f6a832e4..a69e6dfa 100644 --- a/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.test +++ b/src/test/tpkg/285-out_of_filedescriptors.tpkg/285-out_of_filedescriptors.test @@ -6,7 +6,7 @@ LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A localhost. -J \ - | awk -F: '/\"address_data\".*\"127/{print $2}' \ + | awk -F: '/\"address_data\".*\"127/{print $2;exit}' \ | sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'` echo "localhost: $LOCALHOST" @@ -27,7 +27,7 @@ echo "# queries: $NQUERIES" # which is smaller than 5 seconds default query timeout value, # so the test should succeed. -make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST}| ( +cmake . && make && valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST}| ( read PORT ulimit -n $QLIMIT ${GETDNS_STUB_QUERY} -s @${LOCALHOST}:$PORT TXT \ diff --git a/src/test/tpkg/290-transports.tpkg/290-transports.test b/src/test/tpkg/290-transports.tpkg/290-transports.test index c66ac5c5..28cef8e8 100644 --- a/src/test/tpkg/290-transports.tpkg/290-transports.test +++ b/src/test/tpkg/290-transports.tpkg/290-transports.test @@ -4,17 +4,17 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -if grep -q '^#define HAVE_SSL_HN_AUTH 1' "${BUILDDIR}/build-stub-only/src/config.h" -then +#if grep -q '^#define HAVE_SSL_HN_AUTH 1' "${BUILDDIR}/build-stub-only/config.h" +#then HAVE_SSL_HN_AUTH=1 -else - HAVE_SSL_HN_AUTH=0 -fi +#else +# HAVE_SSL_HN_AUTH=0 +#fi SERVER_IP="64.6.64.6" SERVER_IPv6="2620:74:1b::1:1" -SERVER_IP_TSIG="185.49.141.37^" -SERVER_IPv6_TSIG="2a04:b900:0:100::37^" +SERVER_IP_TSIG="185.49.141.53^" +SERVER_IPv6_TSIG="2a04:b900:0:100::53^" TSIG_ALG="hmac-md5.sig-alg.reg.int" TSIG_NAME="hmac-md5.tsigs.getdnsapi.net" TSIG_SECRET="16G69OTeXW6xSQ==" @@ -143,8 +143,8 @@ for (( ii = 0; ii < 1; ii++)); do "-s -A getdnsapi.net -l L @${TLS_SERVER_IP_NO_NAME}" "L" "N" "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP}" "L" "S" "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP_NO_NAME} -K pin-sha256=\"${TLS_SERVER_KEY}\"" "L" "S" - "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP} -K pin-sha256=\"${TLS_SERVER_KEY}\"" "L" "S") -# "-s -G DNSKEY getdnsapi.net -l U @${SERVER_IP} -b 512 -D" "U" "-") + "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP} -K pin-sha256=\"${TLS_SERVER_KEY}\"" "L" "S" + "-s -G TXT large.getdnsapi.net -l U @${SERVER_IP} -b 512 -D" "U" "-") else NUM_GOOD_QUERIES=6 GOOD_QUERIES=( @@ -153,10 +153,10 @@ for (( ii = 0; ii < 1; ii++)); do "-s -A getdnsapi.net -l U @${SERVER_IP_TSIG}${TSIG_ALG}:${TSIG_NAME}:${TSIG_SECRET}" "U" "-" "-s -A getdnsapi.net -l U @${SERVER_IP_TSIG}${TSIG_NAME}:${TSIG_SECRET}" "U" "-" "-s -A getdnsapi.net -l L @${TLS_SERVER_IP_NO_NAME}" "L" "N" - "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP_NO_NAME} -K pin-sha256=\"${TLS_SERVER_KEY}\"" "L" "S") -# "-s -G DNSKEY getdnsapi.net -l U @${SERVER_IP} -b 512 -D" "U" "-") + "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP_NO_NAME} -K pin-sha256=\"${TLS_SERVER_KEY}\"" "L" "S" + "-s -G TXT large.getdnsapi.net -l U @${SERVER_IP} -b 512 -D" "U" "-" + "-s -A getdnsapi.net -l L -m @${TLS_SERVER_SS_IP_NO_NAME} -K pin-sha256=\"${TLS_SERVER_SS_KEY}\"" "L" "S") fi -#"-s -A getdnsapi.net -l L -m @${TLS_SERVER_SS_IP_NO_NAME} -K pin-sha256=\"${TLS_SERVER_SS_KEY}\"" "L" "S" NUM_GOOD_FB_QUERIES=6 GOOD_FALLBACK_QUERIES=( @@ -165,7 +165,7 @@ for (( ii = 0; ii < 1; ii++)); do "-s -A getdnsapi.net -l LT @${TLS_SERVER_IP_NO_NAME}" "L" "N" "-s -A getdnsapi.net -l LT -m @${TLS_SERVER_IP_NO_NAME}" "L" "N" "-s -A getdnsapi.net -l L @${SERVER_IP} @${TLS_SERVER_IP_NO_NAME}" "L" "-" - "-s -G DNSKEY getdnsapi.net -l UT @${SERVER_IP} -b 512 -D" "T" "-") + "-s -G TXT large.getdnsapi.net -l UT @${SERVER_IP} -b 512 -D" "T" "-") NOT_AVAILABLE_QUERIES=( "-s -A getdnsapi.net -l L @${SERVER_IP}" @@ -176,8 +176,8 @@ for (( ii = 0; ii < 1; ii++)); do "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP_NO_NAME} -K pin-sha256=\"${TLS_SERVER_WRONG_KEY}\"" "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP} -K pin-sha256=\"${TLS_SERVER_WRONG_KEY}\"" "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP_WRONG_NAME} -K pin-sha256=\"${TLS_SERVER_KEY}\"" - "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP_WRONG_NAME} -K pin-sha256=\"${TLS_SERVER_WRONG_KEY}\"") -#"-s -A getdnsapi.net -l L -m @${TLS_SERVER_SS_IP} -K pin-sha256=\"${TLS_SERVER_SS_KEY}\"" + "-s -A getdnsapi.net -l L -m @${TLS_SERVER_IP_WRONG_NAME} -K pin-sha256=\"${TLS_SERVER_WRONG_KEY}\"" + "-s -A getdnsapi.net -l L -m @${TLS_SERVER_SS_IP} -K pin-sha256=\"${TLS_SERVER_SS_KEY}\"") echo "Starting transport test" diff --git a/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test b/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test index 90a6e580..c6b1699a 100644 --- a/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test +++ b/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test @@ -7,10 +7,10 @@ rm -fr "${BUILDDIR}/build-event-loops" mkdir "${BUILDDIR}/build-event-loops" cd "${BUILDDIR}/build-event-loops" -"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libev --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libev \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libev --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libev \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libuv +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON -DUSE_LIBEV=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON -DUSE_LIBEV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEV=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBUV=ON $* ${SRCROOT}) diff --git a/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test b/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test index ef88d699..dbc99d17 100644 --- a/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test +++ b/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test @@ -4,6 +4,12 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test +if test "`hostname`" != "bonobo" +then + echo Sorry, running dependency test on bonobo only + exit 0 +fi + export TPKG_HERE=`pwd` # Temporarily copy Makefile.in files find . -type f -name "Makefile.in" -print0 | xargs -0 rm -f && ( @@ -15,11 +21,6 @@ find . -type f -name "Makefile.in" -print0 | xargs -0 rm -f && ( ) ( cd "${BUILDDIR}/build-event-loops" - if test "`hostname`" != "bonobo" - then - echo Sorry, running dependency test on bonobo only - exit 0 - fi if ! ./config.status --config | grep -q 'enable-all-drafts.*--with-libevent.*--with-libev.*--with-libuv' then echo Skipping because not covering enough code diff --git a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc index c06a540e..0541569b 100644 --- a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc +++ b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc @@ -8,8 +8,8 @@ Component: CmdDepends: Depends: 310-dependencies.tpkg Help: -Pre: 320-event-loops-compile.pre -Post: 320-event-loops-compile.post +Pre: +Post: Test: 320-event-loops-compile.test AuxFiles: Passed: diff --git a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.post b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.post deleted file mode 100644 index a3e29076..00000000 --- a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.post +++ /dev/null @@ -1,20 +0,0 @@ -# #-- 320-event-loops-compile.post --# -# source the master var file when it's there -if [ -f ../.tpkg.var.master ] -then - source ../.tpkg.var.master -else - ( - cd .. - [ -f "${TPKG_SRCDIR}/setup-env.sh" ] \ - && sh "${TPKG_SRCDIR}/setup-env.sh" - ) && source ../.tpkg.var.master -fi -# use .tpkg.var.test for in test variable passing -[ -f .tpkg.var.test ] && source .tpkg.var.test - -for f in `cat restore-srcdir-configure-settings` -do - mv "${SRCROOT}/${f}.build-event-loops" "${SRCROOT}/${f}" -done - diff --git a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.pre b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.pre deleted file mode 100644 index a48754d4..00000000 --- a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.pre +++ /dev/null @@ -1,24 +0,0 @@ -# #-- 320-event-loops-compile.pre--# -# source the master var file when it's there -if [ -f ../.tpkg.var.master ] -then - source ../.tpkg.var.master -else - ( - cd .. - [ -f "${TPKG_SRCDIR}/setup-env.sh" ] \ - && sh "${TPKG_SRCDIR}/setup-env.sh" - ) && source ../.tpkg.var.master -fi -# use .tpkg.var.test for in test variable passing -[ -f .tpkg.var.test ] && source .tpkg.var.test - -echo "" > restore-srcdir-configure-settings -for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'` -do - if [ -f "${SRCROOT}/$f" ] - then - mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build-event-loops" && \ - echo "$f" >> restore-srcdir-configure-settings - fi -done diff --git a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.test b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.test index 45176f77..9d81af4f 100644 --- a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.test +++ b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.test @@ -5,4 +5,6 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test cd "${BUILDDIR}/build-event-loops" -make XTRA_CFLAGS="-g -Werror" -j 4 install +make XTRA_CFLAGS="-g -Werror" -j 4 install \ + && echo "export STUBBY=\"${BUILDDIR}/build-event-loops/stubby/stubby\"" \ + >> ../.tpkg.var.master diff --git a/src/test/tpkg/330-event-loops-unit-tests.tpkg/330-event-loops-unit-tests.test b/src/test/tpkg/330-event-loops-unit-tests.tpkg/330-event-loops-unit-tests.test index 10ab6ded..7f3279fe 100644 --- a/src/test/tpkg/330-event-loops-unit-tests.tpkg/330-event-loops-unit-tests.test +++ b/src/test/tpkg/330-event-loops-unit-tests.tpkg/330-event-loops-unit-tests.test @@ -5,43 +5,5 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test cd "${BUILDDIR}/build-event-loops" -make -j 4 test -if test -e "${BUILDDIR}/build-event-loops/src/test/fails" -then - if test -e "${BUILDDIR}/build-event-loops/src/test/check_getdns.failed" - then - echo "" - echo "********************" - echo "*** check_getdns ***" - echo "********************" - cat "${BUILDDIR}/build-event-loops/src/test/check_getdns.log" - fi - if test -e "${BUILDDIR}/build-event-loops/src/test/check_getdns_event.failed" - then - echo "" - echo "**************************" - echo "*** check_getdns_event ***" - echo "**************************" - cat "${BUILDDIR}/build-event-loops/src/test/check_getdns_event.log" - fi - if test -e "${BUILDDIR}/build-event-loops/src/test/check_getdns_ev.failed" - then - echo "" - echo "***********************" - echo "*** check_getdns_ev ***" - echo "***********************" - cat "${BUILDDIR}/build-event-loops/src/test/check_getdns_ev.log" - fi - if test -e "${BUILDDIR}/build-event-loops/src/test/check_getdns_uv.failed" - then - echo "" - echo "***********************" - echo "*** check_getdns_uv ***" - echo "***********************" - cat "${BUILDDIR}/build-event-loops/src/test/check_getdns_uv.log" - fi - exit 1 -else - exit 0 -fi +CTEST_OUTPUT_ON_FAILURE=1 make -j 4 test diff --git a/src/test/tpkg/340-run-stubby.tpkg/340-run-stubby.dsc b/src/test/tpkg/340-run-stubby.tpkg/340-run-stubby.dsc new file mode 100644 index 00000000..18ce1fed --- /dev/null +++ b/src/test/tpkg/340-run-stubby.tpkg/340-run-stubby.dsc @@ -0,0 +1,16 @@ +BaseName: 340-run-stubby +Version: 1.0 +Description: Run the getdns_query program +CreationDate: nov 15 11:09:59 CET 2015 +Maintainer: Sara Dickinson +Category: +Component: +CmdDepends: +Depends: 320-event-loops-compile.tpkg +Help: +Pre: +Post: +Test: 340-run-stubby.test +AuxFiles: +Passed: +Failure: diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.test b/src/test/tpkg/340-run-stubby.tpkg/340-run-stubby.test similarity index 62% rename from src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.test rename to src/test/tpkg/340-run-stubby.tpkg/340-run-stubby.test index b3735fb4..cf5f9c99 100644 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.test +++ b/src/test/tpkg/340-run-stubby.tpkg/340-run-stubby.test @@ -1,7 +1,7 @@ -# #-- 255-yaml-config.test --# +# #-- 120-run-getdns_query.test --# # source the master var file when it's there [ -f ../.tpkg.var.master ] && source ../.tpkg.var.master # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -make && "./${TPKG_NAME}" 255-yaml-config.input | tee out && diff out "${TPKG_NAME}.good" +"${STUBBY}" -i diff --git a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.dsc b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.dsc index 33cf7bb3..bcc603f8 100644 --- a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.dsc +++ b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.dsc @@ -9,7 +9,7 @@ CmdDepends: scan-build Depends: Help: Pre: 400-static-analysis.pre -Post: 400-static-analysis.post +Post: Test: 400-static-analysis.test AuxFiles: Passed: diff --git a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.post b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.post index 5551a73d..3ccc7cbc 100644 --- a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.post +++ b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.post @@ -12,9 +12,3 @@ else fi # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test - -for f in `cat restore-srcdir-configure-settings` -do - mv "${SRCROOT}/${f}.build-static-analysis" "${SRCROOT}/${f}" -done - diff --git a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.pre b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.pre index 9a95798c..9aadc944 100644 --- a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.pre +++ b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.pre @@ -13,23 +13,13 @@ fi # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -echo "" > restore-srcdir-configure-settings -for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'` -do - if [ -f "${SRCROOT}/$f" ] - then - mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build-static-analysis" && \ - echo "$f" >> restore-srcdir-configure-settings - fi -done rm -fr "${BUILDDIR}/build-static-analysis" mkdir "${BUILDDIR}/build-static-analysis" cd "${BUILDDIR}/build-static-analysis" -"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libev --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libev \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libev --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libev \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libuv - +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install -DUSE_LIBEVENT2=ON -DUSE_LIBEV=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install -DUSE_LIBEVENT2=ON -DUSE_LIBEV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install -DUSE_LIBEVENT2=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install -DUSE_LIBEV=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install -DUSE_LIBEVENT2=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install -DUSE_LIBEV=ON $* ${SRCROOT}) || \ +(rm -f CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install -DUSE_LIBUV=ON $* ${SRCROOT}) diff --git a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.test b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.test index a08a7abb..4456b027 100644 --- a/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.test +++ b/src/test/tpkg/400-static-analysis.tpkg/400-static-analysis.test @@ -6,7 +6,7 @@ ( cd "${BUILDDIR}/build-static-analysis" - scan-build -o ../scan-build-reports -v --status-bugs make -j 4 everything + scan-build -o ../scan-build-reports -v --status-bugs make -j 4 all ) || ( chmod 0400 ./400-static-analysis scp -o "StrictHostKeyChecking no" -i ./400-static-analysis -r "${BUILDDIR}/scan-build-reports" static-analysis@getdnsapi.net:scan-build-resports-$$-`date +%s` diff --git a/src/test/tpkg/run-offline-only.sh b/src/test/tpkg/run-offline-only.sh new file mode 100755 index 00000000..7fea9a49 --- /dev/null +++ b/src/test/tpkg/run-offline-only.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +export SRCDIR=`dirname $0` +. `dirname $0`/setup-env.sh + +control_c() +# run if user hits control-c +{ + echo -en "\n*** Exiting ***\n" + exit $? +} + +for TEST_PKG in 080-iana-rr-types.tpkg 125-valgrind-checks.tpkg \ + 130-run-unit-tests.tpkg 225-stub-only-valgrind-checks.tpkg \ + 230-stub-only-run-unit-tests.tpkg 270-header-extension.tpkg \ + 290-transports.tpkg 330-event-loops-unit-tests.tpkg \ + 340-run-stubby.tpkg +do + "${TPKG}" $* fake "${TEST_PKG}" +done +for TEST_PKG in ${SRCDIR}/*.tpkg +do + "${TPKG}" $* exe "${TEST_PKG}" + # trap keyboard interrupt (control-c) + trap control_c 2 +done +"${TPKG}" -n -1 r diff --git a/src/test/tpkg/setup-env.sh b/src/test/tpkg/setup-env.sh index d3269d64..8c9bd7af 100755 --- a/src/test/tpkg/setup-env.sh +++ b/src/test/tpkg/setup-env.sh @@ -5,20 +5,12 @@ export SRCROOT=`(cd "${SRCDIR}/../../.."; pwd)` export TPKG="${SRCDIR}/tpkg" export BUILDDIR=`pwd` export BUILDROOT=`(cd "${BUILDDIR}/../../.."; pwd)` -export LIBTOOL="${BUILDROOT}/libtool" if [ ! -f "${SRCROOT}/src/test/jsmn/jsmn.c" ] then (cd "${SRCROOT}"; git submodule update --init) fi -if [ ! -f "${SRCROOT}/libtool" ] -then - (cd "${SRCROOT}"; (glibtoolize -fic || libtoolize -fic)) -fi -if [ ! -f "${SRCROOT}/configure" ] -then - (cd "${SRCROOT}"; autoreconf -fi) -fi + if [ -f .tpkg.var.master ] then cat .tpkg.var.master \ @@ -33,7 +25,5 @@ export SRCROOT="${SRCROOT}" export BUILDDIR="${BUILDDIR}" export BUILDROOT="${BUILDROOT}" export TPKG="${TPKG}" -export LIBTOOL="${LIBTOOL}" END_OF_TPKG_VAR_MASTER -${TPKG} f 255-yaml-config.tpkg diff --git a/src/tls.h b/src/tls.h index aacf4257..a9be6a16 100644 --- a/src/tls.h +++ b/src/tls.h @@ -42,7 +42,7 @@ /* Forward declare type. */ struct sha256_pin; -typedef struct sha256_pin sha256_pin_t; +struct getdns_log_config; /* Additional return codes required by TLS abstraction. Internal use only. */ #define GETDNS_RETURN_TLS_WANT_READ ((getdns_return_t) 420) @@ -61,7 +61,7 @@ void _getdns_tls_init(); * @paam log pointer to context log config. * @return pointer to new context or NULL on error. */ -_getdns_tls_context* _getdns_tls_context_new(struct mem_funcs* mfs, const getdns_log_config* log); +_getdns_tls_context* _getdns_tls_context_new(struct mem_funcs* mfs, const struct getdns_log_config* log); /** * Free a TLS context. @@ -166,7 +166,7 @@ getdns_return_t _getdns_tls_context_set_ca(_getdns_tls_context* ctx, const char* * @paam log pointer to connection log config. * @return pointer to new connection or NULL on error. */ -_getdns_tls_connection* _getdns_tls_connection_new(struct mem_funcs* mfs, _getdns_tls_context* ctx, int fd, const getdns_log_config* log); +_getdns_tls_connection* _getdns_tls_connection_new(struct mem_funcs* mfs, _getdns_tls_context* ctx, int fd, const struct getdns_log_config* log); /** * Free a TLS connection. @@ -314,7 +314,7 @@ getdns_return_t _getdns_tls_connection_setup_hostname_auth(_getdns_tls_connectio * @return GETDNS_RETURN_GOOD if all OK. * @return GETDNS_RETURN_INVALID_PARAMETER if conn is null or has no SSL. */ -getdns_return_t _getdns_tls_connection_set_host_pinset(_getdns_tls_connection* conn, const char* auth_name, const sha256_pin_t* pinset); +getdns_return_t _getdns_tls_connection_set_host_pinset(_getdns_tls_connection* conn, const char* auth_name, const struct sha256_pin* pinset); /** * Get result of certificate verification. diff --git a/src/tls/anchor-internal.c b/src/tls/anchor-internal.c index a981f556..b045eac1 100644 --- a/src/tls/anchor-internal.c +++ b/src/tls/anchor-internal.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include "types-internal.h" #include "context.h" diff --git a/src/tls/val_secalgo.c b/src/tls/val_secalgo.c index 765eafa7..d8c44f6f 100644 --- a/src/tls/val_secalgo.c +++ b/src/tls/val_secalgo.c @@ -1726,7 +1726,11 @@ _verify_nettle_ecdsa(sldns_buffer* buf, unsigned int digest_size, unsigned char* { uint8_t digest[SHA256_DIGEST_SIZE]; mpz_t x, y; +#ifdef HAVE_NETTLE_GET_SECP_256R1 + nettle_ecc_point_init(&pubkey, nettle_get_secp_256r1()); +#else nettle_ecc_point_init(&pubkey, &nettle_secp_256r1); +#endif nettle_mpz_init_set_str_256_u(x, SHA256_DIGEST_SIZE, key); nettle_mpz_init_set_str_256_u(y, SHA256_DIGEST_SIZE, key+SHA256_DIGEST_SIZE); nettle_mpz_set_str_256_u(signature.r, SHA256_DIGEST_SIZE, sigblock); @@ -1743,7 +1747,11 @@ _verify_nettle_ecdsa(sldns_buffer* buf, unsigned int digest_size, unsigned char* { uint8_t digest[SHA384_DIGEST_SIZE]; mpz_t x, y; +#ifdef HAVE_NETTLE_GET_SECP_384R1 + nettle_ecc_point_init(&pubkey, nettle_get_secp_384r1()); +#else nettle_ecc_point_init(&pubkey, &nettle_secp_384r1); +#endif nettle_mpz_init_set_str_256_u(x, SHA384_DIGEST_SIZE, key); nettle_mpz_init_set_str_256_u(y, SHA384_DIGEST_SIZE, key+SHA384_DIGEST_SIZE); nettle_mpz_set_str_256_u(signature.r, SHA384_DIGEST_SIZE, sigblock); diff --git a/src/tools/Makefile.in b/src/tools/Makefile.in deleted file mode 100644 index 6cefffcd..00000000 --- a/src/tools/Makefile.in +++ /dev/null @@ -1,133 +0,0 @@ -# -# @configure_input@ -# -# Copyright (c) 2013, Verisign, Inc., NLNet Labs -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the names of the copyright holders nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package = @PACKAGE_NAME@ -version = @PACKAGE_VERSION@ -tarname = @PACKAGE_TARNAME@ -distdir = $(tarname)-$(version) - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -INSTALL = @INSTALL@ -LIBTOOL = ../../libtool - -srcdir = @srcdir@ - -CC=@CC@ -WPEDANTICFLAG=@WPEDANTICFLAG@ -CFLAGS=-I$(srcdir)/.. -I$(srcdir) -I.. $(cflags) @CFLAGS@ @CPPFLAGS@ $(WPEDANTICFLAG) $(XTRA_CFLAGS) -LDFLAGS=-L.. @LDFLAGS@ -LDLIBS=../libgetdns.la @LIBS@ - -ALL_OBJS=getdns_query.lo getdns_server_mon.lo - -PROGRAMS=getdns_query getdns_server_mon - - -.SUFFIXES: .c .o .a .lo .h - -.c.o: - $(CC) $(CFLAGS) -c $< -o $@ - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -default: all - -all: $(PROGRAMS) - -$(ALL_OBJS): - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@ - -getdns_query: getdns_query.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ getdns_query.lo $(LDFLAGS) $(LDLIBS) - -getdns_server_mon: getdns_server_mon.lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ getdns_server_mon.lo $(LDFLAGS) $(LDLIBS) - -stubby: - cd .. && $(MAKE) $@ - -install-getdns_query: getdns_query - $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) - $(LIBTOOL) --mode=install cp getdns_query $(DESTDIR)$(bindir) - -uninstall-getdns_query: - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/getdns_query - -install-getdns_server_mon: getdns_server_mon - $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) - $(LIBTOOL) --mode=install cp getdns_server_mon $(DESTDIR)$(bindir) - -uninstall-getdns_server_mon: - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/getdns_server_mon - -install-stubby: - cd .. && $(MAKE) $@ - -uninstall-stubby: - cd .. && $(MAKE) $@ - -clean: - rm -f *.o *.lo $(PROGRAMS) - rm -rf .libs - -distclean : clean - rm -f Makefile - -Makefile: $(srcdir)/Makefile.in ../../config.status - cd ../.. && ./config.status src/test/Makefile - -depend: - (cd $(srcdir) ; awk 'BEGIN{P=1}{if(P)print}/^# Dependencies/{P=0}' Makefile.in > Makefile.in.new ) - (blddir=`pwd`; cd $(srcdir) ; gcc -MM -I. -I.. -I"$$blddir"/.. *.c | \ - sed -e "s? $$blddir/? ?g" \ - -e 's? \([a-z0-9_-]*\)\.\([ch]\)? $$(srcdir)/\1.\2?g' \ - -e 's? \.\./\([a-z0-9_-]*\)\.h? $$(srcdir)/../\1.h?g' \ - -e 's? \.\./\([a-z0-9_-]*\)/\([a-z0-9_-]*\)\.h? $$(srcdir)/../\1/\2.h?g' \ - -e 's? \$$(srcdir)/config\.h? ../config.h?g' \ - -e 's? \$$(srcdir)/\.\./config\.h? ../config.h?g' \ - -e 's? \$$(srcdir)/\.\./getdns/getdns\.h? ../getdns/getdns.h?g' \ - -e 's? \$$(srcdir)/\.\./getdns/getdns_extra\.h? ../getdns/getdns_extra.h?g' \ - -e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' >> Makefile.in.new ) - (cd $(srcdir) ; diff Makefile.in.new Makefile.in && rm Makefile.in.new \ - || mv Makefile.in.new Makefile.in ) - -.PHONY: clean test - -# Dependencies for getdns_query -getdns_query.lo getdns_query.o: $(srcdir)/getdns_query.c \ - ../config.h \ - $(srcdir)/../debug.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h -getdns_server_mon.lo getdns_server_mon.o: $(srcdir)/getdns_server_mon.c \ - ../config.h \ - ../getdns/getdns.h \ - ../getdns/getdns_extra.h diff --git a/src/tools/getdns_query.c b/src/tools/getdns_query.c index 80b94dbd..636292c5 100644 --- a/src/tools/getdns_query.c +++ b/src/tools/getdns_query.c @@ -1357,7 +1357,7 @@ void read_line_cb(void *userarg) typedef struct dns_msg { getdns_transaction_t request_id; getdns_dict *request; - uint32_t rt; + getdns_resolution_t rt; uint32_t ad_bit; uint32_t do_bit; uint32_t cd_bit; diff --git a/src/util-internal.c b/src/util-internal.c index be919637..62aaf226 100644 --- a/src/util-internal.c +++ b/src/util-internal.c @@ -51,6 +51,7 @@ #include "gldns/gbuffer.h" #include "gldns/pkthdr.h" #include "dnssec.h" +#include "convert.h" getdns_return_t @@ -725,6 +726,23 @@ _getdns_create_reply_dict(getdns_context *context, getdns_network_req *req, , answer_spc.rrset.name)) goto error; + if (!req->upstream) + ; + else if (req->upstream->addr.ss_family == AF_INET) { + struct sockaddr_in *addr = (struct sockaddr_in *) &req->upstream->addr; + if (_getdns_dict_set_const_bindata(result, + "answer_ipv4_address", sizeof(addr->sin_addr) + , (uint8_t *) & (addr->sin_addr))) + goto error; + } + else if (req->upstream->addr.ss_family == AF_INET6) { + struct sockaddr_in6 *addr = (struct sockaddr_in6 *) &req->upstream->addr; + if (_getdns_dict_set_const_bindata(result, + "answer_ipv6_address", sizeof(addr->sin6_addr) + , (uint8_t *) & (addr->sin6_addr))) + goto error; + } + if (!req->owner->add_warning_for_bad_dns) goto success; @@ -803,6 +821,9 @@ _getdns_create_call_reporting_dict( getdns_bindata qname; getdns_dict *netreq_debug; getdns_dict *address_debug = NULL; + getdns_dict *query_dict = NULL; + const uint8_t *wire; + size_t wire_len; assert(netreq); @@ -839,6 +860,23 @@ _getdns_create_call_reporting_dict( return NULL; } /* Stub resolver debug data */ + wire = netreq->query; + wire_len = netreq->response - netreq->query; + if (!wire) + ; /* pass */ + + else if(_getdns_wire2msg_dict_scan( + &netreq_debug->mf, &wire, &wire_len, &query_dict)) { + + getdns_dict_destroy(netreq_debug); + return NULL; + + } else if (_getdns_dict_set_this_dict( + netreq_debug, "query", query_dict)) { + + getdns_dict_destroy(netreq_debug); + return NULL; + } _getdns_sockaddr_to_dict( context, &netreq->upstream->addr, &address_debug); @@ -1125,6 +1163,8 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request) getdns_dict *netreq_debug; _srvs srvs = { 0, 0, NULL }; _getdns_rrset_spc answer_spc; + getdns_bindata *answer_ipv4_address = NULL; + getdns_bindata *answer_ipv6_address = NULL; /* info (bools) about dns_req */ int dnssec_return_status; @@ -1160,8 +1200,7 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request) goto error_free_result; } } - if (getdns_dict_set_int(result, GETDNS_STR_KEY_ANSWER_TYPE, - GETDNS_NAMETYPE_DNS)) + if (getdns_dict_set_int(result, "answer_type", GETDNS_NAMETYPE_DNS)) goto error_free_result; if (!(replies_full = getdns_list_create_with_context(context))) @@ -1176,6 +1215,8 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request) for ( netreq_p = completed_request->netreqs ; (netreq = *netreq_p) ; netreq_p++) { + getdns_bindata *tmp_ipv4_address; + getdns_bindata *tmp_ipv6_address; if (call_reporting && ( netreq->response_len || netreq->state == NET_REQ_TIMED_OUT)) { @@ -1233,6 +1274,27 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request) result, "canonical_name", canonical_name)) goto error; } + + if (!getdns_dict_get_bindata( + reply, "answer_ipv4_address", &tmp_ipv4_address)) { + if (!answer_ipv4_address) + answer_ipv4_address = tmp_ipv4_address; + else if (tmp_ipv4_address->size != answer_ipv4_address->size + || memcmp( tmp_ipv4_address->data + , answer_ipv4_address->data + , answer_ipv4_address->size)) + answer_ipv4_address = NULL; + } + if (!getdns_dict_get_bindata( + reply, "answer_ipv6_address", &tmp_ipv6_address)) { + if (!answer_ipv6_address) + answer_ipv6_address = tmp_ipv6_address; + else if (tmp_ipv6_address->size != answer_ipv6_address->size + || memcmp( tmp_ipv6_address->data + , answer_ipv6_address->data + , answer_ipv6_address->size)) + answer_ipv6_address = NULL; + } /* TODO: Check instead if canonical_name for request_type * is in the answer section. */ @@ -1269,6 +1331,14 @@ _getdns_create_getdns_response(getdns_dns_req *completed_request) completed_request->name_len, completed_request->name)) goto error; + if (answer_ipv4_address && + getdns_dict_set_bindata(result, "answer_ipv4_address", answer_ipv4_address)) + goto error; + + if (answer_ipv6_address && + getdns_dict_set_bindata(result, "answer_ipv6_address", answer_ipv6_address)) + goto error; + if (call_reporting) { if (_getdns_dict_set_this_list( result, "call_reporting", call_reporting)) diff --git a/src/util/auxiliary/util/log.h b/src/util/auxiliary/util/log.h index cdd949b2..8def2f38 100644 --- a/src/util/auxiliary/util/log.h +++ b/src/util/auxiliary/util/log.h @@ -34,6 +34,8 @@ #ifndef UTIL_LOG_H #define UTIL_LOG_H +#include + #include "config.h" #include "debug.h" diff --git a/src/util/locks.c b/src/util/locks.c index b65a02bd..e6e848a2 100644 --- a/src/util/locks.c +++ b/src/util/locks.c @@ -42,6 +42,7 @@ #include "config.h" #include "util/locks.h" #include +#include #ifdef HAVE_SYS_WAIT_H #include #endif diff --git a/src/util/lookup3.c b/src/util/lookup3.c index cc110748..46e56271 100644 --- a/src/util/lookup3.c +++ b/src/util/lookup3.c @@ -49,8 +49,16 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #include "util/storage/lookup3.h" #include /* defines printf for tests */ #include /* defines time_t for timings in the test */ -/*#include defines uint32_t etc (from config.h) */ -#include /* attempt to define endianness */ + +#if defined(HAVE_TARGET_ENDIANNESS) +# if defined(TARGET_IS_BIG_ENDIAN) +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 1 +# else +# define HASH_LITTLE_ENDIAN 1 +# define HASH_BIG_ENDIAN 0 +# endif +#else #ifdef HAVE_SYS_TYPES_H # include /* attempt to define endianness (solaris) */ #endif @@ -65,15 +73,6 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #include /* attempt to define endianness */ #endif -/* random initial value */ -static uint32_t raninit = (uint32_t)0xdeadbeef; - -void -hash_set_raninit(uint32_t v) -{ - raninit = v; -} - /* * My best guess at if you are big-endian or little-endian. This may * need adjustment. @@ -103,6 +102,16 @@ hash_set_raninit(uint32_t v) # define HASH_LITTLE_ENDIAN 0 # define HASH_BIG_ENDIAN 0 #endif +#endif /* defined(TARGET_IS_BIG_ENDIAN) */ + +/* random initial value */ +static uint32_t raninit = (uint32_t)0xdeadbeef; + +void +hash_set_raninit(uint32_t v) +{ + raninit = v; +} #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) diff --git a/src/util/lruhash.c b/src/util/lruhash.c index 0003ff49..2c21ad2d 100644 --- a/src/util/lruhash.c +++ b/src/util/lruhash.c @@ -40,6 +40,8 @@ * */ +#include + #include "config.h" #include "util/storage/lruhash.h" #include "util/fptr_wlist.h" @@ -458,6 +460,7 @@ lruhash_clear(struct lruhash* table) void lruhash_status(struct lruhash* table, const char* id, int extended) { + (void)id; lock_quick_lock(&table->lock); log_info("%s: %u entries, memory %u / %u", id, (unsigned)table->num, (unsigned)table->space_used, diff --git a/src/util/orig-headers/locks.h b/src/util/orig-headers/locks.h index d86ee492..7e61bcc0 100644 --- a/src/util/orig-headers/locks.h +++ b/src/util/orig-headers/locks.h @@ -36,6 +36,8 @@ #ifndef UTIL_LOCKS_H #define UTIL_LOCKS_H +#include + /** * \file * Locking primitives. @@ -219,6 +221,7 @@ void* ub_thread_key_get(ub_thread_key_type key); #else /* we do not HAVE_SOLARIS_THREADS and no PTHREADS */ /******************* WINDOWS THREADS ************************/ #ifdef HAVE_WINDOWS_THREADS +#include #include /* Use a mutex */ diff --git a/src/util/rbtree.c b/src/util/rbtree.c index ff4e3e46..b1a94b78 100644 --- a/src/util/rbtree.c +++ b/src/util/rbtree.c @@ -39,6 +39,8 @@ * Implementation of a redblack tree. */ +#include + #include "config.h" #include "log.h" #include "fptr_wlist.h" diff --git a/src/yxml b/src/yxml index 10f968b0..57497cdc 160000 --- a/src/yxml +++ b/src/yxml @@ -1 +1 @@ -Subproject commit 10f968b0e78b9aeee357d0de81a46b445c3fb27b +Subproject commit 57497cdcacb6e5538e6bf6dad0b274896d9b3962 diff --git a/stubby b/stubby index b0d3154a..70937487 160000 --- a/stubby +++ b/stubby @@ -1 +1 @@ -Subproject commit b0d3154af61e1b46a30b56d239dc074273642217 +Subproject commit 709374879bca5d77548df68fd91c51174a862229