Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compiler:
- clang
- gcc
before_install:
- sudo apt-get install -qq autotools-dev libidn11-dev
- sudo apt-get install -qq autotools-dev libidn11-dev libidn2-0-dev
before_script:
- ./autogen.sh
script: ./configure && make V=1 && make check V=1
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ AC_ARG_WITH([libidn-headers],
[CFLAGS="$CFLAGS -I$with_libidn_headers"],
[])

AC_ARG_WITH([libidn2],
[AS_HELP_STRING([--with-libidn2], [Support IDN (needs GNU libidn2) @<:@check@:>@])],
[with_libidn2="$withval"],
[with_libidn2="check"])
AS_IF([test x"$with_libidn2" != xno],
[AC_SEARCH_LIBS([idn2_check_version], [idn2],
[AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 is available.])],
[AS_IF([test x"$with_idn2" = xcheck],
[AC_MSG_WARN([Unable to find libidn2.])],
[AC_MSG_ERROR([--with-libidn2 was given but libidn2 was not found.])])])])

AC_CHECK_LIB([resolv], [res_mkquery], [], [
AC_MSG_CHECKING([if res_mkquery is provided by libresolv with mangled symbols])
save_LIBS="$LIBS"
Expand Down
12 changes: 12 additions & 0 deletions src/lib/hesiod.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ static const char rcsid[] = "$Id: hesiod.c,v 1.30 2002-04-03 21:40:55 ghudson Ex
#include <idna.h>
#include <idn-free.h>
#endif
#ifdef HAVE_LIBIDN2
#include <idn2.h>
#endif
#include "hesiod.h"

/* A few operating systems don't define this. */
Expand Down Expand Up @@ -246,6 +249,15 @@ char *hesiod_to_bind(void *context, const char *name, const char *type)
}
ret = strdup(idn_ret);
idn_free(idn_ret);
#elif HAVE_LIBIDN2
rc = idn2_to_ascii_lz(bindname, &idn_ret, 0);
if (rc != IDN2_OK)
{
errno = EINVAL;
return NULL;
}
ret = strdup(idn_ret);
idn2_free(idn_ret);
#else
ret = strdup(bindname);
#endif
Expand Down