1#!/bin/sh
2#
3# Copyright (C) 2004, 2007, 2009, 2012  Internet Systems Consortium, Inc. ("ISC")
4#
5# Permission to use, copy, modify, and/or distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15# PERFORMANCE OF THIS SOFTWARE.
16
17# $Id$
18
19SYSTEMTESTTOP=..
20. $SYSTEMTESTTOP/conf.sh
21
22status=0
23
24#
25echo "I: checking that we detect a NS which refers to a CNAME"
26if $CHECKZONE . cname.db > cname.out 2>&1
27then
28	echo "I:failed (status)"; status=1
29else
30	if grep "is a CNAME" cname.out > /dev/null
31	then
32		:
33	else
34		echo "I:failed (message)"; status=1
35	fi
36fi
37
38#
39echo "I: checking that we detect a NS which is below a DNAME"
40if $CHECKZONE . dname.db > dname.out 2>&1
41then
42	echo "I:failed (status)"; status=1
43else
44	if grep "is below a DNAME" dname.out > /dev/null
45	then
46		:
47	else
48		echo "I:failed (message)"; status=1
49	fi
50fi
51
52#
53echo "I: checking that we detect a NS which has no address records (A/AAAA)"
54if $CHECKZONE . noaddress.db > noaddress.out
55then
56	echo "I:failed (status)"; status=1
57else
58	if grep "has no address records" noaddress.out > /dev/null
59	then
60		:
61	else
62		echo "I:failed (message)"; status=1
63	fi
64fi
65
66#
67echo "I: checking that we detect a NS which has no records"
68if $CHECKZONE . nxdomain.db > nxdomain.out
69then
70	echo "I:failed (status)"; status=1
71else
72	if grep "has no address records" noaddress.out > /dev/null
73	then
74		:
75	else
76		echo "I:failed (message)"; status=1
77	fi
78fi
79
80#
81echo "I: checking that we detect a NS which looks like a A record (fail)"
82if $CHECKZONE -n fail . a.db > a.out 2>&1
83then
84	echo "I:failed (status)"; status=1
85else
86	if grep "appears to be an address" a.out > /dev/null
87	then
88		:
89	else
90		echo "I:failed (message)"; status=1
91	fi
92fi
93
94#
95echo "I: checking that we detect a NS which looks like a A record (warn=default)"
96if $CHECKZONE . a.db > a.out 2>&1
97then
98	if grep "appears to be an address" a.out > /dev/null
99	then
100		:
101	else
102		echo "I:failed (message)"; status=1
103	fi
104else
105	echo "I:failed (status)"; status=1
106fi
107
108#
109echo "I: checking that we detect a NS which looks like a A record (ignore)"
110if $CHECKZONE -n ignore . a.db > a.out 2>&1
111then
112	if grep "appears to be an address" a.out > /dev/null
113	then
114		echo "I:failed (message)"; status=1
115	else
116		:
117	fi
118else
119	echo "I:failed (status)"; status=1
120fi
121
122#
123echo "I: checking that we detect a NS which looks like a AAAA record (fail)"
124if $CHECKZONE -n fail . aaaa.db > aaaa.out 2>&1
125then
126	echo "I:failed (status)"; status=1
127else
128	if grep "appears to be an address" aaaa.out > /dev/null
129	then
130		:
131	else
132		echo "I:failed (message)"; status=1
133	fi
134fi
135
136#
137echo "I: checking that we detect a NS which looks like a AAAA record (warn=default)"
138if $CHECKZONE . aaaa.db > aaaa.out 2>&1
139then
140	if grep "appears to be an address" aaaa.out > /dev/null
141	then
142		:
143	else
144		echo "I:failed (message)"; status=1
145	fi
146else
147	echo "I:failed (status)"; status=1
148fi
149
150#
151echo "I: checking that we detect a NS which looks like a AAAA record (ignore)"
152if $CHECKZONE -n ignore . aaaa.db > aaaa.out 2>&1
153then
154	if grep "appears to be an address" aaaa.out > /dev/null
155	then
156		echo "I:failed (message)"; status=1
157	else
158		:
159	fi
160else
161	echo "I:failed (status)"; status=1
162fi
163echo "I:exit status: $status"
164exit $status
165