[or-cvs] reintroduce the logic to exit_policy_is_general_exit() to c...

arma at seul.org arma at seul.org
Tue Jun 13 02:48:08 UTC 2006


Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	policies.c 
Log Message:
reintroduce the logic to exit_policy_is_general_exit() to count
how many ports are allowd. require two ports open, not just one.


Index: policies.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/policies.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -d -r1.3 -r1.4
--- policies.c	12 Jun 2006 22:03:25 -0000	1.3
+++ policies.c	13 Jun 2006 02:48:06 -0000	1.4
@@ -603,11 +603,12 @@ policies_parse_exit_policy(config_line_t
 
 /** Return true iff <b>ri</b> is "useful as an exit node", meaning
  * it allows exit to at least one /8 address space for at least
- * one of ports 80, 443, and 6667. */
+ * two of ports 80, 443, and 6667. */
 int
 exit_policy_is_general_exit(addr_policy_t *policy)
 {
   static const int ports[] = { 80, 443, 6667 };
+  int n_allowed = 0;
   int i;
   for (i = 0; i < 3; ++i) {
     struct addr_policy_t *p = policy;
@@ -620,10 +621,10 @@ exit_policy_is_general_exit(addr_policy_
         continue; /* 127.x */
       /* We have a match that is at least a /8. */
       if (p->policy_type == ADDR_POLICY_ACCEPT)
-        return 1;
+        ++n_allowed;
     }
   }
-  return 0;
+  return n_allowed >= 2;
 }
 
 /** Release all storage held by <b>p</b> */



More information about the tor-commits mailing list