]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3770] Minor correction to hash input value.
authorThomas Markwalder <tmark@isc.org>
Wed, 23 Jul 2025 18:19:51 +0000 (14:19 -0400)
committerThomas Markwalder <tmark@isc.org>
Wed, 23 Jul 2025 18:19:51 +0000 (14:19 -0400)
Use non-empy delimiter.

modified:   ../classify.cc
modified:   classify_unittest.cc

src/lib/dhcp/classify.cc
src/lib/dhcp/tests/classify_unittest.cc

index 543b81d99f38284ab1f25411a81c04ebb7e18aa7..3c63ddfca4b9de87aea95c0b568a5a12d51963e2 100644 (file)
@@ -141,7 +141,7 @@ ClientClasses::Hash::operator()(const ClientClasses &client_classes) {
 
 size_t hash_value(const ClientClasses& client_classes) {
     boost::hash<std::string> hasher;
-    return (hasher(client_classes.toText("")));
+    return (hasher(client_classes.toText("+")));
 }
 
 }} // end of namespace isc
index 64c68064fe694c57a1dbd1aaff6e2782e3ba64eb..6253167c914ed0f54167b1b2e713009f9f7068a1 100644 (file)
@@ -322,10 +322,16 @@ TEST(ClassifyTest, ClientClassesHash) {
     ClientClasses cclasses2(cclasses);
     EXPECT_EQ(hash(cclasses2), hash(cclasses));
 
-    // Check that different ordering make not equal hashes.
+    // Check that different ordering makes not equal hashes.
     ClientClasses cclasses3;
     cclasses3.insert("three");
     cclasses3.insert("two");
     cclasses3.insert("one");
     EXPECT_NE(hash(cclasses3), hash(cclasses));
+
+    // Check that single class name same as individual class names
+    // makes not equal hashes.
+    ClientClasses cclasses4;
+    cclasses4.insert("onetwothree");
+    EXPECT_NE(hash(cclasses4), hash(cclasses));
 }