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" |
Gunnar Mills | 703131f | 2020-10-28 14:26:33 -0500 | [diff] [blame^] | 3 | #include <filesystem> |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 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; |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 13 | |
Gunnar Mills | 703131f | 2020-10-28 14:26:33 -0500 | [diff] [blame^] | 14 | std::filesystem::path configDir = |
| 15 | std::filesystem::path(LDAP_CONFIG_FILE).parent_path(); |
| 16 | |
| 17 | if (!std::filesystem::exists(configDir / |
| 18 | phosphor::ldap::defaultNslcdFile) || |
| 19 | !std::filesystem::exists(configDir / phosphor::ldap::nsSwitchFile)) |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 20 | { |
| 21 | log<level::ERR>("Error starting LDAP Config App, configfile(s) are " |
| 22 | "missing, exiting!!!"); |
| 23 | elog<InternalFailure>(); |
| 24 | } |
| 25 | auto bus = sdbusplus::bus::new_default(); |
| 26 | |
| 27 | // Add sdbusplus ObjectManager for the 'root' path of the LDAP config. |
| 28 | sdbusplus::server::manager::manager objManager(bus, LDAP_CONFIG_ROOT); |
| 29 | |
Nagaraju Goruganti | 3b4d06a | 2018-11-08 03:13:38 -0600 | [diff] [blame] | 30 | phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT, LDAP_CONFIG_FILE, |
Zbigniew Kurzynski | 5d00cf2 | 2019-10-03 12:10:20 +0200 | [diff] [blame] | 31 | LDAP_CONF_PERSIST_PATH, TLS_CACERT_PATH, |
Ratan Gupta | 22f13f1 | 2019-04-29 15:36:40 +0530 | [diff] [blame] | 32 | TLS_CERT_FILE); |
Ratan Gupta | 21e88cb | 2019-04-12 17:15:52 +0530 | [diff] [blame] | 33 | mgr.restore(); |
Nagaraju Goruganti | 997f5e0 | 2018-08-30 03:05:11 -0500 | [diff] [blame] | 34 | |
| 35 | bus.request_name(LDAP_CONFIG_BUSNAME); |
| 36 | |
| 37 | while (true) |
| 38 | { |
| 39 | bus.process_discard(); |
| 40 | bus.wait(); |
| 41 | } |
| 42 | |
| 43 | return 0; |
| 44 | } |