[gpm] [patch] make sure changing gid/uid actually works

Dmitry Torokhov dtor_core@ameritech.net
Wed May 4 04:42:59 CEST 2005


On Tuesday 03 May 2005 21:40, Mike Frysinger wrote:
> 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);

This is a very peculiar way to indent the code...

-- 
Dmitry


More information about the gpm mailing list