Date: Tue, 17 Sep 2002 11:09:32 +0200 From: =?iso-8859-2?Q?Micha=B3?= Belczyk <diavul@bsd.krakow.pl> To: freebsd-hackers@freebsd.org Subject: Re: Changing process informations. Message-ID: <20020917090932.GA319@bsd.krakow.pl> In-Reply-To: <20020916110734.GE68652@garage.freebsd.pl> References: <20020915030157.GP68652@garage.freebsd.pl> <20020916110734.GE68652@garage.freebsd.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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? */
> +> }
>
> 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=666(diavul) gid=666(diavul) groups=666(diavul), 0(wheel)
diavul@vanity ~$cat /tmp/file
cat: /tmp/file: Permission denied
vanity% id
uid=777(michau) gid=777(michau) groups=777(michau)
vanity% cat /tmp/file
blah
> But in other hand setsugid() is always called after setgroups().
Now You know why ;)
--
Micha³ Belczyk
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE9hvFMfe5awv+mgJoRAtbRAJ4+RPHTqbrJW91LumZqYma1zMtSAACgltlT
c+Z+LFoULs0VFqPHXHBmfII=
=tisE
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020917090932.GA319>
