www.nico.schottelius.org/software/gpm/browse_source/gpm-1.20.5/patches/1.20.1/mike-setgid1
Nico Schottelius 95a46c5577 import gpm from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-08 22:52:35 +02:00

25 lines
727 B
Text

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