phosphor-ldap-conf: handle "InterfaceAdded" signal on the ca-cert object
When ever a new ca-cert file is installed/changed(re-installed),
the certificate manager sends a Signal, which is caught by the
phosphor-user-manager and the nslcd deamon will be restarted with
the appropriate ca-certfile.
TestedBy:
Installed a new ca-certificate using busctl command, and verified if the
phosphor-user-manager captured the InterfaceAdded signal there by updating
the nslcd configuration accordingly.
Signed-off-by: manojkiraneda <manojkiran.eda@gmail.com>
Change-Id: Iffc9b70435d819f6bdaee57970edc65f555ff42d
diff --git a/phosphor-ldap-config/ldap_config.cpp b/phosphor-ldap-config/ldap_config.cpp
index d01757a..526310f 100644
--- a/phosphor-ldap-config/ldap_config.cpp
+++ b/phosphor-ldap-config/ldap_config.cpp
@@ -29,6 +29,7 @@
constexpr auto LDAPSscheme = "ldaps";
constexpr auto certObjPath = "/xyz/openbmc_project/certs/client/ldap/1";
constexpr auto certRootPath = "/xyz/openbmc_project/certs/client/ldap";
+constexpr auto authObjPath = "/xyz/openbmc_project/certs/authority/ldap";
constexpr auto certIface = "xyz.openbmc_project.Certs.Certificate";
constexpr auto certProperty = "CertificateString";
@@ -63,6 +64,12 @@
bus, sdbusplus::bus::match::rules::interfacesAdded(certRootPath),
std::bind(std::mem_fn(&Config::certificateInstalled), this,
std::placeholders::_1)),
+
+ cacertificateInstalledSignal(
+ bus, sdbusplus::bus::match::rules::interfacesAdded(authObjPath),
+ std::bind(std::mem_fn(&Config::certificateInstalled), this,
+ std::placeholders::_1)),
+
certificateChangedSignal(
bus,
sdbusplus::bus::match::rules::propertiesChanged(certObjPath, certIface),
@@ -108,6 +115,11 @@
bus, sdbusplus::bus::match::rules::interfacesAdded(certRootPath),
std::bind(std::mem_fn(&Config::certificateInstalled), this,
std::placeholders::_1)),
+ cacertificateInstalledSignal(
+ bus, sdbusplus::bus::match::rules::interfacesAdded(authObjPath),
+ std::bind(std::mem_fn(&Config::certificateInstalled), this,
+ std::placeholders::_1)),
+
certificateChangedSignal(
bus,
sdbusplus::bus::match::rules::propertiesChanged(certObjPath, certIface),
diff --git a/phosphor-ldap-config/ldap_config.hpp b/phosphor-ldap-config/ldap_config.hpp
index 9cf59f7..220677c 100644
--- a/phosphor-ldap-config/ldap_config.hpp
+++ b/phosphor-ldap-config/ldap_config.hpp
@@ -280,6 +280,8 @@
void certificateInstalled(sdbusplus::message::message& msg);
sdbusplus::bus::match_t certificateInstalledSignal;
+ sdbusplus::bus::match_t cacertificateInstalledSignal;
+
/** @brief React to certificate changed signal
* @param[in] msg - sdbusplus message
*/