Loading changes/bug32753 0 → 100644 +3 −0 Original line number Diff line number Diff line o Minor bugfixes (bridges): - Lowercase the value of BridgeDistribution from torrc before adding it to the descriptor. Fixes bug 32753; bugfix on 0.3.2.3-alpha. src/feature/relay/relay_config.c +2 −3 Original line number Diff line number Diff line Loading @@ -468,7 +468,6 @@ compute_publishserverdescriptor(or_options_t *options) * - "https" * - "email" * - "moat" * - "hyphae" * * If the option string is unrecognised, a warning will be logged and 0 is * returned. If the option string contains an invalid character, -1 is Loading @@ -481,11 +480,11 @@ check_bridge_distribution_setting(const char *bd) return 0; const char *RECOGNIZED[] = { "none", "any", "https", "email", "moat", "hyphae" "none", "any", "https", "email", "moat" }; unsigned i; for (i = 0; i < ARRAY_LENGTH(RECOGNIZED); ++i) { if (!strcmp(bd, RECOGNIZED[i])) if (!strcasecmp(bd, RECOGNIZED[i])) return 0; } Loading src/feature/relay/router.c +10 −5 Original line number Diff line number Diff line Loading @@ -2908,15 +2908,20 @@ router_dump_router_to_string(routerinfo_t *router, } if (options->BridgeRelay) { const char *bd; char *bd = NULL; if (options->BridgeDistribution && strlen(options->BridgeDistribution)) { bd = options->BridgeDistribution; bd = tor_strdup(options->BridgeDistribution); } else { bd = "any"; bd = tor_strdup("any"); } if (strchr(bd, '\n') || strchr(bd, '\r')) bd = escaped(bd); // Make sure our value is lowercased in the descriptor instead of just // forwarding what the user wrote in their torrc directly. tor_strlower(bd); smartlist_add_asprintf(chunks, "bridge-distribution-request %s\n", bd); tor_free(bd); } if (router->onion_curve25519_pkey) { Loading src/test/test_config.c +19 −3 Original line number Diff line number Diff line Loading @@ -5712,11 +5712,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; } Loading Loading
changes/bug32753 0 → 100644 +3 −0 Original line number Diff line number Diff line o Minor bugfixes (bridges): - Lowercase the value of BridgeDistribution from torrc before adding it to the descriptor. Fixes bug 32753; bugfix on 0.3.2.3-alpha.
src/feature/relay/relay_config.c +2 −3 Original line number Diff line number Diff line Loading @@ -468,7 +468,6 @@ compute_publishserverdescriptor(or_options_t *options) * - "https" * - "email" * - "moat" * - "hyphae" * * If the option string is unrecognised, a warning will be logged and 0 is * returned. If the option string contains an invalid character, -1 is Loading @@ -481,11 +480,11 @@ check_bridge_distribution_setting(const char *bd) return 0; const char *RECOGNIZED[] = { "none", "any", "https", "email", "moat", "hyphae" "none", "any", "https", "email", "moat" }; unsigned i; for (i = 0; i < ARRAY_LENGTH(RECOGNIZED); ++i) { if (!strcmp(bd, RECOGNIZED[i])) if (!strcasecmp(bd, RECOGNIZED[i])) return 0; } Loading
src/feature/relay/router.c +10 −5 Original line number Diff line number Diff line Loading @@ -2908,15 +2908,20 @@ router_dump_router_to_string(routerinfo_t *router, } if (options->BridgeRelay) { const char *bd; char *bd = NULL; if (options->BridgeDistribution && strlen(options->BridgeDistribution)) { bd = options->BridgeDistribution; bd = tor_strdup(options->BridgeDistribution); } else { bd = "any"; bd = tor_strdup("any"); } if (strchr(bd, '\n') || strchr(bd, '\r')) bd = escaped(bd); // Make sure our value is lowercased in the descriptor instead of just // forwarding what the user wrote in their torrc directly. tor_strlower(bd); smartlist_add_asprintf(chunks, "bridge-distribution-request %s\n", bd); tor_free(bd); } if (router->onion_curve25519_pkey) { Loading
src/test/test_config.c +19 −3 Original line number Diff line number Diff line Loading @@ -5712,11 +5712,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; } Loading