]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#86,!152] Modified v6 FQDN option unit tests for case insensitive compare.
authorMarcin Siodelski <marcin@isc.org>
Tue, 4 Dec 2018 09:55:46 +0000 (10:55 +0100)
committerMarcin Siodelski <marcin@isc.org>
Tue, 4 Dec 2018 09:55:46 +0000 (10:55 +0100)
src/lib/dhcp/option6_client_fqdn.h
src/lib/dhcp/tests/option6_client_fqdn_unittest.cc

index 58adfbd52e8db41aa25b4457ddc472bd0a041895..2ddcfb731ca6a85cde597615b1601ac2f668332f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -70,6 +70,10 @@ class Option6ClientFqdnImpl;
 /// domain-names to indicate that server should generate complete fully
 /// qualified domain-name.
 ///
+/// Since domain names are case insensitive (see RFC 4343), this class
+/// converts them to lower case format regardless if they are received over
+/// the wire or created from strings.
+///
 /// <b>Design choice:</b> This class uses pimpl idiom to separate the interface
 /// from implementation specifics. Implementations may use different approaches
 /// to handle domain names (mostly validation of the domain-names). The existing
index 2d1bad878b0f12cd0e9605a9cf43a166e48a7921..c2934899ccb379ed6498a0342673b45d6dee3709 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -146,9 +146,9 @@ TEST(Option6ClientFqdnTest, copyConstructEmptyDomainName) {
 TEST(Option6ClientFqdnTest, constructFromWire) {
     const uint8_t in_data[] = {
         Option6ClientFqdn::FLAG_S,           // flags
-        6, 109, 121, 104, 111, 115, 116,     // myhost.
-        7, 101, 120, 97, 109, 112, 108, 101, // example.
-        3, 99, 111, 109, 0                   // com.
+        6, 77, 121, 104, 111, 115, 116,      // Myhost.
+        7, 69, 120, 97, 109, 112, 108, 101,  // Example.
+        3, 67, 111, 109, 0                   // Com.
     };
     size_t in_data_size = sizeof(in_data) / sizeof(in_data[0]);
     OptionBuffer in_buf(in_data, in_data + in_data_size);
@@ -210,7 +210,7 @@ TEST(Option6ClientFqdnTest, constructFromWireTruncated) {
 TEST(Option6ClientFqdnTest, constructFromWirePartial) {
     const uint8_t in_data[] = {
         Option6ClientFqdn::FLAG_N,           // flags
-        6, 109, 121, 104, 111, 115, 116      // myhost
+        6, 77, 121, 104, 111, 115, 116       // Myhost
     };
     size_t in_data_size = sizeof(in_data) / sizeof(in_data[0]);
     OptionBuffer in_buf(in_data, in_data + in_data_size);
@@ -274,7 +274,7 @@ TEST(Option6ClientFqdnTest, assignment) {
 
     // Create first option.
     Option6ClientFqdn option(Option6ClientFqdn::FLAG_S,
-                             "myhost.example.com",
+                             "Myhost.Example.Com",
                              Option6ClientFqdn::FULL);
 
     // Verify that the values have been set correctly.
@@ -514,13 +514,13 @@ TEST(Option6ClientFqdnTest, setDomainName) {
     ASSERT_EQ(Option6ClientFqdn::FULL, option->getDomainNameType());
 
     // Partial domain-name.
-    ASSERT_NO_THROW(option->setDomainName("myhost",
+    ASSERT_NO_THROW(option->setDomainName("Myhost",
                                           Option6ClientFqdn::PARTIAL));
     EXPECT_EQ("myhost", option->getDomainName());
     EXPECT_EQ(Option6ClientFqdn::PARTIAL, option->getDomainNameType());
 
     // Fully qualified domain-name.
-    ASSERT_NO_THROW(option->setDomainName("example.com",
+    ASSERT_NO_THROW(option->setDomainName("Example.com",
                                           Option6ClientFqdn::FULL));
     EXPECT_EQ("example.com.", option->getDomainName());
     EXPECT_EQ(Option6ClientFqdn::FULL, option->getDomainNameType());
@@ -664,8 +664,8 @@ TEST(Option6ClientFqdnTest, unpack) {
 
     const uint8_t in_data[] = {
         Option6ClientFqdn::FLAG_S,           // flags
-        6, 109, 121, 104, 111, 115, 116,     // myhost.
-        7, 101, 120, 97, 109, 112, 108, 101, // example.
+        6, 77, 121, 104, 111, 115, 116,      // Myhost.
+        7, 69, 120, 97, 109, 112, 108, 101,  // Example.
         3, 99, 111, 109, 0                   // com.
     };
     size_t in_data_size = sizeof(in_data) / sizeof(in_data[0]);
@@ -703,7 +703,7 @@ TEST(Option6ClientFqdnTest, unpackPartial) {
 
     const uint8_t in_data[] = {
         Option6ClientFqdn::FLAG_S,           // flags
-        6, 109, 121, 104, 111, 115, 116      // myhost
+        6, 77, 121, 104, 111, 115, 116       // Myhost
     };
     size_t in_data_size = sizeof(in_data) / sizeof(in_data[0]);
     OptionBuffer in_buf(in_data, in_data + in_data_size);