Bug 36190

Summary: P1003.1-2001 newgrp command
Product: Base System Reporter: Tim J. Robbins <tim>
Component: standardsAssignee: Tim Robbins <tjr>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.5-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.shar none

Description Tim J. Robbins 2002-03-22 07:40:03 UTC
FreeBSD is missing the P1003.1-2001 newgrp command. Many people believe
4.2BSD's group system makes this command unnecessary, but the standard
still requires it.

Fix: This is an implementation of the newgrp utility. It obviously needs to
be suid root to work, which is a security risk, and a risk I don't believe
is worth taking in most cases. I suggest making newgrp suid a compile-time
option like with ssh because most people won't use it.
How-To-Repeat: newgrp
Comment 1 Tim J. Robbins 2002-03-22 08:03:33 UTC
On Thu, Mar 21, 2002 at 11:45:49PM -0801, Jos Backus wrote:

> On Fri, Mar 22, 2002 at 06:37:05PM +1100, Tim J. Robbins wrote:

> > X	/* Finally set grop id. */
> 
> Typo?

Fixed.

tim@descent$ rcsdiff -u -r1.5 -r1.6 newgrp.c
===================================================================
RCS file: RCS/newgrp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- newgrp.c    2002/03/19 10:53:30     1.5
+++ newgrp.c    2002/03/22 08:01:36     1.6
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
-__RCSID("$Id: newgrp.c,v 1.5 2002/03/19 10:53:30 tim Exp $");
+__RCSID("$Id: newgrp.c,v 1.6 2002/03/22 08:01:36 tim Exp $");
 
 #include <sys/types.h>
 
@@ -162,7 +162,7 @@
                        warn("setgroups");
        }
 
-       /* Finally set grop id. */
+       /* Finally set group id. */
        if (setgid(grp->gr_gid))
                warn("setgid");
 }
Comment 2 ru freebsd_committer freebsd_triage 2002-03-22 13:09:45 UTC
On Fri, Mar 22, 2002 at 06:37:05PM +1100, Tim J. Robbins wrote:
> 
> # $Id: Makefile,v 1.1 2002/02/17 22:59:24 tim Exp $
> 
> PROG=	newgrp
> DPADD=	${LIBCRYPT}
> LDADD=	-lcrypt -lutil
> 
> BINMODE=4555
> INSTALLFLAGS=-fschg
> 
> .include <bsd.prog.mk>

You need to fix DPADD -- consult with ``make checkdpadd''.


Cheers,
-- 
Ruslan Ermilov		Sysadmin and 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 3 Tim J. Robbins 2002-03-23 00:56:37 UTC
On Fri, Mar 22, 2002 at 03:09:45PM +0200, Ruslan Ermilov wrote:

> You need to fix DPADD -- consult with ``make checkdpadd''.

Thanks. I believe this patch makes it correct, then:

--- Makefile	2002/02/17 22:59:24	1.1
+++ Makefile	2002/03/23 00:30:09	1.2
@@ -1,8 +1,8 @@
 # $FreeBSD$
-# $Id: Makefile,v 1.1 2002/02/17 22:59:24 tim Exp $
+# $Id: Makefile,v 1.2 2002/03/23 00:30:09 tim Exp $
 
 PROG=	newgrp
-DPADD=	${LIBCRYPT}
+DPADD=	${LIBCRYPT} ${LIBUTIL}
 LDADD=	-lcrypt -lutil
 
 BINMODE=4555



Tim
Comment 4 Tim Robbins freebsd_committer freebsd_triage 2002-05-22 12:37:32 UTC
Responsible Changed
From-To: freebsd-standards->tjr

Over to me.
Comment 5 Tim Robbins freebsd_committer freebsd_triage 2002-05-28 06:21:06 UTC
State Changed
From-To: open->patched

Updated version committed.
Comment 6 Tim Robbins freebsd_committer freebsd_triage 2002-11-26 00:03:36 UTC
State Changed
From-To: patched->closed

I don't intend to MFC this any time soon.