Blame SOURCES/Port-to-libidn2.patch

1acd6d
From 754ea50b570f72609b1931883bf9908d70ead089 Mon Sep 17 00:00:00 2001
1acd6d
From: Robbie Harwood <rharwood@redhat.com>
1acd6d
Date: Mon, 19 Apr 2021 11:35:26 -0400
1acd6d
Subject: [PATCH 3/3] Port to libidn2
1acd6d
1acd6d
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1acd6d
---
1acd6d
 configure.ac     | 20 ++++++++++----------
1acd6d
 src/lib/hesiod.c |  7 +++----
1acd6d
 2 files changed, 13 insertions(+), 14 deletions(-)
1acd6d
1acd6d
diff --git a/configure.ac b/configure.ac
1acd6d
index 9098afa..792345a 100644
1acd6d
--- a/configure.ac
1acd6d
+++ b/configure.ac
1acd6d
@@ -29,16 +29,16 @@ AC_PROG_LIBTOOL
1acd6d
 # Checks for libraries.
1acd6d
 hesiod_save_LIBS="$LIBS"
1acd6d
 LIBS=
1acd6d
-AC_ARG_WITH([libidn],
1acd6d
-  [AS_HELP_STRING([--with-libidn], [Support IDN (needs GNU libidn) @<:@check@:>@])],
1acd6d
-  [with_libidn="$withval"],
1acd6d
-  [with_libidn="check"])
1acd6d
-AS_IF([test x"$with_libidn" != xno],
1acd6d
-  [AC_SEARCH_LIBS([stringprep_check_version], [idn],
1acd6d
-    [AC_DEFINE([HAVE_LIBIDN], [1], [Define if libidn is available.])],
1acd6d
-    [AS_IF([test x"$with_idn" = xcheck],
1acd6d
-      [AC_MSG_WARN([Unable to find libidn.])],
1acd6d
-      [AC_MSG_ERROR([--with-libidn was given but libidn was not found.])])])])
1acd6d
+AC_ARG_WITH([libidn2],
1acd6d
+  [AS_HELP_STRING([--with-libidn2], [Support IDN2 (needs libidn2) @<:@check@:>@])],
1acd6d
+  [with_libidn2="$withval"],
1acd6d
+  [with_libidn2="check"])
1acd6d
+AS_IF([test x"$with_libidn2" != xno],
1acd6d
+  [AC_SEARCH_LIBS([idn2_to_ascii_8z], [idn2],
1acd6d
+    [AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 is available.])],
1acd6d
+    [AS_IF([test x"$with_idn2" = xcheck],
1acd6d
+      [AC_MSG_WARN([Unable to find libidn2.])],
1acd6d
+      [AC_MSG_ERROR([--with-libidn2 was given but libidn2 was not found.])])])])
1acd6d
 
1acd6d
 AC_CHECK_LIB([resolv], [res_mkquery], [], [
1acd6d
     AC_MSG_CHECKING([if res_mkquery is provided by libresolv with mangled symbols])
1acd6d
diff --git a/src/lib/hesiod.c b/src/lib/hesiod.c
1acd6d
index e69a8ca..3745d69 100644
1acd6d
--- a/src/lib/hesiod.c
1acd6d
+++ b/src/lib/hesiod.c
1acd6d
@@ -70,9 +70,8 @@ static const char rcsid[] = "$Id: hesiod.c,v 1.30 2002-04-03 21:40:55 ghudson Ex
1acd6d
 #include <string.h>
1acd6d
 #include <unistd.h>
1acd6d
 #include <ctype.h>
1acd6d
-#ifdef HAVE_LIBIDN
1acd6d
-#include <idna.h>
1acd6d
-#include <idn-free.h>
1acd6d
+#ifdef HAVE_LIBIDN2
1acd6d
+#include <idn2.h>
1acd6d
 #endif
1acd6d
 #include "hesiod.h"
1acd6d
 
1acd6d
@@ -233,7 +232,7 @@ char *hesiod_to_bind(void *context, const char *name, const char *type)
1acd6d
     hesiod_free_list(context, rhs_list);
1acd6d
 
1acd6d
   /* Make a copy of the result and return it to the caller. */
1acd6d
-#ifdef HAVE_LIBIDN
1acd6d
+#ifdef HAVE_LIBIDN2
1acd6d
   rc = idna_to_ascii_lz(bindname, &idn_ret, 0);
1acd6d
   if (rc != IDNA_SUCCESS)
1acd6d
     {
1acd6d
-- 
1acd6d
2.31.0
1acd6d