summaryrefslogtreecommitdiffstats
path: root/phosphor-ldap-config
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@in.ibm.com>2018-10-18 00:47:01 +0530
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-11-19 21:37:57 -0500
commitc9c86a2cf57a0cb87ba469ddd69169409fc2b55b (patch)
tree5a65ed41bf5c36d55e58cebaa62bd20ec9a7b780 /phosphor-ldap-config
parent53dd108be2a9b3bc97e199af371e39335c310d68 (diff)
downloadphosphor-user-manager-c9c86a2cf57a0cb87ba469ddd69169409fc2b55b.tar.gz
phosphor-user-manager-c9c86a2cf57a0cb87ba469ddd69169409fc2b55b.zip
phosphor-ldap-conf: Don't create the LDAP config object
During restore path(i.e while phosphor-ldap-conf service restarts) after parsing the file if any of the LDAP parameter(BindDN,BaseDN,URI) is having empty value then don't create the LDAP config object. Before this commit the config object was not being created but it throws a unnecessary log in the journal due to creation of errorlog. In restore path we don't want the errorlog. This commit fixes the problem of creating unnecesary log in the journal. Change-Id: I074fe96a6c6382bc2d31e91df1275756b57c1045 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com> Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
Diffstat (limited to 'phosphor-ldap-config')
-rw-r--r--phosphor-ldap-config/ldap_configuration.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/phosphor-ldap-config/ldap_configuration.cpp b/phosphor-ldap-config/ldap_configuration.cpp
index 5582bf1..3e31e41 100644
--- a/phosphor-ldap-config/ldap_configuration.cpp
+++ b/phosphor-ldap-config/ldap_configuration.cpp
@@ -540,6 +540,18 @@ void ConfigMgr::restore(const char* filePath)
lDAPType = ldap_base::Create::Type::OpenLdap;
}
+ // Don't create the config object if either of the field is empty.
+ if (configValues["uri"] == "" || configValues["binddn"] == "" ||
+ configValues["base"] == "")
+ {
+ log<level::INFO>(
+ "LDAP config parameter value missing",
+ entry("URI=%s", configValues["uri"].c_str()),
+ entry("BASEDN=%s", configValues["base"].c_str()),
+ entry("BINDDN=%s", configValues["binddn"].c_str()));
+ return;
+ }
+
createConfig(
std::move(configValues["uri"]), std::move(configValues["binddn"]),
std::move(configValues["base"]), std::move(configValues["bindpw"]),
OpenPOWER on IntegriCloud