dce54b9b5cfa450570fe9c11644450aeb3ee89f3Tinderbox User# Copyright (C) 2009, 2010, 2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt# $Id: tests.sh,v 1.7 2010/01/18 19:19:31 each Exp $
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# replace_data dname RR old_data new_data
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 if [ $# -ne 4 ]; then
20914534e691755ddcc3b3a5e8d10e910270a3d9Jeremy C. Reed $NSUPDATE -d <<END >> nsupdate.out.test 2>&1 || _ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉server 10.53.0.2 5300
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉update delete ${_dname} 30 ${_rr} ${_olddata}
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉update add ${_dname} 30 ${_rr} ${_newdata}
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉 if [ $_ret != 0 ]; then
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 hostile MX` || ret=1
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewstest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsecho I:Checking that bogus additional is not returned with +CD.
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# Prime cache with pending additional records. These should not be promoted
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Priming cache (pending additional A and AAAA)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS @10.53.0.4 example.com MX` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Replacing pending A"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data mail.example.com. A 192.0.2.2 192.0.2.3 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Replacing pending AAAA"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data mail.example.com. AAAA 2001:db8::2 2001:db8::3 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Checking updated data to be returned (without CD)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS @10.53.0.4 mail.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Checking updated data to be returned (with CD)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example.com AAAA` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# Prime cache with a pending answer record. It can be returned (without
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# validation) with +CD.
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Priming cache (pending answer)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data pending-ok.example.com. A 192.0.2.2 192.0.2.3 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo I:Confirming cached pending data to be returned with CD
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# Prime cache with a pending answer record. It should not be returned
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉# to no-DNSSEC clients.
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo "I:Priming cache (pending answer)"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ng.example.com A` || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉test $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉replace_data pending-ng.example.com. A 192.0.2.102 192.0.2.103 || ret=1
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉echo I:Confirming updated data returned, not the cached one, without CD
d8680445d6212d5552ea8a22fd2f9951b11c4b10Tatuya JINMEI 神明達哉ans=`$DIG $DIGOPTS @10.53.0.4 pending-ng.example.com A` || ret=1
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewstest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
597642c0baaf66172ca44104ed5a18957a969748Evan Hunt# Try to fool the resolver with an out-of-bailiwick CNAME
597642c0baaf66172ca44104ed5a18957a969748Evan Huntecho I:Trying to Prime out-of-bailiwick pending answer with CD
597642c0baaf66172ca44104ed5a18957a969748Evan Huntans=`$DIG $DIGOPTS_CD @10.53.0.4 bad.example. A` || ret=1
597642c0baaf66172ca44104ed5a18957a969748Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
597642c0baaf66172ca44104ed5a18957a969748Evan Huntecho I:Confirming the out-of-bailiwick answer is not cached or reused with CD
597642c0baaf66172ca44104ed5a18957a969748Evan Huntans=`$DIG $DIGOPTS_CD @10.53.0.4 nice.good. A` || ret=1
597642c0baaf66172ca44104ed5a18957a969748Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunt# Make sure the resolver doesn't cache bogus NXDOMAIN
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`$DIG +tcp -p 5300 @10.53.0.4 removed.example.com. A` || ret=1
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/'`
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntecho I:Confirming the bogus NXDOMAIN was not cached
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`$DIG +tcp -p 5300 @10.53.0.4 removed.example.com. A` || ret=1
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Huntans=`echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/'`
e11a0c114cdaf8f7e7832e9f1a011138248093a6Evan Hunttest $ret = 0 || echo I:failed, got "'""$ans""'", expected "'""$expect""'"
a39a5f4d816ca7d3f43106712ca668dd1ab31d69Mark Andrewsecho "I:exit status: $status"