From aa01d0a18337787209241d08a630a2d8c10f29f0 Mon Sep 17 00:00:00 2001 From: Jérémy Bobbio Date: Fri, 6 Jul 2012 15:31:47 +0200 Subject: Implement proposal 204: ignore subdomains in hidden service addresses The implementation is pretty straightforward: parse_extended_hostname() is modified to drop any leading components from an address like 'foo.aaaaaaaaaaaaaaaa.onion'. --- src/test/test.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/test/test.c') diff --git a/src/test/test.c b/src/test/test.c index c219d984a8..e3e989b0c1 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -1412,11 +1412,20 @@ test_rend_fns(void) char address2[] = "aaaaaaaaaaaaaaaa.onion"; char address3[] = "fooaddress.exit"; char address4[] = "www.torproject.org"; + char address5[] = "foo.abcdefghijklmnop.onion"; + char address6[] = "foo.bar.abcdefghijklmnop.onion"; + char address7[] = ".abcdefghijklmnop.onion"; test_assert(BAD_HOSTNAME == parse_extended_hostname(address1)); test_assert(ONION_HOSTNAME == parse_extended_hostname(address2)); + test_streq(address2, "aaaaaaaaaaaaaaaa"); test_assert(EXIT_HOSTNAME == parse_extended_hostname(address3)); test_assert(NORMAL_HOSTNAME == parse_extended_hostname(address4)); + test_assert(ONION_HOSTNAME == parse_extended_hostname(address5)); + test_streq(address5, "abcdefghijklmnop"); + test_assert(ONION_HOSTNAME == parse_extended_hostname(address6)); + test_streq(address6, "abcdefghijklmnop"); + test_assert(BAD_HOSTNAME == parse_extended_hostname(address7)); pk1 = pk_generate(0); pk2 = pk_generate(1); -- cgit v1.2.3-54-g00ecf