summaryrefslogtreecommitdiff
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
parent3b6359737e97a499e84163d9b705fcb9f515fa1a (diff)
downloadtor-bc668233adc3e1d09b5ddd20f9ec08761ca8cb49.tar.gz
tor-bc668233adc3e1d09b5ddd20f9ec08761ca8cb49.zip
Improve error msgs in tor-resolve.c; resolve bug 112
svn:r3947
-rw-r--r--doc/TODO15
-rw-r--r--src/tools/tor-resolve.c15
2 files changed, 18 insertions, 12 deletions
diff --git a/doc/TODO b/doc/TODO
index d4c4d7c4f9..32fc539803 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -42,21 +42,21 @@ N . Switch to libevent
bandwidth buckets under heavy load. (Really, the logic was
never right in the first place.) Also, we should audit all users
of get_pending_bytes().
- . Find a way to make sure we have libevent 1.0 or later.
+ o Find a way to make sure we have libevent 1.0 or later.
o Implement patch to libevent
o Submit patch to niels making this possible.
- - Implement Tor side once patch is accepted.
- . Log which poll method we're using.
+ o Implement Tor side once patch is accepted.
+ o Log which poll method we're using.
o Implement patch to libevent
o Submit patch to niels making this possible.
- - Implement Tor side once patch is accepted.
- . Intercept libevent's "log" messages.
+ o Implement Tor side once patch is accepted.
+ o Intercept libevent's "log" messages.
o Ask Niels whether a patch would be accepted.
o Implement patch, if so.
- - Implement Tor side once patch is accepted.
+ o Implement Tor side once patch is accepted.
o Check return from event_set, event_add, event_del.
o Keep pushing to get a windows patch accepted.
- - After about 26 March, check back with Niels; he should be back
+ o After about 26 March, check back with Niels; he should be back
by then.
Security:
@@ -181,6 +181,7 @@ R o client software not upload descriptor until:
* no need to do this yet. few people define their ORPort.
Arguable
+N - tor-resolve script should use socks5 to get better error messages.
N - Script to try pulling bytes through slow-seeming servers so they can
notice that they might be fast.
N . Reverse DNS
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;
}