Fix crash during GET of manager network protocol
If the ethernet interface is having the domain
name entry then Redfish GET request on network
manager protocol was crashing the bmcweb.
This commit fixes this behaviour.
Tested By:
Configure the Domain Name and run the GET request
on the network protocol: PASS
GET request on the network protocol even the
domain name was not configured : PASS
Redfish Validator: PASS
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Change-Id: I1e6cd6e3fe507ff375463ece1f6f10bae4d4fb6a
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index d92315e..71e58cc 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -243,11 +243,12 @@
asyncResp->res.jsonValue["NTP"]["NTPServers"] = ntpServers;
if (hostName.empty() == false)
{
- asyncResp->res.jsonValue["FQDN"] = hostName;
+ std::string FQDN = std::move(hostName);
if (domainNames.empty() == false)
{
- asyncResp->res.jsonValue["FQDN"] += "." + domainNames[0];
+ FQDN += "." + domainNames[0];
}
+ asyncResp->res.jsonValue["FQDN"] = std::move(FQDN);
}
});