diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-17 20:02:19 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-17 20:02:19 +0000 |
commit | 3a0e90bd8b7769c863d19fe734ad6ad8fd831bea (patch) | |
tree | 6215ca31ece508dbf4109593dbc6acc141d4e2f7 | |
parent | cabd81c0f715bad0b015572895a6ebfcc5d420ce (diff) | |
download | glibc-3a0e90bd8b7769c863d19fe734ad6ad8fd831bea.tar.gz glibc-3a0e90bd8b7769c863d19fe734ad6ad8fd831bea.tar.xz glibc-3a0e90bd8b7769c863d19fe734ad6ad8fd831bea.zip |
Update.
2004-03-17 Ulrich Drepper <drepper@redhat.com> * resolv/netdb.h: Define AI_IDN_ALLOW_UNASSIGNED, AI_IDN_USE_STD3_ASCII_RULES, NI_IDN_ALLOW_UNASSIGNED, and NI_IDN_USE_STD3_ASCII_RULES. * inet/getnameinfo.c (getnameinfo): Implement handling of NI_IDN_ALLOW_UNASSIGNED and NI_IDN_USE_STD3_ASCII_RULES. * sysdeps/posix/getaddrinfo.c (gaih_inet): Implement handling of AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | inet/getnameinfo.c | 11 | ||||
-rw-r--r-- | resolv/netdb.h | 8 | ||||
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 19 |
4 files changed, 43 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index 228b876b32..a2f6dbec6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-03-17 Ulrich Drepper <drepper@redhat.com> + + * resolv/netdb.h: Define AI_IDN_ALLOW_UNASSIGNED, + AI_IDN_USE_STD3_ASCII_RULES, NI_IDN_ALLOW_UNASSIGNED, and + NI_IDN_USE_STD3_ASCII_RULES. + * inet/getnameinfo.c (getnameinfo): Implement handling of + NI_IDN_ALLOW_UNASSIGNED and NI_IDN_USE_STD3_ASCII_RULES. + * sysdeps/posix/getaddrinfo.c (gaih_inet): Implement handling of + AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES. + 2004-03-17 Jakub Jelinek <jakub@redhat.com> * sysdeps/x86_64/hp-timing.h (HP_TIMING_NOW): Make asm volatile. diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index e62d5759b8..493a423c10 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -169,7 +169,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM #ifdef HAVE_LIBIDN - |NI_IDN + |NI_IDN|NI_IDN_ALLOW_UNASSIGNED|NI_IDN_USE_STD3_ASCII_RULES #endif )) return EAI_BADFLAGS; @@ -262,8 +262,15 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, /* If requested, convert from the IDN format. */ if (flags & NI_IDN) { + int idn_flags = 0; + if (flags & NI_IDN_ALLOW_UNASSIGNED) + idn_flags |= IDNA_ALLOW_UNASSIGNED; + if (flags & NI_IDN_USE_STD3_ASCII_RULES) + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + char *out; - int rc = __idna_to_unicode_lzlz (h->h_name, &out, 0); + int rc = __idna_to_unicode_lzlz (h->h_name, &out, + idn_flags); if (rc != IDNA_SUCCESS) { if (rc == IDNA_MALLOC_ERROR) diff --git a/resolv/netdb.h b/resolv/netdb.h index 204ba2ebf8..53025ab0ea 100644 --- a/resolv/netdb.h +++ b/resolv/netdb.h @@ -578,6 +578,10 @@ struct gaicb in the current locale's character set) before looking it up. */ # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */ +# define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode + code points. */ +# define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to + STD3 rules. */ # endif /* Error values for `getaddrinfo' function. */ @@ -612,6 +616,10 @@ struct gaicb # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ # ifdef __USE_GNU # define NI_IDN 32 /* Convert name from IDN format. */ +# define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode + code points. */ +# define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to + STD3 rules. */ # endif /* Translate name of a service location and/or a service name to set of diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 4597feac79..e3b83e5ea1 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -549,8 +549,14 @@ gaih_inet (const char *name, const struct gaih_service *service, #ifdef HAVE_LIBIDN if (req->ai_flags & AI_IDN) { + int idn_flags = 0; + if (req->ai_flags & AI_IDN_ALLOW_UNASSIGNED) + idn_flags |= IDNA_ALLOW_UNASSIGNED; + if (req->ai_flags & AI_IDN_USE_STD3_ASCII_RULES) + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + char *p = NULL; - rc = __idna_to_ascii_lz (name, &p, 0); + rc = __idna_to_ascii_lz (name, &p, idn_flags); if (rc != IDNA_SUCCESS) { if (rc == IDNA_MALLOC_ERROR) @@ -838,8 +844,14 @@ gaih_inet (const char *name, const struct gaih_service *service, #ifdef HAVE_LIBIDN if (req->ai_flags & AI_CANONIDN) { + int idn_flags = 0; + if (req->ai_flags & AI_IDN_ALLOW_UNASSIGNED) + idn_flags |= IDNA_ALLOW_UNASSIGNED; + if (req->ai_flags & AI_IDN_USE_STD3_ASCII_RULES) + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + char *out; - int rc = __idna_to_unicode_lzlz (c, &out, 0); + int rc = __idna_to_unicode_lzlz (c, &out, idn_flags); if (rc != IDNA_SUCCESS) { if (rc == IDNA_MALLOC_ERROR) @@ -1306,7 +1318,8 @@ 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|AI_CANONIDN + |AI_IDN|AI_CANONIDN|AI_IDN_ALLOW_UNASSIGNED + |AI_IDN_USE_STD3_ASCII_RULES #endif |AI_ALL)) return EAI_BADFLAGS; |