[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-158-g38416
From: |
Mats Erik Andersson |
Subject: |
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-158-g3841619 |
Date: |
Fri, 31 Aug 2012 16:25:37 +0000 |
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 3841619d01f81d265c9cec7c37a1388bda465a1b (commit)
from 910a251821bd879991cc11f73908402e575c3d5e (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=3841619d01f81d265c9cec7c37a1388bda465a1b
commit 3841619d01f81d265c9cec7c37a1388bda465a1b
Author: Mats Erik Andersson <address@hidden>
Date: Fri Aug 31 17:30:50 2012 +0200
ping, ping6: Support IDN named hosts.
diff --git a/ChangeLog b/ChangeLog
index 87b909a..1c8c87f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2012-08-31 Mats Erik Andersson <address@hidden>
+
+ ping, ping6: Support IDN named hosts.
+
+ * configure.ac: New checks for `locale.h' and setlocale().
+ (--with-idn): New setting.
+ (INCIDN, LIBIDN): New variables.
+ * ping/Makefile.am (ping_LDADD): Add $(LIBIDN).
+ (ping6_LDADD): Likewise.
+ (INCLUDES): Add $(INCIDN).
+ * ping/libping.c [HAVE_LOCALE_H]: Include <locale.h>.
+ [HAVE_IDNA_H]: Include <idna.h>.
+ (ping_set_dest) [HAVE_IDN]: New variables P and RC.
+ Resolve HOST by a call to idna_to_ascii_lz().
+ [HAVE_IDN && HAVE_SETLOCALE]: Call setlocale().
+ * ping/ping6.c [HAVE_LOCALE_H]: Include <locale.h>.
+ [HAVE_IDNA_H]: Include <idna.h>.
+ (ping_set_dest): New variable RHOST used in getaddrinfo().
+ [!HAVE_IDN]: Make RHOST a reference to HOST.
+ [HAVE_IDN]: Resolve HOST by a call to idna_to_ascii_lz().
+ [HAVE_IDN && HAVE_SETLOCALE]: Call setlocale().
+
2012-08-30 Mats Erik Andersson <address@hidden>
* configure.ac: Add a final AC_MSG_NOTICE, containing a summary
diff --git a/configure.ac b/configure.ac
index d147fd5..e313b59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,10 @@ AC_ARG_WITH([wrap],
AC_ARG_WITH([pam],
AC_HELP_STRING([--with-pam],
[Add support for PAM]))
+AC_ARG_WITH([idn],
+ AC_HELP_STRING([--with-idn],
+ [Use IDN support, with optional inclusion directory]), ,
+ [with_idn=no])
IU_ENABLE_SERVER(ftpd)
IU_ENABLE_SERVER(inetd)
@@ -557,6 +561,31 @@ if test "$with_wrap" = yes; then
fi
AC_SUBST(LIBWRAP)
+### Check for GNU Libidn
+AC_CHECK_HEADERS([locale.h])
+AC_CHECK_FUNCS([setlocale])
+if test x"$with_idn" != xno \
+ && test "$ac_cv_header_locale_h" = yes \
+ && test "$ac_cv_func_setlocale" = yes; then
+ AC_MSG_CHECKING([if GNU libidn is available])
+ if test x"$with_idn" != xyes; then
+ INCIDN=-I$with_idn
+ fi
+ save_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $INCIDN"
+ AC_CHECK_HEADERS([idna.h])
+ if test "$ac_cv_header_idna_h" = yes; then
+ AC_CHECK_LIB(idn, idna_to_ascii_lz, [LIBIDN=-lidn], [INCIDN=])
+ if test "$ac_cv_lib_idn_idna_to_ascii_lz" = yes; then
+ AC_DEFINE(HAVE_IDN, 1, [Define to 1 for use of GNU Libidn.])
+ fi
+ fi
+ AC_MSG_RESULT($ac_cv_lib_idna_to_ascii_lz)
+ CPPFLAGS=$save_CPPFLAGS
+fi
+AC_SUBST([LIBIDN])
+AC_SUBST([INCIDN])
+
### Checks for header files.
AC_HEADER_STDC
@@ -963,8 +992,10 @@ ${ftp_BUILD:+${LIBREADLINE:+$LIBREADLINE }$LIBTERMCAP}
hostname ${enable_hostname}
ifconfig ${enable_ifconfig}
logger ${enable_logger}
- ping ${enable_ping}
- ping6 ${enable_ping6}
+ ping ${enable_ping} \
+${ping_BUILD:+$LIBIDN}
+ ping6 ${enable_ping6} \
+${ping6_BUILD:+$LIBIDN}
rcp ${enable_rcp} \
${rcp_BUILD:+$KERBEROS_VERSION}
rexec ${enable_rexec}
diff --git a/ping/Makefile.am b/ping/Makefile.am
index 8314662..0b51189 100644
--- a/ping/Makefile.am
+++ b/ping/Makefile.am
@@ -22,9 +22,9 @@ bin_PROGRAMS = $(ping_BUILD) $(ping6_BUILD)
EXTRA_PROGRAMS = ping ping6
-ping_LDADD = $(iu_LIBRARIES) $(top_builddir)/libicmp/libicmp.a
-ping6_LDADD = $(iu_LIBRARIES)
-INCLUDES = $(iu_INCLUDES) -I$(top_srcdir)/libicmp
+ping_LDADD = $(iu_LIBRARIES) $(top_builddir)/libicmp/libicmp.a $(LIBIDN)
+ping6_LDADD = $(iu_LIBRARIES) $(LIBIDN)
+INCLUDES = $(iu_INCLUDES) -I$(top_srcdir)/libicmp $(INCIDN)
ping_SOURCES = ping.c ping_common.c ping_echo.c ping_address.c \
ping_router.c ping_timestamp.c ping_common.h ping_impl.h ping.h libping.c
diff --git a/ping/libping.c b/ping/libping.c
index 41d3f92..a2bf3d7 100644
--- a/ping/libping.c
+++ b/ping/libping.c
@@ -33,6 +33,12 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+#ifdef HAVE_IDNA_H
+# include <idna.h>
+#endif
#include "ping.h"
@@ -273,7 +279,22 @@ ping_set_dest (PING * ping, char *host)
ping->ping_hostname = strdup (host);
else
{
- struct hostent *hp = gethostbyname (host);
+ struct hostent *hp;
+#ifdef HAVE_IDN
+ char *p;
+ int rc;
+
+# ifdef HAVE_SETLOCALE
+ setlocale(LC_ALL, "");
+# endif
+ rc = idna_to_ascii_lz (host, &p, 0);
+ if (rc)
+ return 1;
+ hp = gethostbyname (p);
+ free (p);
+#else /* !HAVE_IDN */
+ hp = gethostbyname (host);
+#endif
if (!hp)
return 1;
diff --git a/ping/ping6.c b/ping/ping6.c
index d432af4..4f3e948 100644
--- a/ping/ping6.c
+++ b/ping/ping6.c
@@ -41,6 +41,12 @@
#include <ctype.h>
#include <errno.h>
#include <limits.h>
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+#ifdef HAVE_IDNA_H
+# include <idna.h>
+#endif
#include <xalloc.h>
#include "ping6.h"
@@ -877,12 +883,26 @@ ping_set_dest (PING * ping, char *host)
{
int err;
struct addrinfo *result, hints;
+ char *rhost;
- memset (&hints, 0, sizeof (hints));
+#ifdef HAVE_IDN
+# ifdef HAVE_SETLOCALE
+ setlocale (LC_ALL, "");
+# endif
+ err = idna_to_ascii_lz (host, &rhost, 0);
+ if (err)
+ return 1;
+#else /* !HAVE_IDN */
+ rhost = host;
+#endif
+ memset (&hints, 0, sizeof (hints));
hints.ai_family = AF_INET6;
- err = getaddrinfo (host, NULL, &hints, &result);
+ err = getaddrinfo (rhost, NULL, &hints, &result);
+#if HAVE_IDN
+ free (rhost);
+#endif
if (err)
return 1;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 22 ++++++++++++++++++++++
configure.ac | 35 +++++++++++++++++++++++++++++++++--
ping/Makefile.am | 6 +++---
ping/libping.c | 23 ++++++++++++++++++++++-
ping/ping6.c | 24 ++++++++++++++++++++++--
5 files changed, 102 insertions(+), 8 deletions(-)
hooks/post-receive
--
GNU Inetutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-158-g3841619,
Mats Erik Andersson <=