[distcc] [PATCH] setsid() in the right place
Martin Pool
mbp at sourcefrog.net
Fri Jan 9 02:09:52 GMT 2004
On 28 Dec 2003 Daniel Ritz <daniel.ritz at gmx.ch> wrote:
> hi
>
> the call to setsid() must be after setgid()/setgroups() because if
> it's before, those calls return with -1, errno gets EPERM (=the user
> is not the super-user) this way distccd can actually start for me..
Do you mean setsid or setuid?
>
> against distcc-2.12
>
>
> rgds
> -daniel
>
> ps: please cc, i'm not subscribed
>
>
> --- setuid.c-old 2003-12-28 21:51:36.000000000 +0100
> +++ setuid.c 2003-12-28 21:52:03.000000000 +0100
> @@ -108,11 +108,6 @@
> * permanently discard privileges: both the real and effective
> uid are* set. */
>
> - if (setuid(uid)) {
> - rs_log_error("setuid(%d) failed: %s", (int) uid,
> strerror(errno));- return EXIT_SETUID_FAILED;
> - }
> -
> if (setgid(gid)) {
> rs_log_error("setgid(%d) failed: %s", (int) gid,
> strerror(errno)); return EXIT_SETUID_FAILED;
> @@ -128,6 +123,11 @@
> }
> #endif
>
> + if (setuid(uid)) {
> + rs_log_error("setuid(%d) failed: %s", (int) uid,
> strerror(errno));+ return EXIT_SETUID_FAILED;
> + }
> +
> if (getuid() == 0 || geteuid() == 0) {
> rs_log_crit("still have root privileges after trying to
> discard them!"); return EXIT_SETUID_FAILED;
>
> __
> distcc mailing list http://distcc.samba.org/
> To unsubscribe or change options:
> http://lists.samba.org/mailman/listinfo/distcc
--
Martin
linux.conf.au -- Adelaide, January 2004
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/distcc/attachments/20040109/bf9c8e97/attachment.bin
More information about the distcc
mailing list