summaryrefslogtreecommitdiff
path: root/src/serve.c
diff options
context:
space:
mode:
authorShawn Landden <shawn@git.icu>2018-08-07 15:16:26 -0700
committerShawn Landden <shawn@git.icu>2018-08-07 15:16:26 -0700
commit686e731d71b22af6080234f2f9d613c9f5682268 (patch)
tree4c555fd79887a750dd369ddc40445043dcd6f1e1 /src/serve.c
parentcf606adb8ffd6f21cf1a687c89c8ab75353b1995 (diff)
downloaddistcc-git-686e731d71b22af6080234f2f9d613c9f5682268.tar.gz
serve: fix also checking /usr/lib/distcc when have fstatat();
Diffstat (limited to 'src/serve.c')
-rw-r--r--src/serve.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/serve.c b/src/serve.c
index 4deb76f..1d26e18 100644
--- a/src/serve.c
+++ b/src/serve.c
@@ -402,8 +402,14 @@ static int dcc_check_compiler_whitelist(char *_compiler_name)
}
if (faccessat(dirfd, compiler_name, X_OK, 0) < 0) {
- rs_log_crit("%s not in %s whitelist.", compiler_name, LIBDIR "/distcc");
- return EXIT_BAD_ARGUMENTS; /* ENOENT, EACCESS, etc */
+ char *compiler_path = NULL;
+ if (asprintf(&compiler_path, "/usr/lib/distcc/%s", compiler_name) && compiler_path) {
+ if (access(compiler_path, X_OK) < 0) {
+ rs_log_crit("%s not in %s or %s whitelist.", compiler_name, LIBDIR "/distcc", "/usr/lib/distcc);
+ return EXIT_BAD_ARGUMENTS; /* ENOENT, EACCESS, etc */
+ }
+ free(compiler_path);
+ }
}
rs_trace("%s in" LIBDIR "/distcc whitelist", compiler_name);
@@ -414,6 +420,7 @@ static int dcc_check_compiler_whitelist(char *_compiler_name)
int ret = 0;
if (asprintf(&compiler_path, "%s/distcc/%s", LIBDIR, compiler_name) && compiler_path) {
if (access(compiler_path, X_OK) < 0) {
+ free(compiler_path);
/* check /usr/lib/distcc too */
if (asprintf(&compiler_path, "/usr/lib/distcc/%s", compiler_name) && compiler_path) {
if (access(compiler_path, X_OK) < 0) {