Date: Sun, 4 Aug 2002 20:14:13 +0400 (MSD) From: Dmitry Morozovsky <marck@rinet.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/41317: reflect kernel building user for sudo-ers Message-ID: <200208041614.g74GEDY84314@woozle.rinet.ru>
next in thread | raw e-mail | index | archive | help
>Number: 41317
>Category: kern
>Synopsis: reflect kernel building user for sudo-ers
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Aug 04 09:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Dmitry Morozovsky
>Release: FreeBSD 4-STABLE i386
>Organization:
Cronyx Plus LLC (RiNet ISP)
>Environment:
System: FreeBSD 4-STABLE
>Description:
When using sudo instead of su, environment is slightly different.
In particular, both $USER and $LOGNAME are set to root after sudo -s.
There is at least one annoying side effect of this: kernel build user
mentioned is always 'root'.
In this case the only reliable way to get logged-in user name is
/usr/bin/logname. Following patch utilizes it.
>How-To-Repeat:
For example, using old-way kernel compile:
sudo -s
cd /usr/src/sys/i386/conf
config GENERIC
cd ../../compile/GENERIC
make vers.c
grep compile vers.c
>Fix:
Index: newvers.sh
===================================================================
RCS file: /home/ncvs/src/sys/conf/newvers.sh,v
retrieving revision 1.44.2.24
diff -u -r1.44.2.24 newvers.sh
--- newvers.sh 16 Jun 2002 00:31:54 -0000 1.44.2.24
+++ newvers.sh 4 Aug 2002 15:30:14 -0000
@@ -85,7 +85,8 @@
fi
touch version
-v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date`
+u=`/usr/bin/logname`
+v=`cat version` u=${u-root} d=`pwd` h=`hostname` t=`date`
cat << EOF > vers.c
$COPYRIGHT
char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' };
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208041614.g74GEDY84314>
