summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-11-30 08:15:09 +0000
committerRoger Dingledine <arma@torproject.org>2004-11-30 08:15:09 +0000
commitd383c23e73161882e7df5773c16628d2a0d2fbed (patch)
tree58f9e9dd72712a68f74ab3d02cd6ebe245d51947
parent00c945af6cc81f7ccf01edf3c809599721652342 (diff)
downloadtor-d383c23e73161882e7df5773c16628d2a0d2fbed.tar.gz
tor-d383c23e73161882e7df5773c16628d2a0d2fbed.zip
refuse .exit addresses immediately if the requested node would
refuse the request (e.g. due to exit policy or wrong version) svn:r3038
-rw-r--r--src/or/connection_edge.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 31bc9ba351..01b4810b0d 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -354,6 +354,7 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
socks_request_t *socks;
int sockshere;
hostname_type_t addresstype;
+ routerinfo_t *router;
tor_assert(conn);
tor_assert(conn->type == CONN_TYPE_AP);
@@ -411,16 +412,16 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
log_fn(LOG_WARN,"Malformed address '%s.exit'. Refusing.", socks->address);
return -1;
}
- if (strlen(s+1) == HEX_DIGEST_LEN) {
- conn->chosen_exit_name = tor_malloc(HEX_DIGEST_LEN+2);
- *(conn->chosen_exit_name) = '$';
- strlcpy(conn->chosen_exit_name+1, s+1, HEX_DIGEST_LEN+1);
- } else {
- conn->chosen_exit_name = tor_strdup(s+1);
- }
+ conn->chosen_exit_name = tor_strdup(s+1);
*s = 0;
- if (!is_legal_nickname_or_hexdigest(conn->chosen_exit_name)) {
- log_fn(LOG_WARN, "%s is not a legal exit node nickname; rejecting.",
+ router = router_get_by_nickname(conn->chosen_exit_name);
+ if(!router) {
+ log_fn(LOG_WARN,"Requested exit point '%s' is not known. Closing.",
+ conn->chosen_exit_name);
+ return -1;
+ }
+ if (!connection_ap_can_use_exit(conn, router)) {
+ log_fn(LOG_WARN, "Requested exit point '%s' would refuse request. Closing.",
conn->chosen_exit_name);
return -1;
}