Subject: Re: bin/33479: su unconditionally sets nice value to -2 [PATCH]
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Johan Veenhuizen <veenhuizen@users.sourceforge.net>
List: netbsd-bugs
Date: 05/14/2006 16:20:02
The following reply was made to PR bin/33479; it has been noted by GNATS.

From: Johan Veenhuizen <veenhuizen@users.sourceforge.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/33479: su unconditionally sets nice value to -2 [PATCH]
Date: Sun, 14 May 2006 18:15:40 +0200

 The priority change is only supposed to take effect during the
 execution of the su command, not in the resulting shell.  Apparently,
 the code to reset the priority before exec has been lost between
 su.c and su_pam.c.  Apply the following patch (code copied from su.c).
 
 Regards,
 Johan
 
 Index: su_pam.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/su/su_pam.c,v
 retrieving revision 1.5.2.6
 diff -u -r1.5.2.6 su_pam.c
 --- su_pam.c	16 Dec 2005 11:57:20 -0000	1.5.2.6
 +++ su_pam.c	14 May 2006 16:09:23 -0000
 @@ -510,6 +510,9 @@
  	if (setusercontext(lc, pwd, pwd->pw_uid, setwhat) == -1)
  		err(EXIT_FAILURE, "setusercontext");
  
 +	/* Raise our priority back to what we had before */
 +	(void)setpriority(PRIO_PROCESS, 0, prio);
 +
  	(void)execv(shell, np);
  	err(EXIT_FAILURE, "%s", shell);
  done: