aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-01-16 12:08:10 -0500
committerNick Mathewson <nickm@torproject.org>2013-01-16 12:09:49 -0500
commitd1b5ae903f330c03c32baa60fcc6679d148ad8ac (patch)
treeaf925129b6a1e582ba946462ff1002786ba2a4ea /src
parent7fc91dc274f38dc50f2a6eef2db060c788ef3040 (diff)
downloadtor-d1b5ae903f330c03c32baa60fcc6679d148ad8ac.tar
tor-d1b5ae903f330c03c32baa60fcc6679d148ad8ac.tar.gz
When we get an END cell before CONNECTED, don't report SOCKS success
Bug 7902; fix on 0.1.0.1-rc.
Diffstat (limited to 'src')
-rw-r--r--src/or/reasons.c7
-rw-r--r--src/or/relay.c6
2 files changed, 11 insertions, 2 deletions
diff --git a/src/or/reasons.c b/src/or/reasons.c
index 26ad12e8f..637f8cdc7 100644
--- a/src/or/reasons.c
+++ b/src/or/reasons.c
@@ -105,7 +105,12 @@ stream_end_reason_to_socks5_response(int reason)
case END_STREAM_REASON_DESTROY:
return SOCKS5_GENERAL_ERROR;
case END_STREAM_REASON_DONE:
- return SOCKS5_SUCCEEDED;
+ /* Note that 'DONE' usually indicates a successful close from the other
+ * side of the stream... but if we receive it before a connected cell --
+ * that is, before we have sent a SOCKS reply -- that means that the
+ * other side of the circuit closed the connection before telling us it
+ * was complete. */
+ return SOCKS5_CONNECTION_REFUSED;
case END_STREAM_REASON_TIMEOUT:
return SOCKS5_TTL_EXPIRED;
case END_STREAM_REASON_NOROUTE:
diff --git a/src/or/relay.c b/src/or/relay.c
index bb3a83544..2701263e5 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -734,7 +734,11 @@ connection_ap_process_end_not_open(
}
}
- if (rh->length > 0 && edge_reason_is_retriable(reason) &&
+ if (rh->length == 0) {
+ reason = END_STREAM_REASON_MISC;
+ }
+
+ if (edge_reason_is_retriable(reason) &&
/* avoid retry if rend */
!connection_edge_is_rendezvous_stream(edge_conn)) {
const char *chosen_exit_digest =