]> 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 10:19:56 +0000 (12:19 +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.

(cherry picked from commit c8a871e908f932d35e42a363c1f571fbf38c8982)

bin/dig/dighost.c

index 15f31da40e553bfcb4ca9cf45481f30e5435da84..42e2f16a6806fdbf5270817be3b8b254a62b648f 100644 (file)
@@ -4865,9 +4865,17 @@ idn_ace_to_locale(const char *from, char *to, size_t tolen) {
         */
        res = idn2_to_unicode_8zlz(utf8_src, &tmp_str, 0);
        if (res != IDN2_OK) {
-               fatal("Cannot represent '%s' in the current locale (%s), "
-                     "use +noidnout or a different locale",
-                     from, idn2_strerror(res));
+               /*
+                * Cannot represent in current locale.
+                * Output ACE form undecoded.
+                */
+               res = idn2_to_ascii_8z(utf8_src, &tmp_str, 0);
+               if (res != IDN2_OK) {
+                       fatal("Cannot represent '%s' "
+                             "in the current locale nor ascii (%s), "
+                             "use +noidnout or a different locale",
+                             from, idn2_strerror(res));
+               }
        }
 
        /*