Commit 108ad199 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

reject negative statistics-interval values

parent 9633a3ad
...@@ -177,7 +177,12 @@ public: ...@@ -177,7 +177,12 @@ public:
server_(server), interval_(0) server_(server), interval_(0)
{} {}
virtual void build(ConstElementPtr config_value) { virtual void build(ConstElementPtr config_value) {
interval_ = config_value->intValue(); const int32_t config_interval = config_value->intValue();
if (config_interval < 0) {
isc_throw(AuthConfigError, "negative statistics-interval value: "
<< config_interval);
}
interval_ = config_interval;
} }
virtual void commit() { virtual void commit() {
// setStatisticsTimerInterval() is not 100% exception free. But // setStatisticsTimerInterval() is not 100% exception free. But
......
...@@ -364,5 +364,6 @@ TEST_F(StatisticsIntervalConfigTest, badInterval) { ...@@ -364,5 +364,6 @@ TEST_F(StatisticsIntervalConfigTest, badInterval) {
isc::data::TypeError); isc::data::TypeError);
EXPECT_THROW(parser->build(Element::fromJSON("2.5")), EXPECT_THROW(parser->build(Element::fromJSON("2.5")),
isc::data::TypeError); isc::data::TypeError);
EXPECT_THROW(parser->build(Element::fromJSON("-1")), AuthConfigError);
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment