summaryrefslogtreecommitdiffstats
path: root/phosphor-ldap-config/ldap_configuration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'phosphor-ldap-config/ldap_configuration.cpp')
-rw-r--r--phosphor-ldap-config/ldap_configuration.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/phosphor-ldap-config/ldap_configuration.cpp b/phosphor-ldap-config/ldap_configuration.cpp
index 1369362..31e4e75 100644
--- a/phosphor-ldap-config/ldap_configuration.cpp
+++ b/phosphor-ldap-config/ldap_configuration.cpp
@@ -49,10 +49,12 @@ void Config::delete_()
parent.deleteObject();
try
{
- fs::copy_file(defaultNslcdFile, LDAP_CONFIG_FILE,
+ fs::path configDir = fs::path(configFilePath.c_str()).parent_path();
+
+ fs::copy_file(configDir / defaultNslcdFile, LDAP_CONFIG_FILE,
fs::copy_options::overwrite_existing);
- fs::copy_file(linuxNsSwitchFile, nsSwitchFile,
+ fs::copy_file(configDir / linuxNsSwitchFile, configDir / nsSwitchFile,
fs::copy_options::overwrite_existing);
}
catch (const std::exception& e)
@@ -236,6 +238,10 @@ std::string Config::lDAPBindDN(std::string value)
{
throw;
}
+ catch (const InvalidArgument& e)
+ {
+ throw;
+ }
catch (const std::exception& e)
{
log<level::ERR>(e.what());
@@ -270,6 +276,10 @@ std::string Config::lDAPBaseDN(std::string value)
{
throw;
}
+ catch (const InvalidArgument& e)
+ {
+ throw;
+ }
catch (const std::exception& e)
{
log<level::ERR>(e.what());
@@ -415,7 +425,8 @@ std::string
deleteObject();
try
{
- fs::copy_file(LDAPNsSwitchFile, nsSwitchFile,
+ 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)
@@ -442,7 +453,7 @@ void ConfigMgr::restore(const char* filePath)
if (!fs::exists(filePath))
{
log<level::ERR>("Config file doesn't exists",
- entry("LDAP_CONFIG_FILE=%s", LDAP_CONFIG_FILE));
+ entry("LDAP_CONFIG_FILE=%s", configFilePath.c_str()));
return;
}
OpenPOWER on IntegriCloud