update to 9.7.1-P2
[tridge/bind9.git] / bin / tests / system / resolver / tests.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2004, 2007, 2009, 2010  Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000, 2001  Internet Software Consortium.
5 #
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
9 #
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
17
18 # $Id: tests.sh,v 1.11.142.2 2010/05/19 09:32:36 tbox Exp $
19
20 SYSTEMTESTTOP=..
21 . $SYSTEMTESTTOP/conf.sh
22
23 status=0
24
25 echo "I:checking non-cachable NXDOMAIN response handling"
26 ret=0
27 $DIG +tcp nxdomain.example.net @10.53.0.1 a -p 5300 > dig.out || ret=1
28 grep "status: NXDOMAIN" dig.out > /dev/null || ret=1
29 if [ $ret != 0 ]; then echo "I:failed"; fi
30 status=`expr $status + $ret`
31
32 echo "I:checking non-cachable NODATA response handling"
33 ret=0
34 $DIG +tcp nodata.example.net @10.53.0.1 a -p 5300 > dig.out || ret=1
35 grep "status: NOERROR" dig.out > /dev/null || ret=1
36
37 if [ $ret != 0 ]; then echo "I:failed"; fi
38 status=`expr $status + $ret`
39 echo "I:checking handling of bogus referrals"
40 # If the server has the "INSIST(!external)" bug, this query will kill it.
41 $DIG +tcp www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
42
43 echo "I:check handling of cname + other data / 1"
44 $DIG +tcp cname1.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
45
46 echo "I:check handling of cname + other data / 2"
47 $DIG +tcp cname2.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
48
49 echo "I:check that server is still running"
50 $DIG +tcp www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1
51
52 echo "I:checking answer IPv4 address filtering (deny)"
53 ret=0
54 $DIG +tcp www.example.net @10.53.0.1 a -p 5300 > dig.out || ret=1
55 grep "status: SERVFAIL" dig.out > /dev/null || ret=1
56 if [ $ret != 0 ]; then echo "I:failed"; fi
57 status=`expr $status + $ret`
58
59 echo "I:checking answer IPv6 address filtering (deny)"
60 ret=0
61 $DIG +tcp www.example.net @10.53.0.1 aaaa -p 5300 > dig.out || ret=1
62 grep "status: SERVFAIL" dig.out > /dev/null || ret=1
63 if [ $ret != 0 ]; then echo "I:failed"; fi
64 status=`expr $status + $ret`
65
66 echo "I:checking answer IPv4 address filtering (accept)"
67 ret=0
68 $DIG +tcp www.example.org @10.53.0.1 a -p 5300 > dig.out || ret=1
69 grep "status: NOERROR" dig.out > /dev/null || ret=1
70 if [ $ret != 0 ]; then echo "I:failed"; fi
71 status=`expr $status + $ret`
72
73 echo "I:checking answer IPv6 address filtering (accept)"
74 ret=0
75 $DIG +tcp www.example.org @10.53.0.1 aaaa -p 5300 > dig.out || ret=1
76 grep "status: NOERROR" dig.out > /dev/null || ret=1
77 if [ $ret != 0 ]; then echo "I:failed"; fi
78 status=`expr $status + $ret`
79
80 echo "I:checking CNAME target filtering (deny)"
81 ret=0
82 $DIG +tcp badcname.example.net @10.53.0.1 a -p 5300 > dig.out || ret=1
83 grep "status: SERVFAIL" dig.out > /dev/null || ret=1
84 if [ $ret != 0 ]; then echo "I:failed"; fi
85 status=`expr $status + $ret`
86
87 echo "I:checking CNAME target filtering (accept)"
88 ret=0
89 $DIG +tcp goodcname.example.net @10.53.0.1 a -p 5300 > dig.out || ret=1
90 grep "status: NOERROR" dig.out > /dev/null || ret=1
91 if [ $ret != 0 ]; then echo "I:failed"; fi
92 status=`expr $status + $ret`
93
94 echo "I:checking CNAME target filtering (accept due to subdomain)"
95 ret=0
96 $DIG +tcp cname.sub.example.org @10.53.0.1 a -p 5300 > dig.out || ret=1
97 grep "status: NOERROR" dig.out > /dev/null || ret=1
98 if [ $ret != 0 ]; then echo "I:failed"; fi
99 status=`expr $status + $ret`
100
101 echo "I:checking DNAME target filtering (deny)"
102 ret=0
103 $DIG +tcp foo.baddname.example.net @10.53.0.1 a -p 5300 > dig.out || ret=1
104 grep "status: SERVFAIL" dig.out > /dev/null || ret=1
105 if [ $ret != 0 ]; then echo "I:failed"; fi
106 status=`expr $status + $ret`
107
108 echo "I:checking DNAME target filtering (accept)"
109 ret=0
110 $DIG +tcp foo.gooddname.example.net @10.53.0.1 a -p 5300 > dig.out || ret=1
111 grep "status: NOERROR" dig.out > /dev/null || ret=1
112 if [ $ret != 0 ]; then echo "I:failed"; fi
113 status=`expr $status + $ret`
114
115 echo "I:checking DNAME target filtering (accept due to subdomain)"
116 ret=0
117 $DIG +tcp www.dname.sub.example.org @10.53.0.1 a -p 5300 > dig.out || ret=1
118 grep "status: NOERROR" dig.out > /dev/null || ret=1
119 if [ $ret != 0 ]; then echo "I:failed"; fi
120 status=`expr $status + $ret`
121
122
123 echo "I:exit status: $status"
124 exit $status