about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-17 20:02:19 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-17 20:02:19 +0000
commit3a0e90bd8b7769c863d19fe734ad6ad8fd831bea (patch)
tree6215ca31ece508dbf4109593dbc6acc141d4e2f7 /sysdeps
parentcabd81c0f715bad0b015572895a6ebfcc5d420ce (diff)
downloadglibc-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.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/posix/getaddrinfo.c19
1 files changed, 16 insertions, 3 deletions
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;