1 #!/bin/sh 2 3 # Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4 # 5 # SPDX-License-Identifier: MPL-2.0 6 # 7 # This Source Code Form is subject to the terms of the Mozilla Public 8 # License, v. 2.0. If a copy of the MPL was not distributed with this 9 # file, you can obtain one at https://mozilla.org/MPL/2.0/. 10 # 11 # See the COPYRIGHT file distributed with this work for additional 12 # information regarding copyright ownership. 13 14 set -e 15 16 . ../conf.sh 17 18 status=0 19 20 echo_i "test name too long" 21 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} nametoolong >nametoolong.out 22 ans=$(grep got: nametoolong.out) 23 if [ "${ans}" != "got: 000080010000000000000000" ]; then 24 echo_i "failed" 25 status=$((status + 1)) 26 fi 27 28 echo_i "two question names" 29 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} twoquestionnames >twoquestionnames.out 30 ans=$(grep got: twoquestionnames.out) 31 if [ "${ans}" != "got: 000080010000000000000000" ]; then 32 echo_i "failed" 33 status=$((status + 1)) 34 fi 35 36 echo_i "two question types" 37 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} twoquestiontypes >twoquestiontypes.out 38 ans=$(grep got: twoquestiontypes.out) 39 if [ "${ans}" != "got: 0000800100020000000000000e41414141414141414141414141410000010001c00c00020001" ]; then 40 echo_i "failed" 41 status=$((status + 1)) 42 fi 43 44 echo_i "duplicate questions" 45 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} dupquestion >dupquestion.out 46 ans=$(grep got: dupquestion.out) 47 if [ "${ans}" != "got: 000080010000000000000000" ]; then 48 echo_i "failed" 49 status=$(expr $status + 1) 50 fi 51 52 echo_i "duplicate answer" 53 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} dupans >dupans.out 54 ans=$(grep got: dupans.out) 55 if [ "${ans}" != "got: 0000800100010000000000000000060001" ]; then 56 echo_i "failed" 57 status=$(expr $status + 1) 58 fi 59 60 echo_i "question only type in answer" 61 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} qtypeasanswer >qtypeasanswer.out 62 ans=$(grep got: qtypeasanswer.out) 63 if [ "${ans}" != "got: 000080010000000000000000" ]; then 64 echo_i "failed" 65 status=$(expr $status + 1) 66 fi 67 68 # this would be NOERROR if it included a COOKIE option, 69 # but is a FORMERR without one. 70 echo_i "empty question section (and no COOKIE option)" 71 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} noquestions >noquestions.out 72 ans=$(grep got: noquestions.out) 73 if [ "${ans}" != "got: 000080010000000000000000" ]; then 74 echo_i "failed" 75 status=$((status + 1)) 76 fi 77 78 echo_i "bad nsec3 owner" 79 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} badnsec3owner >badnsec3owner.out 80 ans=$(grep got: badnsec3owner.out) 81 # SERVFAIL (2) rather than FORMERR (1) 82 if [ "${ans}" != "got: 0008800200010000000000000000010001" ]; then 83 echo_i "failed" 84 status=$(expr $status + 1) 85 fi 86 87 echo_i "short record before rdata " 88 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} shortrecord >shortrecord.out 89 ans=$(grep got: shortrecord.out) 90 if [ "${ans}" != "got: 000980010000000000000000" ]; then 91 echo_i "failed" 92 status=$(expr $status + 1) 93 fi 94 95 echo_i "short question" 96 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} shortquestion >shortquestion.out 97 ans=$(grep got: shortquestion.out) 98 if [ "${ans}" != "got: 000080010000000000000000" ]; then 99 echo_i "failed" 100 status=$(expr $status + 1) 101 fi 102 103 echo_i "mismatch classes in question section" 104 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} questionclass >questionclass.out 105 ans=$(grep got: questionclass.out) 106 if [ "${ans}" != "got: 000080010000000000000000" ]; then 107 echo_i "failed" 108 status=$(expr $status + 1) 109 fi 110 111 echo_i "bad record owner name" 112 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} badrecordname >badrecordname.out 113 ans=$(grep got: badrecordname.out) 114 if [ "${ans}" != "got: 000080010000000000000000" ]; then 115 echo_i "failed" 116 status=$(expr $status + 1) 117 fi 118 119 echo_i "mismatched class in record" 120 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} wrongclass >wrongclass.out 121 ans=$(grep got: wrongclass.out) 122 if [ "${ans}" != "got: 000080010000000000000000" ]; then 123 echo_i "failed" 124 status=$(expr $status + 1) 125 fi 126 127 echo_i "mismatched KEY class" 128 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} keyclass >keyclass.out 129 ans=$(grep got: keyclass.out) 130 if [ "${ans}" != "got: 0000800100010000000000000000010001" ]; then 131 echo_i "failed" 132 status=$(expr $status + 1) 133 fi 134 135 echo_i "OPT wrong owner name" 136 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} optwrongname >optwrongname.out 137 ans=$(grep got: optwrongname.out) 138 if [ "${ans}" != "got: 000080010000000000000000" ]; then 139 echo_i "failed" 140 status=$(expr $status + 1) 141 fi 142 143 echo_i "RRSIG invalid covers" 144 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} malformedrrsig >malformedrrsig.out 145 ans=$(grep got: malformedrrsig.out) 146 if [ "${ans}" != "got: 000080010000000000000000" ]; then 147 echo_i "failed" 148 status=$(expr $status + 1) 149 fi 150 151 echo_i "UPDATE malformed delete type" 152 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} malformeddeltype >malformeddeltype.out 153 ans=$(grep got: malformeddeltype.out) 154 if [ "${ans}" != "got: 0000a8010000000000000000" ]; then 155 echo_i "failed" 156 status=$(expr $status + 1) 157 fi 158 159 echo_i "TSIG wrong class" 160 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} tsigwrongclass >tsigwrongclass.out 161 ans=$(grep got: tsigwrongclass.out) 162 if [ "${ans}" != "got: 000080010000000000000000" ]; then 163 echo_i "failed" 164 status=$(expr $status + 1) 165 fi 166 167 echo_i "TSIG not last" 168 $PERL formerr.pl -a 10.53.0.1 -p ${PORT} tsignotlast >tsignotlast.out 169 ans=$(grep got: tsignotlast.out) 170 if [ "${ans}" != "got: 000080010000000000000000" ]; then 171 echo_i "failed" 172 status=$(expr $status + 1) 173 fi 174 175 echo_i "exit status: $status" 176 177 [ $status -eq 0 ] || exit 1 178