Don't allow to delete the config object
User should not be able to delete the default objects
which are AD and openpldap.
TestedBy: Unit tested.
Make sure that delete function is not there in the default objects.
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Change-Id: I51f11792e842fe964740123c40f9301a3b444786
diff --git a/phosphor-ldap-config/ldap_config.cpp b/phosphor-ldap-config/ldap_config.cpp
index cfa825c..aa984c6 100644
--- a/phosphor-ldap-config/ldap_config.cpp
+++ b/phosphor-ldap-config/ldap_config.cpp
@@ -56,27 +56,6 @@
parent.startOrStopService(nslcdService, enabled());
}
-void Config::delete_()
-{
- parent.deleteObject();
- try
- {
- fs::path configDir = fs::path(configFilePath.c_str()).parent_path();
-
- fs::copy_file(configDir / defaultNslcdFile, LDAP_CONFIG_FILE,
- fs::copy_options::overwrite_existing);
- }
- catch (const std::exception& e)
- {
- log<level::ERR>("Failed to rename Config Files while deleting Object",
- entry("ERR=%s", e.what()));
- elog<InternalFailure>();
- }
-
- parent.restartService(nscdService);
- parent.stopService(nslcdService);
-}
-
void Config::writeConfig()
{
std::stringstream confData;
diff --git a/phosphor-ldap-config/ldap_config.hpp b/phosphor-ldap-config/ldap_config.hpp
index 8af4e4d..858d1a3 100644
--- a/phosphor-ldap-config/ldap_config.hpp
+++ b/phosphor-ldap-config/ldap_config.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "config.h"
-#include <xyz/openbmc_project/Object/Delete/server.hpp>
#include <xyz/openbmc_project/Object/Enable/server.hpp>
#include <xyz/openbmc_project/User/Ldap/Create/server.hpp>
#include <xyz/openbmc_project/User/Ldap/Config/server.hpp>
@@ -22,9 +21,7 @@
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
using ConfigIface = sdbusplus::xyz::openbmc_project::User::Ldap::server::Config;
using EnableIface = sdbusplus::xyz::openbmc_project::Object::server::Enable;
-using DeleteIface = sdbusplus::xyz::openbmc_project::Object::server::Delete;
-using Ifaces =
- sdbusplus::server::object::object<ConfigIface, EnableIface, DeleteIface>;
+using Ifaces = sdbusplus::server::object::object<ConfigIface, EnableIface>;
using CreateIface = sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::User::Ldap::server::Create>;
@@ -143,10 +140,6 @@
*/
std::string lDAPBindDNPassword(std::string value) override;
- /** @brief Delete this D-bus object.
- */
- void delete_() override;
-
bool secureLDAP;
private: