React to nsswitch config file changes

There's just one nsswitch config file now (instead of a default, an
_linux and an _ldap). Make fixes in code relevant to this.

Change-Id: I92362aac7a1f5e034cea06e9299f7e574dc2fab9
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
diff --git a/phosphor-ldap-config/ldap_configuration.cpp b/phosphor-ldap-config/ldap_configuration.cpp
index be6c1cc..8503929 100644
--- a/phosphor-ldap-config/ldap_configuration.cpp
+++ b/phosphor-ldap-config/ldap_configuration.cpp
@@ -53,9 +53,6 @@
 
         fs::copy_file(configDir / defaultNslcdFile, LDAP_CONFIG_FILE,
                       fs::copy_options::overwrite_existing);
-
-        fs::copy_file(configDir / linuxNsSwitchFile, configDir / nsSwitchFile,
-                      fs::copy_options::overwrite_existing);
     }
     catch (const std::exception& e)
     {
@@ -441,18 +438,6 @@
 
     // With current implementation we support only one LDAP server.
     deleteObject();
-    try
-    {
-        fs::path configDir = fs::path(configFilePath.c_str()).parent_path();
-        fs::copy_file(configDir / LDAPNsSwitchFile, configDir / nsSwitchFile,
-                      fs::copy_options::overwrite_existing);
-    }
-    catch (const std::exception& e)
-    {
-        log<level::ERR>("Failed to rename Config Files while creating Object",
-                        entry("ERR=%s", e.what()));
-        elog<InternalFailure>();
-    }
 
     auto objPath = std::string(LDAP_CONFIG_DBUS_OBJ_PATH);
     configPtr = std::make_unique<Config>(
diff --git a/phosphor-ldap-config/ldap_configuration.hpp b/phosphor-ldap-config/ldap_configuration.hpp
index 0254d42..ad2c52a 100644
--- a/phosphor-ldap-config/ldap_configuration.hpp
+++ b/phosphor-ldap-config/ldap_configuration.hpp
@@ -18,8 +18,6 @@
 {
 static constexpr auto defaultNslcdFile = "nslcd.conf.default";
 static constexpr auto nsSwitchFile = "nsswitch.conf";
-static constexpr auto LDAPNsSwitchFile = "nsswitch_ldap.conf";
-static constexpr auto linuxNsSwitchFile = "nsswitch_linux.conf";
 
 using namespace phosphor::logging;
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
diff --git a/phosphor-ldap-config/main.cpp b/phosphor-ldap-config/main.cpp
index adbfdd3..3ecc0ca 100644
--- a/phosphor-ldap-config/main.cpp
+++ b/phosphor-ldap-config/main.cpp
@@ -14,9 +14,7 @@
     fs::path configDir = fs::path(LDAP_CONFIG_FILE).parent_path();
 
     if (!fs::exists(configDir / phosphor::ldap::defaultNslcdFile) ||
-        !fs::exists(configDir / phosphor::ldap::nsSwitchFile) ||
-        (!fs::exists(configDir / phosphor::ldap::LDAPNsSwitchFile) &&
-         !fs::exists(configDir / phosphor::ldap::linuxNsSwitchFile)))
+        !fs::exists(configDir / phosphor::ldap::nsSwitchFile))
     {
         log<level::ERR>("Error starting LDAP Config App, configfile(s) are "
                         "missing, exiting!!!");
diff --git a/test/ldap_config_test.cpp b/test/ldap_config_test.cpp
index a0447c9..0893a95 100644
--- a/test/ldap_config_test.cpp
+++ b/test/ldap_config_test.cpp
@@ -41,12 +41,6 @@
         fs.close();
         fs.open(dir / nsSwitchFile, std::fstream::out);
         fs.close();
-        fs.open(dir / LDAPNsSwitchFile, std::fstream::out);
-        fs.close();
-        fs.open(dir / linuxNsSwitchFile, std::fstream::out);
-        fs.close();
-        fs.open(dir / tslCacertFile, std::fstream::out);
-        fs.close();
     }
 
     void TearDown() override