From owner-freebsd-hackers Tue Sep 17 2: 9:23 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6055437B401 for ; Tue, 17 Sep 2002 02:09:21 -0700 (PDT) Received: from a.mx.bsd.krakow.pl (gw.BSD.krakow.pl [62.121.128.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9468743E6A for ; Tue, 17 Sep 2002 02:09:20 -0700 (PDT) (envelope-from diavul@bsd.krakow.pl) Received: by a.mx.bsd.krakow.pl (Postfix, from userid 666) id 4EED51CABF; Tue, 17 Sep 2002 11:09:32 +0200 (CEST) Date: Tue, 17 Sep 2002 11:09:32 +0200 From: =?iso-8859-2?Q?Micha=B3?= Belczyk To: freebsd-hackers@freebsd.org Subject: Re: Changing process informations. Message-ID: <20020917090932.GA319@bsd.krakow.pl> References: <20020915030157.GP68652@garage.freebsd.pl> <20020916110734.GE68652@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dDRMvlgZJXvWKvBx" Content-Disposition: inline In-Reply-To: <20020916110734.GE68652@garage.freebsd.pl> User-Agent: Mutt/1.4i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 16, 2002 at 01:07:35PM +0200, Pawel Jakub Dawidek wrote: > +> void > +> delgroup(struct proc *p, gid_t gid) > +> { > [...] > +> setsugid(p); /* XXX: Have to be here? */ > +> } >=20 > When I'm removing group should I call setsugid() and set P_SUGID flag? > I think that in delgroup() this shouln't be done. Am I right? Nope. Removing some groups might also increase process privileges. A trivial example: root@vanity ~#echo blah > /tmp/file root@vanity ~#chmod 604 /tmp/file root@vanity ~#ls -l /tmp/file -rw----r-- 1 root wheel 5 17 Wrz 11:02 /tmp/file diavul@vanity ~$id uid=3D666(diavul) gid=3D666(diavul) groups=3D666(diavul), 0(wheel) diavul@vanity ~$cat /tmp/file cat: /tmp/file: Permission denied vanity% id uid=3D777(michau) gid=3D777(michau) groups=3D777(michau) vanity% cat /tmp/file blah > But in other hand setsugid() is always called after setgroups(). Now You know why ;) --=20 Micha=B3 Belczyk --dDRMvlgZJXvWKvBx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9hvFMfe5awv+mgJoRAtbRAJ4+RPHTqbrJW91LumZqYma1zMtSAACgltlT c+Z+LFoULs0VFqPHXHBmfII= =tisE -----END PGP SIGNATURE----- --dDRMvlgZJXvWKvBx-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message