Subject: misc/16884: Better method for syslogd to determine location of extra log-sockets
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jarle@uninett.no>
List: netbsd-bugs
Date: 05/18/2002 19:16:14
>Number:         16884
>Category:       misc
>Synopsis:       Better method for syslogd to determine location of extra log-sockets
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat May 18 10:17:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jarle Greipsland
>Release:        NetBSD 1.5ZC
>Organization:
	
>Environment:
	
	
System: NetBSD splitter-pine.urc.uninett.no 1.5ZC NetBSD 1.5ZC (GENERIC.MPDEBUG) #3: Sun May 5 18:48:09 CEST 2002 jarle@splitter-pine.urc.uninett.no:/usr/src/sys/arch/i386/compile/GENERIC.MPDEBUG i386
Architecture: i386
Machine: i386
>Description:
Currently /etc/rc.d/syslogd has a hard coded list of applications that may 
be configured to run in chrooted environments.  This makes it harder to drop
in new applications with such a capability.

By introducing the new keyword 'chroot' to the KEYWORD:-line(s) in the
rc-script, syslogd can determine dynamically which chroot directories
should have an extra log socket.

A possible drawback with this construct is that the list of scripts
run by /etc/rc is now hard coded into the syslogd script ...
	
>How-To-Repeat:
Notice that if one drops a new rc-script for a chrooted application into
/etc/rc, one'll have to update /etc/rc/syslogd in order for the application
to find a log socket in the proper place.
	
>Fix:
	
[ Note: I haven't really tested this, so the code is indicative only ... ]
--- /etc/rc.d/syslogd   Wed May  8 08:57:33 2002
+++ syslogd     Sat May 18 19:00:20 2002
@@ -35,5 +35,7 @@
        #       syslog socket to list of sockets to watch.
        #
-       for _l in named ntpd; do
+       _chfiles=`rcorder -k chroot /etc/rc.d/*`
+       for _f in $_chfiles; do
+               _l=${_f##*/}
                eval _ldir=\$${_l}_chrootdir
                if checkyesno $_l && [ -n "$_ldir" ]; then
--- /etc/rc.d/ntpd      Wed May  8 08:57:31 2002
+++ ntpd        Sat May 18 19:10:10 2002
@@ -7,4 +7,5 @@
 # REQUIRE: DAEMON
 # BEFORE:  LOGIN
+# KEYWORD: chroot
 
 . /etc/rc.subr
--- /etc/rc.d/named     Wed May  8 08:57:30 2002
+++ named       Sat May 18 19:10:15 2002
@@ -7,4 +7,5 @@
 # REQUIRE: SERVERS
 # BEFORE:  DAEMON
+# KEYWORD: chroot
 
 . /etc/rc.subr
>Release-Note:
>Audit-Trail:
>Unformatted: