[or-cvs] caching dirservers don"t handle posts, running-routers, or ...

Roger Dingledine arma at seul.org
Wed Jul 21 08:41:00 UTC 2004


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

Modified Files:
	directory.c 
Log Message:
caching dirservers don't handle posts, running-routers, or rend descs


Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- directory.c	21 Jul 2004 00:12:42 -0000	1.118
+++ directory.c	21 Jul 2004 08:40:57 -0000	1.119
@@ -524,6 +524,11 @@
   }
 
   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 @@
     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 @@
 
   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;



More information about the tor-commits mailing list