NetBSD Problem Report #15798

Received: (qmail 24563 invoked from network); 3 Mar 2002 22:19:21 -0000
Message-Id: <200203032218.g23MI1i14117@allegory.demon.co.uk>
Date: Sun, 3 Mar 2002 23:18:01 +0100 (MET)
From: Bob Kemp <bob@allegory.demon.co.uk>
Reply-To: bob@allegory.demon.co.uk
To: gnats-bugs@gnats.netbsd.org
Subject: Error if /etc/changelist entries contains "*"
X-Send-Pr-Version: 3.95

>Number:         15798
>Category:       security
>Synopsis:       Error if /etc/changelist entries contains "*"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lukem
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 03 22:20:00 +0000 2002
>Closed-Date:    Tue May 21 13:56:22 +0000 2002
>Last-Modified:  Wed May 13 13:19:09 +0000 2015
>Originator:     Bob Kemp
>Release:        NetBSD 1.5ZA
>Organization:

Bob
>Environment:
System: NetBSD allegory.demon.co.uk 1.5ZA NetBSD 1.5ZA (ALLEGORY) #0: Sat Mar 2 14:43:24 MET 2002 bob@allegory.demon.co.uk:/usr/src/sys/arch/i386/compile/ALLEGORY i386
Architecture: i386
Machine: i386
>Description:

    If the file /etc/changelist contains a line with an asterisk in it,
    eg

	/etc/ppp/peers/*

    then there is an error during execution of /etc/security because
    the pattern is expanded inappropriately


	[: /etc/ppp/peers/freesurf: unexpected operator

    It also seems to trash the named file, ie freesurf, but the file is still retrievable from /var/backups.
    (BTW, Thanks to all who've made it so nice -- a beautiful safety net despite this small glitch!)


>How-To-Repeat:
	echo '/etc/ppp/peers/*' >> /etc/changelist
	sh /etc/daily

	(But be warned it will truncate one of the files matching the pattern!)

>Fix:

    Either could you add /etc/ppp/peers to the special-cased files,
    ie near line 800 do the following

		    # Add other files which might dynamically exist:
		    #       /etc/ifconfig.*
		    #       /etc/raid*.conf
		    #       /etc/rc.d/*
		    #       /etc/rc.conf.d/*
		    #
	    ls -1d  $backup_dir/etc/ifconfig.*.current      \
		    $backup_dir/etc/raid*.conf.current      \
		    $backup_dir/etc/rc.d/*.current          \
		    $backup_dir/etc/rc.conf.d/*.current     \
@@@		    $backup_dir/etc/ppp/peers/*.current     \
		2>/dev/null |
		sed "s,^$backup_dir/,/, ; s,\.current$,," >> $CHANGEFILES
	    ls -1d  /etc/ifconfig.*         \
		    /etc/raid*.conf         \
		    /etc/rc.d/*             \
		    /etc/rc.conf.d/*        \
@@@		    /etc/ppp/peers/*        \
		2>/dev/null >> $CHANGEFILES


    Or preferably could you change backup_and_diff near line 130 to expand $_file
    with something like

	files=`echo $_file`
	for file in $files; do
	    ...
	done

    I think that should work okay and would then allow the special-case code to be removed.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: security-officer->lukem 
Responsible-Changed-By: lukem 
Responsible-Changed-When: Sun Mar 3 14:33:08 PST 2002 
Responsible-Changed-Why:  
i'll take this one 
State-Changed-From-To: open->closed 
State-Changed-By: lukem 
State-Changed-When: Tue May 21 06:55:55 PDT 2002 
State-Changed-Why:  
I've fixed this.  You can now use shell metacharacters in /etc/changelist 

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.