aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-11-16 23:37:35 +0000
committerRoger Dingledine <arma@torproject.org>2005-11-16 23:37:35 +0000
commitc4aa9e7941d64f75f6003dbda5bd2226766d3e12 (patch)
tree0ad72efd87013cb21b3e23af2f7c4de6a16fb059 /src/or/buffers.c
parent83d6b0387b198f31819cf8de128c04470689c4d8 (diff)
downloadtor-c4aa9e7941d64f75f6003dbda5bd2226766d3e12.tar
tor-c4aa9e7941d64f75f6003dbda5bd2226766d3e12.tar.gz
Add a new config option TestSocks so people can see if their
applications are using socks4, socks4a, socks5-with-ip, or socks5-with-hostname. This way they don't have to keep mucking with tcpdump and wondering if something got cached somewhere. svn:r5399
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 68f51e7eb..da60a619d 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -888,10 +888,13 @@ fetch_from_buf_http(buf_t *buf,
* If you want to specify the socks reply, write it into <b>req->reply</b>
* and set <b>req->replylen</b>, else leave <b>req->replylen</b> alone.
*
+ * If <b>log_sockstype</b> is non-zero, then do a notice-level log of whether
+ * the connection is possibly leaking DNS requests locally or not.
+ *
* If returning 0 or -1, <b>req->address</b> and <b>req->port</b> are undefined.
*/
int
-fetch_from_buf_socks(buf_t *buf, socks_request_t *req)
+fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
{
unsigned char len;
char tmpbuf[INET_NTOA_BUF_LEN];
@@ -924,7 +927,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req)
req->reply[1] = '\xFF'; /* reject all methods */
return -1;
}
- buf_remove_from_front(buf,2+nummethods);/* remove packet from buf */
+ buf_remove_from_front(buf,2+nummethods); /* remove packet from buf */
req->replylen = 2; /* 2 bytes of response */
req->reply[0] = 5; /* socks5 reply */
@@ -982,6 +985,8 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req)
req->address[len] = 0;
req->port = ntohs(get_uint16(buf->cur+5+len));
buf_remove_from_front(buf, 5+len+2);
+ if (log_sockstype)
+ notice(LD_APP, "Your application (using socks5 on port %d) gave Tor a hostname, which means Tor will do the DNS resolve for you. This is good.", req->port);
return 1;
default: /* unsupported */
warn(LD_APP,"socks5: unsupported address type %d. Rejecting.",*(buf->cur+3));
@@ -1055,6 +1060,8 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req)
return -1;
}
tor_assert(next < buf->cur+buf->datalen);
+ if (log_sockstype)
+ notice(LD_APP, "Your application (using socks4a on port %d) gave Tor a hostname, which means Tor will do the DNS resolve for you. This is good.", req->port);
}
debug(LD_APP,"socks4: Everything is here. Success.");
strlcpy(req->address, startaddr ? startaddr : tmpbuf,