From owner-svn-src-all@FreeBSD.ORG Sat Dec 12 21:51:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B33F106566B; Sat, 12 Dec 2009 21:51:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4F6E8FC0C; Sat, 12 Dec 2009 21:51:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCLpoXH064713; Sat, 12 Dec 2009 21:51:50 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCLpoP7064711; Sat, 12 Dec 2009 21:51:50 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912122151.nBCLpoP7064711@svn.freebsd.org> From: Doug Barton Date: Sat, 12 Dec 2009 21:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200448 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 21:51:51 -0000 Author: dougb Date: Sat Dec 12 21:51:50 2009 New Revision: 200448 URL: http://svn.freebsd.org/changeset/base/200448 Log: 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 Modified: head/etc/rc.d/named Modified: head/etc/rc.d/named ============================================================================== --- head/etc/rc.d/named Sat Dec 12 21:31:07 2009 (r200447) +++ head/etc/rc.d/named Sat Dec 12 21:51:50 2009 (r200448) @@ -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"