mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 01:49:48 +00:00
[#3848] Fix element position reporting
modified: src/lib/cc/data.cc altered data::copy() to also copy the source element's position modified: src/bin/dhcp4/json_config_parser.cc modified: src/hooks/dhcp/lease_query/tests/lease_query_impl4_unittest.cc modified: src/lib/http/tests/basic_auth_config_unittests.cc
This commit is contained in:
parent
0a85700c28
commit
fe696acbb6
@ -412,7 +412,7 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) {
|
||||
ConstElementPtr control_socket = mutable_cfg->get("control-socket");
|
||||
if (control_socket) {
|
||||
mutable_cfg->remove("control-socket");
|
||||
ElementPtr l = Element::createList();
|
||||
ElementPtr l = Element::createList(control_socket->getPosition());
|
||||
l->add(UserContext::toElement(control_socket));
|
||||
mutable_cfg->set("control-sockets", l);
|
||||
}
|
||||
|
@ -1224,7 +1224,7 @@ TEST_F(LeaseQueryImpl4ProcessTest, addRelayAgentInfo) {
|
||||
// Pass lease and response into addRelayAgentInfo().
|
||||
ASSERT_THROW_MSG(LeaseQueryImpl4::addRelayAgentInfo(response, lease),
|
||||
Unexpected, "Error creating relay-agent-info option:"
|
||||
" stringValue() called on non-string Element");
|
||||
" stringValue() called on non-string Element in (<string>:1:32)");
|
||||
|
||||
// Verify relay-agent-info is not in the response
|
||||
checkRelayAgentInfo(response, "");
|
||||
|
@ -1421,19 +1421,21 @@ copy(ConstElementPtr from, int level) {
|
||||
if (!from) {
|
||||
isc_throw(BadValue, "copy got a null pointer");
|
||||
}
|
||||
|
||||
auto pos = from->getPosition();
|
||||
int from_type = from->getType();
|
||||
if (from_type == Element::integer) {
|
||||
return (ElementPtr(new IntElement(from->intValue())));
|
||||
return (ElementPtr(new IntElement(from->intValue(), pos)));
|
||||
} else if (from_type == Element::real) {
|
||||
return (ElementPtr(new DoubleElement(from->doubleValue())));
|
||||
return (ElementPtr(new DoubleElement(from->doubleValue(), pos)));
|
||||
} else if (from_type == Element::boolean) {
|
||||
return (ElementPtr(new BoolElement(from->boolValue())));
|
||||
return (ElementPtr(new BoolElement(from->boolValue(), pos)));
|
||||
} else if (from_type == Element::null) {
|
||||
return (ElementPtr(new NullElement()));
|
||||
} else if (from_type == Element::string) {
|
||||
return (ElementPtr(new StringElement(from->stringValue())));
|
||||
return (ElementPtr(new StringElement(from->stringValue(), pos)));
|
||||
} else if (from_type == Element::list) {
|
||||
ElementPtr result = ElementPtr(new ListElement());
|
||||
ElementPtr result = ElementPtr(new ListElement(pos));
|
||||
for (auto const& elem : from->listValue()) {
|
||||
if (level == 0) {
|
||||
result->add(elem);
|
||||
@ -1443,7 +1445,7 @@ copy(ConstElementPtr from, int level) {
|
||||
}
|
||||
return (result);
|
||||
} else if (from_type == Element::map) {
|
||||
ElementPtr result = ElementPtr(new MapElement());
|
||||
ElementPtr result = ElementPtr(new MapElement(pos));
|
||||
for (auto const& kv : from->mapValue()) {
|
||||
auto key = kv.first;
|
||||
auto value = kv.second;
|
||||
|
@ -556,7 +556,6 @@ TEST_F(BasicHttpAuthConfigTest, parse) {
|
||||
cfg->set("clients", clients_cfg);
|
||||
EXPECT_NO_THROW(config.parse(cfg));
|
||||
runToElementTest<BasicHttpAuthConfig>(cfg, config);
|
||||
std::cout << "TKM config: " << prettyPrint(config.toElement()) << std::endl;
|
||||
|
||||
// Check a working not empty config with files.
|
||||
config.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user