summaryrefslogtreecommitdiff
path: root/include/hostname_monitor.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/hostname_monitor.hpp')
-rw-r--r--include/hostname_monitor.hpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp
index fd49b02cf4..f1a0d3d2c1 100644
--- a/include/hostname_monitor.hpp
+++ b/include/hostname_monitor.hpp
@@ -22,12 +22,12 @@ inline void installCertificate(const std::filesystem::path& certPath)
[certPath](const boost::system::error_code& ec) {
if (ec)
{
- BMCWEB_LOG_ERROR << "Replace Certificate Fail..";
+ BMCWEB_LOG_ERROR("Replace Certificate Fail..");
return;
}
- BMCWEB_LOG_INFO << "Replace HTTPs Certificate Success, "
- "remove temporary certificate file..";
+ BMCWEB_LOG_INFO("Replace HTTPs Certificate Success, "
+ "remove temporary certificate file..");
remove(certPath.c_str());
},
"xyz.openbmc_project.Certs.Manager.Server.Https",
@@ -40,7 +40,7 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
{
if (retError == nullptr || (sd_bus_error_is_set(retError) != 0))
{
- BMCWEB_LOG_ERROR << "Got sdbus error on match";
+ BMCWEB_LOG_ERROR("Got sdbus error on match");
return 0;
}
@@ -62,13 +62,13 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
return 0;
}
- BMCWEB_LOG_DEBUG << "Read hostname from signal: " << *hostname;
+ BMCWEB_LOG_DEBUG("Read hostname from signal: {}", *hostname);
const std::string certFile = "/etc/ssl/certs/https/server.pem";
X509* cert = ensuressl::loadCert(certFile);
if (cert == nullptr)
{
- BMCWEB_LOG_ERROR << "Failed to read cert";
+ BMCWEB_LOG_ERROR("Failed to read cert");
return 0;
}
@@ -80,7 +80,7 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
cnBuffer.size());
if (cnLength == -1)
{
- BMCWEB_LOG_ERROR << "Failed to read NID_commonName";
+ BMCWEB_LOG_ERROR("Failed to read NID_commonName");
X509_free(cert);
return 0;
}
@@ -90,16 +90,16 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
EVP_PKEY* pPubKey = X509_get_pubkey(cert);
if (pPubKey == nullptr)
{
- BMCWEB_LOG_ERROR << "Failed to get public key";
+ BMCWEB_LOG_ERROR("Failed to get public key");
X509_free(cert);
return 0;
}
int isSelfSigned = X509_verify(cert, pPubKey);
EVP_PKEY_free(pPubKey);
- BMCWEB_LOG_DEBUG << "Current HTTPs Certificate Subject CN: " << cnValue
- << ", New HostName: " << *hostname
- << ", isSelfSigned: " << isSelfSigned;
+ BMCWEB_LOG_DEBUG(
+ "Current HTTPs Certificate Subject CN: {}, New HostName: {}, isSelfSigned: {}",
+ cnValue, *hostname, isSelfSigned);
ASN1_IA5STRING* asn1 = static_cast<ASN1_IA5STRING*>(
X509_get_ext_d2i(cert, NID_netscape_comment, nullptr, nullptr));
@@ -108,13 +108,14 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
std::string_view comment(reinterpret_cast<const char*>(asn1->data),
static_cast<size_t>(asn1->length));
- BMCWEB_LOG_DEBUG << "x509Comment: " << comment;
+ BMCWEB_LOG_DEBUG("x509Comment: {}", comment);
if (ensuressl::x509Comment == comment && isSelfSigned == 1 &&
cnValue != *hostname)
{
- BMCWEB_LOG_INFO << "Ready to generate new HTTPs "
- << "certificate with subject cn: " << *hostname;
+ BMCWEB_LOG_INFO(
+ "Ready to generate new HTTPs certificate with subject cn: {}",
+ *hostname);
ensuressl::generateSslCertificate("/tmp/hostname_cert.tmp",
*hostname);
@@ -128,7 +129,7 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
inline void registerHostnameSignal()
{
- BMCWEB_LOG_INFO << "Register HostName PropertiesChanged Signal";
+ BMCWEB_LOG_INFO("Register HostName PropertiesChanged Signal");
std::string propertiesMatchString =
("type='signal',"
"interface='org.freedesktop.DBus.Properties',"