#1 Fix usage of libidn2 symbols so that gnutls30 can be used (#1683812)
Merged 5 years ago by ngompa. Opened 5 years ago by ngompa.
rpms/ ngompa/gnutls30 el6-fix-linking-with-idn2  into  el6

@@ -0,0 +1,66 @@ 

+ From 3c3e5b52bb70f03cd68a720efb51366bca09beeb Mon Sep 17 00:00:00 2001

+ From: Dakota Williams <drwilliams@datto.com>

+ Date: Thu, 28 Feb 2019 15:54:49 -0500

+ Subject: [PATCH] Add version check for internal idn2 symbols

+ 

+ libidn2 >2.1.0 removed _idn2_punycode_[en|de]code symbols from its

+ library and renamed _idn2_to_unicode_8z8z to idn2_to_unicode_8z8z

+ with a different function declaration.

+ 

+ The preprocessor check in str-idna.c only checks for the existence

+ of libidn2, not the version, for how it should use the library.

+ 

+ This change backports the fix in later versions of GnuTLS

+ to fix the problem.

+ 

+ Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1683812

+ 

+ Co-authored-by: Neal Gompa <ngompa@datto.com>

+ Co-authored-by: Dakota Williams <drwilliams@datto.com>

+ Reviewed-by: Neal Gompa <ngompa@datto.com>

+ Signed-off-by: Dakota Williams <drwilliams@datto.com>

+ Signed-off-by: Neal Gompa <ngompa@datto.com>

+ ---

+  lib/str-idna.c | 12 +++++++++++-

+  1 file changed, 11 insertions(+), 1 deletion(-)

+ 

+ diff --git a/lib/str-idna.c b/lib/str-idna.c

+ index 3bf2db877..1e8c00c08 100644

+ --- a/lib/str-idna.c

+ +++ b/lib/str-idna.c

+ @@ -145,7 +145,7 @@ int gnutls_idna_map(const char *input, unsigned ilen, gnutls_datum_t *out, unsig

+  	return ret;

+  }

+  

+ -#ifdef HAVE_LIBIDN2

+ +#if defined(HAVE_LIBIDN2) && (IDN2_VERSION_NUMBER < 0x02000000)

+  int _idn2_punycode_decode(

+  	size_t input_length,

+  	const char input[],

+ @@ -252,6 +252,7 @@ int gnutls_idna_reverse_map(const char *input, unsigned ilen, gnutls_datum_t *ou

+  	}

+  

+  #ifdef HAVE_LIBIDN2

+ +#if (IDN2_VERSION_NUMBER < 0x02000000)

+  	/* currently libidn2 just converts single labels, thus a wrapper function */

+  	rc = _idn2_to_unicode_8z8z((char*)istr.data, &u8);

+  	if (rc != IDN2_OK) {

+ @@ -260,6 +261,15 @@ int gnutls_idna_reverse_map(const char *input, unsigned ilen, gnutls_datum_t *ou

+  		ret = GNUTLS_E_INVALID_UTF8_STRING;

+  		goto fail;

+  	}

+ +#else

+ +	rc = idn2_to_unicode_8z8z((char*)istr.data, &u8, 0);

+ +	if (rc != IDN2_OK) {

+ +		gnutls_assert();

+ +		_gnutls_debug_log("unable to convert ACE name '%s' to UTF-8 format: %s\n", istr.data, idn2_strerror(rc));

+ +		ret = GNUTLS_E_INVALID_UTF8_STRING;

+ +		goto fail;

+ +	}

+ +#endif

+  #else

+  	rc = idna_to_unicode_8z8z((char*)istr.data, &u8, IDNA_ALLOW_UNASSIGNED);

+  	if (rc != IDNA_SUCCESS) {

+ -- 

+ 2.20.1

+ 

file modified
+8 -2
@@ -3,7 +3,7 @@ 

  Summary:        A TLS protocol implementation

  Name:           gnutls30

  Version:        3.5.19

- Release:        1%{?dist}

+ Release:        2%{?dist}

  # The libraries are LGPLv2.1+ (packaged), utilities are GPLv3+ (unpackaged)

  License:        LGPLv2+

  URL:            https://www.gnutls.org/
@@ -11,6 +11,9 @@ 

  Source1:	ftp://ftp.gnutls.org/gcrypt/gnutls/%{srcname}-%{version}.tar.xz.sig

  Source100:      README.fedora

  

+ # Fix usage of libidn2 symbols so that gnutls30 can be used (#1683812)

+ Patch0001:	0001-Add-version-check-for-internal-idn2-symbols.patch

+ 

  BuildRequires:  zlib-devel, libidn2-devel, gmp-devel, nettle-devel

  BuildRequires:  unbound-devel, libunistring-devel

  BuildRequires:  chrpath
@@ -48,7 +51,7 @@ 

  the GnuTLS library.

  

  %prep

- %setup -q -n %{srcname}-%{version}

+ %autosetup -n %{srcname}-%{version} -p1

  

  install -m 0644 %{SOURCE100} README.fedora

  
@@ -145,6 +148,9 @@ 

  %{_libdir}/gnutls30

  

  %changelog

+ * Thu Feb 28 2019 Neal Gompa <ngompa@datto.com> 3.5.19-2

+ - Fix usage of libidn2 symbols so that gnutls30 can be used (#1683812)

+ 

  * Mon Oct  1 2018 Nikos Mavrogiannopoulos <nmav@redhat.com> 3.5.19-1

  - Updated to 3.5.19

  

This PR adds a patch to gnutls30 so that it builds properly against the latest version of libidn2 and applications can successfully link with it.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1683812

Note that gnutls30 is broken right now, and this needs to be merged in ASAP to fix it. If it is not merged in a day or so, I'll merge it myself and submit builds.

rebased onto e4ffff4

5 years ago

Pull-Request has been merged by ngompa

5 years ago