diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-09-25 05:17:11 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-09-25 05:17:11 +0000 |
commit | 3d4ccb781ae5d74f0e16a63c89e08459d15cccf1 (patch) | |
tree | 3e9f214701c4a09bc45b453374bd6806f253a1a4 /src/or/directory.c | |
parent | a3bd8b5483bfb3813ba814c8d73840ca993e0298 (diff) | |
download | tor-3d4ccb781ae5d74f0e16a63c89e08459d15cccf1.tar tor-3d4ccb781ae5d74f0e16a63c89e08459d15cccf1.tar.gz |
Refactor buffers; implement descriptors.
'buf_t' is now an opaque type defined in buffers.c .
Router descriptors now include all keys; routers generate keys as
needed on startup (in a newly defined "data directory"), and generate
their own descriptors. Descriptors are now self-signed.
Implementation is not complete: descriptors are never published; and
upon receiving a descriptor, the directory doesn't do anything with
it.
At least "routers.or" and orkeygen are now obsolete, BTW.
svn:r483
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index b55a41940..d1e0713b5 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -53,11 +53,11 @@ void directory_initiate_command(routerinfo_t *router, int command) { conn->address = strdup(router->address); conn->receiver_bucket = -1; /* edge connections don't do receiver buckets */ conn->bandwidth = -1; - if (router->signing_pkey) - conn->pkey = crypto_pk_dup_key(router->signing_pkey); + if (router->identity_pkey) + conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey); else { log_fn(LOG_ERR, "No signing key known for dirserver %s; signature won't be checked", conn->address); - conn->pkey = NULL; + conn->identity_pkey = NULL; } if(connection_add(conn) < 0) { /* no space, forget it */ @@ -124,7 +124,7 @@ void directory_set_dirty(void) { static void directory_rebuild(void) { if(directory_dirty) { if (dump_signed_directory_to_string(the_directory, MAX_DIR_SIZE, - get_signing_privatekey())) { + get_identity_key())) { log(LOG_ERR, "Error writing directory"); return; } @@ -144,7 +144,7 @@ int connection_dir_process_inbuf(connection_t *conn) { switch(conn->state) { case DIR_CONN_STATE_CLIENT_READING_FETCH: /* kill it, but first process the_directory and learn about new routers. */ - switch(fetch_from_buf_http(conn->inbuf,&conn->inbuf_datalen, + switch(fetch_from_buf_http(conn->inbuf, NULL, 0, the_directory, MAX_DIR_SIZE)) { case -1: /* overflow */ log_fn(LOG_DEBUG,"'fetch' response too large. Failing."); @@ -161,11 +161,11 @@ int connection_dir_process_inbuf(connection_t *conn) { log_fn(LOG_DEBUG,"Empty directory. Ignoring."); return -1; } - if(router_get_dir_from_string(the_directory, conn->pkey) < 0) { + if(router_get_dir_from_string(the_directory, conn->identity_pkey) < 0){ log_fn(LOG_DEBUG,"...but parsing failed. Ignoring."); } else { log_fn(LOG_DEBUG,"and got an %s directory; updated routers.", - conn->pkey ? "authenticated" : "unauthenticated"); + conn->identity_pkey ? "authenticated" : "unauthenticated"); } if(options.OnionRouter) { /* connect to them all */ router_retry_connections(); @@ -196,7 +196,7 @@ static int directory_handle_command(connection_t *conn) { assert(conn && conn->type == CONN_TYPE_DIR); - switch(fetch_from_buf_http(conn->inbuf,&conn->inbuf_datalen, + switch(fetch_from_buf_http(conn->inbuf, headers, sizeof(headers), body, sizeof(body))) { case -1: /* overflow */ log_fn(LOG_DEBUG,"input too large. Failing."); |