Permalink
Browse files

don't hardcode /usr/lib/distcc but $PREFIX/distcc

  • Loading branch information...
RJVB authored and shawnl committed May 19, 2018
1 parent d1a94a4 commit bb4d613c08eeb2678e6b1095b99b7f8e870115cb
Showing with 9 additions and 9 deletions.
  1. +1 −1 Makefile.in
  2. +3 −3 src/daemon.c
  3. +5 −5 src/serve.c
@@ -58,7 +58,7 @@ include_server_builddir = $(builddir)/_include_server
# These must be done from here, not from autoconf, because they can
# contain variable expansions written in Make syntax. Ew.
DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
DIR_DEFS = -DLIBDIR="\"${libdir}\"" -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""
# arguments to pkgconfig
GNOME_PACKAGES = @GNOME_PACKAGES@
@@ -160,13 +160,13 @@ static void dcc_warn_masquerade_whitelist(void) {
" --make-me-a-botnet. To set up masquerade automatically" \
" run update-distcc-symlinks.";
d = opendir("/usr/lib/distcc");
d = opendir(LIBDIR "/distcc");
if (!d) {
rs_log_crit("/usr/lib/distcc not found. %s", warn);
rs_log_crit(LIBDIR "/distcc not found. %s", warn);
dcc_exit(EXIT_COMPILER_MISSING);
}
if (!readdir(d)) {
rs_log_crit("/usr/lib/distcc empty. %s", warn);
rs_log_crit(LIBDIR "/distcc empty. %s", warn);
dcc_exit(EXIT_COMPILER_MISSING);
}
}
@@ -358,7 +358,7 @@ static int dcc_check_compiler_masq(char *compiler_name)
}
/**
* Make sure there is a masquerade to distcc in /usr/lib/distcc in order to
* Make sure there is a masquerade to distcc in LIBDIR/distcc in order to
* execute a binary of the same name.
*
* Before this it was possible to execute arbitrary command after connecting
@@ -387,19 +387,19 @@ static int dcc_check_compiler_whitelist(char *_compiler_name)
return EXIT_BAD_ARGUMENTS;
}
dirfd = open("/usr/lib/distcc", O_RDONLY);
dirfd = open(LIBDIR "/distcc", O_RDONLY);
if (dirfd < 0) {
if (errno == ENOENT)
rs_log_crit("no %s", "/usr/lib/distcc");
rs_log_crit("no %s", LIBDIR "/distcc");
return EXIT_DISTCC_FAILED;
}
if (faccessat(dirfd, compiler_name, X_OK, 0) < 0) {
rs_log_crit("%s not in %s whitelist.", compiler_name, "/usr/lib/distcc");
rs_log_crit("%s not in %s whitelist.", compiler_name, LIBDIR "/distcc");
return EXIT_BAD_ARGUMENTS; /* ENOENT, EACCESS, etc */
}
rs_trace("%s in /usr/lib/distcc whitelist", compiler_name);
rs_trace("%s in" LIBDIR "/distcc whitelist", compiler_name);
#endif
return 0;
}

0 comments on commit bb4d613

Please sign in to comment.