From amir@active.ath.cx  Mon Oct 11 09:48:15 2004
Return-Path: <amir@active.ath.cx>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DD71516A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Oct 2004 09:48:15 +0000 (GMT)
Received: from sa6.bezeqint.net (sa6.bezeqint.net [192.115.104.20])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9DFA043D2D
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Oct 2004 09:48:14 +0000 (GMT)
	(envelope-from amir@active.ath.cx)
Received: from localhost (unknown [127.0.0.1])
	by sa6.bezeqint.net (Bezeq International SMTP out Mail Server) with ESMTP id AE46D33BBF
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Oct 2004 11:46:05 +0200 (IST)
Received: from sa6.bezeqint.net ([127.0.0.1])
 by localhost (sa6 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 19808-09 for <FreeBSD-gnats-submit@freebsd.org>;
 Mon, 11 Oct 2004 11:46:05 +0200 (IST)
Received: from active.ath.cx (unknown [81.218.66.74])
	by sa6.bezeqint.net (Bezeq International SMTP out Mail Server) with ESMTP
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Oct 2004 11:46:05 +0200 (IST)
Received: from localhost (localhost.active.ath.cx [127.0.0.1])
	by active.ath.cx (Postfix) with ESMTP id 4EBB65D26
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Oct 2004 11:48:12 +0200 (IST)
Received: from active.ath.cx ([127.0.0.1])
 by localhost (active.ath.cx [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 86693-07 for <FreeBSD-gnats-submit@freebsd.org>;
 Mon, 11 Oct 2004 11:48:06 +0200 (IST)
Received: by active.ath.cx (Postfix, from userid 1000)
	id 337A05D25; Mon, 11 Oct 2004 11:48:06 +0200 (IST)
Message-Id: <20041011094806.337A05D25@active.ath.cx>
Date: Mon, 11 Oct 2004 11:48:06 +0200 (IST)
From: Amir Shalem <amir@active.ath.cx>
Reply-To: Amir Shalem <amir@boom.org.il>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] Fix rc.d/ppp-user to make use of rc.subr
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         72505
>Category:       conf
>Synopsis:       [patch] Fix rc.d/ppp-user to make use of rc.subr
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    brian
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 11 09:50:20 GMT 2004
>Closed-Date:    Tue Apr 24 21:03:25 GMT 2007
>Last-Modified:  Tue Apr 24 21:03:25 GMT 2007
>Originator:     Amir Shalem
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD active.ath.cx 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Sun Oct 10 18:53:39 IST 2004 amir@active.ath.cx:/usr/obj/usr/src/sys/ACTIVE i386

>Description:
	/etc/rc.d/ppp-user, the script which controls /usr/sbin/ppp
	doesn't support many rc.subr features, such as `ppp_nice`.
	because the script starts the /usr/sbin/ppp manually
	which includes the `su`ing part.

>How-To-Repeat:
	set ppp_nice in rc.conf, and see it doesn't change a thing.

>Fix:
	Apply this patch:
--- etc/defaults/rc.conf.orig	Mon Oct 11 11:41:47 2004
+++ etc/defaults/rc.conf	Mon Oct 11 11:42:30 2004
@@ -142,6 +142,7 @@
 
 # User ppp configuration.
 ppp_enable="NO"		# Start user-ppp (or NO).
+ppp_program="/usr/sbin/ppp" # path to user-ppp program.
 ppp_mode="auto"		# Choice of "auto", "ddial", "direct" or "dedicated".
 			# For details see man page for ppp(8). Default is auto.
 ppp_nat="YES"		# Use PPP's internal network address translation or NO.
--- etc/rc.d/ppp-user.orig	Sun Oct 10 16:26:35 2004
+++ etc/rc.d/ppp-user	Mon Oct 11 11:37:58 2004
@@ -10,11 +10,11 @@
 . /etc/rc.subr
 
 name="ppp"
-rcvar="ppp_enable"
-start_cmd="ppp_start"
-stop_cmd=":"
+rcvar=`set_rcvar`
+start_precmd="ppp_precmd"
+start_postcmd="ppp_postcmd"
 
-ppp_start()
+ppp_precmd()
 {
 	# Establish ppp mode.
 	#
@@ -24,21 +24,21 @@
 		ppp_mode="auto"
 	fi
 
-	ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
+	rc_flags="$rc_flags -quiet -${ppp_mode}"
 
 	# Switch on NAT mode?
 	#
 	case ${ppp_nat} in
 	[Yy][Ee][Ss])
-		ppp_command="${ppp_command} -nat"
+		rc_flags="${rc_flags} -nat"
 		;;
 	esac
 
-	ppp_command="${ppp_command} ${ppp_profile}"
-
-	echo "Starting ppp as \"${ppp_user}\""
-	su -m ${ppp_user} -c "exec ${ppp_command}"
+	rc_flags="${rc_flags} ${ppp_profile}"
+}
 
+ppp_postcmd()
+{
 	# Re-Sync ipfilter so it picks up any new network interfaces
 	#
 	/etc/rc.d/ipfilter resync


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->brian 
Responsible-Changed-By: brian 
Responsible-Changed-When: Mon Oct 18 21:58:40 GMT 2004 
Responsible-Changed-Why:  
I'll look at this... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72505 
State-Changed-From-To: open->patched 
State-Changed-By: brian 
State-Changed-When: Wed Dec 15 12:33:59 GMT 2004 
State-Changed-Why:  
Patch applied to -current - thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72505 
State-Changed-From-To: patched->closed 
State-Changed-By: brian 
State-Changed-When: Tue Apr 24 21:02:22 UTC 2007 
State-Changed-Why:  
This is part of RELENG_6 

http://www.freebsd.org/cgi/query-pr.cgi?pr=72505 
>Unformatted:
