Bug 30538

Summary: [PATCH] ownerships pedantry
Product: Base System Reporter: Tony Finch <dot>
Component: binAssignee: ru <ru>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Tony Finch 2001-09-13 00:40:01 UTC
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.
Comment 1 ru freebsd_committer freebsd_triage 2001-09-13 08:13:51 UTC
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
Comment 2 ru freebsd_committer freebsd_triage 2001-09-13 08:21:21 UTC
State Changed
From-To: open->feedback

Fixed all of the bugs mentioned here, explained the guidelines 
on using BINOWN in Makefiles. 


Comment 3 ru freebsd_committer freebsd_triage 2001-09-13 08:21:21 UTC
Responsible Changed
From-To: freebsd-bugs->ru

MFC time for some of the changes is unclear.
Comment 4 fanf 2001-09-14 00:46:53 UTC
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.
Comment 5 ru freebsd_committer freebsd_triage 2001-09-14 08:18:23 UTC
State Changed
From-To: feedback->closed

Originator agreed on me closing this PR (pending necessary MFCs).
Comment 6 Tony Finch 2001-11-30 06:07:38 UTC
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.