commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-104-g70575


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-104-g705750b
Date: Sun, 5 Apr 2020 10:25:53 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  705750b8b4a62f23cc08dfc0eb06813fb49e4d1f (commit)
      from  2117c3140a5c9dfe9e959961e1ae4ad89bf76294 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=705750b8b4a62f23cc08dfc0eb06813fb49e4d1f


commit 705750b8b4a62f23cc08dfc0eb06813fb49e4d1f
Author: Mats Erik Andersson <address@hidden>
Date:   Sun Apr 5 16:21:30 2020 +0200

    Support for libidn2 in addition to libidn.
    
    Prefer libidn2 when both are present and usable.

diff --git a/ChangeLog b/ChangeLog
index d817c09..d616be8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2020-04-05  Mats Erik Andersson  <address@hidden>
+
+       Support for libidn2 in addition to libidn.
+
+       * am/libidn.m4 (have_IDN2, have_IDN): New local variables.
+       Detect presence of libidn2 by checking for `idn2_to_ascii_lz',
+       but still aim at backwards compatibility.  Detect header file
+       `idna.h' as well as `idn2.h', but prefer libidn2 to libidn,
+       should both libraries be detected.
+       * configure.ac (--with-idn): Mention that IDN2 is acceptable.
+       (idn_link): New variable.
+       (ftp_PROPS, ping_PROPS, talk_PROPS, telnet_PROPS, tftp_PROPS)
+       (traceroute_PROPS): Update these to state `idn', or `idn2'.
+
+       * ftp/ftp.c [HAVE_IDN2_H && HAVE_IDN2]: Include `idn2.h'.
+       [(!HAVE_IDN2_H || !HAVE_IDN2) && HAVE_IDNA_H]: Include `idna.h'.
+       (hookup) [HAVE_IDN || HAVE_IDN2]: Use compatibility function
+       idna_to_ascii_lz().
+       * ping/libping.c (ping_set_dest): Likewise.
+       * ping/ping6.c (ping_set_dest): Likewise.
+       * src/tftp.c (resolve_name): Likewise.
+       * src/traceroute.c (main): Likewise.
+       * talk/get_addrs.c (get_addrs)
+       [HAVE_DECL_GETADDRINFO || HAVE_IDN || HAVE_IDN2]: Declare ERR.
+       [HAVE_IDN || HAVE_IDN2]: Likewise.
+       * telnet/commands.c (tn): Declare HOSTTMP.  Likewise.
+
 2020-04-04  Alfred M. Szmidt  <address@hidden>
 
        * ping/ping6.c (print_packet_too_big): Use %u when printing MTU.
diff --git a/am/libidn.m4 b/am/libidn.m4
index ab2121c..68c43fd 100644
--- a/am/libidn.m4
+++ b/am/libidn.m4
@@ -1,4 +1,4 @@
-# libidn.m4 serial 1
+# libidn.m4 serial 2
 dnl Copyright (C) 2013-2020 Free Software Foundation, Inc.
 dnl
 dnl This file is part of GNU Inetutils.
@@ -44,9 +44,21 @@ then
     INCIDN=-I$2
   fi
 
-  AC_CHECK_LIB([idn], [idna_to_ascii_lz],
-              [LIBIDN="$LIBIDN -lidn"], [INCIDN= LIBIDN=],
-              [$LIBIDN])
+  AC_CHECK_LIB([idn2], [idn2_to_ascii_lz], [have_IDN2=yes], , [$LIBIDN])
+
+  AC_CHECK_LIB([idn], [idna_to_ascii_lz], [have_IDN=yes], , [$LIBIDN])
+
+  if test x"$have_IDN2" = xyes
+  then
+    LIBIDN="$LIBIDN -lidn2"
+  else
+    if test x"$have_IDN" = xyes
+    then
+      LIBIDN="$LIBIDN -lidn"
+    else
+      INCIDN= LIBIDN=
+    fi
+  fi
 
   # Some systems are known to install <idna.h> below
   # '/usr/include/idn'.  The caching performed by
@@ -54,16 +66,23 @@ then
   # repeated call of the macro.  Functional alternative?
   save_CPPFLAGS=$CPPFLAGS
   CPPFLAGS="$CPPFLAGS $INCIDN"
-  AC_CHECK_HEADERS([idna.h])
+
+  AC_CHECK_HEADERS([idna.h idn2.h])
 
   AC_MSG_CHECKING([if GNU libidn is available])
-  if test "$ac_cv_lib_idn_idna_to_ascii_lz" = yes \
-      && test "$ac_cv_header_idna_h" = yes; then
-    AC_DEFINE(HAVE_IDN, 1, [Define to 1 for use of GNU Libidn.])
-    AC_MSG_RESULT($ac_cv_lib_idn_idna_to_ascii_lz)
+  if test "$ac_cv_lib_idn2_idn2_to_ascii_lz" = yes \
+      && test "$ac_cv_header_idn2_h" = yes; then
+    AC_DEFINE(HAVE_IDN2, 1, [Define to 1 for use of GNU Libidn2.])
+    AC_MSG_RESULT($ac_cv_lib_idn2_idn2_to_ascii_lz)
   else
-    AC_MSG_RESULT([no])
-    INCIDN= LIBIDN=
+    if test "$ac_cv_lib_idn_idna_to_ascii_lz" = yes \
+       && test "$ac_cv_header_idna_h" = yes; then
+      AC_DEFINE(HAVE_IDN, 1, [Define to 1 for use of GNU Libidn.])
+      AC_MSG_RESULT($ac_cv_lib_idn_idna_to_ascii_lz)
+    else
+      AC_MSG_RESULT([no])
+      INCIDN= LIBIDN=
+    fi
   fi
   CPPFLAGS=$save_CPPFLAGS
 fi
diff --git a/configure.ac b/configure.ac
index 5852746..a8bdae5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,7 +86,7 @@ AC_ARG_WITH([pam],
                            [Add support for PAM]))
 AC_ARG_WITH([idn],
   AS_HELP_STRING([--with-idn[[=DIR]]],
-                [Use IDN support, with optional inclusion directory]), ,
+                [Use IDN or IDN2 support, with optional inclusion directory]), 
,
                 [with_idn=no])
 AC_ARG_WITH([libidn-prefix],
   AS_HELP_STRING([--with-libidn-prefix[[=DIR]]],
@@ -1124,12 +1124,14 @@ rlogind_PROPS="${rlogind_PROPS:+$rlogind_PROPS 
}$LIBWRAP"
 
 # Support for libidn.
 
-ftp_PROPS="${ftp_PROPS:+$ftp_PROPS }${LIBIDN:+-lidn}"
-ping_PROPS="${ping_PROPS:+$ping_PROPS }${LIBIDN:+-lidn}"
-talk_PROPS="${talk_PROPS:+$talk_PROPS }${LIBIDN:+-lidn}"
-telnet_PROPS="${telnet_PROPS:+$telnet_PROPS }${LIBIDN:+-lidn}"
-tftp_PROPS="${tftp_PROPS:+$tftp_PROPS }${LIBIDN:+-lidn}"
-traceroute_PROPS="${traceroute_PROPS:+$traceroute_PROPS }${LIBIDN:+-lidn}"
+idn_link=`expr X"$LIBIDN" : '.*-l\(idn2*\)'`
+
+ftp_PROPS="${ftp_PROPS:+$ftp_PROPS }${LIBIDN:+$idn_link}"
+ping_PROPS="${ping_PROPS:+$ping_PROPS }${LIBIDN:+$idn_link}"
+talk_PROPS="${talk_PROPS:+$talk_PROPS }${LIBIDN:+$idn_link}"
+telnet_PROPS="${telnet_PROPS:+$telnet_PROPS }${LIBIDN:+$idn_link}"
+tftp_PROPS="${tftp_PROPS:+$tftp_PROPS }${LIBIDN:+$idn_link}"
+traceroute_PROPS="${traceroute_PROPS:+$traceroute_PROPS }${LIBIDN:+$idn_link}"
 
 # Termcap variants.
 
diff --git a/ftp/ftp.c b/ftp/ftp.c
index 061eccb..d474051 100644
--- a/ftp/ftp.c
+++ b/ftp/ftp.c
@@ -81,7 +81,9 @@
 #include <stdarg.h>
 #include <sys/select.h>
 
-#ifdef HAVE_IDNA_H
+#if defined HAVE_IDN2_H && defined HAVE_IDN2
+# include <idn2.h>
+#elif defined HAVE_IDNA_H
 # include <idna.h>
 #endif
 
@@ -135,7 +137,7 @@ hookup (char *host, int port)
   if (p && p != host && isprint (p[1]))
     host = ++p;
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   status = idna_to_ascii_lz (host, &rhost, 0);
   if (status)
     {
@@ -143,7 +145,7 @@ hookup (char *host, int port)
       code = -1;
       return ((char *) 0);
     }
-#else /* !HAVE_IDN */
+#else /* !HAVE_IDN && !HAVE_IDN2 */
   rhost = strdup (host);
 #endif
 
diff --git a/ping/libping.c b/ping/libping.c
index d771d34..9bfd9a1 100644
--- a/ping/libping.c
+++ b/ping/libping.c
@@ -32,7 +32,9 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-#ifdef HAVE_IDNA_H
+#if defined HAVE_IDN2_H && defined HAVE_IDN2
+# include <idn2.h>
+#elif defined HAVE_IDNA_H
 # include <idna.h>
 #endif
 
@@ -293,7 +295,7 @@ ping_set_dest (PING * ping, const char *host)
   struct addrinfo hints, *res;
   char *rhost;
 
-# ifdef HAVE_IDN
+# if defined HAVE_IDN || defined HAVE_IDN2
   rc = idna_to_ascii_lz (host, &rhost, 0);     /* P is allocated.  */
   if (rc)
     return 1;
@@ -324,7 +326,7 @@ ping_set_dest (PING * ping, const char *host)
   if (res->ai_canonname)
     ping->ping_hostname = strdup (res->ai_canonname);
   else
-# ifdef HAVE_IDN
+# if defined HAVE_IDN || defined HAVE_IDN2
     ping->ping_hostname = host;
 #else
     ping->ping_hostname = strdup (host);
@@ -345,7 +347,7 @@ ping_set_dest (PING * ping, const char *host)
   else
     {
       struct hostent *hp;
-# ifdef HAVE_IDN
+# if defined HAVE_IDN || defined HAVE_IDN2
       char *rhost;
       int rc;
 
@@ -354,7 +356,7 @@ ping_set_dest (PING * ping, const char *host)
        return 1;
       hp = gethostbyname (rhost);
       free (rhost);
-# else /* !HAVE_IDN */
+# else /* !HAVE_IDN && !HAVE_IDN2 */
       hp = gethostbyname (host);
 # endif
       if (!hp)
diff --git a/ping/ping6.c b/ping/ping6.c
index 995d71d..871f60a 100644
--- a/ping/ping6.c
+++ b/ping/ping6.c
@@ -44,7 +44,9 @@
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
 #endif
-#ifdef HAVE_IDNA_H
+#if defined HAVE_IDN2_H && defined HAVE_IDN2
+# include <idn2.h>
+#elif defined HAVE_IDNA_H
 # include <idna.h>
 #endif
 
@@ -1004,12 +1006,12 @@ ping_set_dest (PING * ping, const char *host)
   struct addrinfo *result, hints;
   char *rhost;
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   err = idna_to_ascii_lz (host, &rhost, 0);
   if (err)
     return 1;
   host = rhost;
-#else /* !HAVE_IDN */
+#else /* !HAVE_IDN && !HAVE_IDN2 */
   rhost = NULL;
 #endif
 
@@ -1035,7 +1037,7 @@ ping_set_dest (PING * ping, const char *host)
   if (result->ai_canonname)
     ping->ping_hostname = strdup (result->ai_canonname);
   else
-#if HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
     ping->ping_hostname = host;
 #else
   ping->ping_hostname = strdup (host);
diff --git a/src/tftp.c b/src/tftp.c
index e44dd58..670253e 100644
--- a/src/tftp.c
+++ b/src/tftp.c
@@ -73,7 +73,9 @@
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
 #endif
-#ifdef HAVE_IDNA_H
+#if defined HAVE_IDN2_H && defined HAVE_IDN2
+# include <idn2.h>
+#elif defined HAVE_IDNA_H
 # include <idna.h>
 #endif
 
@@ -313,14 +315,14 @@ resolve_name (char *name)
   struct sockaddr_storage ss;
   struct addrinfo hints, *ai, *aiptr;
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   err = idna_to_ascii_lz (name, &rname, 0);
   if (err)
     {
       fprintf (stderr, "tftp: %s: %s\n", name, idna_strerror (err));
       return RESOLVE_FAIL;
     }
-#else /* !HAVE_IDN */
+#else /* !HAVE_IDN && !HAVE_IDN2 */
   rname = name;
 #endif
 
@@ -342,7 +344,7 @@ resolve_name (char *name)
       return RESOLVE_FAIL;
     }
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   free (rname);
 #endif
 
diff --git a/src/traceroute.c b/src/traceroute.c
index 8d52bf2..3107c8b 100644
--- a/src/traceroute.c
+++ b/src/traceroute.c
@@ -53,7 +53,9 @@
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
 #endif
-#ifdef HAVE_IDNA_H
+#if defined HAVE_IDN2_H && defined HAVE_IDN2
+# include <idn2.h>
+#elif defined HAVE_IDNA_H
 # include <idna.h>
 #endif
 
@@ -301,13 +303,13 @@ main (int argc, char **argv)
 # endif
 #endif
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   rc = idna_to_ascii_lz (hostname, &rhost, 0);
   free (hostname);
 
   if (rc)
     error (EXIT_FAILURE, 0, "unknown host");
-#else /* !HAVE_IDN */
+#else /* !HAVE_IDN && !HAVE_IDN2 */
   rhost = hostname;
 #endif
 
diff --git a/talk/get_addrs.c b/talk/get_addrs.c
index e97f0b5..563fbad 100644
--- a/talk/get_addrs.c
+++ b/talk/get_addrs.c
@@ -57,7 +57,9 @@
 #include <netdb.h>
 #include <stdio.h>
 #include <unistd.h>
-#ifdef HAVE_IDNA_H
+#if defined HAVE_IDN2_H && defined HAVE_IDN2
+# include <idn2.h>
+#elif defined HAVE_IDNA_H
 # include <idna.h>
 #endif
 
@@ -66,7 +68,7 @@
 int
 get_addrs (char *my_machine_name, char *his_machine_name)
 {
-#if HAVE_DECL_GETADDRINFO || defined HAVE_IDN
+#if HAVE_DECL_GETADDRINFO || defined HAVE_IDN || defined HAVE_IDN2
   int err;
 #endif
   char *lhost, *rhost;
@@ -77,7 +79,7 @@ get_addrs (char *my_machine_name, char *his_machine_name)
 #endif
   struct servent *sp;
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   err = idna_to_ascii_lz (my_machine_name, &lhost, 0);
   if (err)
     {
@@ -93,7 +95,7 @@ get_addrs (char *my_machine_name, char *his_machine_name)
               his_machine_name, idna_strerror (err));
       exit (-1);
     }
-#else /* !HAVE_IDN */
+#else /* !HAVE_IDN && !HAVE_IDN2 */
   lhost = my_machine_name;
   rhost = his_machine_name;
 #endif
@@ -236,7 +238,7 @@ get_addrs (char *my_machine_name, char *his_machine_name)
     }
   daemon_port = ntohs (sp->s_port);
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   free (lhost);
   free (rhost);
 #endif
diff --git a/telnet/commands.c b/telnet/commands.c
index d935108..29b2bfd 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -72,7 +72,9 @@
 #include <arpa/inet.h>
 #include <arpa/telnet.h>
 
-#ifdef HAVE_IDNA_H
+#if defined HAVE_IDN2_H && defined HAVE_IDN2
+# include <idn2.h>
+#elif defined HAVE_IDNA_H
 # include <idna.h>
 #endif
 
@@ -2454,7 +2456,7 @@ tn (int argc, char *argv[])
   const int on = 1;
   int err;
   char *cmd, *hostp = 0, *portp = 0, *user = 0;
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   char *hosttmp = 0;
 #endif
 
@@ -2602,7 +2604,7 @@ tn (int argc, char *argv[])
   }
 #endif /* AUTHENTICATION || ENCRYPTION */
 
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   err = idna_to_ascii_lz (hostp, &hosttmp, 0);
   if (err)
     {
@@ -2611,7 +2613,7 @@ tn (int argc, char *argv[])
       return 0;
     }
   hostp = hosttmp;
-#endif /* !HAVE_IDN */
+#endif /* !HAVE_IDN && !HAVE_IDN2 */
 
 #ifdef IPV6
   hints.ai_socktype = SOCK_STREAM;
@@ -2786,7 +2788,7 @@ tn (int argc, char *argv[])
 #endif /* !IPV6 */
 
   cmdrc (hostp, hostname);
-#ifdef HAVE_IDN
+#if defined HAVE_IDN || defined HAVE_IDN2
   /* Last use of HOSTP, alias HOSTTMP.  */
   free (hosttmp);
 #endif

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         | 27 +++++++++++++++++++++++++++
 am/libidn.m4      | 41 ++++++++++++++++++++++++++++++-----------
 configure.ac      | 16 +++++++++-------
 ftp/ftp.c         |  8 +++++---
 ping/libping.c    | 12 +++++++-----
 ping/ping6.c      | 10 ++++++----
 src/tftp.c        | 10 ++++++----
 src/traceroute.c  |  8 +++++---
 talk/get_addrs.c  | 12 +++++++-----
 telnet/commands.c | 12 +++++++-----
 10 files changed, 109 insertions(+), 47 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]