mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Check that fmt_addr32() returned non-empty string before putting it into documents
This commit is contained in:
parent
d8e24684b6
commit
8ab7e30484
@ -322,43 +322,47 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key,
|
|||||||
tor_free(digest_algo_b64_digest_bw_file);
|
tor_free(digest_algo_b64_digest_bw_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
smartlist_add_asprintf(chunks,
|
const char *ip_str = fmt_addr32(addr);
|
||||||
"network-status-version 3\n"
|
|
||||||
"vote-status %s\n"
|
if (ip_str[0]) {
|
||||||
"consensus-methods %s\n"
|
smartlist_add_asprintf(chunks,
|
||||||
"published %s\n"
|
"network-status-version 3\n"
|
||||||
"valid-after %s\n"
|
"vote-status %s\n"
|
||||||
"fresh-until %s\n"
|
"consensus-methods %s\n"
|
||||||
"valid-until %s\n"
|
"published %s\n"
|
||||||
"voting-delay %d %d\n"
|
"valid-after %s\n"
|
||||||
"%s%s" /* versions */
|
"fresh-until %s\n"
|
||||||
"%s" /* protocols */
|
"valid-until %s\n"
|
||||||
"known-flags %s\n"
|
"voting-delay %d %d\n"
|
||||||
"flag-thresholds %s\n"
|
"%s%s" /* versions */
|
||||||
"params %s\n"
|
"%s" /* protocols */
|
||||||
"%s" /* bandwidth file headers */
|
"known-flags %s\n"
|
||||||
"%s" /* bandwidth file digest */
|
"flag-thresholds %s\n"
|
||||||
"dir-source %s %s %s %s %d %d\n"
|
"params %s\n"
|
||||||
"contact %s\n"
|
"%s" /* bandwidth file headers */
|
||||||
"%s" /* shared randomness information */
|
"%s" /* bandwidth file digest */
|
||||||
,
|
"dir-source %s %s %s %s %d %d\n"
|
||||||
v3_ns->type == NS_TYPE_VOTE ? "vote" : "opinion",
|
"contact %s\n"
|
||||||
methods,
|
"%s" /* shared randomness information */
|
||||||
published, va, fu, vu,
|
,
|
||||||
v3_ns->vote_seconds, v3_ns->dist_seconds,
|
v3_ns->type == NS_TYPE_VOTE ? "vote" : "opinion",
|
||||||
client_versions_line,
|
methods,
|
||||||
server_versions_line,
|
published, va, fu, vu,
|
||||||
protocols_lines,
|
v3_ns->vote_seconds, v3_ns->dist_seconds,
|
||||||
flags,
|
client_versions_line,
|
||||||
flag_thresholds,
|
server_versions_line,
|
||||||
params,
|
protocols_lines,
|
||||||
bw_headers_line ? bw_headers_line : "",
|
flags,
|
||||||
bw_file_digest ? bw_file_digest: "",
|
flag_thresholds,
|
||||||
voter->nickname, fingerprint, voter->address,
|
params,
|
||||||
fmt_addr32(addr), voter->dir_port, voter->or_port,
|
bw_headers_line ? bw_headers_line : "",
|
||||||
voter->contact,
|
bw_file_digest ? bw_file_digest: "",
|
||||||
shared_random_vote_str ?
|
voter->nickname, fingerprint, voter->address,
|
||||||
shared_random_vote_str : "");
|
ip_str, voter->dir_port, voter->or_port,
|
||||||
|
voter->contact,
|
||||||
|
shared_random_vote_str ?
|
||||||
|
shared_random_vote_str : "");
|
||||||
|
}
|
||||||
|
|
||||||
tor_free(params);
|
tor_free(params);
|
||||||
tor_free(flags);
|
tor_free(flags);
|
||||||
|
@ -53,20 +53,23 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
|
|||||||
char digest64[BASE64_DIGEST_LEN+1];
|
char digest64[BASE64_DIGEST_LEN+1];
|
||||||
smartlist_t *chunks = smartlist_new();
|
smartlist_t *chunks = smartlist_new();
|
||||||
|
|
||||||
|
const char *ip_str = fmt_addr32(rs->addr);
|
||||||
|
|
||||||
format_iso_time(published, rs->published_on);
|
format_iso_time(published, rs->published_on);
|
||||||
digest_to_base64(identity64, rs->identity_digest);
|
digest_to_base64(identity64, rs->identity_digest);
|
||||||
digest_to_base64(digest64, rs->descriptor_digest);
|
digest_to_base64(digest64, rs->descriptor_digest);
|
||||||
|
|
||||||
smartlist_add_asprintf(chunks,
|
if (ip_str[0])
|
||||||
"r %s %s %s%s%s %s %d %d\n",
|
smartlist_add_asprintf(chunks,
|
||||||
rs->nickname,
|
"r %s %s %s%s%s %s %d %d\n",
|
||||||
identity64,
|
rs->nickname,
|
||||||
(format==NS_V3_CONSENSUS_MICRODESC)?"":digest64,
|
identity64,
|
||||||
(format==NS_V3_CONSENSUS_MICRODESC)?"":" ",
|
(format==NS_V3_CONSENSUS_MICRODESC)?"":digest64,
|
||||||
published,
|
(format==NS_V3_CONSENSUS_MICRODESC)?"":" ",
|
||||||
fmt_addr32(rs->addr),
|
published,
|
||||||
(int)rs->or_port,
|
ip_str,
|
||||||
(int)rs->dir_port);
|
(int)rs->or_port,
|
||||||
|
(int)rs->dir_port);
|
||||||
|
|
||||||
/* TODO: Maybe we want to pass in what we need to build the rest of
|
/* TODO: Maybe we want to pass in what we need to build the rest of
|
||||||
* this here, instead of in the caller. Then we could use the
|
* this here, instead of in the caller. Then we could use the
|
||||||
|
Loading…
Reference in New Issue
Block a user