From 8e961b2174f6714fdff295f032abe993f864b81b Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 30 Mar 2019 12:09:47 +1000 Subject: [PATCH] bwauth: Actually include the bandwidth-file-digest in authority votes Fixes bug 29959; bugfix on 0.4.0.2-alpha. --- changes/bug29959-040 | 3 +++ src/feature/dirauth/dirvote.c | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 changes/bug29959-040 diff --git a/changes/bug29959-040 b/changes/bug29959-040 new file mode 100644 index 0000000000..3740e0169a --- /dev/null +++ b/changes/bug29959-040 @@ -0,0 +1,3 @@ + o Minor bugfixes (directory authorities): + - Actually include the bandwidth-file-digest line in directory authority + votes. Fixes bug 29959; bugfix on 0.4.0.2-alpha. diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c index ba7b2f1de6..29f5d04509 100644 --- a/src/feature/dirauth/dirvote.c +++ b/src/feature/dirauth/dirvote.c @@ -320,18 +320,17 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key, if (!tor_digest256_is_zero((const char *)v3_ns->bw_file_digest256)) { /* Encode the digest. */ char b64_digest_bw_file[BASE64_DIGEST256_LEN+1] = {0}; - if (digest256_to_base64(b64_digest_bw_file, - (const char *)v3_ns->bw_file_digest256)>0) { - /* "bandwidth-file-digest" 1*(SP algorithm "=" digest) NL */ - char *digest_algo_b64_digest_bw_file = NULL; - tor_asprintf(&digest_algo_b64_digest_bw_file, "%s=%s", - crypto_digest_algorithm_get_name(DIGEST_ALG_BW_FILE), - b64_digest_bw_file); - /* No need for tor_strdup(""), format_line_if_present does it. */ - bw_file_digest = format_line_if_present( + digest256_to_base64(b64_digest_bw_file, + (const char *)v3_ns->bw_file_digest256); + /* "bandwidth-file-digest" 1*(SP algorithm "=" digest) NL */ + char *digest_algo_b64_digest_bw_file = NULL; + tor_asprintf(&digest_algo_b64_digest_bw_file, "%s=%s", + crypto_digest_algorithm_get_name(DIGEST_ALG_BW_FILE), + b64_digest_bw_file); + /* No need for tor_strdup(""), format_line_if_present does it. */ + bw_file_digest = format_line_if_present( "bandwidth-file-digest", digest_algo_b64_digest_bw_file); - tor_free(digest_algo_b64_digest_bw_file); - } + tor_free(digest_algo_b64_digest_bw_file); } smartlist_add_asprintf(chunks,