blob: 7f5cdad57348498758e5756722a69d88f6c0307c [file] [log] [blame]
Nagaraju Goruganti997f5e02018-08-30 03:05:11 -05001#include "config.h"
Ratan Guptae1f4db62019-04-11 18:57:42 +05302#include "ldap_config_mgr.hpp"
Nagaraju Goruganti997f5e02018-08-30 03:05:11 -05003#include <experimental/filesystem>
4#include <phosphor-logging/log.hpp>
5#include <phosphor-logging/elog-errors.hpp>
6#include <sdbusplus/bus.hpp>
7#include <xyz/openbmc_project/Common/error.hpp>
8
9int main(int argc, char* argv[])
10{
11 using namespace phosphor::logging;
12 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
13 namespace fs = std::experimental::filesystem;
Nagaraju Gorugantid514e5d2018-11-08 03:07:25 -060014 fs::path configDir = fs::path(LDAP_CONFIG_FILE).parent_path();
Nagaraju Goruganti997f5e02018-08-30 03:05:11 -050015
Nagaraju Gorugantid514e5d2018-11-08 03:07:25 -060016 if (!fs::exists(configDir / phosphor::ldap::defaultNslcdFile) ||
Deepak Kodihalli5088e542018-10-28 06:53:25 -050017 !fs::exists(configDir / phosphor::ldap::nsSwitchFile))
Nagaraju Goruganti997f5e02018-08-30 03:05:11 -050018 {
19 log<level::ERR>("Error starting LDAP Config App, configfile(s) are "
20 "missing, exiting!!!");
21 elog<InternalFailure>();
22 }
23 auto bus = sdbusplus::bus::new_default();
24
25 // Add sdbusplus ObjectManager for the 'root' path of the LDAP config.
26 sdbusplus::server::manager::manager objManager(bus, LDAP_CONFIG_ROOT);
27
Nagaraju Goruganti3b4d06a2018-11-08 03:13:38 -060028 phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT, LDAP_CONFIG_FILE,
Zbigniew Kurzynski5d00cf22019-10-03 12:10:20 +020029 LDAP_CONF_PERSIST_PATH, TLS_CACERT_PATH,
Ratan Gupta22f13f12019-04-29 15:36:40 +053030 TLS_CERT_FILE);
Ratan Gupta21e88cb2019-04-12 17:15:52 +053031 mgr.restore();
Nagaraju Goruganti997f5e02018-08-30 03:05:11 -050032
33 bus.request_name(LDAP_CONFIG_BUSNAME);
34
35 while (true)
36 {
37 bus.process_discard();
38 bus.wait();
39 }
40
41 return 0;
42}