mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[2314] Validate option space name received in a configuration.
This commit is contained in:
@@ -768,7 +768,10 @@ private:
|
||||
}
|
||||
|
||||
std::string option_space = getParam<std::string>("space", string_values_);
|
||||
/// @todo Validate option space once #2313 is merged.
|
||||
if (!OptionSpace::validateName(option_space)) {
|
||||
isc_throw(DhcpConfigError, "invalid option space name'"
|
||||
<< option_space << "'");
|
||||
}
|
||||
|
||||
OptionDefinitionPtr def;
|
||||
if (option_space == "dhcp4" &&
|
||||
@@ -978,7 +981,7 @@ public:
|
||||
/// @brief Parser for a single option definition.
|
||||
///
|
||||
/// This parser creates an instance of a single option definition.
|
||||
class OptionDefParser: DhcpConfigParser {
|
||||
class OptionDefParser : public DhcpConfigParser {
|
||||
public:
|
||||
|
||||
/// @brief Constructor.
|
||||
@@ -1055,8 +1058,8 @@ public:
|
||||
|
||||
/// @brief Stores the parsed option definition in a storage.
|
||||
void commit() {
|
||||
// @todo validate option space name once 2313 is merged.
|
||||
if (storage_ && option_definition_) {
|
||||
if (storage_ && option_definition_ &&
|
||||
OptionSpace::validateName(option_space_name_)) {
|
||||
storage_->addItem(option_definition_, option_space_name_);
|
||||
}
|
||||
}
|
||||
@@ -1078,11 +1081,10 @@ private:
|
||||
void createOptionDef() {
|
||||
// Get the option space name and validate it.
|
||||
std::string space = getParam<std::string>("space", string_values_);
|
||||
// @todo uncomment the code below when the #2313 is merged.
|
||||
/* if (!OptionSpace::validateName()) {
|
||||
if (!OptionSpace::validateName(space)) {
|
||||
isc_throw(DhcpConfigError, "invalid option space name '"
|
||||
<< space << "'");
|
||||
} */
|
||||
}
|
||||
|
||||
// Get other parameters that are needed to create the
|
||||
// option definition.
|
||||
|
@@ -798,7 +798,10 @@ private:
|
||||
}
|
||||
|
||||
std::string option_space = getParam<std::string>("space", string_values_);
|
||||
/// @todo Validate option space once #2313 is merged.
|
||||
if (!OptionSpace::validateName(option_space)) {
|
||||
isc_throw(DhcpConfigError, "invalid option space name'"
|
||||
<< option_space << "'");
|
||||
}
|
||||
|
||||
OptionDefinitionPtr def;
|
||||
if (option_space == "dhcp6" &&
|
||||
@@ -1085,8 +1088,8 @@ public:
|
||||
|
||||
/// @brief Stores the parsed option definition in the data store.
|
||||
void commit() {
|
||||
// @todo validate option space name once 2313 is merged.
|
||||
if (storage_ && option_definition_) {
|
||||
if (storage_ && option_definition_ &&
|
||||
OptionSpace::validateName(option_space_name_)) {
|
||||
storage_->addItem(option_definition_, option_space_name_);
|
||||
}
|
||||
}
|
||||
@@ -1108,11 +1111,10 @@ private:
|
||||
void createOptionDef() {
|
||||
// Get the option space name and validate it.
|
||||
std::string space = getParam<std::string>("space", string_values_);
|
||||
// @todo uncomment the code below when the #2313 is merged.
|
||||
/* if (!OptionSpace::validateName()) {
|
||||
if (!OptionSpace::validateName(space)) {
|
||||
isc_throw(DhcpConfigError, "invalid option space name '"
|
||||
<< space << "'");
|
||||
} */
|
||||
}
|
||||
|
||||
// Get other parameters that are needed to create the
|
||||
// option definition.
|
||||
|
Reference in New Issue
Block a user