Bug 25049

Summary: named.restart does not use named_flags from rc.conf
Product: Base System Reporter: richard <richard>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description richard 2001-02-13 02:10:01 UTC
named.restart does not maintain the named_flags, particularly when named is started via rc when rc.conf contains named_enable="YES"

Fix: modify named.restart to include rc.conf and append ${named_flags} to the exec ndc restart line. Sample patch included.
Comment 1 Peter Pentchev 2001-02-13 07:11:42 UTC
On Mon, Feb 12, 2001 at 06:02:42PM -0800, richard@gohome.net wrote:
> 
> >Number:         25049
> >Category:       misc
> >Synopsis:       named.restart does not use named_flags from rc.conf
> >Originator:     Richard Roderick
> >Release:        4.2
> >Organization:
> >Environment:
> FreeBSD dns.pdx.uspops.com 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000     jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC  i386
> >Description:
> named.restart does not maintain the named_flags, particularly when named is started via rc when rc.conf contains named_enable="YES"
> >How-To-Repeat:
> 
> >Fix:
> modify named.restart to include rc.conf and append ${named_flags} to the exec ndc restart line. Sample patch included.
> 
> --- src/usr.sbin/named.restart/named.restart.sh.orig    Mon Feb 12 17:59:01 2001
> +++ src/usr.sbin/named.restart/named.restart.sh Mon Feb 12 18:00:33 2001
> @@ -4,4 +4,12 @@
>  # $FreeBSD: src/usr.sbin/named.restart/named.restart.sh,v 1.1.2.1 1999/08/29 15:44:26 peter Exp $
>  #
>  
> -exec %DESTSBIN%/%INDOT%ndc restart
> +# If there is a global system configuration file, suck it in.
> +#
> +if [ -f /etc/defaults/rc.conf ]; then
> +       . /etc/defaults/rc.conf
> +elif [ -f /etc/rc.conf ]; then
> +       . /etc/rc.conf
> +fi
> +
> +exec %DESTSBIN%/%INDOT%ndc restart ${named_flags}

Shouldn't this be better done with the source_rc_confs mechanism introduced
lately?  (it might be a good idea to have a -stable system handy before
submitting bug reports, so you are sure you are not submitting something
which has been fixed, or out of date :)

G'luck,
Peter

-- 
If I were you, who would be reading this sentence?
Comment 2 richard 2001-02-13 10:09:24 UTC
>Shouldn't this be better done with the source_rc_confs mechanism introduced
>lately?  (it might be a good idea to have a -stable system handy before
>submitting bug reports, so you are sure you are not submitting something
>which has been fixed, or out of date :)

(: ...This is my first attempt at helping... :)

So, I went to my stable server and saw what you meant!  Of course this is a 
small
change isn't it? I'm not totally familiar with the addition of 
source_rc_confs but I think
I get it. So the patch I suggested would become the following, correct?

diff -u named.restart.sh.orig named.restart.sh
--- named.restart.sh.orig       Fri Aug 27 18:17:25 1999
+++ named.restart.sh    Tue Feb 13 00:18:14 2001
@@ -4,4 +4,13 @@
  # $FreeBSD: src/usr.sbin/named.restart/named.restart.sh,v 1.2 1999/08/28 
01:17:25 peter Exp $
  #

-exec %DESTSBIN%/%INDOT%ndc restart
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/rc.conf ]; then
+        . /etc/defaults/rc.conf
+        source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+        . /etc/rc.conf
+fi
+
+exec %DESTSBIN%/%INDOT%ndc restart ${named_flags}
Comment 3 Murray Stokely freebsd_committer freebsd_triage 2001-04-11 03:13:03 UTC
State Changed
From-To: open->closed

Fix committed to -current, thanks!
Comment 4 Maxim Konovalov 2001-04-15 17:41:46 UTC
Hello,

IMHO it is still a bit incorrect. How about this one:

--- rc.conf.orig	Sun Apr 15 20:25:26 2001
+++ rc.conf	Sun Apr 15 20:27:07 2001
@@ -114,6 +114,7 @@
 named_program="named"		# path to named, if you want a different one.
 named_flags=""			# Flags for named
 #named_flags="-u bind -g bind"	# Flags for named
+named_socket="/var/run/ndc"	# path to named control socket

 kerberos_server_enable="NO"	# Run a kerberos master server (or NO).
 kadmind_server_enable="NO"	# Run kadmind (or NO) -- do not run on

--- named.reload.sh.orig	Sun Apr 15 20:30:55 2001
+++ named.reload.sh	Sun Apr 15 20:34:16 2001
@@ -4,4 +4,12 @@
 # $FreeBSD: src/usr.sbin/named.reload/named.reload.sh,v 1.2 1999/08/28 01:17:23 peter Exp $
 #

-exec %DESTSBIN%/%INDOT%ndc reload
+if [ -r /etc/defaults/rc.conf ]; then
+	. /etc/defaults/rc.conf
+	source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+	. /etc/rc.conf
+fi
+
+if [
+exec %DESTSBIN%/%INDOT%ndc -c ${named_socket:-/var/run/ndc} reload

--- named.restart.sh.orig	Sun Apr 15 20:28:15 2001
+++ named.restart.sh	Sun Apr 15 20:35:52 2001
@@ -10,4 +10,4 @@
 elif [ -r /etc/rc.conf ]; then
         . /etc/rc.conf
 fi
-exec %DESTSBIN%/%INDOT%ndc restart ${named_flags}
+exec %DESTSBIN%/%INDOT%ndc -c ${named_socket:-/var/run/ndc} -n {named_program} restart ${named_flags}

- -maxim

-- 
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: maxim@macomnet.ru