diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-11-17 03:34:44 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-11-17 03:34:44 +0000 |
commit | d125c61e02743d5420567f954a176baeaa4f76a9 (patch) | |
tree | 3f321dbec376927a2091c042e6a47ec00bf5efb4 /src/or/connection_edge.c | |
parent | 942597bc4eede8dda1c4462100027095d1013229 (diff) | |
download | tor-d125c61e02743d5420567f954a176baeaa4f76a9.tar.gz tor-d125c61e02743d5420567f954a176baeaa4f76a9.zip |
r9560@Kushana: nickm | 2006-11-16 22:09:12 -0500
Check in an implementation of "test" connections from Scott Squires:
these connections immediately close upon reaching Tor. They're useful
for apps that want to check whether they're talking to the same Tor as
a given controller. (I'll be tweaking this a bit before I push.)
svn:r8958
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 1a5ab6a2d3..6d3b482d6d 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1440,6 +1440,13 @@ connection_ap_handshake_process_socks(edge_connection_t *conn) return -1; } /* else socks handshake is done, continue processing */ + if (hostname_is_a_test_address(socks->address)) + { + control_event_teststream(conn); + connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); + return -1; + } + if (socks->command == SOCKS_COMMAND_CONNECT) control_event_stream_status(conn, STREAM_EVENT_NEW, 0); else @@ -2450,3 +2457,16 @@ failed: return BAD_HOSTNAME; } +/** Check if the address is of the form "y.test" + */ +int +hostname_is_a_test_address(char *address) +{ + char *s; + s = strrchr(address,'.'); + if (!s) + return 0; + if (!strcmp(s+1,"test")) + return 1; + return 0; +} |