aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-07-21 08:40:57 +0000
committerRoger Dingledine <arma@torproject.org>2004-07-21 08:40:57 +0000
commit906d1aa99fa79a6e1f6cb16ab16bae1ab6cd9030 (patch)
tree774cf9a9b96de139047c2f6f9bc3bcb396ff8904 /src
parent3e97c12f24398db96d4f1926020656a1561082ca (diff)
downloadtor-906d1aa99fa79a6e1f6cb16ab16bae1ab6cd9030.tar
tor-906d1aa99fa79a6e1f6cb16ab16bae1ab6cd9030.tar.gz
caching dirservers don't handle posts, running-routers, or rend descs
svn:r2080
Diffstat (limited to 'src')
-rw-r--r--src/or/directory.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 41c1e8ed9..d391d4a9f 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -524,6 +524,11 @@ directory_handle_command_get(connection_t *conn, char *headers,
}
if(!strcmp(url,"/running-routers")) { /* running-routers fetch */
+ if(!authdir_mode()) {
+ /* XXX008 for now, we don't cache running-routers. Reject. */
+ connection_write_to_buf(answer400, strlen(answer400), conn);
+ return 0;
+ }
dlen = dirserv_get_runningrouters(&cp);
if(dlen < 0) { /* we failed to create cp */
connection_write_to_buf(answer503, strlen(answer503), conn);
@@ -542,6 +547,15 @@ directory_handle_command_get(connection_t *conn, char *headers,
const char *descp;
int desc_len;
+ if(!authdir_mode()) {
+ /* We don't hand out rend descs. In fact, it could be a security
+ * risk, since rend_cache_lookup_desc() below would provide it
+ * if we're gone to the site recently, and 404 if we haven't.
+ *
+ * Reject. */
+ connection_write_to_buf(answer400, strlen(answer400), conn);
+ return 0;
+ }
switch(rend_cache_lookup_desc(url+strlen(rend_fetch_url), &descp, &desc_len)) {
case 1: /* valid */
snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
@@ -580,6 +594,13 @@ directory_handle_command_post(connection_t *conn, char *headers,
conn->state = DIR_CONN_STATE_SERVER_WRITING;
+ if(!authdir_mode()) {
+ /* we just provide cached directories; we don't want to
+ * receive anything. */
+ connection_write_to_buf(answer400, strlen(answer400), conn);
+ return 0;
+ }
+
if (parse_http_url(headers, &url) < 0) {
connection_write_to_buf(answer400, strlen(answer400), conn);
return 0;