]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3074] option def validation
authorPiotrek Zadroga <piotrek@isc.org>
Wed, 22 Nov 2023 09:17:12 +0000 (10:17 +0100)
committerPiotrek Zadroga <piotrek@isc.org>
Tue, 9 Jan 2024 10:40:04 +0000 (11:40 +0100)
src/lib/dhcp/option_definition.cc

index 40d46b0cdaf559191b70a5a9dc279f41b5207906..8e2b8403f4170d436098cd495731b319e01fe95b 100644 (file)
@@ -408,6 +408,12 @@ OptionDefinition::validate() const {
                             << " an option record.";
                     break;
                 }
+                // Custom type is not allowed within a record.
+                if (*it == OPT_CUSTOM_TYPE) {
+                    err_str << "custom data type can't be stored as a field in"
+                            << " an option record.";
+                    break;
+                }
             }
             // If the array flag is set the last field is an array.
             if (err_str.str().empty() && array_type_) {
@@ -437,6 +443,10 @@ OptionDefinition::validate() const {
             err_str << "array of empty value is not"
                     << " a valid option definition.";
 
+        } else if (type_ == OPT_CUSTOM_TYPE) {
+            err_str << "array of custom type value is not"
+                    << " a valid option definition.";
+
         }
     }