# HG changeset patch # User Thomas Klausner # Date 1623861885 -7200 # Node ID 699c3fb0c57bb3ac7b0318855d9df4a453809406 # Parent 9084c6f94a0a1ebd27a2be045fafcdc3072a6f00 Switch from libidn to libidn2. libidn2 is the backwards compatible successor to libidn, and at least Red Hat 8 does not provide a dev package for libidn1. diff -r 9084c6f94a0a -r 699c3fb0c57b INSTALL.Fedora --- a/INSTALL.Fedora Wed Jun 16 18:05:27 2021 +0200 +++ b/INSTALL.Fedora Wed Jun 16 18:44:45 2021 +0200 @@ -3,7 +3,7 @@ Dependencies on Fedora 13 (from minimal system): -# yum install cmake make gcc gcc-c++ flex bison lksctp-tools-devel gnutls-devel libgcrypt-devel libidn-devel +# yum install cmake make gcc gcc-c++ flex bison lksctp-tools-devel gnutls-devel libgcrypt-devel libidn2-devel In addition, if you have not already retrieved the latest source: # yum install mercurial diff -r 9084c6f94a0a -r 699c3fb0c57b INSTALL.FreeBSD --- a/INSTALL.FreeBSD Wed Jun 16 18:05:27 2021 +0200 +++ b/INSTALL.FreeBSD Wed Jun 16 18:44:45 2021 +0200 @@ -34,7 +34,7 @@ 4) Install 'flex' and 'bison', same way. -5) Install 'gnutls' and 'libidn', same way also. +5) Install 'gnutls' and 'libidn2', same way also. 6) Retrieve freeDiameter source code: # cd ~ diff -r 9084c6f94a0a -r 699c3fb0c57b INSTALL.OSX --- a/INSTALL.OSX Wed Jun 16 18:05:27 2021 +0200 +++ b/INSTALL.OSX Wed Jun 16 18:44:45 2021 +0200 @@ -39,10 +39,10 @@ See QUICK INSTRUCTIONS Step #1 above. 2) Install dependencies: - $ brew install mercurial cmake gnutls libgcrypt postgres mysql libidn + $ brew install mercurial cmake gnutls libgcrypt postgres mysql libidn2 Notes: - * GNU IDN (libidn) is optional, see below + * GNU IDN (libidn2) is optional, see below * When libusrsctp package is available, you can use it as well. However, it requires some rework on the source code as libusrsctp is not fully compliant with the other SCTP stack. diff -r 9084c6f94a0a -r 699c3fb0c57b INSTALL.OpenSUSE --- a/INSTALL.OpenSUSE Wed Jun 16 18:05:27 2021 +0200 +++ b/INSTALL.OpenSUSE Wed Jun 16 18:44:45 2021 +0200 @@ -3,7 +3,7 @@ Dependencies on OpenSUSE 11.3 (from minimal server system installation): -# zypper install cmake make gcc gcc-c++ flex bison lksctp-tools-devel libgnutls-devel libgcrypt-devel libidn-devel +# zypper install cmake make gcc gcc-c++ flex bison lksctp-tools-devel libgnutls-devel libgcrypt-devel libidn2-devel # zypper install mercurial Following dependencies are optional, depending on which extensions you plan to compile diff -r 9084c6f94a0a -r 699c3fb0c57b INSTALL.Ubuntu --- a/INSTALL.Ubuntu Wed Jun 16 18:05:27 2021 +0200 +++ b/INSTALL.Ubuntu Wed Jun 16 18:44:45 2021 +0200 @@ -17,9 +17,9 @@ ============================================ The following packages are required to compile freeDiameter from source: - cmake make gcc g++ flex bison libsctp1 libsctp-dev libgnutls-dev libgcrypt-dev libidn11-dev + cmake make gcc g++ flex bison libsctp1 libsctp-dev libgnutls-dev libgcrypt-dev libidn2-dev -(note that libidn and libsctp can be avoided by defining DISABLE_SCTP and DIAMID_IDNA_REJECT) +(note that libidn2 and libsctp can be avoided by defining DISABLE_SCTP and DIAMID_IDNA_REJECT) Additionnaly, these ones may be useful: mercurial gdb @@ -44,7 +44,7 @@ the following commands should generate the freeDiameter packages for you: # Install the dependencies for building the source: -sudo apt-get -y install mercurial cmake make gcc g++ bison flex libsctp-dev libgnutls-dev libgcrypt-dev libidn11-dev ssl-cert debhelper fakeroot \ +sudo apt-get -y install mercurial cmake make gcc g++ bison flex libsctp-dev libgnutls-dev libgcrypt-dev libidn2-dev ssl-cert debhelper fakeroot \ libpq-dev libmysqlclient-dev libxml2-dev swig python-dev # On latest Ubuntu you will need libgnutls28-dev instead of libgnutls-dev @@ -84,7 +84,7 @@ Step by step instructions without using the debhelper tools: 1) Install all packages dependencies -# sudo apt-get install mercurial cmake make gcc g++ bison flex libsctp-dev libgnutls-dev libgcrypt-dev libidn11-dev +# sudo apt-get install mercurial cmake make gcc g++ bison flex libsctp-dev libgnutls-dev libgcrypt-dev libidn2-dev 2) (OPTION) If you will compile modules that require postgresql, also install: # sudo apt-get install libpq-dev diff -r 9084c6f94a0a -r 699c3fb0c57b INSTALL.pkgsrc --- a/INSTALL.pkgsrc Wed Jun 16 18:05:27 2021 +0200 +++ b/INSTALL.pkgsrc Wed Jun 16 18:44:45 2021 +0200 @@ -8,7 +8,7 @@ If you want to build and install freeDiameter from the repository, you'll need to install: - pkg_add bison pkg-config libidn gnutls libgcrypt mercurial + pkg_add bison pkg-config libidn2 gnutls libgcrypt mercurial and follow the usual installation note. For the optional extensions, you need mysql*-client, postgres*-client, diff -r 9084c6f94a0a -r 699c3fb0c57b cmake/Modules/FindIDNA.cmake --- a/cmake/Modules/FindIDNA.cmake Wed Jun 16 18:05:27 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -# - Try to find GNU IDN library and headers -# Once done, this will define -# -# IDNA_FOUND - system has IDNA -# IDNA_INCLUDE_DIR - the IDNA include directories () -# IDNA_LIBRARIES - link these to use IDNA (idna_to_ascii_8z) - -if (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES) - set(IDNA_FIND_QUIETLY TRUE) -endif (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES) - -# Include dir -find_path(IDNA_INCLUDE_DIR - NAMES idna.h -) - -# Library -find_library(IDNA_LIBRARY - NAMES idn -) - - -# handle the QUIETLY and REQUIRED arguments and set IDNA_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(IDNA DEFAULT_MSG IDNA_LIBRARY IDNA_INCLUDE_DIR) - -# If we successfully found the idn library then add the library to the -# IDNA_LIBRARIES cmake variable otherwise set IDNA_LIBRARIES to nothing. -IF(IDNA_FOUND) - SET( IDNA_LIBRARIES ${IDNA_LIBRARY} ) -ELSE(IDNA_FOUND) - SET( IDNA_LIBRARIES ) -ENDIF(IDNA_FOUND) - - -# Lastly make it so that the IDNA_LIBRARY and IDNA_INCLUDE_DIR variables -# only show up under the advanced options in the gui cmake applications. -MARK_AS_ADVANCED( IDNA_LIBRARY IDNA_INCLUDE_DIR ) - diff -r 9084c6f94a0a -r 699c3fb0c57b contrib/RPM/freeDiameter.spec --- a/contrib/RPM/freeDiameter.spec Wed Jun 16 18:05:27 2021 +0200 +++ b/contrib/RPM/freeDiameter.spec Wed Jun 16 18:44:45 2021 +0200 @@ -10,7 +10,7 @@ Source0: http://www.freediameter.net/hg/freeDiameter/archive/1.1.6.tar.gz BuildRequires: cmake make gcc gcc-c++ flex bison lksctp-tools-devel -BuildRequires: gnutls-devel libgcrypt-devel libidn-devel +BuildRequires: gnutls-devel libgcrypt-devel libidn2-devel BuildRequires: mercurial Requires: lksctp-tools diff -r 9084c6f94a0a -r 699c3fb0c57b contrib/debian/control --- a/contrib/debian/control Wed Jun 16 18:05:27 2021 +0200 +++ b/contrib/debian/control Wed Jun 16 18:44:45 2021 +0200 @@ -4,7 +4,7 @@ Maintainer: Sebastien Decugis Build-Depends: debhelper ( >= 7.3.9), cmake, make, gcc, g++, bison, flex, - libsctp-dev, libgnutls-dev | gnutls-dev, libidn11-dev, + libsctp-dev, libgnutls-dev | gnutls-dev, libidn2-dev, libpq-dev, libmysqlclient-dev, libxml2-dev, swig, python-dev, libgcrypt11-dev | libgcrypt20-dev Standards-Version: 3.8.3 diff -r 9084c6f94a0a -r 699c3fb0c57b contrib/nightly_tests/prereqs.fedora --- a/contrib/nightly_tests/prereqs.fedora Wed Jun 16 18:05:27 2021 +0200 +++ b/contrib/nightly_tests/prereqs.fedora Wed Jun 16 18:44:45 2021 +0200 @@ -3,7 +3,7 @@ lksctp-tools-devel kernel-modules-extra postgresql-server postgresql-devel mysql-server mysql-devel -libxml2 libxml2-devel libidn-devel +libxml2 libxml2-devel libidn2-devel swig python-devel # For postgresql server to start automatically, you may have to issue: diff -r 9084c6f94a0a -r 699c3fb0c57b include/freeDiameter/CMakeLists.txt --- a/include/freeDiameter/CMakeLists.txt Wed Jun 16 18:05:27 2021 +0200 +++ b/include/freeDiameter/CMakeLists.txt Wed Jun 16 18:44:45 2021 +0200 @@ -2,6 +2,8 @@ Project("freeDiameter includes directory" C) +INCLUDE(FindPkgConfig) + ######################## # Configurable parameters @@ -135,26 +137,15 @@ SET(SCTP_INCLUDE_DIR ${SCTP_INCLUDE_DIR} PARENT_SCOPE) SET(SCTP_LIBRARIES ${SCTP_LIBRARIES} PARENT_SCOPE) -# IDNA process: we use libidn from GNU (unless the function & header files are included in libc) +# IDNA process: we use GNU libidn2 IF(NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) - FIND_PACKAGE(IDNA) - SET(CHECK_IDNA_SOURCE_CODE " - #include - int main() { - return idna_to_ascii_8z(NULL, NULL, 0); - } - ") - SET(CMAKE_REQUIRED_INCLUDES ${IDNA_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_LIBRARIES ${IDNA_LIBRARIES}) - CHECK_C_SOURCE_COMPILES("${CHECK_IDNA_SOURCE_CODE}" HAS_IDNA_SUPPORT) - IF(NOT HAS_IDNA_SUPPORT) - MESSAGE(SEND_ERROR "Unable to find idna.h header or idna_to_ascii_8z function, please install libidn-dev or equivalent, or set DIAMID_IDNA_IGNORE or DIAMID_IDNA_REJECT") - ENDIF(NOT HAS_IDNA_SUPPORT) + PKG_CHECK_MODULES(IDNA libidn2) + IF(NOT IDNA_FOUND) + MESSAGE(SEND_ERROR "Unable to find libidn2, please install libidn2-dev or equivalent, or set DIAMID_IDNA_IGNORE or DIAMID_IDNA_REJECT") + ENDIF() ELSE (NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) MESSAGE(STATUS "Non-default Internationalized Domain Names (IDN) behavior selected (no stringprep).") ENDIF(NOT DIAMID_IDNA_IGNORE AND NOT DIAMID_IDNA_REJECT) -SET(IDNA_INCLUDE_DIR ${IDNA_INCLUDE_DIR} PARENT_SCOPE) -SET(IDNA_LIBRARIES ${IDNA_LIBRARIES} PARENT_SCOPE) # Require GNU TLS for building the library @@ -220,9 +211,9 @@ ########################## # LFDPROTO_LIBS = libraries required by the libfdproto. -SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${IDNA_LIBRARIES} PARENT_SCOPE) +SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${IDNA_LINK_LIBRARIES} PARENT_SCOPE) # And includes paths -SET(LFDPROTO_INCLUDES ${IDNA_INCLUDE_DIR} PARENT_SCOPE) +SET(LFDPROTO_INCLUDES ${IDNA_INCLUDE_DIRS} PARENT_SCOPE) # Dependencies: the libraries required by any code linking to libfdproto. SET(LFDPROTO_LINK_INTERFACES ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE) diff -r 9084c6f94a0a -r 699c3fb0c57b libfdproto/CMakeLists.txt --- a/libfdproto/CMakeLists.txt Wed Jun 16 18:05:27 2021 +0200 +++ b/libfdproto/CMakeLists.txt Wed Jun 16 18:44:45 2021 +0200 @@ -27,12 +27,12 @@ # Save the list of files for testcases in the core's directory SET(LFDPROTO_SRC ${LFDPROTO_SRC} PARENT_SCOPE) -# Include path -INCLUDE_DIRECTORIES(${LFDPROTO_INCLUDES}) - # Build as a shared library ADD_LIBRARY(libfdproto SHARED ${LFDPROTO_SRC}) +# Include path +TARGET_INCLUDE_DIRECTORIES(libfdproto PRIVATE /a/b/c ${LFDPROTO_INCLUDES}) + ADD_DEPENDENCIES(libfdproto version_information) # Avoid the liblib name, and set the version diff -r 9084c6f94a0a -r 699c3fb0c57b libfdproto/ostr.c --- a/libfdproto/ostr.c Wed Jun 16 18:05:27 2021 +0200 +++ b/libfdproto/ostr.c Wed Jun 16 18:44:45 2021 +0200 @@ -36,8 +36,8 @@ #include "fdproto-internal.h" #if (!defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT)) -/* Process IDNA with stringprep -- See RFC5890 -- and libidn documentation... */ -#include /* idna_to_ascii_8z() */ +/* Process IDNA with stringprep -- See RFC5890 -- and libidn2 documentation... */ +#include /* idn2_to_ascii_8z() */ #endif /* !defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT) */ /* Similar to strdup with (must have been verified) os0_t */ @@ -226,8 +226,8 @@ } } - ret = idna_to_ascii_8z ( *id, &processed, IDNA_USE_STD3_ASCII_RULES ); - if (ret == IDNA_SUCCESS) { + ret = idn2_to_ascii_8z ( *id, &processed, IDNA_USE_STD3_ASCII_RULES ); + if (ret == IDN2_OK) { TRACE_DEBUG(INFO, "The string '%s' is not a valid DiameterIdentity, it was changed to '%s'", *id, processed); if (memory == 0) free(*id); @@ -235,7 +235,7 @@ *inoutsz = strlen(processed); /* Done! */ } else { - TRACE_DEBUG(INFO, "The string '%s' is not a valid DiameterIdentity and cannot be sanitanized: %s", *id, idna_strerror (ret)); + TRACE_DEBUG(INFO, "The string '%s' is not a valid DiameterIdentity and cannot be sanitized: %s", *id, idn2_strerror (ret)); return EINVAL; }