]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fallback to ASCII on output IDN conversion error
authorPetr Menšík <pemensik@redhat.com>
Tue, 29 Jan 2019 17:07:44 +0000 (18:07 +0100)
committerOndřej Surý <ondrej@sury.org>
Mon, 30 Sep 2019 06:52:13 +0000 (08:52 +0200)
It is possible dig used ACE encoded name in locale, which does not
support converting it to unicode. Instead of fatal error, fallback to
ACE name on output.

bin/dig/dighost.c

index 62da6e3a73d3608500bf83274d7ccadbe148a2d0..5bc3534bfcaccfa6a953ceeaaabffad2906dca69 100644 (file)
@@ -4421,9 +4421,17 @@ idn_ace_to_locale(const char *src, char **dst) {
         */
        res = idn2_to_unicode_8zlz(utf8_src, &local_src, 0);
        if (res != IDN2_OK) {
-               fatal("Cannot represent '%s' in the current locale (%s), "
-                     "use +noidnout or a different locale",
-                     src, idn2_strerror(res));
+               /*
+                * Cannot represent in current locale.
+                * Output ACE form undecoded.
+                */
+               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), "
+                             "use +noidnout or a different locale",
+                             src, idn2_strerror(res));
+               }
        }
 
        /*