From 69cfc07d006405fd171c3c9014ed873e00a9478e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 30 Nov 2021 15:18:40 +0100 Subject: [PATCH] Disable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions Disable IDN2_USE_STD3_ASCII_RULES to the libidn2 conversion because it broke encoding some non-letter but valid domain names like _tcp or *. This reverts commit ef8aa91740592a78c9162f3f7109167f2c9297a5. --- bin/dig/dighost.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 38f8021ad7..35b3d52957 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -4365,9 +4365,7 @@ idn_locale_to_ace(const char *src, char *dst, size_t dstlen) { * We trust libidn2 to return an error if 'src' is too large to be a * valid domain name. */ - res = idn2_to_ascii_lz(src, &ascii_src, - IDN2_NONTRANSITIONAL | - IDN2_USE_STD3_ASCII_RULES); + res = idn2_to_ascii_lz(src, &ascii_src, IDN2_NONTRANSITIONAL); if (res != IDN2_OK) { fatal("'%s' is not a legal IDNA2008 name (%s), use +noidnin", src, idn2_strerror(res)); @@ -4422,7 +4420,7 @@ idn_ace_to_locale(const char *src, char **dst) { * * First, convert 'src' to UTF-8, ignoring the current locale. */ - res = idn2_to_unicode_8z8z(src, &utf8_src, IDN2_USE_STD3_ASCII_RULES); + res = idn2_to_unicode_8z8z(src, &utf8_src, 0); if (res != IDN2_OK) { fatal("Bad ACE string '%s' (%s), use +noidnout", src, idn2_strerror(res)); @@ -4431,9 +4429,7 @@ idn_ace_to_locale(const char *src, char **dst) { /* * Then, check whether decoded 'src' is a valid IDNA2008 name. */ - res = idn2_to_ascii_8z(utf8_src, NULL, - IDN2_NONTRANSITIONAL | - IDN2_USE_STD3_ASCII_RULES); + res = idn2_to_ascii_8z(utf8_src, NULL, IDN2_NONTRANSITIONAL); if (res != IDN2_OK) { fatal("'%s' is not a legal IDNA2008 name (%s), use +noidnout", src, idn2_strerror(res)); @@ -4443,13 +4439,11 @@ idn_ace_to_locale(const char *src, char **dst) { * Finally, try converting the decoded 'src' into the current locale's * character encoding. */ - res = idn2_to_unicode_8zlz(utf8_src, &local_src, - IDN2_USE_STD3_ASCII_RULES); + res = idn2_to_unicode_8zlz(utf8_src, &local_src, 0); if (res != IDN2_OK) { static bool warned = false; - res = idn2_to_ascii_8z(utf8_src, &local_src, - IDN2_USE_STD3_ASCII_RULES); + res = idn2_to_ascii_8z(utf8_src, &local_src, 0); if (res != IDN2_OK) { fatal("Cannot represent '%s' " "in the current locale nor ascii (%s), "