[gpm] [patch] make sure changing gid/uid actually works
Nico Schottelius
nico-gpm@schottelius.org
Sat Oct 15 19:07:24 CEST 2005
Applied
Mike Frysinger [Tue, May 03, 2005 at 10:40:27PM -0400]:
> here's a small patch to make sure setgid/setuid actually worked
>
> --- src/prog/gpm-root.y
> +++ src/prog/gpm-root.y
> @@ -433,9 +433,10 @@
> /*====================================================================*/
> void f__fix(struct passwd *pass)
> {
> - setgid(pass->pw_gid);
> - initgroups(pass->pw_name, pass->pw_gid);
> - setuid(pass->pw_uid);
> + if (setgid(pass->pw_gid) < 0 ||
> + initgroups(pass->pw_name, pass->pw_gid) < 0 ||
> + setuid(pass->pw_uid) < 0)
> + exit(1);
> setenv("HOME", pass->pw_dir, 1);
> setenv("LOGNAME", pass->pw_name,1);
> setenv("USER", pass->pw_name,1);
>
> -mike
> _______________________________________________
> gpm mailing list
> gpm@lists.linux.it
> http://lists.linux.it/listinfo/gpm
>
--
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/)
Open Source nutures open minds and free, creative developers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://lists.linux.it/pipermail/gpm/attachments/20051015/39f75c9e/attachment-0001.pgp
More information about the gpm
mailing list