Skip site navigation (1)Skip section navigation (2)
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

--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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020917090932.GA319>