Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 1 | #include "config.h" |
Ratan Gupta | e1f4db6 | 2019-04-11 18:57:42 +0530 | [diff] [blame^] | 2 | #include "ldap_config_mgr.hpp" |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 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 | |
| 9 | int 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 Goruganti | d514e5d | 2018-11-08 03:07:25 -0600 | [diff] [blame] | 14 | fs::path configDir = fs::path(LDAP_CONFIG_FILE).parent_path(); |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 15 | |
Nagaraju Goruganti | d514e5d | 2018-11-08 03:07:25 -0600 | [diff] [blame] | 16 | if (!fs::exists(configDir / phosphor::ldap::defaultNslcdFile) || |
Deepak Kodihalli | 5088e54 | 2018-10-28 06:53:25 -0500 | [diff] [blame] | 17 | !fs::exists(configDir / phosphor::ldap::nsSwitchFile)) |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 18 | { |
| 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 Goruganti | 3b4d06a | 2018-11-08 03:13:38 -0600 | [diff] [blame] | 28 | phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT, LDAP_CONFIG_FILE, |
Ratan Gupta | 95a2931 | 2019-02-18 20:34:10 +0530 | [diff] [blame] | 29 | LDAP_CONF_PERSIST_PATH, TLS_CACERT_FILE); |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 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 | } |