diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-03-06 10:22:40 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-06 10:22:40 -0500 |
commit | 4a2a1e572ec789efee2779e00d920a70892845cc (patch) | |
tree | 184047825e2fbc3b5b46984e29a72145c05ecf2f /src | |
parent | d3c5df6cf6f3d978d28e6f5d707af3541a183544 (diff) | |
parent | 967d9c9f1029a5d9b993888bac91d3959bf4c991 (diff) | |
download | tor-4a2a1e572ec789efee2779e00d920a70892845cc.tar.gz tor-4a2a1e572ec789efee2779e00d920a70892845cc.zip |
Merge branch 'bug11108'
Diffstat (limited to 'src')
-rw-r--r-- | src/or/policies.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/or/policies.c b/src/or/policies.c index 6289d70bbb..42dc46b7fd 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -482,10 +482,12 @@ validate_addr_policies(const or_options_t *options, char **msg) * Ignore port specifiers. */ static int -load_policy_from_option(config_line_t *config, smartlist_t **policy, +load_policy_from_option(config_line_t *config, const char *option_name, + smartlist_t **policy, int assume_action) { int r; + int killed_any_ports = 0; addr_policy_list_free(*policy); *policy = NULL; r = parse_addr_policy(config, policy, assume_action); @@ -504,9 +506,13 @@ load_policy_from_option(config_line_t *config, smartlist_t **policy, c = addr_policy_get_canonical_entry(&newp); SMARTLIST_REPLACE_CURRENT(*policy, n, c); addr_policy_free(n); + killed_any_ports = 1; } } SMARTLIST_FOREACH_END(n); } + if (killed_any_ports) { + log_warn(LD_CONFIG, "Ignoring ports in %s option.", option_name); + } return 0; } @@ -516,20 +522,22 @@ int policies_parse_from_options(const or_options_t *options) { int ret = 0; - if (load_policy_from_option(options->SocksPolicy, &socks_policy, -1) < 0) + if (load_policy_from_option(options->SocksPolicy, "SocksPolicy", + &socks_policy, -1) < 0) ret = -1; - if (load_policy_from_option(options->DirPolicy, &dir_policy, -1) < 0) + if (load_policy_from_option(options->DirPolicy, "DirPolicy", + &dir_policy, -1) < 0) ret = -1; - if (load_policy_from_option(options->AuthDirReject, + if (load_policy_from_option(options->AuthDirReject, "AuthDirReject", &authdir_reject_policy, ADDR_POLICY_REJECT) < 0) ret = -1; - if (load_policy_from_option(options->AuthDirInvalid, + if (load_policy_from_option(options->AuthDirInvalid, "AuthDirInvalid", &authdir_invalid_policy, ADDR_POLICY_REJECT) < 0) ret = -1; - if (load_policy_from_option(options->AuthDirBadDir, + if (load_policy_from_option(options->AuthDirBadDir, "AuthDirBadDir", &authdir_baddir_policy, ADDR_POLICY_REJECT) < 0) ret = -1; - if (load_policy_from_option(options->AuthDirBadExit, + if (load_policy_from_option(options->AuthDirBadExit, "AuthDirBadExit", &authdir_badexit_policy, ADDR_POLICY_REJECT) < 0) ret = -1; if (parse_reachable_addresses() < 0) |