From fanf@dotat.at  Wed Sep 12 16:37:39 2001
Return-Path: <fanf@dotat.at>
Received: from hand.dotat.at (host217-35-41-52.in-addr.btopenworld.com [217.35.41.52])
	by hub.freebsd.org (Postfix) with ESMTP id 941B237B406
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Sep 2001 16:37:34 -0700 (PDT)
Received: from fanf by hand.dotat.at with local (Exim 3.33 #16)
	id 15hKVJ-0001UB-00
	for FreeBSD-gnats-submit@freebsd.org; Thu, 13 Sep 2001 00:37:17 +0000
Message-Id: <E15hKVJ-0001UB-00@hand.dotat.at>
Date: Thu, 13 Sep 2001 00:37:17 +0000
From: Tony Finch <dot@dotat.at>
Reply-To: Tony Finch <dot@dotat.at>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] ownerships pedantry
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         30538
>Category:       bin
>Synopsis:       [PATCH] ownerships pedantry
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 12 16:40:01 PDT 2001
>Closed-Date:    Fri Sep 14 00:18:23 PDT 2001
>Last-Modified:  Thu Nov 29 22:10:00 PST 2001
>Originator:     Tony Finch
>Release:        FreeBSD 4.4-RC i386
>Organization:
dotat labs
>Environment:
System: FreeBSD hand.dotat.at 4.4-RC FreeBSD 4.4-RC #4: Sat Sep 1 19:06:27 GMT 2001 fanf@hand.dotat.at:/FreeBSD/obj/FreeBSD/releng4/sys/SHARP i386
>Description:
A number of programs set BINOWN and BINGRP to non-standard values
for no obvious reason. They are:
	ping6
	traceroute6
	doscmd
There are also some oddities in the games handling in bsd.prog.mk
which fails to set the ownership of a hidden game symlink correctly.
>How-To-Repeat:
>Fix:

Index: sbin/ping6/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/ping6/Makefile,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 Makefile
--- sbin/ping6/Makefile	2001/04/25 10:58:46	1.1.2.2
+++ sbin/ping6/Makefile	2001/06/27 18:25:29
@@ -5,8 +5,6 @@
 
 CFLAGS+=-DINET6 -DIPSEC
 
-BINOWN=	root
-BINGRP=	bin
 BINMODE=4555
 
 LDADD=	-lipsec -lmd
Index: usr.sbin/traceroute6/Makefile
===================================================================
RCS file: /home/ncvs/src/usr.sbin/traceroute6/Makefile,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 Makefile
--- usr.sbin/traceroute6/Makefile	2001/04/25 12:11:06	1.2.2.2
+++ usr.sbin/traceroute6/Makefile	2001/06/27 18:26:13
@@ -15,8 +15,6 @@
 
 PROG=	traceroute6
 
-BINOWN=	root
-BINGRP=	bin
 BINMODE=4555
 
 CFLAGS+=-DINET6 -DIPSEC -DHAVE_POLL
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.prog.mk,v
retrieving revision 1.86.2.4
diff -u -r1.86.2.4 bsd.prog.mk
--- share/mk/bsd.prog.mk	2001/08/01 17:14:26	1.86.2.4
+++ share/mk/bsd.prog.mk	2001/09/07 17:35:20
@@ -107,7 +107,7 @@
 .endif
 .if defined(HIDEGAME)
 	(cd ${DESTDIR}/${GBINDIR}; rm -f ${PROG}; ln -s dm ${PROG}; \
-	    chown games:bin ${PROG})
+	    chown -h ${BINOWN}:${BINGRP} ${PROG})
 .endif
 .if defined(LINKS) && !empty(LINKS)
 	@set ${LINKS}; \
Index: usr.bin/doscmd/Makefile
===================================================================
RCS file: /home/ncvs/src/usr.bin/doscmd/Makefile,v
retrieving revision 1.21.2.3
diff -u -r1.21.2.3 Makefile
--- usr.bin/doscmd/Makefile	2001/08/02 02:17:15	1.21.2.3
+++ usr.bin/doscmd/Makefile	2001/08/28 22:22:53
@@ -22,7 +22,6 @@
 .endif
 
 BINGRP=		kmem
-EXEGRP=		bin
 #BINMODE=	2555
 EXEMODE=	444
 
@@ -37,15 +36,15 @@
 
 beforeinstall:
 .if ${OBJFORMAT} == "aout"
-	${INSTALL} ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
+	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${EXEMODE} \
 	    doscmd.kernel ${DESTDIR}/usr/libexec/
 .endif
-	${INSTALL} ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
+	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${EXEMODE} \
 	    emsdriv.sys redir.com ${DESTDIR}/usr/libdata/doscmd/
-	${INSTALL} ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${SHAREMODE} \
+	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} \
 	    cp437-8x16.pcf.gz ${DESTDIR}/usr/libdata/doscmd/fonts
 	cd ${.CURDIR} && \
-	    ${INSTALL} ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${SHAREMODE} \
+	    ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} \
 		fonts.dir ${DESTDIR}/usr/libdata/doscmd/fonts
 
 .if ${OBJFORMAT} == "aout"
>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@FreeBSD.ORG>
To: Tony Finch <dot@dotat.at>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/30538: [PATCH] ownerships pedantry
Date: Thu, 13 Sep 2001 10:13:51 +0300

 On Thu, Sep 13, 2001 at 12:37:17AM +0000, Tony Finch wrote:
 > 
 > A number of programs set BINOWN and BINGRP to non-standard values
 > for no obvious reason. They are:
 > 	ping6
 > 	traceroute6
 > 	doscmd
 > 
 > There are also some oddities in the games handling in bsd.prog.mk
 > which fails to set the ownership of a hidden game symlink correctly.
 > 
 
 > Index: sbin/ping6/Makefile
 > ===================================================================
 > RCS file: /home/ncvs/src/sbin/ping6/Makefile,v
 > retrieving revision 1.1.2.2
 > diff -u -r1.1.2.2 Makefile
 > --- sbin/ping6/Makefile	2001/04/25 10:58:46	1.1.2.2
 > +++ sbin/ping6/Makefile	2001/06/27 18:25:29
 > @@ -5,8 +5,6 @@
 >  
 >  CFLAGS+=-DINET6 -DIPSEC
 >  
 > -BINOWN=	root
 > -BINGRP=	bin
 >  BINMODE=4555
 >  
 We need BINOWN=root explicitly for setuid root binaries.  One may
 have non-default value of BINOWN in /etc/make.conf, and we still
 want these to be installed setuid root in this case.  I've just
 fixed that (in all cases).  BINGRP=bin is not present in -CURRENT.
 Kris was going to MFC this.
 
 > Index: usr.sbin/traceroute6/Makefile
 > ===================================================================
 > RCS file: /home/ncvs/src/usr.sbin/traceroute6/Makefile,v
 > retrieving revision 1.2.2.2
 > diff -u -r1.2.2.2 Makefile
 > --- usr.sbin/traceroute6/Makefile	2001/04/25 12:11:06	1.2.2.2
 > +++ usr.sbin/traceroute6/Makefile	2001/06/27 18:26:13
 > @@ -15,8 +15,6 @@
 >  
 >  PROG=	traceroute6
 >  
 > -BINOWN=	root
 > -BINGRP=	bin
 >  BINMODE=4555
 >  
 I've removed BINGRP.  BINOWN should stay for above mentioned reasons.
 
 > Index: share/mk/bsd.prog.mk
 > ===================================================================
 > RCS file: /home/ncvs/src/share/mk/bsd.prog.mk,v
 > retrieving revision 1.86.2.4
 > diff -u -r1.86.2.4 bsd.prog.mk
 > --- share/mk/bsd.prog.mk	2001/08/01 17:14:26	1.86.2.4
 > +++ share/mk/bsd.prog.mk	2001/09/07 17:35:20
 > @@ -107,7 +107,7 @@
 >  .endif
 >  .if defined(HIDEGAME)
 >  	(cd ${DESTDIR}/${GBINDIR}; rm -f ${PROG}; ln -s dm ${PROG}; \
 > -	    chown games:bin ${PROG})
 > +	    chown -h ${BINOWN}:${BINGRP} ${PROG})
 >  .endif
 >  .if defined(LINKS) && !empty(LINKS)
 >  	@set ${LINKS}; \
 > 
 Again, this is not the problem in -CURRENT.  See bsd.prog.mk,
 revisions 1.98-1.100.  This was triggered by corresponding
 change to chown(8), which now does (in -CURRENT) follow
 symbolic links specified on a command line in the non -R case.
 This will be MFC'ed at some time I think.
 
 > Index: usr.bin/doscmd/Makefile
 > ===================================================================
 > RCS file: /home/ncvs/src/usr.bin/doscmd/Makefile,v
 > retrieving revision 1.21.2.3
 > diff -u -r1.21.2.3 Makefile
 > --- usr.bin/doscmd/Makefile	2001/08/02 02:17:15	1.21.2.3
 > +++ usr.bin/doscmd/Makefile	2001/08/28 22:22:53
 > @@ -22,7 +22,6 @@
 >  .endif
 >  
 >  BINGRP=		kmem
 > -EXEGRP=		bin
 >  #BINMODE=	2555
 >  EXEMODE=	444
 >  
 EXEGRP and EXEMODE are used to install DOS (EXE format) files.
 EXEGRP is used instead of BINGRP because once upon a time this
 binary was installed ``setgid kmem'', and BINGRP=kmem is not
 feasible for EXE files.  One fix would be to remove BINGRP
 and (commented out) BINMODE, and make EXEGRP=${BINGRP}.
 But I would like to preserve (the commented out) fact that
 this binary may be run ``setgid kmem''.
 
 May I close this PR now?
 
 
 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->feedback 
State-Changed-By: ru 
State-Changed-When: Thu Sep 13 00:21:21 PDT 2001 
State-Changed-Why:  
Fixed all of the bugs mentioned here, explained the guidelines 
on using BINOWN in Makefiles. 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Thu Sep 13 00:21:21 PDT 2001 
Responsible-Changed-Why:  
MFC time for some of the changes is unclear. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30538 

From: Tony Finch <fanf@chiark.greenend.org.uk>
To: Ruslan Ermilov <ru@FreeBSD.ORG>
Cc: Tony Finch <dot@dotat.at>, FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/30538: [PATCH] ownerships pedantry
Date: Fri, 14 Sep 2001 00:46:53 +0100

 On Thu, Sep 13, 2001 at 10:13:51AM +0300, Ruslan Ermilov wrote:
 >
 > We need BINOWN=root explicitly for setuid root binaries.
 
 Ah, I thought the contrary because other setuid binaries didn't
 set BINOWN.
 
 > EXEGRP and EXEMODE are used to install DOS (EXE format) files.
 > EXEGRP is used instead of BINGRP because once upon a time this
 > binary was installed ``setgid kmem'', and BINGRP=kmem is not
 > feasible for EXE files.  One fix would be to remove BINGRP
 > and (commented out) BINMODE, and make EXEGRP=${BINGRP}.
 
 That sounds good.
 
 > May I close this PR now?
 
 Yes.
State-Changed-From-To: feedback->closed 
State-Changed-By: ru 
State-Changed-When: Fri Sep 14 00:18:23 PDT 2001 
State-Changed-Why:  
Originator agreed on me closing this PR (pending necessary MFCs). 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30538 

From: Tony Finch <dot@dotat.at>
To: freebsd-gnats-submit@FreeBSD.org, dot@dotat.at
Cc:  
Subject: Re: bin/30538: [PATCH] ownerships pedantry
Date: Fri, 30 Nov 2001 06:07:38 +0000

 I have just noticed that a part of my patch has slipped through
 the net: I wanted to remove the hardcoded user and group name
 from the chown command in bsd.prog.mk, since that information
 properly belongs in bsd.own.mk and it is out-of-date because the
 bin group isn't used any more anywhere else.
 
 Tony.
 
 
>Unformatted:
