summaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-09-22 00:44:07 +0000
committerNick Mathewson <nickm@torproject.org>2006-09-22 00:44:07 +0000
commit6b3f6afb5863e670cf69c1c5219e1177e2ab26b2 (patch)
treedc522721106de4817b0e9de7554b049e34524b52 /src/or/connection_edge.c
parent213658f117f88eaeb21ffd61451155f451f67604 (diff)
downloadtor-6b3f6afb5863e670cf69c1c5219e1177e2ab26b2.tar.gz
tor-6b3f6afb5863e670cf69c1c5219e1177e2ab26b2.zip
r8895@Kushana: nickm | 2006-09-21 20:05:11 -0400
Debug client-side reverse dns code. svn:r8452
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 8d6c9273ba..9ab672ff07 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1120,7 +1120,7 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
return -1;
}
- if (socks->command == SOCKS_COMMAND_RESOLVE) { // resolve_ptr XXXX NM
+ if (socks->command == SOCKS_COMMAND_RESOLVE) {
uint32_t answer;
struct in_addr in;
/* Reply to resolves immediately if we can. */
@@ -1141,7 +1141,7 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
return 0;
}
rep_hist_note_used_resolve(time(NULL)); /* help predict this next time */
- } else { /* socks->command == SOCKS_COMMAND_CONNECT */
+ } else if (socks->command == SOCKS_COMMAND_CONNECT) {
if (socks->port == 0) {
log_notice(LD_APP,"Application asked to connect to port 0. Refusing.");
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
@@ -1166,6 +1166,12 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
/* help predict this next time */
rep_hist_note_used_port(socks->port, time(NULL));
+ } else if (socks->command == SOCKS_COMMAND_RESOLVE_PTR) {
+ // XXXX NM Do anything here?
+
+ rep_hist_note_used_resolve(time(NULL)); /* help predict this next time */
+ } else {
+ tor_fragile_assert();
}
conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
if ((circ &&
@@ -1701,10 +1707,10 @@ connection_ap_handshake_socks_resolved(edge_connection_t *conn,
buf[1] = SOCKS5_SUCCEEDED;
buf[2] = 0; /* reserved */
buf[3] = 0x03; /* Domainname address type */
- memcpy(buf+4, answer, answer_len); /* address */
- buf[4+answer_len] = '\0';
- set_uint16(buf+4+answer_len+1, 0); /* port == 0. */
- replylen = 4+answer_len+1+2;
+ buf[4] = (char)answer_len;
+ memcpy(buf+5, answer, answer_len); /* address */
+ set_uint16(buf+5+answer_len, 0); /* port == 0. */
+ replylen = 5+answer_len+2;
} else {
buf[1] = SOCKS5_HOST_UNREACHABLE;
memset(buf+2, 0, 8);