aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--Versions.def3
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure8
-rw-r--r--configure.in5
-rw-r--r--resolv/netdb.h8
-rw-r--r--sysdeps/posix/getaddrinfo.c18
7 files changed, 61 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 68a9ea47fc..c3d439f164 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2004-03-07 Ulrich Drepper <drepper@redhat.com>
+ * config.h.in: Add entry for HAVE_LIBIDN.
+ * configure.in: If libidn add-on present define HAVE_LIBIDN.
+ * Versions.def: Add entry for libcidn.
+
+2004-03-07 Simon Josefsson <jas@extundo.com>
+
+ * resolv/netdb.h [__USE_GNU]: Add new AI_IDN ai_flags for addrinfo.
+ [__USE_GNU]: Add new error code EAI_IDN_ENCODE for getaddrinfo.
+ * sysdeps/posix/getaddrinfo.c: Add prototype for __idna_to_ascii_lz
+ and define IDNA_SUCCESS.
+ (gaih_inet): If ai_flags have AI_IDN, invoke __idna_to_ascii_lz.
+ (getaddrinfo): Fix EAI_BADFLAGS test to include AI_IDN.
+ All changes only applicable when glibc is compiled with the libidn
+ add-on.
+
+2004-03-07 Ulrich Drepper <drepper@redhat.com>
+
* sysdeps/unix/sysv/linux/ia64/dl-static.c (_dl_static_init): Call
_dl_lookup_symbol_x not _dl_lookup_symbol.
diff --git a/Versions.def b/Versions.def
index 4e015dc260..67f0e5ed3d 100644
--- a/Versions.def
+++ b/Versions.def
@@ -108,3 +108,6 @@ libthread_db {
libanl {
GLIBC_2.2.3
}
+libcidn {
+ GLIBC_PRIVATE
+}
diff --git a/config.h.in b/config.h.in
index ed6e701df0..86b1e39a7e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -205,6 +205,9 @@
/* Defined if the linker supports the -z relro option. */
#undef HAVE_Z_RELRO
+/* Defined of libidn is available. */
+#undef HAVE_LIBIDN
+
/*
*/
diff --git a/configure b/configure
index 24d5ee3375..4fdb46511d 100755
--- a/configure
+++ b/configure
@@ -7293,6 +7293,7 @@ use_ldconfig=no
ldd_rewrite_script=no
libc_cv_sysconfdir=$sysconfdir
libc_cv_gcc_unwind_find_fde=no
+libc_cv_idn=no
# Iterate over all the sysdep directories we will use, running their
# configure fragments, and looking for a uname implementation.
@@ -7467,6 +7468,13 @@ if test $shared = default; then
fi
fi
+if test x"$libc_cv_idn" = xyes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBIDN 1
+_ACEOF
+
+fi
+
echo "$as_me:$LINENO: checking whether -fPIC is default" >&5
echo $ECHO_N "checking whether -fPIC is default... $ECHO_C" >&6
if test "${pic_default+set}" = set; then
diff --git a/configure.in b/configure.in
index ba7fc3d9d9..30cf01266c 100644
--- a/configure.in
+++ b/configure.in
@@ -1903,6 +1903,7 @@ use_ldconfig=no
ldd_rewrite_script=no
libc_cv_sysconfdir=$sysconfdir
libc_cv_gcc_unwind_find_fde=no
+libc_cv_idn=no
# Iterate over all the sysdep directories we will use, running their
# configure fragments, and looking for a uname implementation.
@@ -2045,6 +2046,10 @@ if test $shared = default; then
fi
fi
+if test x"$libc_cv_idn" = xyes; then
+ AC_DEFINE(HAVE_LIBIDN)
+fi
+
AC_CACHE_CHECK([whether -fPIC is default], pic_default,
[pic_default=yes
cat > conftest.c <<EOF
diff --git a/resolv/netdb.h b/resolv/netdb.h
index cca9ffc830..5aaa387166 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -1,4 +1,4 @@
- /* Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc.
+ /* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -573,6 +573,11 @@ struct gaicb
# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
returned address type.. */
+# ifdef __USE_GNU
+# define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
+ in the current locale's character set)
+ before looking it up. */
+# endif
/* Error values for `getaddrinfo' function. */
# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
@@ -592,6 +597,7 @@ struct gaicb
# define EAI_NOTCANCELED -102 /* Request not canceled. */
# define EAI_ALLDONE -103 /* All requests done. */
# define EAI_INTR -104 /* Interrupted by a signal. */
+# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
# endif
# define NI_MAXHOST 1025
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index afdefdfb52..2b6f0ba0ac 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -55,6 +55,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <nsswitch.h>
#include <not-cancel.h>
+extern int __idna_to_ascii_lz (const char *input, char **output, int flags);
+#define IDNA_SUCCESS 0
+
#define GAIH_OKIFUNSPEC 0x0100
#define GAIH_EAI ~(GAIH_OKIFUNSPEC)
@@ -539,6 +542,18 @@ gaih_inet (const char *name, const struct gaih_service *service,
at->scopeid = 0;
at->next = NULL;
+#ifdef HAVE_LIBIDN
+ if (req->ai_flags & AI_IDN)
+ {
+ char *p = NULL;
+ rc = __idna_to_ascii_lz (name, &p, 0);
+ if (rc != IDNA_SUCCESS)
+ return -EAI_IDN_ENCODE;
+ name = strdupa (p);
+ free (p);
+ }
+#endif
+
if (inet_pton (AF_INET, name, at->addr) > 0)
{
if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET)
@@ -1252,6 +1267,9 @@ getaddrinfo (const char *name, const char *service,
if (hints->ai_flags
& ~(AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST|AI_ADDRCONFIG|AI_V4MAPPED
+#ifdef HAVE_LIBIDN
+ |AI_IDN
+#endif
|AI_ALL))
return EAI_BADFLAGS;