[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Better checking of exit policies for connections by hostname



commit 6e27282dab8f4d4999830f0310ea3f8aa75c6b63
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Oct 31 22:04:25 2012 -0400

    Better checking of exit policies for connections by hostname
---
 src/or/connection_edge.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index e1c6938..c14e116 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -2625,11 +2625,15 @@ connection_ap_can_use_exit(const entry_connection_t *conn, const node_t *exit)
   }
 
   if (conn->socks_request->command == SOCKS_COMMAND_CONNECT) {
-    struct in_addr in;
     tor_addr_t addr, *addrp = NULL;
     addr_policy_result_t r;
-    if (tor_inet_aton(conn->socks_request->address, &in)) {
-      tor_addr_from_in(&addr, &in);
+    if (0 == tor_addr_parse(&addr, conn->socks_request->address)) {
+      addrp = &addr;
+    } else if (!conn->ipv4_traffic_ok && conn->ipv6_traffic_ok) {
+      tor_addr_make_null(&addr, AF_INET6);
+      addrp = &addr;
+    } else if (conn->ipv4_traffic_ok && !conn->ipv6_traffic_ok) {
+      tor_addr_make_null(&addr, AF_INET);
       addrp = &addr;
     }
     r = compare_tor_addr_to_node_policy(addrp, conn->socks_request->port,exit);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits