summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-04-01 07:04:40 +0000
committerNick Mathewson <nickm@torproject.org>2005-04-01 07:04:40 +0000
commitbc668233adc3e1d09b5ddd20f9ec08761ca8cb49 (patch)
tree74b4354f8b805846a4daef2c5606df78461662aa /src/tools
parent3b6359737e97a499e84163d9b705fcb9f515fa1a (diff)
downloadtor-bc668233adc3e1d09b5ddd20f9ec08761ca8cb49.tar.gz
tor-bc668233adc3e1d09b5ddd20f9ec08761ca8cb49.zip
Improve error msgs in tor-resolve.c; resolve bug 112
svn:r3947
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/tor-resolve.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c
index 090503045e..1f4a7a90eb 100644
--- a/src/tools/tor-resolve.c
+++ b/src/tools/tor-resolve.c
@@ -74,15 +74,21 @@ parse_socks4a_resolve_response(const char *response, size_t len,
tor_assert(response);
tor_assert(addr_out);
- if (len < RESPONSE_LEN)
+ if (len < RESPONSE_LEN) {
+ log_fn(LOG_WARN,"Truncated socks response.");
return -1;
- if (((uint8_t)response[0])!=0) /* version: 0 */
+ }
+ if (((uint8_t)response[0])!=0) { /* version: 0 */
+ log_fn(LOG_WARN,"Nonzero version in socks response: bad format.");
return -1;
+ }
status = (uint8_t)response[1];
- if (get_uint16(response+2)!=0) /* port: 0 */
+ if (get_uint16(response+2)!=0) { /* port: 0 */
+ log_fn(LOG_WARN,"Nonzero port in socks response: bad format.");
return -1;
+ }
if (status != 90) {
- log_fn(LOG_WARN,"Got status response '%d', meaning not success.", status);
+ log_fn(LOG_WARN,"Got status response '%d': socks request failed.", status);
return -1;
}
@@ -151,7 +157,6 @@ do_resolve(const char *hostname, uint32_t sockshost, uint16_t socksport,
}
if (parse_socks4a_resolve_response(response_buf, RESPONSE_LEN,result_addr)<0){
- log_fn(LOG_ERR, "Error parsing SOCKS response");
return -1;
}