[tor-commits] [tor/master] Test TLD validation

nickm at torproject.org nickm at torproject.org
Wed Mar 28 11:50:56 UTC 2018


commit db850fec3ac402084a9036c0ea7b4523f1120eb1
Author: rl1987 <rl1987 at sdf.lonestar.org>
Date:   Mon Feb 12 22:20:45 2018 +0100

    Test TLD validation
---
 src/test/test_util.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 2fa03e5bc..db2ea1a34 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -5589,6 +5589,12 @@ test_util_hostname_validation(void *arg)
   tt_assert(!string_is_valid_hostname("[2a00:1450:401b:800::200e]"));
   tt_assert(!string_is_valid_hostname("2a00:1450:401b:800::200e"));
 
+  // Last label of a hostname is required to be alphabetic according to
+  // RFC 1123 Section 2.1.
+  tt_assert(!string_is_valid_hostname("lucky.13"));
+  tt_assert(!string_is_valid_hostname("luck.y13"));
+  tt_assert(!string_is_valid_hostname("luck.y13."));
+
   done:
   return;
 }





More information about the tor-commits mailing list