mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
Check libidn2 version before proceding with one of the tests.
A known issue in libidn2 causes one of the tests of a fake A-label to fail. The problem should be corrected in version 2.0.5 of libidn2.
This commit is contained in:
@@ -136,6 +136,46 @@ idna_fail() {
|
|||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if current version of libidn2 is >= a given version
|
||||||
|
#
|
||||||
|
# This requires that:
|
||||||
|
# a) "pkg-config" exists on the system
|
||||||
|
# b) The libidn2 installed has an associated ".pc" file
|
||||||
|
# c) The system sort command supports "-V"
|
||||||
|
#
|
||||||
|
# $1 - Minimum version required
|
||||||
|
#
|
||||||
|
# Returns:
|
||||||
|
# 0 - Version check is OK, libidn2 at required version or greater.
|
||||||
|
# 1 - Version check was made, but libidn2 not at required version.
|
||||||
|
# 2 - Could not carry out version check
|
||||||
|
|
||||||
|
libidn_version_check() {
|
||||||
|
ret=2
|
||||||
|
if [ -n "`command -v pkg-config`" ]; then
|
||||||
|
version=`pkg-config --modversion --silence-errors libidn2`
|
||||||
|
if [ -n "$version" ]; then
|
||||||
|
# Does the sort command have a "-V" flag on this system?
|
||||||
|
sort -V 2>&1 > /dev/null << .
|
||||||
|
.
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
# Sort -V exists. Sort the IDN version and the minimum version
|
||||||
|
# required. If the IDN version is greater than or equal to that
|
||||||
|
# version, it will appear last in the list.
|
||||||
|
last_version=`printf "%s\n" $version $1 | sort -V | tail -1`
|
||||||
|
if [ "$version" = "$last_version" ]; then
|
||||||
|
ret=0
|
||||||
|
else
|
||||||
|
ret=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to check that case is preserved for an all-ASCII label.
|
# Function to check that case is preserved for an all-ASCII label.
|
||||||
#
|
#
|
||||||
# Without IDNA support, case-preservation is the expected behavior.
|
# Without IDNA support, case-preservation is the expected behavior.
|
||||||
@@ -270,10 +310,16 @@ idna_enabled_test() {
|
|||||||
text="Checking fake A-label"
|
text="Checking fake A-label"
|
||||||
idna_fail "$text" "" "xn--ahahah"
|
idna_fail "$text" "" "xn--ahahah"
|
||||||
idna_test "$text" "+noidnin +noidnout" "xn--ahahah" "xn--ahahah."
|
idna_test "$text" "+noidnin +noidnout" "xn--ahahah" "xn--ahahah."
|
||||||
# The next test is commented out as libidn2 gives invalid output for the
|
|
||||||
# invalid punycode name. Until this is fixed, the test will be skipped.
|
# Owing to issues with libdns, the next test will fail for versions of
|
||||||
# idna_test "$text" "+noidnin +idnout" "xn--ahahah" "xn--ahahah."
|
# libidn earlier than 2.0.5. For this reason, get the version (if
|
||||||
echo_i "(fake A-label: +noidnin +idnout test skipped due to libidn2 issues)"
|
# available) and compare with 2.0.5.
|
||||||
|
libidn_version_check 2.0.5
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo_i "Skipping fake A-label +noidnin +idnout test (libidn2 version issues)"
|
||||||
|
else
|
||||||
|
idna_test "$text" "+noidnin +idnout" "xn--ahahah" "xn--ahahah."
|
||||||
|
fi
|
||||||
idna_fail "$text" "+idnin +noidnout" "xn--ahahah"
|
idna_fail "$text" "+idnin +noidnout" "xn--ahahah"
|
||||||
idna_fail "$text" "+idnin +idnout" "xn--ahahah"
|
idna_fail "$text" "+idnin +idnout" "xn--ahahah"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user