diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-08 04:10:31 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-08 04:10:31 +0000 |
commit | e2fd3cbe085d9867710ee7b3d487c16c150fa204 (patch) | |
tree | 6c145b6019df3a7c10b005c6a10ace5864047331 /sysdeps | |
parent | 01859b1c24e97f30325a3ce189739e66811c40a4 (diff) | |
download | glibc-e2fd3cbe085d9867710ee7b3d487c16c150fa204.zip glibc-e2fd3cbe085d9867710ee7b3d487c16c150fa204.tar.gz glibc-e2fd3cbe085d9867710ee7b3d487c16c150fa204.tar.bz2 |
Update.
* 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>
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index afdefdf..2b6f0ba 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; |