[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r10641: Report address and por correctly on requests to dnsport. (Pa (in tor/trunk: . src/or)
Author: nickm
Date: 2007-06-17 11:59:27 -0400 (Sun, 17 Jun 2007)
New Revision: 10641
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/dnsserv.c
Log:
r13471@catbus: nickm | 2007-06-17 11:59:25 -0400
Report address and por correctly on requests to dnsport. (Patch from Robert Hogan.)
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r13471] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-06-17 15:40:27 UTC (rev 10640)
+++ tor/trunk/ChangeLog 2007-06-17 15:59:27 UTC (rev 10641)
@@ -13,6 +13,8 @@
o Minor features (controller):
- Add a SOURCE_ADDR field to STREAM NEW events so that controllers can
match requests to applications. (Patch from Robert Hogan.)
+ - Report address and port correctly on connections to DNSPort. (Patch
+ from Robert Hogan.)
o Deprecated features:
- RedirectExits is now deprecated.
Modified: tor/trunk/src/or/dnsserv.c
===================================================================
--- tor/trunk/src/or/dnsserv.c 2007-06-17 15:40:27 UTC (rev 10640)
+++ tor/trunk/src/or/dnsserv.c 2007-06-17 15:59:27 UTC (rev 10641)
@@ -23,6 +23,7 @@
struct evdns_server_question *q = NULL;
struct sockaddr_storage addr;
struct sockaddr *sa;
+ struct sockaddr_in *sin;
int addrlen;
uint32_t ipaddr;
int err = DNS_ERR_NONE;
@@ -49,9 +50,10 @@
evdns_server_request_respond(req, DNS_ERR_SERVERFAILED);
return;
} else {
- struct sockaddr_in *sin = (struct sockaddr_in*)&addr;
+ sin = (struct sockaddr_in*)&addr;
ipaddr = ntohl(sin->sin_addr.s_addr);
}
+
if (!socks_policy_permits_address(ipaddr)) {
log_warn(LD_APP, "Rejecting DNS request from disallowed IP.");
evdns_server_request_respond(req, DNS_ERR_REFUSED);
@@ -112,6 +114,11 @@
/* Make a new dummy AP connection, and attach the request to it. */
conn = TO_EDGE_CONN(connection_new(CONN_TYPE_AP, AF_INET));
conn->_base.state = AP_CONN_STATE_RESOLVE_WAIT;
+
+ TO_CONN(conn)->addr = ntohl(sin->sin_addr.s_addr);
+ TO_CONN(conn)->port = ntohs(sin->sin_port);
+ TO_CONN(conn)->address = tor_dup_addr(TO_CONN(conn)->addr);
+
if (q->type == EVDNS_TYPE_A)
conn->socks_request->command = SOCKS_COMMAND_RESOLVE;
else