1#!/bin/sh
2#
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# This Source Code Form is subject to the terms of the Mozilla Public
6# License, v. 2.0. If a copy of the MPL was not distributed with this
7# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8#
9# See the COPYRIGHT file distributed with this work for additional
10# information regarding copyright ownership.
11
12SYSTEMTESTTOP=..
13. $SYSTEMTESTTOP/conf.sh
14
15DIGOPTS="-p ${PORT}"
16
17status=0
18n=1
19
20echo_i "check that 'check-integrity yes; check-mx-cname fail;' works ($n)"
21ret=0
22$DIG $DIGOPTS @10.53.0.1 mx mx-cname-fail > dig.out.test$n || ret=1
23grep "status: SERVFAIL," dig.out.test$n > /dev/null || ret=1
24grep "zone mx-cname-fail/IN: mx-cname-fail/MX 'cname.mx-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
25n=`expr $n + 1`
26if [ $ret != 0 ]; then echo_i "failed"; fi
27status=`expr $status + $ret`
28
29echo_i "check that 'check-integrity yes; check-mx-cname warn;' works ($n)"
30ret=0
31$DIG $DIGOPTS @10.53.0.1 mx mx-cname-warn > dig.out.test$n || ret=1
32grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
33grep "zone mx-cname-warn/IN: mx-cname-warn/MX 'cname.mx-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
34n=`expr $n + 1`
35if [ $ret != 0 ]; then echo_i "failed"; fi
36status=`expr $status + $ret`
37
38echo_i "check that 'check-integrity yes; check-mx-cname ignore;' works ($n)"
39ret=0
40$DIG $DIGOPTS @10.53.0.1 mx mx-cname-ignore > dig.out.test$n || ret=1
41grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
42grep "zone mx-cname-ignore/IN: mx-cname-ignore/MX 'cname.mx-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
43n=`expr $n + 1`
44if [ $ret != 0 ]; then echo_i "failed"; fi
45status=`expr $status + $ret`
46
47echo_i "check that 'check-integrity no; check-mx-cname fail;' works ($n)"
48ret=0
49$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-fail > dig.out.test$n || ret=1
50grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
51grep "zone no-mx-cname-fail/IN: no-mx-cname-fail/MX 'cname.no-mx-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
52n=`expr $n + 1`
53if [ $ret != 0 ]; then echo_i "failed"; fi
54status=`expr $status + $ret`
55
56echo_i "check that 'check-integrity no; check-mx-cname warn;' works ($n)"
57ret=0
58$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-warn > dig.out.test$n || ret=1
59grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
60grep "zone no-mx-cname-warn/IN: no-mx-cname-warn/MX 'cname.no-mx-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
61n=`expr $n + 1`
62if [ $ret != 0 ]; then echo_i "failed"; fi
63status=`expr $status + $ret`
64
65echo_i "check that 'check-integrity no; check-mx-cname ignore;' works ($n)"
66ret=0
67$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-ignore > dig.out.test$n || ret=1
68grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
69grep "zone no-mx-cname-ignore/IN: no-mx-cname-ignore/MX 'cname.no-mx-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
70n=`expr $n + 1`
71if [ $ret != 0 ]; then echo_i "failed"; fi
72status=`expr $status + $ret`
73
74echo_i "check that 'check-integrity yes; check-srv-cname fail;' works ($n)"
75ret=0
76$DIG $DIGOPTS @10.53.0.1 srv srv-cname-fail > dig.out.test$n || ret=1
77grep "status: SERVFAIL," dig.out.test$n > /dev/null || ret=1
78grep "zone srv-cname-fail/IN: srv-cname-fail/SRV 'cname.srv-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
79n=`expr $n + 1`
80if [ $ret != 0 ]; then echo_i "failed"; fi
81status=`expr $status + $ret`
82
83echo_i "check that 'check-integrity yes; check-srv-cname warn;' works ($n)"
84ret=0
85$DIG $DIGOPTS @10.53.0.1 srv srv-cname-warn > dig.out.test$n || ret=1
86grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
87grep "zone srv-cname-warn/IN: srv-cname-warn/SRV 'cname.srv-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1
88n=`expr $n + 1`
89if [ $ret != 0 ]; then echo_i "failed"; fi
90status=`expr $status + $ret`
91
92echo_i "check that 'check-integrity yes; check-srv-cname ignore;' works ($n)"
93ret=0
94$DIG $DIGOPTS @10.53.0.1 srv srv-cname-ignore > dig.out.test$n || ret=1
95grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
96grep "zone srv-cname-ignore/IN: srv-cname-ignore/SRV 'cname.srv-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
97n=`expr $n + 1`
98if [ $ret != 0 ]; then echo_i "failed"; fi
99status=`expr $status + $ret`
100
101echo_i "check that 'check-integrity no; check-srv-cname fail;' works ($n)"
102ret=0
103$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-fail > dig.out.test$n || ret=1
104grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
105grep "zone no-srv-cname-fail/IN: no-srv-cname-fail/SRV 'cname.no-srv-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
106n=`expr $n + 1`
107if [ $ret != 0 ]; then echo_i "failed"; fi
108status=`expr $status + $ret`
109
110echo_i "check that 'check-integrity no; check-srv-cname warn;' works ($n)"
111ret=0
112$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-warn > dig.out.test$n || ret=1
113grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
114grep "zone no-srv-cname-warn/IN: no-srv-cname-warn/SRV 'cname.no-srv-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
115n=`expr $n + 1`
116if [ $ret != 0 ]; then echo_i "failed"; fi
117status=`expr $status + $ret`
118
119echo_i "check that 'check-integrity no; check-srv-cname ignore;' works ($n)"
120ret=0
121$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-ignore > dig.out.test$n || ret=1
122grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1
123grep "zone no-srv-cname-ignore/IN: no-srv-cname-ignore/SRV 'cname.no-srv-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1
124n=`expr $n + 1`
125if [ $ret != 0 ]; then echo_i "failed"; fi
126status=`expr $status + $ret`
127
128echo_i "exit status: $status"
129test $status -eq 0 || exit 1
130