diff options
author | fergus.henderson <fergus.henderson@01de4be4-8c4a-0410-9132-4925637da917> | 2008-09-08 17:51:40 +0000 |
---|---|---|
committer | fergus.henderson <fergus.henderson@01de4be4-8c4a-0410-9132-4925637da917> | 2008-09-08 17:51:40 +0000 |
commit | 3bd6c65499008b27826caff248aefd82dd27ce1d (patch) | |
tree | 898012f25b1fa9657be736977b5809283cf13cec | |
parent | 154c8ba56f2e1367f20cfbb1014c0d795d3fc3fa (diff) | |
download | distcc-3bd6c65499008b27826caff248aefd82dd27ce1d.tar.gz |
Report a better error message if a host specification contains ",cpp"
but not ",lzo".
Previously, setting ",cpp" without ",lzo" would quietly set the protocol
version to -1, which the server would then quietly reject (logging as
"REJ_BAD_REQ"), and then the client would guess (poorly) at why the
server had dropped the connection.
Reviewed by Craig Silverstein.
git-svn-id: http://distcc.googlecode.com/svn/trunk@607 01de4be4-8c4a-0410-9132-4925637da917
-rw-r--r-- | Makefile.in | 6 | ||||
-rw-r--r-- | src/hosts.c | 31 |
2 files changed, 21 insertions, 16 deletions
diff --git a/Makefile.in b/Makefile.in index 34911f3..c271531 100644 --- a/Makefile.in +++ b/Makefile.in @@ -732,7 +732,7 @@ include-server-maintainer-check: include-server # Do distcc-maintainer-check in pump-mode, if possible. pump-maintainer-check: pump include-server check_programs @if [ -d "$(include_server_builddir)" ]; then \ - DISTCC_HOSTS='<invalid>,cpp' \ + DISTCC_HOSTS='<invalid>,cpp,lzo' \ "$(builddir)/pump" \ $(MAKE) \ RESTRICTED_PATH="$(RESTRICTED_PATH)" \ @@ -776,7 +776,7 @@ single-test: check_programs # Run a single test in pump-mode. pump-single-test: pump include-server check_programs - DISTCC_HOSTS='<invalid>,cpp' \ + DISTCC_HOSTS='<invalid>,cpp,lzo' \ "$(builddir)/pump" \ $(MAKE) \ RESTRICTED_PATH="$(RESTRICTED_PATH)" \ @@ -817,7 +817,7 @@ distcc-installcheck: $(check_PROGRAMS) pump-installcheck: which_loc=`which which`; \ pump_loc=`PATH="$(DISTCC_INSTALLATION)" "$$which_loc" pump`; \ - DISTCC_HOSTS='<invalid>,cpp' \ + DISTCC_HOSTS='<invalid>,cpp,lzo' \ "$$pump_loc" \ $(MAKE) DISTCC_INSTALLATION="$(DISTCC_INSTALLATION)" \ RESTRICTED_PATH="$(RESTRICTED_PATH)" \ diff --git a/src/hosts.c b/src/hosts.c index caead87..53205f9 100644 --- a/src/hosts.c +++ b/src/hosts.c @@ -248,22 +248,25 @@ static int dcc_parse_options(const char **psrc, rs_trace("got LZO option"); host->compr = DCC_COMPRESS_LZO1X; p += 3; - } else if (str_startswith("down", p)) { - /* if "hostid,down", mark it down, and strip down from hostname */ + } else if (str_startswith("down", p)) { + /* if "hostid,down", mark it down, and strip down from hostname */ host->is_up = 0; - p += 4; + p += 4; } else if (str_startswith("cpp", p)) { rs_trace("got CPP option"); host->cpp_where = DCC_CPP_ON_SERVER; p += 3; } else { - rs_log_warning("unrecognized option in host specification %s", - started); + rs_log_error("unrecognized option in host specification: %s", + started); return EXIT_BAD_HOSTSPEC; } } - dcc_get_protover_from_features(host->compr, host->cpp_where, - &host->protover); + if (dcc_get_protover_from_features(host->compr, host->cpp_where, + &host->protover) == -1) { + rs_log_error("invalid host options: %s", started); + return EXIT_BAD_HOSTSPEC; + } *psrc = p; @@ -413,20 +416,22 @@ int dcc_get_protover_from_features(enum dcc_compress compr, { *protover = -1; - if (compr == DCC_COMPRESS_NONE && - cpp_where == DCC_CPP_ON_CLIENT) { + if (compr == DCC_COMPRESS_NONE && cpp_where == DCC_CPP_ON_CLIENT) { *protover = DCC_VER_1; } - if (compr == DCC_COMPRESS_LZO1X && - cpp_where == DCC_CPP_ON_SERVER) { + if (compr == DCC_COMPRESS_LZO1X && cpp_where == DCC_CPP_ON_SERVER) { *protover = DCC_VER_3; } - if (compr == DCC_COMPRESS_LZO1X && - cpp_where == DCC_CPP_ON_CLIENT) { + + if (compr == DCC_COMPRESS_LZO1X && cpp_where == DCC_CPP_ON_CLIENT) { *protover = DCC_VER_2; } + if (compr == DCC_COMPRESS_NONE && cpp_where == DCC_CPP_ON_SERVER) { + rs_log_error("pump mode (',cpp') requires compression (',lzo')"); + } + return *protover; } |