Commit aa63a84f authored by Roger Dingledine's avatar Roger Dingledine
Browse files

the things we do for our windows users.

i hope they appreciate it.


svn:r6004
parent d113b75d
This diff is collapsed.
...@@ -147,7 +147,7 @@ dirserv_add_own_fingerprint(const char *nickname, crypto_pk_env_t *pk) ...@@ -147,7 +147,7 @@ dirserv_add_own_fingerprint(const char *nickname, crypto_pk_env_t *pk)
{ {
char fp[FINGERPRINT_LEN+1]; char fp[FINGERPRINT_LEN+1];
if (crypto_pk_get_fingerprint(pk, fp, 0)<0) { if (crypto_pk_get_fingerprint(pk, fp, 0)<0) {
err(LD_BUG, "Error computing fingerprint"); log_err(LD_BUG, "Error computing fingerprint");
return -1; return -1;
} }
if (!fingerprint_list) if (!fingerprint_list)
...@@ -173,13 +173,13 @@ dirserv_parse_fingerprint_file(const char *fname) ...@@ -173,13 +173,13 @@ dirserv_parse_fingerprint_file(const char *fname)
cf = read_file_to_str(fname, 0); cf = read_file_to_str(fname, 0);
if (!cf) { if (!cf) {
warn(LD_FS, "Cannot open fingerprint file %s", fname); log_warn(LD_FS, "Cannot open fingerprint file %s", fname);
return -1; return -1;
} }
result = config_get_lines(cf, &front); result = config_get_lines(cf, &front);
tor_free(cf); tor_free(cf);
if (result < 0) { if (result < 0) {
warn(LD_CONFIG, "Error reading from fingerprint file"); log_warn(LD_CONFIG, "Error reading from fingerprint file");
return -1; return -1;
} }
...@@ -188,35 +188,39 @@ dirserv_parse_fingerprint_file(const char *fname) ...@@ -188,35 +188,39 @@ dirserv_parse_fingerprint_file(const char *fname)
for (list=front; list; list=list->next) { for (list=front; list; list=list->next) {
nickname = list->key; fingerprint = list->value; nickname = list->key; fingerprint = list->value;
if (strlen(nickname) > MAX_NICKNAME_LEN) { if (strlen(nickname) > MAX_NICKNAME_LEN) {
notice(LD_CONFIG, log_notice(LD_CONFIG,
"Nickname '%s' too long in fingerprint file. Skipping.", nickname); "Nickname '%s' too long in fingerprint file. Skipping.",
nickname);
continue; continue;
} }
if (!is_legal_nickname(nickname) && if (!is_legal_nickname(nickname) &&
strcasecmp(nickname, "!reject") && strcasecmp(nickname, "!reject") &&
strcasecmp(nickname, "!invalid")) { strcasecmp(nickname, "!invalid")) {
notice(LD_CONFIG, log_notice(LD_CONFIG,
"Invalid nickname '%s' in fingerprint file. Skipping.", nickname); "Invalid nickname '%s' in fingerprint file. Skipping.",
nickname);
continue; continue;
} }
if (strlen(fingerprint) != FINGERPRINT_LEN || if (strlen(fingerprint) != FINGERPRINT_LEN ||
!crypto_pk_check_fingerprint_syntax(fingerprint)) { !crypto_pk_check_fingerprint_syntax(fingerprint)) {
notice(LD_CONFIG, log_notice(LD_CONFIG,
"Invalid fingerprint (nickname '%s', fingerprint %s). Skipping.", "Invalid fingerprint (nickname '%s', "
"fingerprint %s). Skipping.",
nickname, fingerprint); nickname, fingerprint);
continue; continue;
} }
if (0==strcasecmp(nickname, DEFAULT_CLIENT_NICKNAME)) { if (0==strcasecmp(nickname, DEFAULT_CLIENT_NICKNAME)) {
/* If you approved an OR called "client", then clients who use /* If you approved an OR called "client", then clients who use
* the default nickname could all be rejected. That's no good. */ * the default nickname could all be rejected. That's no good. */
notice(LD_CONFIG, log_notice(LD_CONFIG,
"Authorizing a nickname '%s' would break many clients; skipping.", "Authorizing a nickname '%s' would break "
"many clients; skipping.",
DEFAULT_CLIENT_NICKNAME); DEFAULT_CLIENT_NICKNAME);
continue; continue;
} }
if (add_fingerprint_to_dir(nickname, fingerprint, fingerprint_list_new) if (add_fingerprint_to_dir(nickname, fingerprint, fingerprint_list_new)
!= 0) != 0)
notice(LD_CONFIG, "Duplicate nickname '%s'.", nickname); log_notice(LD_CONFIG, "Duplicate nickname '%s'.", nickname);
} }
config_free_lines(front); config_free_lines(front);
...@@ -239,7 +243,7 @@ dirserv_router_get_status(const routerinfo_t *router, const char **msg) ...@@ -239,7 +243,7 @@ dirserv_router_get_status(const routerinfo_t *router, const char **msg)
char fingerprint[FINGERPRINT_LEN+1]; char fingerprint[FINGERPRINT_LEN+1];
if (crypto_pk_get_fingerprint(router->identity_pkey, fingerprint, 0)) { if (crypto_pk_get_fingerprint(router->identity_pkey, fingerprint, 0)) {
warn(LD_BUG,"Error computing fingerprint"); log_warn(LD_BUG,"Error computing fingerprint");
return -1; return -1;
} }
...@@ -288,7 +292,7 @@ dirserv_get_status_impl(const char *fp, const char *nickname, ...@@ -288,7 +292,7 @@ dirserv_get_status_impl(const char *fp, const char *nickname,
fingerprint_list = smartlist_create(); fingerprint_list = smartlist_create();
if (should_log) if (should_log)
debug(LD_DIRSERV, "%d fingerprints known.", log_debug(LD_DIRSERV, "%d fingerprints known.",
smartlist_len(fingerprint_list)); smartlist_len(fingerprint_list));
SMARTLIST_FOREACH(fingerprint_list, fingerprint_entry_t *, ent, SMARTLIST_FOREACH(fingerprint_list, fingerprint_entry_t *, ent,
{ {
...@@ -318,7 +322,7 @@ dirserv_get_status_impl(const char *fp, const char *nickname, ...@@ -318,7 +322,7 @@ dirserv_get_status_impl(const char *fp, const char *nickname,
if (rej == ADDR_POLICY_PROBABLY_REJECTED || rej == ADDR_POLICY_REJECTED) { if (rej == ADDR_POLICY_PROBABLY_REJECTED || rej == ADDR_POLICY_REJECTED) {
if (should_log) if (should_log)
info(LD_DIRSERV, "Rejecting '%s' because of address '%s'", log_info(LD_DIRSERV, "Rejecting '%s' because of address '%s'",
nickname, address); nickname, address);
if (msg) if (msg)
*msg = "Authdir is rejecting routers in this range."; *msg = "Authdir is rejecting routers in this range.";
...@@ -326,12 +330,12 @@ dirserv_get_status_impl(const char *fp, const char *nickname, ...@@ -326,12 +330,12 @@ dirserv_get_status_impl(const char *fp, const char *nickname,
} }
if (inv == ADDR_POLICY_PROBABLY_REJECTED || inv == ADDR_POLICY_REJECTED) { if (inv == ADDR_POLICY_PROBABLY_REJECTED || inv == ADDR_POLICY_REJECTED) {
if (should_log) if (should_log)
info(LD_DIRSERV, "Not marking '%s' valid because of address '%s'", log_info(LD_DIRSERV, "Not marking '%s' valid because of address '%s'",
nickname, address); nickname, address);
return FP_INVALID; return FP_INVALID;
} }
if (should_log) if (should_log)
debug(LD_DIRSERV,"No fingerprint found for '%s'",nickname); log_debug(LD_DIRSERV,"No fingerprint found for '%s'",nickname);
if (!platform || tor_version_as_new_as(platform,"0.1.0.2-rc")) if (!platform || tor_version_as_new_as(platform,"0.1.0.2-rc"))
return reject_unlisted ? FP_REJECT : FP_VALID; return reject_unlisted ? FP_REJECT : FP_VALID;
else else
...@@ -339,11 +343,11 @@ dirserv_get_status_impl(const char *fp, const char *nickname, ...@@ -339,11 +343,11 @@ dirserv_get_status_impl(const char *fp, const char *nickname,
} }
if (0==strcasecmp(nn_ent->fingerprint, fp)) { if (0==strcasecmp(nn_ent->fingerprint, fp)) {
if (should_log) if (should_log)
debug(LD_DIRSERV,"Good fingerprint for '%s'",nickname); log_debug(LD_DIRSERV,"Good fingerprint for '%s'",nickname);
return FP_NAMED; /* Right fingerprint. */ return FP_NAMED; /* Right fingerprint. */
} else { } else {
if (should_log) if (should_log)
warn(LD_DIRSERV, log_warn(LD_DIRSERV,
"Mismatched fingerprint for '%s': expected '%s' got '%s'. " "Mismatched fingerprint for '%s': expected '%s' got '%s'. "
"ContactInfo '%s', platform '%s'.)", "ContactInfo '%s', platform '%s'.)",
nickname, nn_ent->fingerprint, fp, nickname, nn_ent->fingerprint, fp,
...@@ -406,12 +410,12 @@ dirserv_router_has_valid_address(routerinfo_t *ri) ...@@ -406,12 +410,12 @@ dirserv_router_has_valid_address(routerinfo_t *ri)
if (get_options()->DirAllowPrivateAddresses) if (get_options()->DirAllowPrivateAddresses)
return 0; /* whatever it is, we're fine with it */ return 0; /* whatever it is, we're fine with it */
if (!tor_inet_aton(ri->address, &iaddr)) { if (!tor_inet_aton(ri->address, &iaddr)) {
info(LD_DIRSERV,"Router '%s' published non-IP address '%s'. Refusing.", log_info(LD_DIRSERV,"Router '%s' published non-IP address '%s'. Refusing.",
ri->nickname, ri->address); ri->nickname, ri->address);
return -1; return -1;
} }
if (is_internal_IP(ntohl(iaddr.s_addr), 0)) { if (is_internal_IP(ntohl(iaddr.s_addr), 0)) {
info(LD_DIRSERV, log_info(LD_DIRSERV,
"Router '%s' published internal IP address '%s'. Refusing.", "Router '%s' published internal IP address '%s'. Refusing.",
ri->nickname, ri->address); ri->nickname, ri->address);
return -1; /* it's a private IP, we should reject it */ return -1; /* it's a private IP, we should reject it */
...@@ -514,7 +518,7 @@ dirserv_add_descriptor(const char *desc, const char **msg) ...@@ -514,7 +518,7 @@ dirserv_add_descriptor(const char *desc, const char **msg)
/* Check: is the descriptor syntactically valid? */ /* Check: is the descriptor syntactically valid? */
ri = router_parse_entry_from_string(desc, NULL); ri = router_parse_entry_from_string(desc, NULL);
if (!ri) { if (!ri) {
warn(LD_DIRSERV, "Couldn't parse uploaded server descriptor"); log_warn(LD_DIRSERV, "Couldn't parse uploaded server descriptor");
*msg = "Rejected: Couldn't parse server descriptor."; *msg = "Rejected: Couldn't parse server descriptor.";
return -2; return -2;
} }
...@@ -526,7 +530,7 @@ dirserv_add_descriptor(const char *desc, const char **msg) ...@@ -526,7 +530,7 @@ dirserv_add_descriptor(const char *desc, const char **msg)
if (ri_old && ri_old->cache_info.published_on < ri->cache_info.published_on if (ri_old && ri_old->cache_info.published_on < ri->cache_info.published_on
&& router_differences_are_cosmetic(ri_old, ri) && router_differences_are_cosmetic(ri_old, ri)
&& !router_is_me(ri)) { && !router_is_me(ri)) {
info(LD_DIRSERV, log_info(LD_DIRSERV,
"Not replacing descriptor from '%s'; differences are cosmetic.", "Not replacing descriptor from '%s'; differences are cosmetic.",
ri->nickname); ri->nickname);
*msg = "Not replacing router descriptor; no information has changed since " *msg = "Not replacing router descriptor; no information has changed since "
...@@ -572,14 +576,14 @@ directory_remove_invalid(void) ...@@ -572,14 +576,14 @@ directory_remove_invalid(void)
router_status_t r = dirserv_router_get_status(ent, &msg); router_status_t r = dirserv_router_get_status(ent, &msg);
switch (r) { switch (r) {
case FP_REJECT: case FP_REJECT:
info(LD_DIRSERV, "Router '%s' is now rejected: %s", log_info(LD_DIRSERV, "Router '%s' is now rejected: %s",
ent->nickname, msg?msg:""); ent->nickname, msg?msg:"");
routerlist_remove(rl, ent, i--, 0); routerlist_remove(rl, ent, i--, 0);
changed = 1; changed = 1;
break; break;
case FP_NAMED: case FP_NAMED:
if (!ent->is_verified || !ent->is_named) { if (!ent->is_verified || !ent->is_named) {
info(LD_DIRSERV, log_info(LD_DIRSERV,
"Router '%s' is now verified and named.", ent->nickname); "Router '%s' is now verified and named.", ent->nickname);
ent->is_verified = ent->is_named = 1; ent->is_verified = ent->is_named = 1;
changed = 1; changed = 1;
...@@ -587,7 +591,7 @@ directory_remove_invalid(void) ...@@ -587,7 +591,7 @@ directory_remove_invalid(void)
break; break;
case FP_VALID: case FP_VALID:
if (!ent->is_verified || ent->is_named) { if (!ent->is_verified || ent->is_named) {
info(LD_DIRSERV, "Router '%s' is now verified.", ent->nickname); log_info(LD_DIRSERV, "Router '%s' is now verified.", ent->nickname);
ent->is_verified = 1; ent->is_verified = 1;
ent->is_named = 0; ent->is_named = 0;
changed = 1; changed = 1;
...@@ -595,7 +599,7 @@ directory_remove_invalid(void) ...@@ -595,7 +599,7 @@ directory_remove_invalid(void)
break; break;
case FP_INVALID: case FP_INVALID:
if (ent->is_verified || ent->is_named) { if (ent->is_verified || ent->is_named) {
info(LD_DIRSERV, log_info(LD_DIRSERV,
"Router '%s' is no longer verified.", ent->nickname); "Router '%s' is no longer verified.", ent->nickname);
ent->is_verified = ent->is_named = 0; ent->is_verified = ent->is_named = 0;
changed = 1; changed = 1;
...@@ -812,7 +816,7 @@ dirserv_dump_directory_to_string(char **dir_out, ...@@ -812,7 +816,7 @@ dirserv_dump_directory_to_string(char **dir_out,
if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey, if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey,
&identity_pkey_len)<0) { &identity_pkey_len)<0) {
warn(LD_BUG,"write identity_pkey to string failed!"); log_warn(LD_BUG,"write identity_pkey to string failed!");
return -1; return -1;
} }
...@@ -870,7 +874,7 @@ dirserv_dump_directory_to_string(char **dir_out, ...@@ -870,7 +874,7 @@ dirserv_dump_directory_to_string(char **dir_out,
goto truncated; goto truncated;
if (router_get_dir_hash(buf,digest)) { if (router_get_dir_hash(buf,digest)) {
warn(LD_BUG,"couldn't compute digest"); log_warn(LD_BUG,"couldn't compute digest");
tor_free(buf); tor_free(buf);
return -1; return -1;
} }
...@@ -882,7 +886,7 @@ dirserv_dump_directory_to_string(char **dir_out, ...@@ -882,7 +886,7 @@ dirserv_dump_directory_to_string(char **dir_out,
*dir_out = buf; *dir_out = buf;
return 0; return 0;
truncated: truncated:
warn(LD_BUG,"tried to exceed string length."); log_warn(LD_BUG,"tried to exceed string length.");
tor_free(buf); tor_free(buf);
return -1; return -1;
} }
...@@ -910,21 +914,21 @@ set_cached_dir(cached_dir_t *d, char *directory, time_t when) ...@@ -910,21 +914,21 @@ set_cached_dir(cached_dir_t *d, char *directory, time_t when)
{ {
time_t now = time(NULL); time_t now = time(NULL);
if (when<=d->published) { if (when<=d->published) {
info(LD_DIRSERV, "Ignoring old directory; not caching."); log_info(LD_DIRSERV, "Ignoring old directory; not caching.");
tor_free(directory); tor_free(directory);
} else if (when>=now+ROUTER_MAX_AGE) { } else if (when>=now+ROUTER_MAX_AGE) {
info(LD_DIRSERV, "Ignoring future directory; not caching."); log_info(LD_DIRSERV, "Ignoring future directory; not caching.");
tor_free(directory); tor_free(directory);
} else { } else {
/* if (when>d->published && when<now+ROUTER_MAX_AGE) */ /* if (when>d->published && when<now+ROUTER_MAX_AGE) */
debug(LD_DIRSERV, "Caching directory."); log_debug(LD_DIRSERV, "Caching directory.");
tor_free(d->dir); tor_free(d->dir);
d->dir = directory; d->dir = directory;
d->dir_len = strlen(directory); d->dir_len = strlen(directory);
tor_free(d->dir_z); tor_free(d->dir_z);
if (tor_gzip_compress(&(d->dir_z), &(d->dir_z_len), d->dir, d->dir_len, if (tor_gzip_compress(&(d->dir_z), &(d->dir_z_len), d->dir, d->dir_len,
ZLIB_METHOD)) { ZLIB_METHOD)) {
warn(LD_BUG,"Error compressing cached directory"); log_warn(LD_BUG,"Error compressing cached directory");
} }
d->published = when; d->published = when;
} }
...@@ -1043,11 +1047,11 @@ dirserv_pick_cached_dir_obj(cached_dir_t *cache_src, ...@@ -1043,11 +1047,11 @@ dirserv_pick_cached_dir_obj(cached_dir_t *cache_src,
if (regenerate != NULL) { if (regenerate != NULL) {
if (dirty && dirty + DIR_REGEN_SLACK_TIME < time(NULL)) { if (dirty && dirty + DIR_REGEN_SLACK_TIME < time(NULL)) {
if (regenerate()) { if (regenerate()) {
err(LD_BUG, "Couldn't generate %s?", name); log_err(LD_BUG, "Couldn't generate %s?", name);
exit(1); exit(1);
} }
} else { } else {
info(LD_DIRSERV, "The %s is still clean; reusing.", name); log_info(LD_DIRSERV, "The %s is still clean; reusing.", name);
} }
} }
return auth_src ? auth_src : cache_src; return auth_src ? auth_src : cache_src;
...@@ -1111,15 +1115,15 @@ dirserv_regenerate_directory(void) ...@@ -1111,15 +1115,15 @@ dirserv_regenerate_directory(void)
if (dirserv_dump_directory_to_string(&new_directory, if (dirserv_dump_directory_to_string(&new_directory,
get_identity_key())) { get_identity_key())) {
warn(LD_BUG, "Error creating directory."); log_warn(LD_BUG, "Error creating directory.");
tor_free(new_directory); tor_free(new_directory);
return -1; return -1;
} }
set_cached_dir(&the_directory, new_directory, time(NULL)); set_cached_dir(&the_directory, new_directory, time(NULL));
info(LD_DIRSERV,"New directory (size %d) has been built.", log_info(LD_DIRSERV,"New directory (size %d) has been built.",
(int)the_directory.dir_len); (int)the_directory.dir_len);
debug(LD_DIRSERV,"New directory (size %d):\n%s",(int)the_directory.dir_len, log_debug(LD_DIRSERV,"New directory (size %d):\n%s",
the_directory.dir); (int)the_directory.dir_len, the_directory.dir);
the_directory_is_dirty = 0; the_directory_is_dirty = 0;
...@@ -1152,7 +1156,7 @@ generate_runningrouters(void) ...@@ -1152,7 +1156,7 @@ generate_runningrouters(void)
} }
if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey, if (crypto_pk_write_public_key_to_string(private_key,&identity_pkey,
&identity_pkey_len)<0) { &identity_pkey_len)<0) {
warn(LD_BUG,"write identity_pkey to string failed!"); log_warn(LD_BUG,"write identity_pkey to string failed!");
goto err; goto err;
} }
format_iso_time(published, time(NULL)); format_iso_time(published, time(NULL));
...@@ -1170,7 +1174,7 @@ generate_runningrouters(void) ...@@ -1170,7 +1174,7 @@ generate_runningrouters(void)
tor_free(router_status); tor_free(router_status);
tor_free(identity_pkey); tor_free(identity_pkey);
if (router_get_runningrouters_hash(s,digest)) { if (router_get_runningrouters_hash(s,digest)) {
warn(LD_BUG,"couldn't compute digest"); log_warn(LD_BUG,"couldn't compute digest");
goto err; goto err;
} }
if (router_append_dirobj_signature(s, len, digest, private_key)<0) if (router_append_dirobj_signature(s, len, digest, private_key)<0)
...@@ -1286,7 +1290,7 @@ dirserv_compute_stable_uptime(routerlist_t *rl) ...@@ -1286,7 +1290,7 @@ dirserv_compute_stable_uptime(routerlist_t *rl)
stable_uptime = *(long *)smartlist_get(uptimes, stable_uptime = *(long *)smartlist_get(uptimes,
smartlist_len(uptimes)/2); smartlist_len(uptimes)/2);
info(LD_DIRSERV, "Uptime cutoff is %ld seconds.", stable_uptime); log_info(LD_DIRSERV, "Uptime cutoff is %ld seconds.", stable_uptime);
SMARTLIST_FOREACH(uptimes, long *, up, tor_free(up)); SMARTLIST_FOREACH(uptimes, long *, up, tor_free(up));
smartlist_free(uptimes); smartlist_free(uptimes);
...@@ -1328,7 +1332,7 @@ generate_v2_networkstatus(void) ...@@ -1328,7 +1332,7 @@ generate_v2_networkstatus(void)
const char *contact; const char *contact;
if (resolve_my_address(options, &addr, &hostname)<0) { if (resolve_my_address(options, &addr, &hostname)<0) {
warn(LD_NET, "Couldn't resolve my hostname"); log_warn(LD_NET, "Couldn't resolve my hostname");
goto done; goto done;
} }
in.s_addr = htonl(addr); in.s_addr = htonl(addr);
...@@ -1341,12 +1345,12 @@ generate_v2_networkstatus(void) ...@@ -1341,12 +1345,12 @@ generate_v2_networkstatus(void)
if (crypto_pk_write_public_key_to_string(private_key, &identity_pkey, if (crypto_pk_write_public_key_to_string(private_key, &identity_pkey,
&identity_pkey_len)<0) { &identity_pkey_len)<0) {
warn(LD_BUG,"Writing public key to string failed."); log_warn(LD_BUG,"Writing public key to string failed.");
goto done; goto done;
} }
if (crypto_pk_get_fingerprint(private_key, fingerprint, 0)<0) { if (crypto_pk_get_fingerprint(private_key, fingerprint, 0)<0) {
err(LD_BUG, "Error computing fingerprint"); log_err(LD_BUG, "Error computing fingerprint");
goto done; goto done;
} }
...@@ -1436,7 +1440,7 @@ generate_v2_networkstatus(void) ...@@ -1436,7 +1440,7 @@ generate_v2_networkstatus(void)
f_running?" Running":"", f_running?" Running":"",
f_valid?" Valid":"", f_valid?" Valid":"",
f_v2_dir?" V2Dir":"")<0) { f_v2_dir?" V2Dir":"")<0) {
warn(LD_BUG, "Unable to print router status."); log_warn(LD_BUG, "Unable to print router status.");
goto done; goto done;
} }
outp += strlen(outp); outp += strlen(outp);
...@@ -1445,17 +1449,17 @@ generate_v2_networkstatus(void) ...@@ -1445,17 +1449,17 @@ generate_v2_networkstatus(void)
if (tor_snprintf(outp, endp-outp, "directory-signature %s\n", if (tor_snprintf(outp, endp-outp, "directory-signature %s\n",
get_options()->Nickname)<0) { get_options()->Nickname)<0) {
warn(LD_BUG, "Unable to write signature line."); log_warn(LD_BUG, "Unable to write signature line.");
goto done; goto done;
} }
if (router_get_networkstatus_v2_hash(status, digest)<0) { if (router_get_networkstatus_v2_hash(status, digest)<0) {
warn(LD_BUG, "Unable to hash network status"); log_warn(LD_BUG, "Unable to hash network status");
goto done; goto done;
} }
if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0) { if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0) {
warn(LD_BUG, "Unable to sign router status."); log_warn(LD_BUG, "Unable to sign router status.");
goto done; goto done;
} }
...@@ -1503,7 +1507,8 @@ dirserv_get_networkstatus_v2(smartlist_t *result, ...@@ -1503,7 +1507,8 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
if (d) if (d)
smartlist_add(result, d); smartlist_add(result, d);
else else
warn(LD_BUG,"Unable to generate an authoritative network status."); log_warn(LD_BUG,
"Unable to generate an authoritative network status.");
} }
} else if (!strcmp(key, "all")) { } else if (!strcmp(key, "all")) {
digestmap_iter_t *iter; digestmap_iter_t *iter;
...@@ -1518,7 +1523,7 @@ dirserv_get_networkstatus_v2(smartlist_t *result, ...@@ -1518,7 +1523,7 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
iter = digestmap_iter_next(cached_v2_networkstatus, iter); iter = digestmap_iter_next(cached_v2_networkstatus, iter);
} }
if (smartlist_len(result) == 0) if (smartlist_len(result) == 0)
warn(LD_DIRSERV, log_warn(LD_DIRSERV,
"Client requested 'all' network status objects; we have none."); "Client requested 'all' network status objects; we have none.");
} else if (!strcmpstart(key, "fp/")) { } else if (!strcmpstart(key, "fp/")) {
smartlist_t *digests = smartlist_create(); smartlist_t *digests = smartlist_create();
...@@ -1534,7 +1539,7 @@ dirserv_get_networkstatus_v2(smartlist_t *result, ...@@ -1534,7 +1539,7 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
} else { } else {
char hexbuf[HEX_DIGEST_LEN+1]; char hexbuf[HEX_DIGEST_LEN+1];
base16_encode(hexbuf, sizeof(hexbuf), cp, DIGEST_LEN); base16_encode(hexbuf, sizeof(hexbuf), cp, DIGEST_LEN);
info(LD_DIRSERV, "Don't know about any network status with " log_info(LD_DIRSERV, "Don't know about any network status with "
"fingerprint '%s'", hexbuf); "fingerprint '%s'", hexbuf);
} }
tor_free(cp); tor_free(cp);
...@@ -1651,13 +1656,15 @@ dirserv_orconn_tls_done(const char *address, ...@@ -1651,13 +1656,15 @@ dirserv_orconn_tls_done(const char *address,
if (!ri->is_verified) { if (!ri->is_verified) {
/* We have a router at the same address! */ /* We have a router at the same address! */
if (strcasecmp(ri->nickname, nickname_rcvd)) { if (strcasecmp(ri->nickname, nickname_rcvd)) {
notice(LD_DIRSERV, "Dropping descriptor: nickname '%s' does not match " log_notice(LD_DIRSERV,
"Dropping descriptor: nickname '%s' does not match "
"nickname '%s' in cert from %s:%d", "nickname '%s' in cert from %s:%d",
ri->nickname, nickname_rcvd, address, or_port); ri->nickname, nickname_rcvd, address, or_port);
drop = 1; drop = 1;
} else if (memcmp(ri->cache_info.identity_digest, digest_rcvd, } else if (memcmp(ri->cache_info.identity_digest, digest_rcvd,
DIGEST_LEN)) { DIGEST_LEN)) {
notice(LD_DIRSERV, "Dropping descriptor: identity key does not match " log_notice(LD_DIRSERV,
"Dropping descriptor: identity key does not match "
"key in cert from %s:%d", "key in cert from %s:%d",
address, or_port); address, or_port);
drop = 1; drop = 1;
...@@ -1667,7 +1674,8 @@ dirserv_orconn_tls_done(const char *address, ...@@ -1667,7 +1674,8 @@ dirserv_orconn_tls_done(const char *address,
routerlist_remove(rl, ri, i--, 0); routerlist_remove(rl, ri, i--, 0);
directory_set_dirty(); directory_set_dirty();
} else { /* correct nickname and digest. mark this router reachable! */ } else { /* correct nickname and digest. mark this router reachable! */
info(LD_DIRSERV,"Found router %s to be reachable. Yay.", ri->nickname); log_info(LD_DIRSERV, "Found router %s to be reachable. Yay.",
ri->nickname);
ri->last_reachable = time(NULL); ri->last_reachable = time(NULL);
ri->num_unreachable_notifications = 0; ri->num_unreachable_notifications = 0;
} }
......
...@@ -160,15 +160,18 @@ purge_expired_resolves(uint32_t now) ...@@ -160,15 +160,18 @@ purge_expired_resolves(uint32_t now)
*/ */
while (oldest_cached_resolve && (oldest_cached_resolve->expire < now)) {