diff options
author | Roger Dingledine <arma@torproject.org> | 2006-10-01 22:16:55 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-10-01 22:16:55 +0000 |
commit | a3efc8e3d19a4b221c460f687f780915502542fb (patch) | |
tree | cd70668666e1c4d75192f4ea54e005a28e9b3fb0 /src/or/directory.c | |
parent | a23ba84702a402f0bc5b9a81375b344118310b87 (diff) | |
download | tor-a3efc8e3d19a4b221c460f687f780915502542fb.tar.gz tor-a3efc8e3d19a4b221c460f687f780915502542fb.zip |
- V1 authorities should set "HSAuthoritativeDir 1" to continue being
hidden service authorities too.
- Just because your DirPort is open doesn't mean people should be
able to remotely teach you about hidden service descriptors. Now
only accept rendezvous posts if you've got HSAuthoritativeDir set.
svn:r8573
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 0de573286f..d874e18f5f 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1433,6 +1433,7 @@ directory_handle_command_get(dir_connection_t *conn, char *headers, size_t dlen; const char *cp; char *url = NULL; + or_options_t *options = get_options(); /* We ignore the body of a GET request. */ (void)body; (void)body_len; @@ -1596,25 +1597,15 @@ directory_handle_command_get(dir_connection_t *conn, char *headers, return 0; } - if (!strcmpstart(url,"/tor/rendezvous/") || - !strcmpstart(url,"/tor/rendezvous1/")) { + if (options->HSAuthoritativeDir && + (!strcmpstart(url,"/tor/rendezvous/") || + !strcmpstart(url,"/tor/rendezvous1/"))) { /* rendezvous descriptor fetch */ const char *descp; size_t desc_len; int versioned = !strcmpstart(url,"/tor/rendezvous1/"); const char *query = url+strlen("/tor/rendezvous/")+(versioned?1:0); - if (!authdir_mode(get_options())) { - /* 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. */ - write_http_status_line(conn, 400, "Nonauthoritative directory does not " - "store rendezvous descriptors"); - tor_free(url); - return 0; - } switch (rend_cache_lookup_desc(query, versioned?-1:0, &descp, &desc_len)) { case 1: /* valid */ write_http_response_header(conn, desc_len, "application/octet-stream", @@ -1656,7 +1647,7 @@ directory_handle_command_get(dir_connection_t *conn, char *headers, if (!strcmp(url,"/tor/dir-all-weaselhack") && (conn->_base.addr == 0x7f000001ul) && - authdir_mode(get_options())) { + authdir_mode(options)) { /* XXX until weasel rewrites his scripts XXXX012 */ char *new_directory=NULL; @@ -1694,12 +1685,13 @@ directory_handle_command_post(dir_connection_t *conn, char *headers, char *body, size_t body_len) { char *url = NULL; + or_options_t *options = get_options(); log_debug(LD_DIRSERV,"Received POST command."); conn->_base.state = DIR_CONN_STATE_SERVER_WRITING; - if (!authdir_mode(get_options())) { + if (!authdir_mode(options)) { /* we just provide cached directories; we don't want to * receive anything. */ write_http_status_line(conn, 400, "Nonauthoritative directory does not " @@ -1736,7 +1728,8 @@ directory_handle_command_post(dir_connection_t *conn, char *headers, goto done; } - if (!strcmpstart(url,"/tor/rendezvous/publish")) { + if (options->HSAuthoritativeDir && + !strcmpstart(url,"/tor/rendezvous/publish")) { /* rendezvous descriptor post */ if (rend_cache_store(body, body_len) < 0) { // char tmp[1024*2+1]; |