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