summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2009-12-12 21:51:50 +0000
committerdougb <dougb@FreeBSD.org>2009-12-12 21:51:50 +0000
commitab37c8336417bc9a5b4657bd0a95260ed6c383b9 (patch)
tree647208ec4d3a7702ae13f05b8b9ce68dc6fa1e47 /etc
parentb1c6888d8786b79e6c2b98a9683ccdacfef32281 (diff)
downloadFreeBSD-src-ab37c8336417bc9a5b4657bd0a95260ed6c383b9.zip
FreeBSD-src-ab37c8336417bc9a5b4657bd0a95260ed6c383b9.tar.gz
Since the change to rc.subr in r198162 it's not necessary to specify
command in the rc.d script if we have a corresponding ${name}_program entry, which we do for named. Rename named_precmd to named_prestart to make it more clear and match convention. Move the command_args definition related to -u up into _prestart(). It (and the associated $named_uid value) are only used there, and unlike required_* and pidfile don't need to be used until this stage. Fix a silly bug that would only have affected people who were using the new named_wait or named_auto_forward features, AND had set up an rndc.conf file instead of using the automatically generated rndc.key. For named_conf: Add "-c $named_conf" to command_args if it's not set to the default. If it is set to the default and we're using the base BIND it's not necessary. If we're using BIND from the ports the user is likely to have included it in _flags (due to long necessity for doing so) so don't duplicate that if it's set. Add $named_conf to required_files
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.d/named23
1 files changed, 16 insertions, 7 deletions
diff --git a/etc/rc.d/named b/etc/rc.d/named
index 65a13a5..6e03a2c 100755
--- a/etc/rc.d/named
+++ b/etc/rc.d/named
@@ -12,10 +12,9 @@
name="named"
rcvar=named_enable
-command="/usr/sbin/named"
extra_commands="reload"
-start_precmd="named_precmd"
+start_precmd="named_prestart"
start_postcmd="named_poststart"
reload_cmd="named_reload"
stop_cmd="named_stop"
@@ -155,8 +154,17 @@ create_file () {
chmod 644 $1
}
-named_precmd()
+named_prestart()
{
+ command_args="-u ${named_uid:=root}"
+
+ if [ ! "$named_conf" = '/etc/namedb/named.conf' ]; then
+ case "$named_flags" in
+ -c*|*' -c'*) ;; # No need to add it
+ *) command_args="-c $named_conf $command_args" ;;
+ esac
+ fi
+
local line nsip firstns
# Is the user using a sandbox?
@@ -170,11 +178,11 @@ named_precmd()
# Create an rndc.key file for the user if none exists
#
- if [ -s "${named_chrootdir}/etc/namedb/rndc.conf" ]; then
- return 0
- fi
confgen_command="${command%/named}/rndc-confgen -a -b256 -u $named_uid \
-c ${named_chrootdir}/etc/namedb/rndc.key"
+ if [ -s "${named_chrootdir}/etc/namedb/rndc.conf" ]; then
+ unset confgen_command
+ fi
if [ -s "${named_chrootdir}/etc/namedb/rndc.key" ]; then
case `stat -f%Su ${named_chrootdir}/etc/namedb/rndc.key` in
root|$named_uid) ;;
@@ -260,10 +268,11 @@ named_precmd()
}
load_rc_config $name
+
# Updating the following variables requires that rc.conf be loaded first
#
required_dirs="$named_chrootdir" # if it is set, it must exist
+required_files="${named_conf:=/etc/namedb/named.conf}"
pidfile="${named_pidfile:-/var/run/named/pid}"
-command_args="-u ${named_uid:=root}"
run_rc_command "$1"
OpenPOWER on IntegriCloud