[distcc] distccd 2.12 won't start on Linux
Wayne Davison
wayned at samba.org
Fri Dec 19 19:25:27 GMT 2003
On Fri, Dec 19, 2003 at 03:56:53PM +0100, Dimitri Papadopoulos-Orfanos wrote:
> distccd[18140] (dcc_discard_root) ERROR: setgid(99) failed: Operation
> not permitted
The problem is that the setuid() is being called before the setgid() and
setgroups() calls when it should be called afterward. Attached is a
patch.
..wayne..
-------------- next part --------------
Index: src/setuid.c
--- src/setuid.c 17 Nov 2003 02:01:25 -0000 1.5
+++ src/setuid.c 19 Dec 2003 19:23:19 -0000
@@ -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;
@@ -127,6 +122,11 @@
return EXIT_SETUID_FAILED;
}
#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!");
More information about the distcc
mailing list