mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Never emit the "opt" prefix in any directory stuff
Fix for bug 5124.
This commit is contained in:
parent
1e008e9876
commit
e13e9c40c8
4
changes/bug5124
Normal file
4
changes/bug5124
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Removed code:
|
||||||
|
- No longer include the "opt" prefix when generating routerinfos
|
||||||
|
or v2 directories: it has been needless since Tor 0.1.2. Closes
|
||||||
|
ticket 5124.
|
@ -2114,7 +2114,7 @@ routerstatus_format_entry(char *buf, size_t buf_len,
|
|||||||
/* length of "opt v \n" */
|
/* length of "opt v \n" */
|
||||||
#define V_LINE_OVERHEAD 7
|
#define V_LINE_OVERHEAD 7
|
||||||
if (version && strlen(version) < MAX_V_LINE_LEN - V_LINE_OVERHEAD) {
|
if (version && strlen(version) < MAX_V_LINE_LEN - V_LINE_OVERHEAD) {
|
||||||
if (tor_snprintf(cp, buf_len - (cp-buf), "opt v %s\n", version)<0) {
|
if (tor_snprintf(cp, buf_len - (cp-buf), "v %s\n", version)<0) {
|
||||||
log_warn(LD_BUG, "Unable to print router version.");
|
log_warn(LD_BUG, "Unable to print router version.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1006,8 +1006,7 @@ policy_write_item(char *buf, size_t buflen, addr_policy_t *policy,
|
|||||||
else
|
else
|
||||||
addrpart = addrbuf;
|
addrpart = addrbuf;
|
||||||
|
|
||||||
result = tor_snprintf(buf, buflen, "%s%s%s %s",
|
result = tor_snprintf(buf, buflen, "%s%s %s",
|
||||||
(is_ip6&&format_for_desc)?"opt ":"",
|
|
||||||
is_accept ? "accept" : "reject",
|
is_accept ? "accept" : "reject",
|
||||||
(is_ip6&&format_for_desc)?"6":"",
|
(is_ip6&&format_for_desc)?"6":"",
|
||||||
addrpart);
|
addrpart);
|
||||||
|
@ -1531,7 +1531,7 @@ rep_hist_get_bandwidth_lines(void)
|
|||||||
const char *desc = NULL;
|
const char *desc = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
/* opt [dirreq-](read|write)-history yyyy-mm-dd HH:MM:SS (n s) n,n,n... */
|
/* [dirreq-](read|write)-history yyyy-mm-dd HH:MM:SS (n s) n,n,n... */
|
||||||
/* The n,n,n part above. Largest representation of a uint64_t is 20 chars
|
/* The n,n,n part above. Largest representation of a uint64_t is 20 chars
|
||||||
* long, plus the comma. */
|
* long, plus the comma. */
|
||||||
#define MAX_HIST_VALUE_LEN 21*NUM_TOTALS
|
#define MAX_HIST_VALUE_LEN 21*NUM_TOTALS
|
||||||
|
@ -2053,9 +2053,9 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
|
|||||||
"router %s %s %d 0 %d\n"
|
"router %s %s %d 0 %d\n"
|
||||||
"%s"
|
"%s"
|
||||||
"platform %s\n"
|
"platform %s\n"
|
||||||
"opt protocols Link 1 2 Circuit 1\n"
|
"protocols Link 1 2 Circuit 1\n"
|
||||||
"published %s\n"
|
"published %s\n"
|
||||||
"opt fingerprint %s\n"
|
"fingerprint %s\n"
|
||||||
"uptime %ld\n"
|
"uptime %ld\n"
|
||||||
"bandwidth %d %d %d\n"
|
"bandwidth %d %d %d\n"
|
||||||
"%s%s%s%s"
|
"%s%s%s%s"
|
||||||
@ -2074,15 +2074,15 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
|
|||||||
(int) router->bandwidthrate,
|
(int) router->bandwidthrate,
|
||||||
(int) router->bandwidthburst,
|
(int) router->bandwidthburst,
|
||||||
(int) router->bandwidthcapacity,
|
(int) router->bandwidthcapacity,
|
||||||
has_extra_info_digest ? "opt extra-info-digest " : "",
|
has_extra_info_digest ? "extra-info-digest " : "",
|
||||||
has_extra_info_digest ? extra_info_digest : "",
|
has_extra_info_digest ? extra_info_digest : "",
|
||||||
has_extra_info_digest ? "\n" : "",
|
has_extra_info_digest ? "\n" : "",
|
||||||
options->DownloadExtraInfo ? "opt caches-extra-info\n" : "",
|
options->DownloadExtraInfo ? "caches-extra-info\n" : "",
|
||||||
onion_pkey, identity_pkey,
|
onion_pkey, identity_pkey,
|
||||||
family_line,
|
family_line,
|
||||||
we_are_hibernating() ? "opt hibernating 1\n" : "",
|
we_are_hibernating() ? "hibernating 1\n" : "",
|
||||||
options->HidServDirectoryV2 ? "opt hidden-service-dir\n" : "",
|
options->HidServDirectoryV2 ? "hidden-service-dir\n" : "",
|
||||||
options->AllowSingleHopExits ? "opt allow-single-hop-exits\n" : "");
|
options->AllowSingleHopExits ? "allow-single-hop-exits\n" : "");
|
||||||
|
|
||||||
tor_free(family_line);
|
tor_free(family_line);
|
||||||
tor_free(onion_pkey);
|
tor_free(onion_pkey);
|
||||||
|
@ -147,9 +147,9 @@ test_dir_formats(void)
|
|||||||
"platform Tor "VERSION" on ", sizeof(buf2));
|
"platform Tor "VERSION" on ", sizeof(buf2));
|
||||||
strlcat(buf2, get_uname(), sizeof(buf2));
|
strlcat(buf2, get_uname(), sizeof(buf2));
|
||||||
strlcat(buf2, "\n"
|
strlcat(buf2, "\n"
|
||||||
"opt protocols Link 1 2 Circuit 1\n"
|
"protocols Link 1 2 Circuit 1\n"
|
||||||
"published 1970-01-01 00:00:00\n"
|
"published 1970-01-01 00:00:00\n"
|
||||||
"opt fingerprint ", sizeof(buf2));
|
"fingerprint ", sizeof(buf2));
|
||||||
test_assert(!crypto_pk_get_fingerprint(pk2, fingerprint, 1));
|
test_assert(!crypto_pk_get_fingerprint(pk2, fingerprint, 1));
|
||||||
strlcat(buf2, fingerprint, sizeof(buf2));
|
strlcat(buf2, fingerprint, sizeof(buf2));
|
||||||
strlcat(buf2, "\nuptime 0\n"
|
strlcat(buf2, "\nuptime 0\n"
|
||||||
@ -161,7 +161,7 @@ test_dir_formats(void)
|
|||||||
strlcat(buf2, pk1_str, sizeof(buf2));
|
strlcat(buf2, pk1_str, sizeof(buf2));
|
||||||
strlcat(buf2, "signing-key\n", sizeof(buf2));
|
strlcat(buf2, "signing-key\n", sizeof(buf2));
|
||||||
strlcat(buf2, pk2_str, sizeof(buf2));
|
strlcat(buf2, pk2_str, sizeof(buf2));
|
||||||
strlcat(buf2, "opt hidden-service-dir\n", sizeof(buf2));
|
strlcat(buf2, "hidden-service-dir\n", sizeof(buf2));
|
||||||
strlcat(buf2, "reject *:*\nrouter-signature\n", sizeof(buf2));
|
strlcat(buf2, "reject *:*\nrouter-signature\n", sizeof(buf2));
|
||||||
buf[strlen(buf2)] = '\0'; /* Don't compare the sig; it's never the same
|
buf[strlen(buf2)] = '\0'; /* Don't compare the sig; it's never the same
|
||||||
* twice */
|
* twice */
|
||||||
|
Loading…
Reference in New Issue
Block a user