aboutsummaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-01 20:50:11 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-01 20:50:11 +0000
commitce72a9914e5e996f3c47cc9ec368309e0f1c861e (patch)
tree785572be5289ef84e5f846007a62713494d4ea68 /src/or/control.c
parent7ed921708f94b23653a65173a5b61ddeff6e9125 (diff)
downloadtor-ce72a9914e5e996f3c47cc9ec368309e0f1c861e.tar
tor-ce72a9914e5e996f3c47cc9ec368309e0f1c861e.tar.gz
r8822@totoro: nickm | 2006-10-01 16:24:22 -0400
Fix bug 303: reject attempts to use Tor as a one-hop proxy. svn:r8566
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c
index d479c0600..d75a4e47a 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1997,6 +1997,16 @@ handle_control_attachstream(control_connection_t *conn, uint32_t len,
conn);
return 0;
}
+ if (circ && circuit_get_cpath_len(circ) < 2) {
+ if (STATE_IS_V0(conn->_base.state))
+ send_control0_error(conn, ERR_INTERNAL,
+ "Refuse to attach stream to one-hop circuit.");
+ else
+ connection_write_str_to_buf(
+ "551 Can't attach stream to one-hop circuit.\r\n",
+ conn);
+ return 0;
+ }
if (connection_ap_handshake_rewrite_and_attach(ap_conn, circ) < 0) {
if (STATE_IS_V0(conn->_base.state))
send_control0_error(conn, ERR_INTERNAL, "Unable to attach stream.");