diff options
author | Alexander Færøy <ahf@torproject.org> | 2020-01-15 17:18:30 +0000 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-02-12 12:21:41 +1000 |
commit | b9c7c61ea5233854ff83257a8bc530b7e0a50351 (patch) | |
tree | 08a2cbfc19ae22f6cad29b06f652405112d880e5 /src/test | |
parent | 88723ad1694a96bdbb713ccb5bb47a9f5acdc8bd (diff) | |
download | tor-b9c7c61ea5233854ff83257a8bc530b7e0a50351.tar.gz tor-b9c7c61ea5233854ff83257a8bc530b7e0a50351.zip |
Lowercase the BridgeDistribution value from torrc in descriptors.
This patch ensures that we always lowercase the BridgeDistribution from
torrc in descriptors before submitting it.
See: https://bugs.torproject.org/32753
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_config.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c index 8f011ce1f1..855725411a 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -5620,11 +5620,27 @@ test_config_check_bridge_distribution_setting_not_a_bridge(void *arg) static void test_config_check_bridge_distribution_setting_valid(void *arg) { - int ret = check_bridge_distribution_setting("https"); - (void)arg; - tt_int_op(ret, OP_EQ, 0); + // Check all the possible values we support right now. + tt_int_op(check_bridge_distribution_setting("none"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("any"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("https"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("email"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("moat"), OP_EQ, 0); + + // Check all the possible values we support right now with weird casing. + tt_int_op(check_bridge_distribution_setting("NoNe"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("anY"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("hTTps"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("emAIl"), OP_EQ, 0); + tt_int_op(check_bridge_distribution_setting("moAt"), OP_EQ, 0); + + // Invalid values. + tt_int_op(check_bridge_distribution_setting("x\rx"), OP_EQ, -1); + tt_int_op(check_bridge_distribution_setting("x\nx"), OP_EQ, -1); + tt_int_op(check_bridge_distribution_setting("\t\t\t"), OP_EQ, -1); + done: return; } |