r12915@catbus: nickm | 2007-05-24 12:12:34 -0400

Do not send a warning when somebody uploads an extrainfo that we will reject, if it happens to be newer than our current routerdesc.


svn:r10303
This commit is contained in:
Nick Mathewson 2007-05-24 17:12:54 +00:00
parent ca9e13f2a0
commit d0a5c4f984
2 changed files with 13 additions and 12 deletions

View File

@ -34,11 +34,9 @@ static int the_v2_networkstatus_is_dirty = 1;
static void directory_remove_invalid(void); static void directory_remove_invalid(void);
static cached_dir_t *dirserv_regenerate_directory(void); static cached_dir_t *dirserv_regenerate_directory(void);
static char *format_versions_list(config_line_t *ln); static char *format_versions_list(config_line_t *ln);
/* Should be static; exposed for testing */
/* XXXX020 not actually tested. */
struct authdir_config_t; struct authdir_config_t;
int add_fingerprint_to_dir(const char *nickname, const char *fp, static int add_fingerprint_to_dir(const char *nickname, const char *fp,
struct authdir_config_t *list); struct authdir_config_t *list);
static uint32_t dirserv_router_get_status(const routerinfo_t *router, static uint32_t dirserv_router_get_status(const routerinfo_t *router,
const char **msg); const char **msg);
static uint32_t static uint32_t
@ -75,8 +73,7 @@ typedef struct authdir_config_t {
} authdir_config_t; } authdir_config_t;
/** Should be static; exposed for testing. */ /** Should be static; exposed for testing. */
/* XXXX020 not actually tested. */ static authdir_config_t *fingerprint_list = NULL;
authdir_config_t *fingerprint_list = NULL;
/** Allocate and return a new, empty, authdir_config_t. */ /** Allocate and return a new, empty, authdir_config_t. */
static authdir_config_t * static authdir_config_t *
@ -621,6 +618,7 @@ static int
dirserv_add_extrainfo(extrainfo_t *ei, const char **msg) dirserv_add_extrainfo(extrainfo_t *ei, const char **msg)
{ {
routerinfo_t *ri; routerinfo_t *ri;
int r;
tor_assert(msg); tor_assert(msg);
*msg = NULL; *msg = NULL;
@ -630,9 +628,9 @@ dirserv_add_extrainfo(extrainfo_t *ei, const char **msg)
extrainfo_free(ei); extrainfo_free(ei);
return -1; return -1;
} }
if (routerinfo_incompatible_with_extrainfo(ri, ei, msg)) { if ((r = routerinfo_incompatible_with_extrainfo(ri, ei, msg))) {
extrainfo_free(ei); extrainfo_free(ei);
return -1; return r < 0 ? 0 : -1;
} }
router_add_extrainfo_to_routerlist(ei, msg, 0, 0); router_add_extrainfo_to_routerlist(ei, msg, 0, 0);
return 2; return 2;

View File

@ -4964,7 +4964,8 @@ router_differences_are_cosmetic(routerinfo_t *r1, routerinfo_t *r2)
return 1; return 1;
} }
/** DOCDOC */ /** DOCDOC Returns 1 for "reject with message"; -1 for "reject silently",
* 0 for "accept". */
int int
routerinfo_incompatible_with_extrainfo(routerinfo_t *ri, extrainfo_t *ei, routerinfo_incompatible_with_extrainfo(routerinfo_t *ri, extrainfo_t *ei,
const char **msg) const char **msg)
@ -4972,8 +4973,10 @@ routerinfo_incompatible_with_extrainfo(routerinfo_t *ri, extrainfo_t *ei,
tor_assert(ri); tor_assert(ri);
tor_assert(ei); tor_assert(ei);
if (ei->bad_sig) if (ei->bad_sig) {
if (msg) *msg = "Extrainfo signature was bad, or signed with wrong key.";
return 1; return 1;
}
/* The nickname must match exactly to have been generated at the same time /* The nickname must match exactly to have been generated at the same time
* by the same rotuer. */ * by the same rotuer. */
@ -4999,10 +5002,10 @@ routerinfo_incompatible_with_extrainfo(routerinfo_t *ri, extrainfo_t *ei,
tor_free(ei->pending_sig); tor_free(ei->pending_sig);
} }
if (ei->cache_info.published_on < ei->cache_info.published_on) { if (ei->cache_info.published_on < ri->cache_info.published_on) {
if (msg) *msg = "Extrainfo published time did not match routerdesc"; if (msg) *msg = "Extrainfo published time did not match routerdesc";
return 1; return 1;
} else if (ei->cache_info.published_on > ei->cache_info.published_on) { } else if (ei->cache_info.published_on > ri->cache_info.published_on) {
if (msg) *msg = "Extrainfo published time did not match routerdesc"; if (msg) *msg = "Extrainfo published time did not match routerdesc";
return -1; return -1;
} }