[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] refuse .exit addresses immediately if the requested node wo...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] refuse .exit addresses immediately if the requested node wo...
- From: arma@seul.org (Roger Dingledine)
- Date: Tue, 30 Nov 2004 03:15:11 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 30 Nov 2004 03:15:32 -0500
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or
Modified Files:
connection_edge.c
Log Message:
refuse .exit addresses immediately if the requested node would
refuse the request (e.g. due to exit policy or wrong version)
Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.248
retrieving revision 1.249
diff -u -d -r1.248 -r1.249
--- connection_edge.c 30 Nov 2004 06:12:21 -0000 1.248
+++ connection_edge.c 30 Nov 2004 08:15:09 -0000 1.249
@@ -354,6 +354,7 @@
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 @@
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;
}