Commit e3395f1f authored by Marcin Siodelski's avatar Marcin Siodelski

[#716,!412] Reject "any" keyword as a server tag.

parent 05e68bcc
......@@ -28,6 +28,12 @@ ServerTag::ServerTag(const std::string& tag)
}
boost::algorithm::to_lower(tag_);
// ANY has a defined meaning for server selector and must not be used as
// a server tag.
if (tag_ == "any") {
isc_throw(BadValue, "'any' is reserved and must not be used as a server-tag");
}
}
bool
......
......@@ -18,8 +18,10 @@ namespace data {
/// configuration is stored in the database. The label "all" is reserved
/// and it means "all servers". A configuration object in the database
/// associated with this server tag belongs to all servers. The server
/// tag must not be empty and must not be longer than 256 characters
/// (excluding leading and terminating whitespaces, which are trimmed).
/// tag must not be empty, must not be longer than 256 characters
/// (excluding leading and terminating whitespaces, which are trimmed)
/// and must not be set to "any" which has a special meaning for the
/// server selector.
class ServerTag {
public:
......
......@@ -87,6 +87,11 @@ TEST(ServerTagTest, malformed) {
SCOPED_TRACE("too long tag, max is 256");
EXPECT_THROW(ServerTag(std::string(257, 'c')), BadValue);
}
{
SCOPED_TRACE("use reserved keyword any as a tag");
EXPECT_THROW(ServerTag("any"), BadValue);
}
}
}
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