Merge branch '846-dig-idn-alabel-fallback' into 'master'

Resolve "dig cannot display ACE query if locale is not unicode"

Closes #846

See merge request isc-projects/bind9!1418
This commit is contained in:
Ondřej Surý
2019-09-30 05:49:01 -04:00
3 changed files with 36 additions and 3 deletions

View File

@@ -1,3 +1,6 @@
5294. [func] Fallback to ACE name on output in locale, which does not
support converting it to unicode. [GL #846]
5293. [bug] On Windows, named crashed upon any attempt to fetch XML
statistics from it. [GL #1245]

View File

@@ -4421,9 +4421,20 @@ 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));
static bool warned = false;
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));
} else if (!warned) {
fprintf(stderr, ";; Warning: cannot represent '%s' "
"in the current locale",
local_src);
warned = true;
}
}
/*

View File

@@ -244,6 +244,25 @@ idna_enabled_test() {
idna_test "$text" "+idnin +noidnout" "xn--nxasmq6b.com" "xn--nxasmq6b.com."
idna_test "$text" "+idnin +idnout" "xn--nxasmq6b.com" "βόλοσ.com."
# Test of valid A-label in locale that cannot display it
#
# +noidnout: The string is sent as-is to the server and the returned qname
# is displayed in the same form.
# +idnout: The string is sent as-is to the server and the returned qname
# is displayed as the corresponding A-label.
#
# The "+[no]idnout" flag has no effect in these cases.
text="Checking valid A-label in C locale"
label="xn--nxasmq6b.com"
if command -v idn2 >/dev/null && ! LC_ALL=C idn2 -d "$label" >/dev/null 2>/dev/null; then
LC_ALL=C idna_test "$text" "" "$label" "$label."
LC_ALL=C idna_test "$text" "+noidnin +noidnout" "$label" "$label."
LC_ALL=C idna_test "$text" "+noidnin +idnout" "$label" "$label."
LC_ALL=C idna_test "$text" "+idnin +noidnout" "$label" "$label."
LC_ALL=C idna_test "$text" "+idnin +idnout" "$label" "$label."
LC_ALL=C idna_test "$text" "+noidnin +idnout" "$label" "$label."
fi
# Tests of invalid A-labels