Mercurial > hg > freeDiameter
changeset 1562:6219359a36a9 default tip
Merge latest changes from proposed branch
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Mon, 21 Jun 2021 19:08:18 +0800 |
parents | 932fca1cbbe4 (current diff) 699c3fb0c57b (diff) |
children | |
files | CMakeLists.txt |
diffstat | 17 files changed, 43 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Sat Oct 10 12:58:37 2020 +0800 +++ b/CMakeLists.txt Mon Jun 21 19:08:18 2021 +0800 @@ -20,7 +20,7 @@ INCLUDE(CTest) # CMake version -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) # Location of additional CMake modules SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
--- a/INSTALL.Fedora Sat Oct 10 12:58:37 2020 +0800 +++ b/INSTALL.Fedora Mon Jun 21 19:08:18 2021 +0800 @@ -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
--- a/INSTALL.FreeBSD Sat Oct 10 12:58:37 2020 +0800 +++ b/INSTALL.FreeBSD Mon Jun 21 19:08:18 2021 +0800 @@ -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 ~
--- a/INSTALL.OSX Sat Oct 10 12:58:37 2020 +0800 +++ b/INSTALL.OSX Mon Jun 21 19:08:18 2021 +0800 @@ -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.
--- a/INSTALL.OpenSUSE Sat Oct 10 12:58:37 2020 +0800 +++ b/INSTALL.OpenSUSE Mon Jun 21 19:08:18 2021 +0800 @@ -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
--- a/INSTALL.Ubuntu Sat Oct 10 12:58:37 2020 +0800 +++ b/INSTALL.Ubuntu Mon Jun 21 19:08:18 2021 +0800 @@ -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
--- a/INSTALL.pkgsrc Sat Oct 10 12:58:37 2020 +0800 +++ b/INSTALL.pkgsrc Mon Jun 21 19:08:18 2021 +0800 @@ -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,
--- a/cmake/Modules/FindIDNA.cmake Sat Oct 10 12:58:37 2020 +0800 +++ /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.h>) -# 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 ) -
--- a/contrib/RPM/freeDiameter.spec Sat Oct 10 12:58:37 2020 +0800 +++ b/contrib/RPM/freeDiameter.spec Mon Jun 21 19:08:18 2021 +0800 @@ -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
--- a/contrib/debian/control Sat Oct 10 12:58:37 2020 +0800 +++ b/contrib/debian/control Mon Jun 21 19:08:18 2021 +0800 @@ -4,7 +4,7 @@ Maintainer: Sebastien Decugis <sdecugis@freediameter.net> 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
--- a/contrib/nightly_tests/prereqs.fedora Sat Oct 10 12:58:37 2020 +0800 +++ b/contrib/nightly_tests/prereqs.fedora Mon Jun 21 19:08:18 2021 +0800 @@ -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:
--- a/include/freeDiameter/CMakeLists.txt Sat Oct 10 12:58:37 2020 +0800 +++ b/include/freeDiameter/CMakeLists.txt Mon Jun 21 19:08:18 2021 +0800 @@ -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 <idna.h> - 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)
--- a/libfdcore/CMakeLists.txt Sat Oct 10 12:58:37 2020 +0800 +++ b/libfdcore/CMakeLists.txt Mon Jun 21 19:08:18 2021 +0800 @@ -2,10 +2,7 @@ Project("freeDiameter core library" C) # Configuration for newer cmake -cmake_policy(VERSION 2.6) -if (POLICY CMP0022) - cmake_policy(SET CMP0022 OLD) -endif (POLICY CMP0022) +cmake_policy(VERSION 2.8.12) # Configuration parser BISON_FILE(fdd.y)
--- a/libfdcore/p_ce.c Sat Oct 10 12:58:37 2020 +0800 +++ b/libfdcore/p_ce.c Mon Jun 21 19:08:18 2021 +0800 @@ -336,6 +336,14 @@ return EINVAL; } + /* Origin-Realm is empty */ + if (hdr->avp_value->os.len == 0) { + error->pei_errcode = "DIAMETER_INVALID_AVP_VALUE"; + error->pei_message = "Your Origin-Realm is empty."; + error->pei_avp = avp; + return EINVAL; + } + /* Save the value */ CHECK_MALLOC( peer->p_hdr.info.runtime.pir_realm = os0dup( hdr->avp_value->os.data, hdr->avp_value->os.len ) ); peer->p_hdr.info.runtime.pir_realmlen = hdr->avp_value->os.len;
--- a/libfdproto/CMakeLists.txt Sat Oct 10 12:58:37 2020 +0800 +++ b/libfdproto/CMakeLists.txt Mon Jun 21 19:08:18 2021 +0800 @@ -2,10 +2,7 @@ Project("libfdproto" C) # Configuration for newer cmake -cmake_policy(VERSION 2.6) -if (POLICY CMP0022) - cmake_policy(SET CMP0022 OLD) -endif (POLICY CMP0022) +cmake_policy(VERSION 2.8.12) # List of source files for the library SET(LFDPROTO_SRC @@ -30,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
--- a/libfdproto/messages.c Sat Oct 10 12:58:37 2020 +0800 +++ b/libfdproto/messages.c Mon Jun 21 19:08:18 2021 +0800 @@ -1776,13 +1776,13 @@ if (avp->avp_model == NULL) { /* In the case where we don't know the type of AVP, just copy the raw data or source */ - CHECK_PARAMS( avp->avp_source || avp->avp_rawdata ); + /* there might be no data if the AVP is empty */ if ( avp->avp_rawdata != NULL ) { /* the content was stored in rawdata */ memcpy(&buffer[*offset], avp->avp_rawdata, avp->avp_rawlen); *offset += PAD4(avp->avp_rawlen); - } else { + } else if ( avp->avp_source != NULL ) { /* the message was not parsed completely */ size_t datalen = avp->avp_public.avp_len - GETAVPHDRSZ(avp->avp_public.avp_flags); memcpy(&buffer[*offset], avp->avp_source, datalen);
--- a/libfdproto/ostr.c Sat Oct 10 12:58:37 2020 +0800 +++ b/libfdproto/ostr.c Mon Jun 21 19:08:18 2021 +0800 @@ -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.h> /* idna_to_ascii_8z() */ +/* Process IDNA with stringprep -- See RFC5890 -- and libidn2 documentation... */ +#include <idn2.h> /* 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; }