2c4a61
From ab597b8b91de5f9c6d6b0da410e8a0350876f484 Mon Sep 17 00:00:00 2001
2c4a61
From: Mark Andrews <marka@isc.org>
2c4a61
Date: Fri, 18 Jun 2021 13:02:46 +1000
2c4a61
Subject: [PATCH] Check wild card expansions by code point
2c4a61
2c4a61
(cherry picked from commit c65dc2f7dc211358d5e28ff368cd60ddf5d5dcd4)
2c4a61
---
2c4a61
 bin/tests/system/wildcard/tests.sh | 35 ++++++++++++++++++++++++++++++
2c4a61
 1 file changed, 35 insertions(+)
2c4a61
2c4a61
diff --git a/bin/tests/system/wildcard/tests.sh b/bin/tests/system/wildcard/tests.sh
2c4a61
index 439f8f1eff..0cf2189223 100644
2c4a61
--- a/bin/tests/system/wildcard/tests.sh
2c4a61
+++ b/bin/tests/system/wildcard/tests.sh
2c4a61
@@ -231,5 +231,40 @@ grep "ANSWER: 0," dig.out.ns1.test$n > /dev/null || ret=1
2c4a61
 if [ $ret != 0 ]; then echo_i "failed"; fi
2c4a61
 status=`expr $status + $ret`
2c4a61
 
2c4a61
+n=`expr $n + 1`
2c4a61
+echo_i "check wild card expansions by code point ($n)"
2c4a61
+ret=0
2c4a61
+i=0
2c4a61
+while test $i -lt 256
2c4a61
+do
2c4a61
+	x=`expr 00$i : '.*\(...\)$'`
2c4a61
+	$DIG $DIGOPTS @10.53.0.1 "\\$x.example" TXT > dig.out.ns1.$x.test$n
2c4a61
+	if test $i -le 32 -o $i -ge 127
2c4a61
+	then
2c4a61
+		grep '^\\'"$x"'\.example\..*TXT.*\"this is a wildcard\"$' dig.out.ns1.$x.test$n > /dev/null || { echo_i "code point $x failed" ; ret=1; }
2c4a61
+        # "=34 $=36 (=40 )=41 .=46 ;=59 \=92 @=64
2c4a61
+	elif test $i -eq 34 -o $i -eq 36 -o $i -eq 40 -o $i -eq 41 -o \
2c4a61
+                  $i -eq 46 -o $i -eq 59 -o $i -eq 64 -o $i -eq 92
2c4a61
+	then
2c4a61
+		case $i in
2c4a61
+		34) a='"';;
2c4a61
+		36) a='$';;
2c4a61
+		40) a='(';;
2c4a61
+		41) a=')';;
2c4a61
+		46) a='\.';;
2c4a61
+		59) a=';';;
2c4a61
+		64) a='@';;
2c4a61
+		92) a='\\';;
2c4a61
+		*) a=''; echo_i "code point $x failed" ; ret=1 ;;
2c4a61
+		esac
2c4a61
+		grep '^\\'"$a"'\.example.*.*TXT.*"this is a wildcard"$' dig.out.ns1.$x.test$n > /dev/null || { echo_i "code point $x failed" ; ret=1; }
2c4a61
+	else
2c4a61
+		grep '^\\' dig.out.ns1.$x.test$n && { echo_i "code point $x failed" ; ret=1; }
2c4a61
+	fi
2c4a61
+	i=`expr $i + 1`
2c4a61
+done
2c4a61
+if [ $ret != 0 ]; then echo_i "failed"; fi
2c4a61
+status=`expr $status + $ret`
2c4a61
+
2c4a61
 echo_i "exit status: $status"
2c4a61
 [ $status -eq 0 ] || exit 1
2c4a61
-- 
2c4a61
2.31.1
2c4a61