diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-11-12 19:39:13 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-11-12 19:39:13 +0000 |
commit | 5109de562604c334fee2a0778ff15ad93a4b1191 (patch) | |
tree | 82b677aa510f32609afabaa0afbe575c8caa17f9 /src/or/directory.c | |
parent | ad8e779db22078ca6b18bd6194bbceee538cb632 (diff) | |
download | tor-5109de562604c334fee2a0778ff15ad93a4b1191.tar.gz tor-5109de562604c334fee2a0778ff15ad93a4b1191.zip |
Rename exit_policy to addr_policy, since it gets used for SOCKS and directory connections too. Make all policies get validated in options_validate, and make SOCKS/directory policies get set in options_act.
svn:r2819
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 7649d0fd0e..e0291047ac 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -52,7 +52,7 @@ static int directory_handle_command(connection_t *conn); /********* START VARIABLES **********/ -static struct exit_policy_t *dir_policy = NULL; +static struct addr_policy_t *dir_policy = NULL; #if 0 /* commented out for now, since for now what clients send is different from what servers want to receive */ @@ -69,20 +69,18 @@ char rend_fetch_url[] = "/tor/rendezvous/"; /********* END VARIABLES ************/ -/** A helper function for dir_policy_permits_address() below. - * - * Parse options->DirPolicy in the same way that the exit policy - * is parsed, and put the processed version in &dir_policy. - * Ignore port specifiers. +/** Parse get_options()->DirPolicy, and put the processed version in + * &dir_policy. Ignore port specifiers. */ -static void parse_dir_policy(void) +void +parse_dir_policy(void) { - struct exit_policy_t *n; + struct addr_policy_t *n; if (dir_policy) { - exit_policy_free(dir_policy); + addr_policy_free(dir_policy); dir_policy = NULL; } - config_parse_exit_policy(get_options()->DirPolicy, &dir_policy); + config_parse_addr_policy(get_options()->DirPolicy, &dir_policy); /* ports aren't used. */ for (n=dir_policy; n; n = n->next) { n->prt_min = 1; @@ -96,12 +94,10 @@ static void parse_dir_policy(void) int dir_policy_permits_address(uint32_t addr) { int a; - if (get_options()->DirPolicy && !dir_policy) - parse_dir_policy(); if(!dir_policy) /* 'no dir policy' means 'accept' */ return 1; - a = router_compare_addr_to_exit_policy(addr, 1, dir_policy); + a = router_compare_addr_to_addr_policy(addr, 1, dir_policy); if (a==-1) return 0; else if (a==0) |