NetBSD Problem Report #42300

From tmp+esmtp@disfinite.org  Tue Nov 10 13:12:18 2009
Return-Path: <tmp+esmtp@disfinite.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id BEFDC63B8CD
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Nov 2009 13:12:17 +0000 (UTC)
Message-Id: <20091110131214.6C135372DF@echo.disfinite.org>
Date: Tue, 10 Nov 2009 07:12:14 -0600 (CST)
From: tmp+nb-spr@disfinite.org (T. M. Pederson)
Reply-To: tmp+nb-spr@disfinite.org (T. M. Pederson)
To: gnats-bugs@gnats.NetBSD.org
Subject: name space confusion in /etc/rc.d/syslogd
X-Send-Pr-Version: 3.95

>Number:         42300
>Category:       misc
>Synopsis:       /etc/rc.d/syslogd assumes file names always match a variable in the file instead of reading the variable
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 10 13:15:01 +0000 2009
>Originator:     T. M. Pederson
>Release:        NetBSD 5.0_STABLE
>Organization:
T. M. Pederson <tmp+nb-spr@disfinite.org>
GPG key fingerprint = FFAF D056 F12B E03F 7084  1288 EF8B E1FE 1693 21EB
+Accept: text/plain; charset=ISO-8859-*,UTF-*
>Environment:
System: NetBSD echo.disfinite.org 5.0_STABLE NetBSD 5.0_STABLE (ECHO) #5: Wed Oct 28 08:00:06 CDT 2009 tmp@echo.disfinite.org:/usr/obj/sys/arch/sparc64/compile/ECHO sparc64
Architecture: sparc64
Machine: sparc64
>Description:
	When /etc/rc.d/syslogd checks for chroot daemons, it assumes that
	their files in /etc/rc.d/ have names that exactly match the name
	variable inside the file. Locally maintained daemons sometimes lack
	synchronization between the two name spaces, and syslogd then works
	poorly with the chroot'd daemon.
>How-To-Repeat:
	Add a chroot'd daemon whose file in /etc/rc.d/ has a name that differs
	from the name variable inside the file.
>Fix:
	Patch /etc/rc.d/syslogd to read the variable instead of the file name.
	The patch below is in use locally. I expect awk would be more typical
	here, but I'm better with sed.
--- /etc/rc.d/syslogd.orig	2004-10-11 08:29:52.000000000 -0500
+++ /etc/rc.d/syslogd	2009-11-10 06:24:21.000000000 -0600
@@ -37,7 +37,7 @@
 	#
 	for _lr in $(rcorder -k chrootdir /etc/rc.d/*); do
 	    (
-		_l=${_lr##*/}
+		eval $(sed -n -e '/^name=/s/name/_l/' -e '/^_l=/p' ${_lr})
 		load_rc_config ${_l}
 		eval _ldir=\$${_l}_chrootdir
 		if checkyesno $_l && [ -n "$_ldir" ]; then

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.