diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-07-19 02:36:59 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-07-19 02:44:12 -0400 |
commit | 12dfb4f5d8cfb0f244b4a1ae3cc3af237a3034e7 (patch) | |
tree | c018f20c7eddeb50db9c7ec7fb106d2fd666ba0f /src/or/connection_edge.c | |
parent | 94f85f216ae4b6196d2a3438bfaf328375ebaad6 (diff) | |
download | tor-12dfb4f5d8cfb0f244b4a1ae3cc3af237a3034e7.tar.gz tor-12dfb4f5d8cfb0f244b4a1ae3cc3af237a3034e7.zip |
Use socks username/password information in stream isolation
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 42f74b7ecc..63779f25cd 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -3305,12 +3305,10 @@ connection_edge_streams_are_compatible(const edge_connection_t *a, if ((iso & ISO_DESTADDR) && strcasecmp(a->original_dest_address, b->original_dest_address)) return 0; - /* XXXX023 Waititing for ticket #1666 */ - /* if ((iso & ISO_SOCKSAUTH) && - strcasecmp(a->socks_request->auth, b->socks_request->auth)) + (strcmp_opt(a->socks_request->username, b->socks_request->username) || + strcmp_opt(a->socks_request->password, b->socks_request->password))) return 0; - */ if ((iso & ISO_CLIENTPROTO) && (TO_CONN(a)->type != TO_CONN(b)->type || a->socks_request->socks_version != b->socks_request->socks_version)) @@ -3369,12 +3367,10 @@ connection_edge_compatible_with_circuit(const edge_connection_t *conn, if ((iso & ISO_DESTADDR) && strcasecmp(conn->original_dest_address, circ->dest_address)) return 0; - /* XXXX023 Waititing for ticket #1666 */ - /* if ((iso & ISO_SOCKSAUTH) && - strcasecmp(a->socks_request->auth, b->socks_request->auth)) + (strcmp_opt(conn->socks_request->username, circ->socks_username) || + strcmp_opt(conn->socks_request->password, circ->socks_password))) return 0; - */ if ((iso & ISO_CLIENTPROTO) && (TO_CONN(conn)->type != circ->client_proto_type || conn->socks_request->socks_version != circ->client_proto_socksver)) @@ -3420,7 +3416,10 @@ connection_edge_update_circuit_isolation(const edge_connection_t *conn, tor_addr_copy(&circ->client_addr, &TO_CONN(conn)->addr); circ->session_group = conn->session_group; circ->nym_epoch = conn->nym_epoch; - /* XXXX023 auth too, once #1666 is in. */ + circ->socks_username = conn->socks_request->username ? + tor_strdup(conn->socks_request->username) : NULL; + circ->socks_password = conn->socks_request->password ? + tor_strdup(conn->socks_request->password) : NULL; circ->isolation_values_set = 1; return 0; @@ -3430,7 +3429,9 @@ connection_edge_update_circuit_isolation(const edge_connection_t *conn, mixed |= ISO_DESTPORT; if (strcasecmp(conn->original_dest_address, circ->dest_address)) mixed |= ISO_DESTADDR; - /* XXXX023 auth too, once #1666 is in. */ + if (strcmp_opt(conn->socks_request->username, circ->socks_username) || + strcmp_opt(conn->socks_request->password, circ->socks_password)) + mixed |= ISO_SOCKSAUTH; if ((TO_CONN(conn)->type != circ->client_proto_type || conn->socks_request->socks_version != circ->client_proto_socksver)) mixed |= ISO_CLIENTPROTO; @@ -3486,5 +3487,7 @@ circuit_clear_isolation(origin_circuit_t *circ) tor_free(circ->dest_address); circ->session_group = -1; circ->nym_epoch = 0; + tor_free(circ->socks_username); + tor_free(circ->socks_password); } |