blob: 6bba619aa09ee2984e42e443c77c1a4bf05a68ca [file] [log] [blame]
Nagaraju Goruganti997f5e02018-08-30 03:05:11 -05001#include "config.h"
2#include "ldap_configuration.hpp"
3#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;
14
15 if (!fs::exists(phosphor::ldap::defaultNslcdFile) ||
16 !fs::exists(phosphor::ldap::nsSwitchFile) ||
17 (!fs::exists(phosphor::ldap::LDAPNsSwitchFile) &&
18 !fs::exists(phosphor::ldap::linuxNsSwitchFile)))
19 {
20 log<level::ERR>("Error starting LDAP Config App, configfile(s) are "
21 "missing, exiting!!!");
22 elog<InternalFailure>();
23 }
24 auto bus = sdbusplus::bus::new_default();
25
26 // Add sdbusplus ObjectManager for the 'root' path of the LDAP config.
27 sdbusplus::server::manager::manager objManager(bus, LDAP_CONFIG_ROOT);
28
29 phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT);
30
31 bus.request_name(LDAP_CONFIG_BUSNAME);
32
33 while (true)
34 {
35 bus.process_discard();
36 bus.wait();
37 }
38
39 return 0;
40}