diff options
author | juga <juga@riseup.net> | 2023-11-18 17:45:28 +0000 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2023-11-21 10:43:36 -0500 |
commit | d8aa69925380acf165335917bb87becb2f659875 (patch) | |
tree | 291e1bd031c60a43ecce240c528da149f8469ffc /src/feature | |
parent | 8bb7d681ae5898232a42b066784f578a594de41a (diff) | |
download | tor-d8aa69925380acf165335917bb87becb2f659875.tar.gz tor-d8aa69925380acf165335917bb87becb2f659875.zip |
bwauth: Allow "node_id" KeyValue without "$"
Allow "node_id" KeyValue without the dollar sign at the start of the
hexdigit in the BandwidthFiles, in order to easier database queries
combining Tor documents in which the relays fingerprint doesn't
include it.
Bugfix on all supported versions of Tor.
Closes #40891
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/dirauth/bwauth.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/feature/dirauth/bwauth.c b/src/feature/dirauth/bwauth.c index 90b425842a..b5b1081e47 100644 --- a/src/feature/dirauth/bwauth.c +++ b/src/feature/dirauth/bwauth.c @@ -434,15 +434,19 @@ measured_bw_line_parse(measured_bw_line_t *out, const char *orig_line, return -1; } got_bw=1; - } else if (strcmpstart(cp, "node_id=$") == 0) { + // Allow node_id to start with or without the dollar sign. + } else if (strcmpstart(cp, "node_id=") == 0) { if (got_node_id) { log_warn(LD_DIRSERV, "Double node_id= in bandwidth file line: %s", escaped(orig_line)); tor_free(line); return -1; } - cp+=strlen("node_id=$"); - + if (strcmpstart(cp, "node_id=$") == 0) { + cp+=strlen("node_id=$"); + } else if (strcmpstart(cp, "node_id=") == 0) { + cp+=strlen("node_id="); + } if (strlen(cp) != HEX_DIGEST_LEN || base16_decode(out->node_id, DIGEST_LEN, cp, HEX_DIGEST_LEN) != DIGEST_LEN) { |