summaryrefslogtreecommitdiffstats
path: root/named.sh
blob: 8c2ebaa18e47fe10f19799d728dc3aad1812bf9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This source code is released into the public domain.
#
# The named allow_internal.conf file is an ACL definition containing a
# list of "<prefix>;"

NAMED_FILE="/usr/local/etc/namedb/allow_internal.conf"
NAMED_TEMP="${NAMED_FILE}.ldaptmp"

if [ ! -f "$NAMED_FILE" ]; then
	exit 0
fi

printf >"$NAMED_TEMP" 'acl "allow_internal" {\n'
awk <"$NETWORKS_FILE" >>"$NAMED_TEMP" '{ print $1 ";" }'
printf >>"$NAMED_TEMP" '};\n'

if cmp -s "$NAMED_TEMP" "$NAMED_FILE"; then
	rm "$NAMED_TEMP"
	exit 0
fi

printf '%s updated:\n\n' "$NAMED_FILE"
diff "$NAMED_FILE" "$NAMED_TEMP"
printf '\n'

mv "$NAMED_TEMP" "$NAMED_FILE" 
/usr/local/sbin/rndc reload