mirror of
https://github.com/curl/curl.git
synced 2026-08-25 21:03:34 +03:00
idn: switch to libidn2 use and IDNA2008 support
CVE-2016-8625 Bug: https://curl.haxx.se/docs/adv_20161102K.html Reported-by: Christian Heimes
This commit is contained in:
parent
42b650b9ea
commit
9c91ec7781
8 changed files with 66 additions and 254 deletions
76
configure.ac
76
configure.ac
|
|
@ -157,7 +157,7 @@ curl_tls_srp_msg="no (--enable-tls-srp)"
|
|||
curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
|
||||
curl_ipv6_msg="no (--enable-ipv6)"
|
||||
curl_unix_sockets_msg="no (--enable-unix-sockets)"
|
||||
curl_idn_msg="no (--with-{libidn,winidn})"
|
||||
curl_idn_msg="no (--with-{libidn2,winidn})"
|
||||
curl_manual_msg="no (--enable-manual)"
|
||||
curl_libcurl_msg="enabled (--disable-libcurl-option)"
|
||||
curl_verbose_msg="enabled (--disable-verbose)"
|
||||
|
|
@ -2830,15 +2830,15 @@ dnl **********************************************************************
|
|||
dnl Check for the presence of IDN libraries and headers
|
||||
dnl **********************************************************************
|
||||
|
||||
AC_MSG_CHECKING([whether to build with libidn])
|
||||
AC_MSG_CHECKING([whether to build with libidn2])
|
||||
OPT_IDN="default"
|
||||
AC_ARG_WITH(libidn,
|
||||
AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
|
||||
AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
|
||||
AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
|
||||
AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
|
||||
[OPT_IDN=$withval])
|
||||
case "$OPT_IDN" in
|
||||
no)
|
||||
dnl --without-libidn option used
|
||||
dnl --without-libidn2 option used
|
||||
want_idn="no"
|
||||
AC_MSG_RESULT([no])
|
||||
;;
|
||||
|
|
@ -2849,13 +2849,13 @@ case "$OPT_IDN" in
|
|||
AC_MSG_RESULT([(assumed) yes])
|
||||
;;
|
||||
yes)
|
||||
dnl --with-libidn option used without path
|
||||
dnl --with-libidn2 option used without path
|
||||
want_idn="yes"
|
||||
want_idn_path="default"
|
||||
AC_MSG_RESULT([yes])
|
||||
;;
|
||||
*)
|
||||
dnl --with-libidn option used with path
|
||||
dnl --with-libidn2 option used with path
|
||||
want_idn="yes"
|
||||
want_idn_path="$withval"
|
||||
AC_MSG_RESULT([yes ($withval)])
|
||||
|
|
@ -2872,33 +2872,33 @@ if test "$want_idn" = "yes"; then
|
|||
if test "$want_idn_path" != "default"; then
|
||||
dnl path has been specified
|
||||
IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
|
||||
CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
|
||||
CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
|
||||
if test "$PKGCONFIG" != "no"; then
|
||||
IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
|
||||
$PKGCONFIG --libs-only-l libidn 2>/dev/null`
|
||||
$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
|
||||
IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
|
||||
$PKGCONFIG --libs-only-L libidn 2>/dev/null`
|
||||
$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
|
||||
IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
|
||||
$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
|
||||
$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
|
||||
IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
|
||||
else
|
||||
dnl pkg-config not available or provides no info
|
||||
IDN_LIBS="-lidn"
|
||||
IDN_LIBS="-lidn2"
|
||||
IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
|
||||
IDN_CPPFLAGS="-I$want_idn_path/include"
|
||||
IDN_DIR="$want_idn_path/lib$libsuff"
|
||||
fi
|
||||
else
|
||||
dnl path not specified
|
||||
CURL_CHECK_PKGCONFIG(libidn)
|
||||
CURL_CHECK_PKGCONFIG(libidn2)
|
||||
if test "$PKGCONFIG" != "no"; then
|
||||
IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
|
||||
IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
|
||||
IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
|
||||
IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
|
||||
IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
|
||||
IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
|
||||
IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
|
||||
else
|
||||
dnl pkg-config not available or provides no info
|
||||
IDN_LIBS="-lidn"
|
||||
IDN_LIBS="-lidn2"
|
||||
fi
|
||||
fi
|
||||
#
|
||||
|
|
@ -2918,9 +2918,9 @@ if test "$want_idn" = "yes"; then
|
|||
LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
|
||||
LIBS="$IDN_LIBS $LIBS"
|
||||
#
|
||||
AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
|
||||
AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
|
||||
AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
tst_links_libidn="yes"
|
||||
|
|
@ -2928,37 +2928,19 @@ if test "$want_idn" = "yes"; then
|
|||
AC_MSG_RESULT([no])
|
||||
tst_links_libidn="no"
|
||||
])
|
||||
if test "$tst_links_libidn" = "no"; then
|
||||
AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
tst_links_libidn="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
tst_links_libidn="no"
|
||||
])
|
||||
fi
|
||||
#
|
||||
AC_CHECK_HEADERS( idn2.h )
|
||||
|
||||
if test "$tst_links_libidn" = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
|
||||
AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
|
||||
dnl different versions of libidn have different setups of these:
|
||||
AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
|
||||
AC_CHECK_HEADERS( idn-free.h tld.h )
|
||||
if test "x$ac_cv_header_tld_h" = "xyes"; then
|
||||
AC_SUBST([IDN_ENABLED], [1])
|
||||
curl_idn_msg="enabled"
|
||||
if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
|
||||
export LD_LIBRARY_PATH
|
||||
AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
|
||||
CPPFLAGS="$clean_CPPFLAGS"
|
||||
LDFLAGS="$clean_LDFLAGS"
|
||||
LIBS="$clean_LIBS"
|
||||
|
||||
AC_SUBST([IDN_ENABLED], [1])
|
||||
curl_idn_msg="enabled (libidn2)"
|
||||
if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
|
||||
export LD_LIBRARY_PATH
|
||||
AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue