Permalink
Browse files

daemon: warn when masquerade is not setup

  • Loading branch information...
shawnl committed Feb 26, 2018
1 parent a41d1bb commit 920e8b922addea8c54e68cc29c1416753f532f78
Showing with 23 additions and 2 deletions.
  1. +21 −0 src/daemon.c
  2. +2 −2 test/testdistcc.py
View
@@ -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
View
@@ -815,7 +815,7 @@ def runtest(self):
"""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),

0 comments on commit 920e8b9

Please sign in to comment.