When group wheel is empty, allow everyone to su to root. This has normally

no conseqeunces as we ship with a non-empty wheel.

Closes PR/1882
Submitted by:	Arne Henrik Juul <arnej@frida.imf.unit.no>
This commit is contained in:
Guido van Rooij 1997-02-24 20:32:24 +00:00
parent 8c9b80bcd6
commit e8694bc269
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=23085
2 changed files with 7 additions and 5 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)su.1 8.2 (Berkeley) 4/18/94
.\" $Id$
.\" $Id: su.1,v 1.7 1997/02/22 19:57:15 peter Exp $
.\"
.\" this is for hilit19's braindeadness: "
.Dd April 18, 1994
@ -149,12 +149,13 @@ option as understood by most shells. Note that
usually expects a single argument only; you have to quote it when
passing multiple words.
.Pp
Only users in group 0 (normally
Only users listed in group 0 (normally
.Dq wheel )
can
.Nm su
to
.Dq root .
.Dq root ,
unless this group is empty.
.Pp
By default (unless the prompt is reset by a startup file) the super-user
prompt is set to

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";
*/
static const char rcsid[] =
"$Id: su.c,v 1.15 1997/01/13 06:39:19 davidn Exp $";
"$Id: su.c,v 1.17 1997/01/14 09:24:09 davidn Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -223,7 +223,8 @@ main(argc, argv)
#endif
{
/* only allow those in group zero to su to root. */
if (pwd->pw_uid == 0 && (gr = getgrgid((gid_t)0)))
if (pwd->pw_uid == 0 && (gr = getgrgid((gid_t)0)) &&
gr->gr_mem && *(gr->gr_mem))
for (g = gr->gr_mem;; ++g) {
if (!*g)
errx(1,