diff --git a/CHANGES b/CHANGES index 0b83c6f118..b923a0a23b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5659. [bug] 'W' in wildcard expansions was being mapped to '\000'. + [GL #2779] + 5658. [bug] Increasing "max-cache-size" for a running named instance (using "rndc reconfig") was not causing the hash tables used by cache databases to be grown accordingly. This diff --git a/bin/tests/system/wildcard/tests.sh b/bin/tests/system/wildcard/tests.sh index f94f1b16fa..ce5e1d025f 100644 --- a/bin/tests/system/wildcard/tests.sh +++ b/bin/tests/system/wildcard/tests.sh @@ -239,5 +239,40 @@ grep "ANSWER: 0," dig.out.ns1.test$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` +n=`expr $n + 1` +echo_i "check wild card expansions by code point ($n)" +ret=0 +i=0 +while test $i -lt 256 +do + x=`expr 00$i : '.*\(...\)$'` + $DIG $DIGOPTS @10.53.0.1 "\\$x.example" TXT > dig.out.ns1.$x.test$n + if test $i -le 32 -o $i -ge 127 + then + grep '^\\'"$x"'\.example\..*TXT.*\"this is a wildcard\"$' dig.out.ns1.$x.test$n > /dev/null || { echo_i "code point $x failed" ; ret=1; } + # "=34 $=36 (=40 )=41 .=46 ;=59 \=92 @=64 + elif test $i -eq 34 -o $i -eq 36 -o $i -eq 40 -o $i -eq 41 -o \ + $i -eq 46 -o $i -eq 59 -o $i -eq 64 -o $i -eq 92 + then + case $i in + 34) a='"';; + 36) a='$';; + 40) a='(';; + 41) a=')';; + 46) a='\.';; + 59) a=';';; + 64) a='@';; + 92) a='\\';; + *) a=''; echo_i "code point $x failed" ; ret=1 ;; + esac + grep '^\\'"$a"'\.example.*.*TXT.*"this is a wildcard"$' dig.out.ns1.$x.test$n > /dev/null || { echo_i "code point $x failed" ; ret=1; } + else + grep '^\\' dig.out.ns1.$x.test$n && { echo_i "code point $x failed" ; ret=1; } + fi + i=`expr $i + 1` +done +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/doc/notes/notes-current.rst b/doc/notes/notes-current.rst index f553c45c76..114c25afe6 100644 --- a/doc/notes/notes-current.rst +++ b/doc/notes/notes-current.rst @@ -48,3 +48,8 @@ Bug Fixes lacked the necessary NSEC records or contained duplicate NSEC records when both wildcard expansion and CNAME chaining were required to prepare the response. This has been fixed. :gl:`#2759` + +- Queries where the wildcard match contained the letter ``W`` failed + to return the correct response as the ``W`` was mapped to ``\000``. + :gl:`#2779` + diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 11bd4712d9..06ac91d793 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -9874,7 +9874,8 @@ static const unsigned char maptolower[256] = { ['F'] = 'f', ['G'] = 'g', ['H'] = 'h', ['I'] = 'i', ['J'] = 'j', ['K'] = 'k', ['L'] = 'l', ['M'] = 'm', ['N'] = 'n', ['O'] = 'o', ['P'] = 'p', ['Q'] = 'q', ['R'] = 'r', ['S'] = 's', ['T'] = 't', - ['U'] = 'u', ['V'] = 'v', ['X'] = 'x', ['Y'] = 'y', ['Z'] = 'z', + ['U'] = 'u', ['V'] = 'v', ['W'] = 'w', ['X'] = 'x', ['Y'] = 'y', + ['Z'] = 'z', }; static const unsigned char maptoupper[256] = { @@ -9882,7 +9883,8 @@ static const unsigned char maptoupper[256] = { ['f'] = 'F', ['g'] = 'G', ['h'] = 'H', ['i'] = 'I', ['j'] = 'J', ['k'] = 'K', ['l'] = 'L', ['m'] = 'M', ['n'] = 'N', ['o'] = 'O', ['p'] = 'P', ['q'] = 'Q', ['r'] = 'R', ['s'] = 'S', ['t'] = 'T', - ['u'] = 'U', ['v'] = 'V', ['x'] = 'X', ['y'] = 'Y', ['z'] = 'Z', + ['u'] = 'U', ['v'] = 'V', ['w'] = 'W', ['x'] = 'X', ['y'] = 'Y', + ['z'] = 'Z', }; static void