*BSD News Article 33633


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!comp.vuw.ac.nz!waikato!ames!hookup!swrinde!howland.reston.ans.net!usenet.ins.cwru.edu!news.csuohio.edu!stever
From: stever@csuohio.edu (Steve Ratliff)
Subject: Re: Unexpected (mis?)features of RPC, connect(), mount & setgroups()
Message-ID: <1994Aug2.000204.18407@news.csuohio.edu>
Sender: news@news.csuohio.edu (USENET News System)
Organization: Cleveland State University
X-Newsreader: TIN [version 1.2 PL2]
References: <CtqIIJ.156@deanstoy.wa.com>
Date: Tue, 2 Aug 1994 00:02:04 GMT
Lines: 35

Dean M. Phillips (dean@deanstoy.wa.com) wrote:
[deleted]
: In working on deslogind, I found that the setgroups() call has the
: undocumented side effect of setting the egid to the first group in the
: list.  Also, why does the user's base gid have to appear in the list of
: supplemental gid's?

	There are bugs in the getgrent() functions when called multiple
times as listed in the man page for getgrent().  The initgroups.c file
documents the feature of setting the egid to the first group.
		/*
		 * If installing primary group, duplicate it;
		 * the first element of groups is the effective gid
		 * and will be overwritten when a setgid file is executed.
		 */

	I fixed the /usr/bin/groups program to not repeat or otherwise
screw up the groups listing.  This patch was put into FreeBSD1.1.5 but
it is more of a band-aid on the underlying bug in repeated calls to
getgrent().  Both setgroups() and initgroups() call getgrent() and can
cause problems when called multiple times.

Steve


: Thanks in advance for any patches, pointers, or explainations.
: -- 
: Dean M. Phillips    Microsoft free and proud of it!    dean@deanstoy.wa.com

--
--------------------------------------------------------------------------
stever@babbage.cba.csuohio.edu		"What's better than a free OS?"
					" A free OS with source."       
					FreeBSD at freebsd.cdrom.com
--------------------------------------------------------------------------