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 14SYSTEMTESTTOP=.. 15. $SYSTEMTESTTOP/conf.sh 16 17status=0 18n=0 19 20n=`expr $n + 1` 21echo_i "Check that domain names that are too big when applying a search list entry are handled cleanly ($n)" 22ret=0 23l=012345678901234567890123456789012345678901234567890123456789012 24t=0123456789012345678901234567890123456789012345678901234567890 25d=$l.$l.$l.$t 26$NSLOOKUP -port=${PORT} -domain=$d -type=soa example 10.53.0.1 > nslookup.out${n} || ret=1 27grep "origin = ns1.example" nslookup.out${n} > /dev/null || ret=1 28if [ $ret != 0 ]; then echo_i "failed"; fi 29status=`expr $status + $ret` 30 31n=`expr $n + 1` 32echo_i "Check A only lookup" 33ret=0 34$NSLOOKUP -port=${PORT} a-only.example.net 10.53.0.1 > nslookup.out${n} || ret=1 35lines=`grep "Server:" nslookup.out${n} | wc -l` 36test $lines = 1 || ret=1 37lines=`grep a-only.example.net nslookup.out${n} | wc -l` 38test $lines = 1 || ret=1 39grep "1.2.3.4" nslookup.out${n} > /dev/null || ret=1 40if [ $ret != 0 ]; then echo_i "failed"; fi 41status=`expr $status + $ret` 42 43n=`expr $n + 1` 44echo_i "Check AAAA only lookup" 45ret=0 46$NSLOOKUP -port=${PORT} aaaa-only.example.net 10.53.0.1 > nslookup.out${n} || ret=1 47lines=`grep "Server:" nslookup.out${n} | wc -l` 48test $lines = 1 || ret=1 49lines=`grep aaaa-only.example.net nslookup.out${n} | wc -l` 50test $lines = 1 || ret=1 51grep "2001::ffff" nslookup.out${n} > /dev/null || ret=1 52if [ $ret != 0 ]; then echo_i "failed"; fi 53status=`expr $status + $ret` 54 55n=`expr $n + 1` 56echo_i "Check dual A + AAAA lookup" 57ret=0 58$NSLOOKUP -port=${PORT} dual.example.net 10.53.0.1 > nslookup.out${n} || ret=1 59lines=`grep "Server:" nslookup.out${n} | wc -l` 60test $lines = 1 || ret=1 61lines=`grep dual.example.net nslookup.out${n} | wc -l` 62test $lines = 2 || ret=1 63grep "1.2.3.4" nslookup.out${n} > /dev/null || ret=1 64grep "2001::ffff" nslookup.out${n} > /dev/null || ret=1 65if [ $ret != 0 ]; then echo_i "failed"; fi 66status=`expr $status + $ret` 67 68n=`expr $n + 1` 69echo_i "Check CNAME to A only lookup" 70ret=0 71$NSLOOKUP -port=${PORT} cname-a-only.example.net 10.53.0.1 > nslookup.out${n} || ret=1 72lines=`grep "Server:" nslookup.out${n} | wc -l` 73test $lines = 1 || ret=1 74lines=`grep "canonical name" nslookup.out${n} | wc -l` 75test $lines = 1 || ret=1 76lines=`grep a-only.example.net nslookup.out${n} | grep -v "canonical name" | wc -l` 77test $lines = 1 || ret=1 78grep "1.2.3.4" nslookup.out${n} > /dev/null || ret=1 79if [ $ret != 0 ]; then echo_i "failed"; fi 80status=`expr $status + $ret` 81 82n=`expr $n + 1` 83echo_i "Check CNAME to AAAA only lookup" 84ret=0 85$NSLOOKUP -port=${PORT} cname-aaaa-only.example.net 10.53.0.1 > nslookup.out${n} || ret=1 86lines=`grep "Server:" nslookup.out${n} | wc -l` 87test $lines = 1 || ret=1 88lines=`grep "canonical name" nslookup.out${n} | wc -l` 89test $lines = 1 || ret=1 90lines=`grep aaaa-only.example.net nslookup.out${n} | grep -v "canonical name" |wc -l` 91test $lines = 1 || ret=1 92grep "2001::ffff" nslookup.out${n} > /dev/null || ret=1 93if [ $ret != 0 ]; then echo_i "failed"; fi 94status=`expr $status + $ret` 95 96n=`expr $n + 1` 97echo_i "Check CNAME to dual A + AAAA lookup" 98ret=0 99$NSLOOKUP -port=${PORT} cname-dual.example.net 10.53.0.1 > nslookup.out${n} || ret=1 100lines=`grep "Server:" nslookup.out${n} | wc -l` 101test $lines = 1 || ret=1 102lines=`grep "canonical name" nslookup.out${n} | wc -l` 103test $lines = 1 || ret=1 104lines=`grep dual.example.net nslookup.out${n} | grep -v "canonical name" | wc -l` 105test $lines = 2 || ret=1 106grep "1.2.3.4" nslookup.out${n} > /dev/null || ret=1 107grep "2001::ffff" nslookup.out${n} > /dev/null || ret=1 108if [ $ret != 0 ]; then echo_i "failed"; fi 109status=`expr $status + $ret` 110 111echo_i "exit status: $status" 112[ $status -eq 0 ] || exit 1 113