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 14# Test of include statement with glob expression. 15 16set -e 17 18. ../conf.sh 19 20DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noadd +nostats -p ${PORT}" 21 22status=0 23n=0 24 25# Test 1 - check if zone1 was loaded. 26n=$((n + 1)) 27echo_i "checking glob include of zone1 config ($n)" 28ret=0 29$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 zone1.com. a >dig.out.ns2.$n || ret=1 30grep 'status: NOERROR' dig.out.ns2.$n >/dev/null || ret=1 31grep '^zone1.com.' dig.out.ns2.$n >/dev/null || ret=1 32if [ $ret != 0 ]; then echo_i "failed"; fi 33status=$((status + ret)) 34 35# Test 2 - check if zone2 was loaded. 36n=$((n + 1)) 37echo_i "checking glob include of zone2 config ($n)" 38ret=0 39$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 zone2.com. a >dig.out.ns2.$n || ret=1 40grep 'status: NOERROR' dig.out.ns2.$n >/dev/null || ret=1 41grep '^zone2.com.' dig.out.ns2.$n >/dev/null || ret=1 42if [ $ret != 0 ]; then echo_i "failed"; fi 43status=$((status + ret)) 44 45# Test 3 - check if standard file path (no magic chars) works. 46n=$((n + 1)) 47echo_i "checking include of standard file path config ($n)" 48ret=0 49$DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 mars.com. a >dig.out.ns2.$n || ret=1 50grep 'status: NOERROR' dig.out.ns2.$n >/dev/null || ret=1 51grep '^mars.com.' dig.out.ns2.$n >/dev/null || ret=1 52if [ $ret != 0 ]; then echo_i "failed"; fi 53status=$((status + ret)) 54 55# Test 4: named-checkconf correctly parses glob includes. 56n=$((n + 1)) 57echo_i "checking named-checkconf with glob include ($n)" 58ret=0 59( 60 cd ns2 61 $CHECKCONF named.conf 62) || ret=1 63if [ $ret != 0 ]; then echo_i "failed"; fi 64status=$((status + ret)) 65 66echo_i "exit status: $status" 67[ $status -eq 0 ] || exit 1 68