diff options
author | Ratan Gupta <ratagupt@linux.vnet.ibm.com> | 2019-02-18 20:34:10 +0530 |
---|---|---|
committer | Ratan Gupta <ratagupt@linux.vnet.ibm.com> | 2019-03-11 12:10:22 +0530 |
commit | 95a2931473dfa61a30e7a65606dab15ab24cd5b4 (patch) | |
tree | 489495eee9fde8aa5254dd515305214779df0301 /phosphor-ldap-config/ldap_configuration.cpp | |
parent | aeaf9413a965d225d11ee1cd2c8ee9aa1f8dc862 (diff) | |
download | phosphor-user-manager-95a2931473dfa61a30e7a65606dab15ab24cd5b4.tar.gz phosphor-user-manager-95a2931473dfa61a30e7a65606dab15ab24cd5b4.zip |
LDAP: Add the persistency for the "Enabled" property
This property will control that whether the LDAP service would
be started or not.
We are persisting this property using cereal, other properties
is being persisted through nslcd.conf, nslcd doesn't give us
a way to put this property under nslcd.conf.
Tested By:
Test the persistency of enabled property.
Verified that it was getting persisted across restart/reboot.
Change-Id: Id64b23b71865bac15d3be2d79abad615aa576bea
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Diffstat (limited to 'phosphor-ldap-config/ldap_configuration.cpp')
-rw-r--r-- | phosphor-ldap-config/ldap_configuration.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/phosphor-ldap-config/ldap_configuration.cpp b/phosphor-ldap-config/ldap_configuration.cpp index 413998a..4f2f85c 100644 --- a/phosphor-ldap-config/ldap_configuration.cpp +++ b/phosphor-ldap-config/ldap_configuration.cpp @@ -1,6 +1,7 @@ #include "ldap_configuration.hpp" +#include "ldap_serialize.hpp" #include "utils.hpp" -#include <experimental/filesystem> +#include <filesystem> #include <fstream> #include <sstream> @@ -15,7 +16,7 @@ constexpr auto LDAPSscheme = "ldaps"; using namespace phosphor::logging; using namespace sdbusplus::xyz::openbmc_project::Common::Error; -namespace fs = std::experimental::filesystem; +namespace fs = std::filesystem; using Argument = xyz::openbmc_project::Common::InvalidArgument; using Line = std::string; @@ -386,6 +387,8 @@ bool Config::enabled(bool value) return value; } isEnable = EnableIface::enabled(value); + // save the enabled property. + serialize(*this, parent.dbusPersistentPath); parent.startOrStopService(nslcdService, value); } catch (const InternalFailure& e) @@ -691,6 +694,13 @@ void ConfigMgr::restore(const char* filePath) std::move(configValues["bindpw"]), lDAPSearchScope, lDAPType, std::move(configValues["map_passwd_uid"]), std::move(configValues["map_passwd_gidNumber"])); + + // Get the enabled property value from the persistent location + if (!deserialize(dbusPersistentPath, *configPtr)) + { + log<level::INFO>( + "Deserialization Failed, continue with service disable"); + } } catch (const InvalidArgument& e) { |