aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-15 04:57:36 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-15 04:57:36 +0000
commit88e0c080cf5493e2841a392f77daeef3db6a289d (patch)
treee8ad4382a7320dcf27647fe42bc0487b79e5e593 /src/or/directory.c
parent5e80944c52ae8abb43a446272f202d8a7d8af083 (diff)
downloadtor-88e0c080cf5493e2841a392f77daeef3db6a289d.tar
tor-88e0c080cf5493e2841a392f77daeef3db6a289d.tar.gz
Ignore fascistfirewall when dealing with service descriptors; obey fascistfirewall when posting server descriptors; ignore fascistfirewall on directory connections when httpproxy is set.
svn:r2527
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index e221a9a42..7726d3371 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -76,6 +76,7 @@ directory_post_to_dirservers(uint8_t purpose, const char *payload,
int i;
routerinfo_t *router;
routerlist_t *rl;
+ char buf[16];
router_get_routerlist(&rl);
if(!rl)
@@ -85,8 +86,14 @@ directory_post_to_dirservers(uint8_t purpose, const char *payload,
router = smartlist_get(rl->routers, i);
/* Note: this posts our descriptor to ourselves, if we're an
* authdirserver. But I think that's ok. */
- if(router->is_trusted_dir)
- directory_initiate_command_router(router, purpose, payload, payload_len);
+ if(!router->is_trusted_dir)
+ continue;
+ if (options.FascistFirewall && purpose == DIR_PURPOSE_UPLOAD_DIR) {
+ sprintf(buf,"%d",router->dir_port);
+ if (!smartlist_string_isin(options.FirewallPorts, buf))
+ continue;
+ }
+ directory_initiate_command_router(router, purpose, payload, payload_len);
}
}
@@ -105,18 +112,19 @@ directory_get_from_dirserver(uint8_t purpose, const char *payload,
if (purpose == DIR_PURPOSE_FETCH_DIR) {
if (advertised_server_mode()) {
/* only ask authdirservers, and don't ask myself */
- ds = router_pick_trusteddirserver(1);
+ ds = router_pick_trusteddirserver(1, options.FascistFirewall);
} else {
/* anybody with a non-zero dirport will do */
- r = router_pick_directory_server(1);
+ r = router_pick_directory_server(1, options.FascistFirewall);
if (!r) {
log_fn(LOG_INFO, "No router found for directory; falling back to dirserver list");
- ds = router_pick_trusteddirserver(1);
+ ds = router_pick_trusteddirserver(1, options.FascistFirewall);
}
}
} else { // (purpose == DIR_PURPOSE_FETCH_RENDDESC)
/* only ask authdirservers, any of them will do */
- ds = router_pick_trusteddirserver(0);
+ /* Never use fascistfirewall; we're going via Tor. */
+ ds = router_pick_trusteddirserver(0, 0);
}
if (r)