[or-cvs] export the default exit policy via the control port, so con...

arma at seul.org arma at seul.org
Tue Jun 13 09:16:11 UTC 2006


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

Modified Files:
	control.c or.h policies.c 
Log Message:
export the default exit policy via the control port, so controllers
don't need to guess what it is / will be later.


Index: control.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -p -d -r1.193 -r1.194
--- control.c	4 Jun 2006 22:42:12 -0000	1.193
+++ control.c	13 Jun 2006 09:16:09 -0000	1.194
@@ -1289,12 +1289,14 @@ list_getinfo_options(void)
     "addr-mappings/configl Addresses remapped from configuration options.\n"
     "addr-mappings/control Addresses remapped by a controller.\n"
     "circuit-status Status of each current circuit.\n"
+    "config-file Current location of the \"torrc\" file.\n"
     "config/names List of configuration options, types, and documentation.\n"
     "desc/id/* Server descriptor by hex ID\n"
     "desc/name/* Server descriptor by nickname.\n"
     "desc/all-recent Latest server descriptor for every router\n"
     "dir/server/* Fetch server descriptors -- see dir-spec.txt\n"
     "entry-guards Which nodes will we use as entry guards?\n"
+    "exit-policy/default Default lines appended to config->ExitPolicy\n"
     "info/names List of GETINFO options, types, and documentation.\n"
     "network-status List of hex IDs, nicknames, server statuses.\n"
     "orconn-status Status of each current OR connection.\n"
@@ -1532,6 +1534,8 @@ handle_getinfo_helper(const char *questi
       cp += d->dir_len;
       });
     *cp = '\0';
+  } else if (!strcmpstart(question, "exit-policy/")) {
+    return policies_getinfo_helper(question, answer);
   }
   return 0;
 }

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.838
retrieving revision 1.839
diff -u -p -d -r1.838 -r1.839
--- or.h	10 Jun 2006 00:26:39 -0000	1.838
+++ or.h	13 Jun 2006 09:16:09 -0000	1.839
@@ -2051,6 +2051,7 @@ int policies_parse_exit_policy(config_li
                                addr_policy_t **dest,
                                int rejectprivate);
 int exit_policy_is_general_exit(addr_policy_t *policy);
+int policies_getinfo_helper(const char *question, char **answer);
 
 void addr_policy_free(addr_policy_t *p);
 void policies_free_all(void);

Index: policies.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/policies.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -d -r1.4 -r1.5
--- policies.c	13 Jun 2006 02:48:06 -0000	1.4
+++ policies.c	13 Jun 2006 09:16:09 -0000	1.5
@@ -627,6 +627,18 @@ exit_policy_is_general_exit(addr_policy_
   return n_allowed >= 2;
 }
 
+int
+policies_getinfo_helper(const char *question, char **answer)
+{
+  if (!strcmp(question, "exit-policy/default")) {
+    *answer = tor_strdup(DEFAULT_EXIT_POLICY);
+//  } else if (!strcmp(question, "exit-policy/prepend")) {
+  } else {
+    *answer = NULL;
+  }
+  return 0;
+}
+
 /** Release all storage held by <b>p</b> */
 void
 addr_policy_free(addr_policy_t *p)



More information about the tor-commits mailing list