[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #15215 [Tor]: Use destination address type in SOCKS5 reply rather than AP address
#15215: Use destination address type in SOCKS5 reply rather than AP address
------------------------+--------------------------------
Reporter: sysrqb | Owner:
Type: defect | Status: needs_review
Priority: normal | Milestone: Tor: 0.2.6.x-final
Component: Tor | Version:
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
------------------------+--------------------------------
Changes (by sysrqb):
* cc: dgoulet, yawning (added)
Comment:
After re-rereading the socks5 spec, and discussing this with dgoulet and
yawning, I realized that the new behavior is wrong. I have a better and
not-wrong, this time (as I understand it) patch. The old behavior of
looking at the ap connection address family type was correct, but it seems
like there's an even easier way because connection_t has socket_family
which is set when we open the connection listener and it's copied into new
connections, so looking at this seems easier.
New branch bug15215_2
{{{
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 2a1a2f0..5571817 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -2570,7 +2570,8 @@
connection_ap_handshake_socks_reply(entry_connection_t *conn, char *reply,
} else if (conn->socks_request->socks_version == 5) {
size_t buf_len;
memset(buf,0,sizeof(buf));
- if (tor_addr_family(&conn->edge_.base_.addr) == AF_INET) {
+ if (conn->edge_.base_.socket_family == AF_INET ||
+ conn->edge_.base_.socket_family == AF_UNIX) {
buf[0] = 5; /* version 5 */
buf[1] = (char)status;
buf[2] = 0;
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/15215#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs