diff options
author | Kevin Butler <haqkrs@gmail.com> | 2013-08-31 04:49:04 +0100 |
---|---|---|
committer | Kevin Butler <haqkrs@gmail.com> | 2013-08-31 04:49:04 +0100 |
commit | 0513643317db56b3bb86c0e754ac65b8ad9b803c (patch) | |
tree | 37f5768e9a14344f9880b6b35caa09b4ebe578ed /src/test | |
parent | 7121e7bd15659052ccf42e554ae959a75cfacb45 (diff) | |
download | tor-0513643317db56b3bb86c0e754ac65b8ad9b803c.tar.gz tor-0513643317db56b3bb86c0e754ac65b8ad9b803c.zip |
MyFamily option will now fix fingerprints missing their leading instead of complaining. Should fix #4341.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_config.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c index 3848d352d5..911913aa8c 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -509,6 +509,41 @@ test_config_parse_transport_options_line(void *arg) } } +// Tests if an options with MyFamily fingerprints missing '$' normalises +// them correctly and also ensure it also works with multiple fingerprints +static void +test_config_fix_my_family(void *arg) +{ + char *err = NULL; + char *family = "$1111111111111111111111111111111111111111, " + "1111111111111111111111111111111111111112, " + "$1111111111111111111111111111111111111113"; + + or_options_t* options = options_new(); + or_options_t* defaults = options_new(); + options_init(options); + options_init(defaults); + options->MyFamily = tor_strdup(family); + + options_validate(NULL, options, defaults, 0, &err) ; + + if (err != NULL) { + test_fail_msg(err); + } + + test_streq(options->MyFamily, "$1111111111111111111111111111111111111111, " + "$1111111111111111111111111111111111111112, " + "$1111111111111111111111111111111111111113"); + + done: + if (err != NULL) { + tor_free(err); + } + + or_options_free(options); + or_options_free(defaults); +} + #define CONFIG_TEST(name, flags) \ { #name, test_config_ ## name, flags, NULL, NULL } @@ -518,6 +553,7 @@ struct testcase_t config_tests[] = { CONFIG_TEST(parse_transport_options_line, 0), CONFIG_TEST(check_or_create_data_subdir, TT_FORK), CONFIG_TEST(write_to_data_subdir, TT_FORK), + CONFIG_TEST(fix_my_family, 0), END_OF_TESTCASES }; |