This file is indexed.

/etc/resolvconf/update.d/bind-debian-edu is in debian-edu-config 1.702.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
#!/bin/bash
# Need bash because we use ${foo//bar/baz}
#
# Script to update the named options file
#
# Resolvconf may run us even if named is not running.
# If a bind package is installed then we go ahead and update
# the named configuration in case named is started later.
#
# Assumption: On entry, PWD contains the resolv.conf-type files
#
# Licensed under the GNU GPL.  See /usr/share/doc/resolvconf/copyright.
#
# Written by Thomas Hood <jdthood@yahoo.co.uk>

set -e
PATH=/sbin:/bin

[ -x /usr/sbin/named ] || exit 0
[ -x /lib/resolvconf/list-records ] || exit 1
[ -f /etc/bind/debian-edu/named.conf.options ] || exit 0

OPTS_FILE=named-debian-edu.options
RUN_DIR=/var/run/bind

[ -d "$RUN_DIR" ] || mkdir --parents --mode=0755 "$RUN_DIR"

# Stores arguments (minus duplicates) in RSLT, separated by spaces
# Doesn't work properly if an argument itself contain whitespace
uniquify()
{
	RSLT=""
	while [ "$1" ] ; do
		for E in $RSLT ; do
			[ "$1" = "$E" ] && { shift ; continue 2 ; }
		done
		RSLT="${RSLT:+$RSLT }$1"
		shift
	done
}

# Get list of records, excluding all those for the loopback interface
RSLVCNFFILES="$(/lib/resolvconf/list-records | sed -e '/^lo$/d' -e '/^lo[.]/d')"
 
### Compile semicolon-separated list nameservers ###
NMSRVRS=""
if [ "$RSLVCNFFILES" ] ; then
	uniquify $(sed -n -e 's/^[[:space:]]*nameserver[[:space:]]\+//p' $RSLVCNFFILES)
	[ "$RSLT" ] && NMSRVRS="${RSLT// /; }; "
fi

# N.B.: After changing directory we no longer have access to the resolv.conf-type files
cd "$RUN_DIR"

TMP_FILE="${OPTS_FILE}_new.$$"
clean_up() { rm -f "${RUN_DIR}/$TMP_FILE" ; }
trap clean_up EXIT
rm -f "$TMP_FILE"

# We want to process named.conf.options such that the new forwarders 
# statement gets inserted but nothing else is corrupted in the process.
# We want to do this using only commands available in /bin and /sbin, i.e.,
# with sh, sed and/or grep.   Sed can be made to work -- with difficulty.
# Even so, the following script does not work properly if comment
# delimiters of one style of commenting appear inside another kind of
# comment.  (Named supports C, C++ and sh comment styles.)
#
# First, we do our best to delete all and only comments.
# Then we delete any existing forwarders statement, taking into account
# the fact that these can span several lines.  Then we add a new
# forwarders statement at the beginning of the options statement.
#
echo "// named.conf fragment automatically generated by $0" > "$TMP_FILE"
echo "// DO NOT EDIT THIS FILE.  Instead edit /etc/bind/debian-edu/named.conf.options ." >> "$TMP_FILE"
cat /etc/bind/debian-edu/named.conf.options \
	| sed -e 's%\*/%\*/\
%g' \
	| sed -e '\%/\*%{ :x ; s%\*/%\*/% ; t y ; N ; b x ; :y ; s%/\*.*\*/%% ; }' \
	| sed -e 's%//.*%%' -e 's%#.*%%' \
	| sed -e '/forwarders/{ :x ; s/}/}/ ; t y ; N ; b x ; :y ; s/}[[:space:]]*;/};/ ; t z ; N ; b y ; :z s/forwarders[[:space:]]*{[^}]*};// ; }' \
	| sed -e 's/options[[:space:]]*{/options {\
	forwarders { '"${NMSRVRS}"'};/' | sed -e '/^[[:space:]]*$/{ d ; }' \
	>> "$TMP_FILE"

# bind version 8 does not create a "bind" group
chown root:bind "$TMP_FILE" > /dev/null 2>&1 || :

if [ "$1" = "-i" ] ; then
	mv -f "$TMP_FILE" "$OPTS_FILE"
	exit 0
fi

# Reload named unless we know its options haven't changed
if [ -x /usr/bin/diff ] && [ -f "$OPTS_FILE" ] && /usr/bin/diff -q "$OPTS_FILE" "$TMP_FILE" > /dev/null ; then
	# No change
	rm -f "$TMP_FILE"
else
	mv -f "$TMP_FILE" "$OPTS_FILE"
	# /usr/sbin/ for invoke-rc.d
	PATH=$PATH:/usr/sbin
	[ -x /etc/init.d/bind9 ] && invoke-rc.d bind9 reload > /dev/null 2>&1 || :
	[ -x /etc/init.d/bind  ] && invoke-rc.d bind reload > /dev/null 2>&1 || :
fi