summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2016-09-13 17:28:03 +1000
committerNick Mathewson <nickm@torproject.org>2016-09-13 10:13:57 -0400
commitf311c9ffa2d9cdb64b92e4ceab5b3c582b976228 (patch)
treec45eee9cc5caa6834d156ca727b4f1534f686b3a /src/test
parent365ca3ca0f5d9d391a2156436d1a7c620906e23a (diff)
downloadtor-f311c9ffa2d9cdb64b92e4ceab5b3c582b976228.tar.gz
tor-f311c9ffa2d9cdb64b92e4ceab5b3c582b976228.zip
Replace OnionService* with HiddenService* in option names
And make consequential line-length adjustments.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_hs.c70
-rw-r--r--src/test/test_options.c64
2 files changed, 67 insertions, 67 deletions
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 297fb0e97f..a9cd315a82 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -538,14 +538,14 @@ test_single_onion_poisoning(void *arg)
(void) arg;
/* No services, no problem! */
- mock_options->OnionServiceSingleHopMode = 0;
- mock_options->OnionServiceNonAnonymousMode = 0;
+ mock_options->HiddenServiceSingleHopMode = 0;
+ mock_options->HiddenServiceNonAnonymousMode = 0;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
/* Either way, no problem. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
@@ -572,21 +572,21 @@ test_single_onion_poisoning(void *arg)
/* But don't add the second service yet. */
/* Service directories, but no previous keys, no problem! */
- mock_options->OnionServiceSingleHopMode = 0;
- mock_options->OnionServiceNonAnonymousMode = 0;
+ mock_options->HiddenServiceSingleHopMode = 0;
+ mock_options->HiddenServiceNonAnonymousMode = 0;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
/* Either way, no problem. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
/* Poison! Poison! Poison!
- * This can only be done in OnionServiceSingleHopMode. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ * This can only be done in HiddenServiceSingleHopMode. */
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_poison_new_single_onion_dirs(services);
tt_assert(ret == 0);
/* Poisoning twice is a no-op. */
@@ -594,14 +594,14 @@ test_single_onion_poisoning(void *arg)
tt_assert(ret == 0);
/* Poisoned service directories, but no previous keys, no problem! */
- mock_options->OnionServiceSingleHopMode = 0;
- mock_options->OnionServiceNonAnonymousMode = 0;
+ mock_options->HiddenServiceSingleHopMode = 0;
+ mock_options->HiddenServiceNonAnonymousMode = 0;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
/* Either way, no problem. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
@@ -610,21 +610,21 @@ test_single_onion_poisoning(void *arg)
tt_assert(ret == 0);
/* Poisoned service directories with previous keys are not allowed. */
- mock_options->OnionServiceSingleHopMode = 0;
- mock_options->OnionServiceNonAnonymousMode = 0;
+ mock_options->HiddenServiceSingleHopMode = 0;
+ mock_options->HiddenServiceNonAnonymousMode = 0;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret < 0);
/* But they are allowed if we're in non-anonymous mode. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
/* Re-poisoning directories with existing keys is a no-op, because
* directories with existing keys are ignored. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_poison_new_single_onion_dirs(services);
tt_assert(ret == 0);
/* And it keeps the poison. */
@@ -635,14 +635,14 @@ test_single_onion_poisoning(void *arg)
smartlist_add(services, service_2);
/* A new service, and an existing poisoned service. Not ok. */
- mock_options->OnionServiceSingleHopMode = 0;
- mock_options->OnionServiceNonAnonymousMode = 0;
+ mock_options->HiddenServiceSingleHopMode = 0;
+ mock_options->HiddenServiceNonAnonymousMode = 0;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret < 0);
/* But ok to add in non-anonymous mode. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
@@ -655,22 +655,22 @@ test_single_onion_poisoning(void *arg)
/* Unpoisoned service directories with previous keys are ok, as are empty
* directories. */
- mock_options->OnionServiceSingleHopMode = 0;
- mock_options->OnionServiceNonAnonymousMode = 0;
+ mock_options->HiddenServiceSingleHopMode = 0;
+ mock_options->HiddenServiceNonAnonymousMode = 0;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
/* But the existing unpoisoned key is not ok in non-anonymous mode, even if
* there is an empty service. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret < 0);
/* Poisoning directories with existing keys is a no-op, because directories
* with existing keys are ignored. But the new directory should poison. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_poison_new_single_onion_dirs(services);
tt_assert(ret == 0);
/* And the old directory remains unpoisoned. */
@@ -678,14 +678,14 @@ test_single_onion_poisoning(void *arg)
tt_assert(ret < 0);
/* And the new directory should be ignored, because it has no key. */
- mock_options->OnionServiceSingleHopMode = 0;
- mock_options->OnionServiceNonAnonymousMode = 0;
+ mock_options->HiddenServiceSingleHopMode = 0;
+ mock_options->HiddenServiceNonAnonymousMode = 0;
ret = rend_service_list_verify_single_onion_poison(services, mock_options);
tt_assert(ret == 0);
/* Re-poisoning directories without existing keys is a no-op. */
- mock_options->OnionServiceSingleHopMode = 1;
- mock_options->OnionServiceNonAnonymousMode = 1;
+ mock_options->HiddenServiceSingleHopMode = 1;
+ mock_options->HiddenServiceNonAnonymousMode = 1;
ret = rend_service_poison_new_single_onion_dirs(services);
tt_assert(ret == 0);
/* And the old directory remains unpoisoned. */
diff --git a/src/test/test_options.c b/src/test/test_options.c
index f01e137f8f..bdcb318bb6 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -2766,37 +2766,37 @@ test_options_validate__single_onion(void *ignored)
options_test_data_t *tdata = NULL;
int previous_log = setup_capture_of_logs(LOG_WARN);
- /* Test that OnionServiceSingleHopMode must come with
- * OnionServiceNonAnonymousMode */
+ /* Test that HiddenServiceSingleHopMode must come with
+ * HiddenServiceNonAnonymousMode */
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"SOCKSPort 0\n"
- "OnionServiceSingleHopMode 1\n"
+ "HiddenServiceSingleHopMode 1\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(msg, OP_EQ, "OnionServiceSingleHopMode does not provide any "
+ tt_str_op(msg, OP_EQ, "HiddenServiceSingleHopMode does not provide any "
"server anonymity. It must be used with "
- "OnionServiceNonAnonymousMode set to 1.");
+ "HiddenServiceNonAnonymousMode set to 1.");
tor_free(msg);
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"SOCKSPort 0\n"
- "OnionServiceSingleHopMode 1\n"
- "OnionServiceNonAnonymousMode 0\n"
+ "HiddenServiceSingleHopMode 1\n"
+ "HiddenServiceNonAnonymousMode 0\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(msg, OP_EQ, "OnionServiceSingleHopMode does not provide any "
+ tt_str_op(msg, OP_EQ, "HiddenServiceSingleHopMode does not provide any "
"server anonymity. It must be used with "
- "OnionServiceNonAnonymousMode set to 1.");
+ "HiddenServiceNonAnonymousMode set to 1.");
tor_free(msg);
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"SOCKSPort 0\n"
- "OnionServiceSingleHopMode 1\n"
- "OnionServiceNonAnonymousMode 1\n"
+ "HiddenServiceSingleHopMode 1\n"
+ "HiddenServiceNonAnonymousMode 1\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
@@ -2804,26 +2804,26 @@ test_options_validate__single_onion(void *ignored)
free_options_test_data(tdata);
/* Test that SOCKSPort must come with Tor2webMode if
- * OnionServiceSingleHopMode is 1 */
+ * HiddenServiceSingleHopMode is 1 */
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"SOCKSPort 5000\n"
- "OnionServiceSingleHopMode 1\n"
- "OnionServiceNonAnonymousMode 1\n"
+ "HiddenServiceSingleHopMode 1\n"
+ "HiddenServiceNonAnonymousMode 1\n"
"Tor2webMode 0\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(msg, OP_EQ, "OnionServiceNonAnonymousMode is incompatible with "
+ tt_str_op(msg, OP_EQ, "HiddenServiceNonAnonymousMode is incompatible with "
"using Tor as an anonymous client. Please set "
- "Socks/Trans/NATD/DNSPort to 0, or OnionServiceNonAnonymousMode "
+ "Socks/Trans/NATD/DNSPort to 0, or HiddenServiceNonAnonymousMode "
"to 0, or use the non-anonymous Tor2webMode.");
tor_free(msg);
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"SOCKSPort 0\n"
- "OnionServiceSingleHopMode 1\n"
- "OnionServiceNonAnonymousMode 1\n"
+ "HiddenServiceSingleHopMode 1\n"
+ "HiddenServiceNonAnonymousMode 1\n"
"Tor2webMode 0\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
@@ -2833,7 +2833,7 @@ test_options_validate__single_onion(void *ignored)
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"SOCKSPort 5000\n"
- "OnionServiceSingleHopMode 0\n"
+ "HiddenServiceSingleHopMode 0\n"
"Tor2webMode 0\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
@@ -2843,8 +2843,8 @@ test_options_validate__single_onion(void *ignored)
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"SOCKSPort 5000\n"
- "OnionServiceSingleHopMode 1\n"
- "OnionServiceNonAnonymousMode 1\n"
+ "HiddenServiceSingleHopMode 1\n"
+ "HiddenServiceNonAnonymousMode 1\n"
"Tor2webMode 1\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
@@ -2853,29 +2853,29 @@ test_options_validate__single_onion(void *ignored)
free_options_test_data(tdata);
/* Test that a hidden service can't be run with Tor2web
- * Use OnionServiceNonAnonymousMode instead of Tor2webMode, because
+ * Use HiddenServiceNonAnonymousMode instead of Tor2webMode, because
* Tor2webMode requires a compilation #define */
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
- "OnionServiceNonAnonymousMode 1\n"
+ "HiddenServiceNonAnonymousMode 1\n"
"HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/\n"
"HiddenServicePort 80 127.0.0.1:8080\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(msg, OP_EQ, "OnionServiceNonAnonymousMode does not provide any "
- "server anonymity. It must be used with OnionServiceSingleHopMode "
- "set to 1.");
+ tt_str_op(msg, OP_EQ, "HiddenServiceNonAnonymousMode does not provide any "
+ "server anonymity. It must be used with "
+ "HiddenServiceSingleHopMode set to 1.");
tor_free(msg);
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
- "OnionServiceNonAnonymousMode 1\n"
+ "HiddenServiceNonAnonymousMode 1\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
- tt_str_op(msg, OP_EQ, "OnionServiceNonAnonymousMode does not provide any "
- "server anonymity. It must be used with OnionServiceSingleHopMode "
- "set to 1.");
+ tt_str_op(msg, OP_EQ, "HiddenServiceNonAnonymousMode does not provide any "
+ "server anonymity. It must be used with "
+ "HiddenServiceSingleHopMode set to 1.");
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
@@ -2888,10 +2888,10 @@ test_options_validate__single_onion(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
- "OnionServiceNonAnonymousMode 1\n"
+ "HiddenServiceNonAnonymousMode 1\n"
"HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/\n"
"HiddenServicePort 80 127.0.0.1:8080\n"
- "OnionServiceSingleHopMode 1\n"
+ "HiddenServiceSingleHopMode 1\n"
"SOCKSPort 0\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);