summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Landden <slandden@gmail.com>2018-02-26 11:29:14 -0800
committerShawn Landden <slandden@gmail.com>2018-02-26 15:23:07 -0800
commit920e8b922addea8c54e68cc29c1416753f532f78 (patch)
tree8b134101a4b243f7e7ca6402ed4580bf59ccb388
parenta41d1bb8e4df8ceb439dd71c6d9511f851524fc0 (diff)
downloaddistcc-git-920e8b922addea8c54e68cc29c1416753f532f78.tar.gz
daemon: warn when masquerade is not setup
-rw-r--r--src/daemon.c21
-rwxr-xr-xtest/testdistcc.py4
2 files changed, 23 insertions, 2 deletions
diff --git a/src/daemon.c b/src/daemon.c
index a1056f8..2127695 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -44,6 +44,7 @@
#include <config.h>
+#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -151,6 +152,23 @@ static int dcc_setup_daemon_path(void)
}
}
+static void dcc_warn_masquerade_whitelist(void) {
+ DIR *d;
+ const char *warn = "You must see up masquerade" \
+ " (see distcc(1)) to list whitelisted compilers or pass" \
+ " --make-me-a-botnet. To set up masquerade automatically" \
+ " run update-distcc-symlinks.py.";
+
+ d = opendir("/usr/lib/distcc");
+ if (!d) {
+ rs_log_crit("/usr/lib/distcc not found. %s", warn);
+ dcc_exit(EXIT_COMPILER_MISSING);
+ }
+ if (!readdir(d)) {
+ rs_log_crit("/usr/lib/distcc empty. %s", warn);
+ dcc_exit(EXIT_COMPILER_MISSING);
+ }
+}
/**
* distcc daemon. May run from inetd, or standalone. Accepts
@@ -227,6 +245,9 @@ int main(int argc, char *argv[])
/* Initialize the distcc io timeout value */
dcc_get_io_timeout();
+ if (!opt_make_me_a_botnet)
+ dcc_warn_masquerade_whitelist();
+
if (dcc_should_be_inetd())
ret = dcc_inetd_server();
else
diff --git a/test/testdistcc.py b/test/testdistcc.py
index 1daf318..b1d2fda 100755
--- a/test/testdistcc.py
+++ b/test/testdistcc.py
@@ -815,7 +815,7 @@ class DaemonBadPort_Case(SimpleDistCC_Case):
"""Test daemon invoked with invalid port number"""
self.runcmd(self.distccd() +
"--log-file=distccd.log --lifetime=10 --port 80000 "
- "--allow 127.0.0.1",
+ "--allow 127.0.0.1 --make-me-a-botnet",
EXIT_BAD_ARGUMENTS)
self.assert_no_file("daemonpid.tmp")
@@ -2046,7 +2046,7 @@ class AccessDenied_Case(CompileHello_Case):
def daemon_command(self):
return (self.distccd()
+ "--verbose --lifetime=%d --daemon --log-file %s "
- "--pid-file %s --port %d --allow 127.0.0.2"
+ "--pid-file %s --port %d --allow 127.0.0.2 --make-me-a-botnet"
% (self.daemon_lifetime(),
_ShellSafe(self.daemon_logfile),
_ShellSafe(self.daemon_pidfile),