1 #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 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; 14 fs::path configDir = fs::path(LDAP_CONFIG_FILE).parent_path(); 15 16 if (!fs::exists(configDir / phosphor::ldap::defaultNslcdFile) || 17 !fs::exists(configDir / phosphor::ldap::nsSwitchFile) || 18 (!fs::exists(configDir / phosphor::ldap::LDAPNsSwitchFile) && 19 !fs::exists(configDir / phosphor::ldap::linuxNsSwitchFile))) 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 30 phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT, LDAP_CONFIG_FILE, 31 TLS_CACERT_FILE); 32 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 } 43