mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Don't crash when accountingmax is set in non-server Tors
We use a hash of the identity key to seed a prng to tell when an accounting period should end. But thanks to the bug998 changes, clients no longer have server-identity keys to use as a long-term seed in accounting calculations. In any case, their identity keys (as used in TLS) were never never fixed. So we can just set the wakeup time from a random seed instead there. Still open is whether everybody should be random. This patch fixes bug 2235, which was introduced in 0.2.2.18-alpha. Diagnosed with help from boboper on irc.
This commit is contained in:
parent
ee8f451bf1
commit
c0f1517d87
3
changes/bug2235
Normal file
3
changes/bug2235
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor bugfixes
|
||||||
|
- Avoid crashes when AccountingMax is set on clients. Fixes bug 2235;
|
||||||
|
Bugfix on 0.2.2.18-alpha. Diagnosed by boboper.
|
@ -529,7 +529,9 @@ accounting_set_wakeup_time(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (server_identity_key_is_set()) {
|
||||||
format_iso_time(buf, interval_start_time);
|
format_iso_time(buf, interval_start_time);
|
||||||
|
|
||||||
crypto_pk_get_digest(get_server_identity_key(), digest);
|
crypto_pk_get_digest(get_server_identity_key(), digest);
|
||||||
|
|
||||||
d_env = crypto_new_digest_env();
|
d_env = crypto_new_digest_env();
|
||||||
@ -537,6 +539,9 @@ accounting_set_wakeup_time(void)
|
|||||||
crypto_digest_add_bytes(d_env, digest, DIGEST_LEN);
|
crypto_digest_add_bytes(d_env, digest, DIGEST_LEN);
|
||||||
crypto_digest_get_digest(d_env, digest, DIGEST_LEN);
|
crypto_digest_get_digest(d_env, digest, DIGEST_LEN);
|
||||||
crypto_free_digest_env(d_env);
|
crypto_free_digest_env(d_env);
|
||||||
|
} else {
|
||||||
|
crypto_rand(digest, DIGEST_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
if (!expected_bandwidth_usage) {
|
if (!expected_bandwidth_usage) {
|
||||||
char buf1[ISO_TIME_LEN+1];
|
char buf1[ISO_TIME_LEN+1];
|
||||||
|
Loading…
Reference in New Issue
Block a user