diff options
author | Nagaraju Goruganti <ngorugan@in.ibm.com> | 2018-08-30 03:05:11 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-10-04 15:14:12 -0400 |
commit | 997f5e0087568a17dc1434fdaccb553dbcaa7b0e (patch) | |
tree | 22ad00a4ae8d5bd7288ba7e578f54ef15a9c85c4 /phosphor-ldap-config/main.cpp | |
parent | 0b14c471fc77cbcb93f435a46878b25f57741e0e (diff) | |
download | phosphor-user-manager-997f5e0087568a17dc1434fdaccb553dbcaa7b0e.tar.gz phosphor-user-manager-997f5e0087568a17dc1434fdaccb553dbcaa7b0e.zip |
phosphor-ldap-conf: add application to configure LDAP
The application implements the xyz.openbmc_project.User.Ldap.Config
and xyz.openbmc_project.User.Ldap.Create D-Bus interfaces to create
LDAP config file(for example generate nslcd.conf)
Change-Id: Idc7cc643c4143f9bc51182019926e1dd6125da2f
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
Diffstat (limited to 'phosphor-ldap-config/main.cpp')
-rw-r--r-- | phosphor-ldap-config/main.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/phosphor-ldap-config/main.cpp b/phosphor-ldap-config/main.cpp new file mode 100644 index 0000000..6bba619 --- /dev/null +++ b/phosphor-ldap-config/main.cpp @@ -0,0 +1,40 @@ +#include "config.h" +#include "ldap_configuration.hpp" +#include <experimental/filesystem> +#include <phosphor-logging/log.hpp> +#include <phosphor-logging/elog-errors.hpp> +#include <sdbusplus/bus.hpp> +#include <xyz/openbmc_project/Common/error.hpp> + +int main(int argc, char* argv[]) +{ + using namespace phosphor::logging; + using namespace sdbusplus::xyz::openbmc_project::Common::Error; + namespace fs = std::experimental::filesystem; + + if (!fs::exists(phosphor::ldap::defaultNslcdFile) || + !fs::exists(phosphor::ldap::nsSwitchFile) || + (!fs::exists(phosphor::ldap::LDAPNsSwitchFile) && + !fs::exists(phosphor::ldap::linuxNsSwitchFile))) + { + log<level::ERR>("Error starting LDAP Config App, configfile(s) are " + "missing, exiting!!!"); + elog<InternalFailure>(); + } + auto bus = sdbusplus::bus::new_default(); + + // Add sdbusplus ObjectManager for the 'root' path of the LDAP config. + sdbusplus::server::manager::manager objManager(bus, LDAP_CONFIG_ROOT); + + phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT); + + bus.request_name(LDAP_CONFIG_BUSNAME); + + while (true) + { + bus.process_discard(); + bus.wait(); + } + + return 0; +} |