From glebius@snark.rinet.ru  Wed Dec  5 21:58:57 2001
Return-Path: <glebius@snark.rinet.ru>
Received: from snark.rinet.ru (snark.rinet.ru [195.54.192.73])
	by hub.freebsd.org (Postfix) with ESMTP id 303F137B405
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  5 Dec 2001 21:58:56 -0800 (PST)
Received: (from glebius@localhost)
	by snark.rinet.ru (8.11.6/8.11.6) id fB65wow38925;
	Thu, 6 Dec 2001 08:58:50 +0300 (MSK)
	(envelope-from glebius)
Message-Id: <200112060558.fB65wow38925@snark.rinet.ru>
Date: Thu, 6 Dec 2001 08:58:50 +0300 (MSK)
From: Gleb Smirnoff <glebius@rinet.ru>
Reply-To: Gleb Smirnoff <glebius@rinet.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: broken configuration option in rc.conf
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         32552
>Category:       conf
>Synopsis:       broken configuration option in rc.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    cjc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 05 22:00:01 PST 2001
>Closed-Date:    Fri Dec 7 00:32:57 PST 2001
>Last-Modified:  Fri Dec 07 00:34:09 PST 2001
>Originator:     Gleb Smirnoff
>Release:        FreeBSD 4.4-RC i386
>Organization:
RINET ISP
>Environment:
System: FreeBSD snark.rinet.ru 4.4-RC FreeBSD 4.4-RC #13: Wed Sep 12 21:45:58 MSD 2001 root@snark.rinet.ru:/usr/obj/usr/src/sys/SNARK i386

>Description:
	In /etc/defaults/rc.conf exists option
	pppoed_provider="*". If it is not overriden in /etc/rc.conf,
	it is expanded to the listing of /. So pppoed is invoked
	with option -p COPYRIGHT bin boot ....

>How-To-Repeat:
	Try pppoed_enable="YES" in rc.conf. pppoed will not run on boot.
	If we insert echo in rc.network before /usr/libexec/pppoed,
	then we will see how pppoed_provider is misinterpreted.

>Fix:
	Comment out this line or override it.
>Release-Note:
>Audit-Trail:

From: "Crist J . Clark" <cjc@FreeBSD.ORG>
To: Gleb Smirnoff <glebius@rinet.ru>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: conf/32552: broken configuration option in rc.conf
Date: Wed, 5 Dec 2001 23:14:45 -0800

 On Thu, Dec 06, 2001 at 08:58:50AM +0300, Gleb Smirnoff wrote:
 [snip]
 > >Description:
 > 	In /etc/defaults/rc.conf exists option
 > 	pppoed_provider="*". If it is not overriden in /etc/rc.conf,
 > 	it is expanded to the listing of /. So pppoed is invoked
 > 	with option -p COPYRIGHT bin boot ....
 > 
 > >How-To-Repeat:
 > 	Try pppoed_enable="YES" in rc.conf. pppoed will not run on boot.
 > 	If we insert echo in rc.network before /usr/libexec/pppoed,
 > 	then we will see how pppoed_provider is misinterpreted.
 > 
 > >Fix:
 > 	Comment out this line or override it.
 
 That _is_ the intended default, a '*' (see pppoed(8) why that is). The
 problem is the code rc.network doesn't protect it from metacharacter
 expansion.
 
 The easiest way around this I could think of is,
 
 Index: src/etc/rc.network
 ===================================================================
 RCS file: /export/ncvs/src/etc/rc.network,v
 retrieving revision 1.115
 diff -u -r1.115 rc.network
 --- src/etc/rc.network  24 Nov 2001 23:41:32 -0000      1.115
 +++ src/etc/rc.network  6 Dec 2001 07:12:53 -0000
 @@ -804,11 +804,13 @@
  
         case ${pppoed_enable} in
         [Yy][Ee][Ss])
 +               echo -n ' pppoed';
                 if [ -n "${pppoed_provider}" ]; then
 -                       pppoed_flags="${pppoed_flags} -p ${pppoed_provider}"
 +                       /usr/libexec/pppoed ${pppoed_flags} \
 +                           -p "${pppoed_provider}" ${pppoed_interface}
 +               else
 +                       /usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
                 fi
 -               echo -n ' pppoed';
 -               /usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
                 ;;
         esac
  
 Not the prettiest, but I think it works. Unless someone has a better
 one, I'll commit it.
 -- 
 "It's always funny until someone gets hurt. Then it's hilarious."
 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

From: Ruslan Ermilov <ru@FreeBSD.ORG>
To: "Crist J . Clark" <cjc@FreeBSD.ORG>
Cc: bug-followup@FreeBSD.ORG
Subject: Re: conf/32552: broken configuration option in rc.conf
Date: Thu, 6 Dec 2001 10:48:08 +0200

 On Wed, Dec 05, 2001 at 11:20:02PM -0800, Crist J . Clark wrote:
 > That _is_ the intended default, a '*' (see pppoed(8) why that is). The
 > problem is the code rc.network doesn't protect it from metacharacter
 > expansion.
 > 
 > The easiest way around this I could think of is,
 > 
 > Index: src/etc/rc.network
 > ===================================================================
 > RCS file: /export/ncvs/src/etc/rc.network,v
 > retrieving revision 1.115
 > diff -u -r1.115 rc.network
 > --- src/etc/rc.network  24 Nov 2001 23:41:32 -0000      1.115
 > +++ src/etc/rc.network  6 Dec 2001 07:12:53 -0000
 > @@ -804,11 +804,13 @@
 >  
 >         case ${pppoed_enable} in
 >         [Yy][Ee][Ss])
 > +               echo -n ' pppoed';
 >                 if [ -n "${pppoed_provider}" ]; then
 > -                       pppoed_flags="${pppoed_flags} -p ${pppoed_provider}"
 > +                       /usr/libexec/pppoed ${pppoed_flags} \
 > +                           -p "${pppoed_provider}" ${pppoed_interface}
 > +               else
 > +                       /usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
 >                 fi
 > -               echo -n ' pppoed';
 > -               /usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
 >                 ;;
 >         esac
 >  
 > Not the prettiest, but I think it works. Unless someone has a better
 > one, I'll commit it.
 > 
 Index: rc.network
 ===================================================================
 RCS file: /home/ncvs/src/etc/rc.network,v
 retrieving revision 1.115
 diff -u -p -r1.115 rc.network
 --- rc.network	2001/11/24 23:41:32	1.115
 +++ rc.network	2001/12/06 08:46:43
 @@ -808,7 +808,9 @@ network_pass3() {
  			pppoed_flags="${pppoed_flags} -p ${pppoed_provider}"
  		fi
  		echo -n ' pppoed';
 +		_opts=$-; set -f
  		/usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
 +		set +f; set -${_opts}
  		;;
  	esac
 
 
 The ${_opts} is only needed for the case where -f was already set.
  
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
State-Changed-From-To: open->analyzed 
State-Changed-By: cjc 
State-Changed-When: Thu Dec 6 01:42:23 PST 2001 
State-Changed-Why:  
ru's fix committed to CURRENT. Wait a day for MFC. 


Responsible-Changed-From-To: freebsd-bugs->cjc 
Responsible-Changed-By: cjc 
Responsible-Changed-When: Thu Dec 6 01:42:23 PST 2001 
Responsible-Changed-Why:  
I'll handle the MFC. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32552 
State-Changed-From-To: analyzed->closed 
State-Changed-By: cjc 
State-Changed-When: Fri Dec 7 00:32:57 PST 2001 
State-Changed-Why:  
MFC. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32552 
>Unformatted:
