diff options
author | Shawn Landden <slandden@gmail.com> | 2018-04-16 12:03:55 -0700 |
---|---|---|
committer | Shawn Landden <slandden@gmail.com> | 2018-04-17 08:28:43 -0700 |
commit | 03c835444c4c52b9d6ce799b665d063ed6e0e69f (patch) | |
tree | e393e0b4845319bfd99b2a422846ecbb418d0de7 | |
parent | 6393f49cb1734e6085a9242eb12b603e68b7fa66 (diff) | |
download | distcc-git-03c835444c4c52b9d6ce799b665d063ed6e0e69f.tar.gz |
support some absolute path names
-rw-r--r-- | src/serve.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/serve.c b/src/serve.c index 3a966a3..e90a6e2 100644 --- a/src/serve.c +++ b/src/serve.c @@ -368,12 +368,21 @@ static int dcc_check_compiler_masq(char *compiler_name) * https://nvd.nist.gov/vuln/detail/CVE-2004-2687 * https://github.com/distcc/distcc/issues/155 **/ -static int dcc_check_compiler_whitelist(char *compiler_name) +static int dcc_check_compiler_whitelist(char *_compiler_name) { + char *compiler_name = _compiler_name; int dirfd = -1; + /* Support QtCreator by treating /usr/bin and /bin absolute paths as non-absolute + * see https://github.com/distcc/distcc/issues/279 + */ + if (strstr(_compiler_name, "/bin/")) + compiler_name = _compiler_name + strlen("/bin/"); + else if (strstr(_compiler_name, "/usr/bin/")) + compiler_name = _compiler_name + strlen("/usr/bin/"); + if (strchr(compiler_name, '/')) { - rs_log_crit("compiler name <%s> cannot be an absolute path (or must pass --make-me-a-botnet)", compiler_name); + rs_log_crit("compiler name <%s> cannot be an absolute path (or must pass --make-me-a-botnet)", _compiler_name); return EXIT_BAD_ARGUMENTS; } |