Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Apr 2015 14:43:05 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r385049 - in head/dns: bind910 bind910/files bind99 bind99/files
Message-ID:  <201504301443.t3UEh5KE063399@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Thu Apr 30 14:43:04 2015
New Revision: 385049
URL: https://svnweb.freebsd.org/changeset/ports/385049

Log:
  When named.conf was placed somewhere else than %%ETCDIR%%, rndc would stop
  working.
  
  PR:		199384
  Submitted by:	Curtis Villamizar
  Sponsored by:	Absolight

Modified:
  head/dns/bind910/Makefile
  head/dns/bind910/files/named.in
  head/dns/bind99/Makefile
  head/dns/bind99/files/named.in

Modified: head/dns/bind910/Makefile
==============================================================================
--- head/dns/bind910/Makefile	Thu Apr 30 14:41:20 2015	(r385048)
+++ head/dns/bind910/Makefile	Thu Apr 30 14:43:04 2015	(r385049)
@@ -7,7 +7,7 @@ PORTVERSION=	${ISCVERSION:S/-P/P/}
 PORTREVISION=	0
 .else
 # dns/bind910 here
-PORTREVISION=	2
+PORTREVISION=	3
 .endif
 CATEGORIES=	dns net ipv6
 MASTER_SITES=	ISC/bind9/${ISCVERSION}

Modified: head/dns/bind910/files/named.in
==============================================================================
--- head/dns/bind910/files/named.in	Thu Apr 30 14:41:20 2015	(r385048)
+++ head/dns/bind910/files/named.in	Thu Apr 30 14:43:04 2015	(r385049)
@@ -64,6 +64,10 @@ _named_confdir="${named_chrootdir}${_nam
 _named_program_root="${named_program%/sbin/named}"
 _openssl_engines="%%LOCALBASE%%/lib/engines"
 
+# Needed if named.conf and rndc.conf are moved or if rndc.conf is used
+rndc_conf=${rndc_conf:-"$_named_confdir/rndc.conf"}
+rndc_key=${rndc_key:-"$_named_confdir/rndc.key"}
+
 # If running in a chroot cage, ensure that the appropriate files
 # exist inside the cage, as well as helper symlinks into the cage
 # from outside.
@@ -134,7 +138,7 @@ chroot_autoupdate()
 				"within a jail. Thus a chrooted named cannot " \
 				"be run from within a jail.  Either mount the " \
 				"devfs with null and random from the host, or " \
-				"run named without chrooting it, set" \
+				"run named without chrooting it, set " \
 				"named_chrootdir=\"\" in /etc/rc.conf."
 		fi
 	fi
@@ -188,9 +192,9 @@ named_poststart()
 
 named_reload()
 {
-	# This is a one line function, but ${named_program} is not defined early
+	# This is a one line function, but ${named_program} is not defined early
 	# enough to be there when the reload_cmd variable is defined up there.
-	${_named_program_root}/sbin/rndc reload
+	${_named_program_root}/sbin/rndc ${rndc_flags} reload
 }
 
 find_pidfile()
@@ -216,7 +220,7 @@ named_stop()
 		return 1
 	fi
 	echo 'Stopping named.'
-	if ${_named_program_root}/sbin/rndc stop 2>/dev/null; then
+	if ${_named_program_root}/sbin/rndc ${rndc_flags} stop 2>/dev/null; then
 		wait_for_pids ${rc_pid}
 	else
 		echo -n 'rndc failed, trying kill: '
@@ -266,6 +270,16 @@ named_prestart()
 
 	command_args="-u ${named_uid:=root} -c ${named_conf} ${command_args}"
 
+	if [ -z "${rndc_flags}" ]; then
+		if [ -s ${rndc_conf} ] ; then
+			rndc_flags="-c ${rndc_conf}"
+		elif [ -s ${rndc_key} ] ; then
+			rndc_flags="-k ${rndc_key}"
+		else
+			rndc_flags=""
+		fi
+	fi
+
 %%NATIVE_PKCS11%%	if [ -z "${named_pkcs11_engine}"]; then
 %%NATIVE_PKCS11%%		err 3 "named_pkcs11_engine has to be set to the PKCS#11 engine's library you want to use"
 %%NATIVE_PKCS11%%	elif [ ! -f ${named_pkcs11_engine} ]; then

Modified: head/dns/bind99/Makefile
==============================================================================
--- head/dns/bind99/Makefile	Thu Apr 30 14:41:20 2015	(r385048)
+++ head/dns/bind99/Makefile	Thu Apr 30 14:43:04 2015	(r385049)
@@ -2,7 +2,7 @@
 
 PORTNAME=	bind
 PORTVERSION=	${ISCVERSION:S/-P/P/}
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	dns net ipv6
 MASTER_SITES=	ISC/bind9/${ISCVERSION}
 PKGNAMESUFFIX=	99

Modified: head/dns/bind99/files/named.in
==============================================================================
--- head/dns/bind99/files/named.in	Thu Apr 30 14:41:20 2015	(r385048)
+++ head/dns/bind99/files/named.in	Thu Apr 30 14:43:04 2015	(r385049)
@@ -62,6 +62,10 @@ _named_confdir="${named_chrootdir}${_nam
 _named_program_root="${named_program%/sbin/named}"
 _openssl_engines="%%LOCALBASE%%/lib/engines"
 
+# Needed if named.conf and rndc.conf are moved or if rndc.conf is used
+rndc_conf=${rndc_conf:-"$_named_confdir/rndc.conf"}
+rndc_key=${rndc_key:-"$_named_confdir/rndc.key"}
+
 # If running in a chroot cage, ensure that the appropriate files
 # exist inside the cage, as well as helper symlinks into the cage
 # from outside.
@@ -186,9 +190,9 @@ named_poststart()
 
 named_reload()
 {
-	# This is a one line function, but ${named_program} is not defined early
+	# This is a one line function, but ${named_program} is not defined early
 	# enough to be there when the reload_cmd variable is defined up there.
-	${_named_program_root}/sbin/rndc reload
+	${_named_program_root}/sbin/rndc ${rndc_flags} reload
 }
 
 find_pidfile()
@@ -214,7 +218,7 @@ named_stop()
 		return 1
 	fi
 	echo 'Stopping named.'
-	if ${_named_program_root}/sbin/rndc stop 2>/dev/null; then
+	if ${_named_program_root}/sbin/rndc ${rndc_flags} stop 2>/dev/null; then
 		wait_for_pids ${rc_pid}
 	else
 		echo -n 'rndc failed, trying kill: '
@@ -264,6 +268,16 @@ named_prestart()
 
 	command_args="-u ${named_uid:=root} -c ${named_conf} ${command_args}"
 
+	if [ -z "${rndc_flags}" ]; then
+		if [ -s ${rndc_conf} ] ; then
+			rndc_flags="-c ${rndc_conf}"
+		elif [ -s ${rndc_key} ] ; then
+			rndc_flags="-k ${rndc_key}"
+		else
+			rndc_flags=""
+		fi
+	fi
+
 	local line nsip firstns
 
 	# Is the user using a sandbox?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504301443.t3UEh5KE063399>