blob: 60109d4beb0bc7edf7282563a458764479cca2f4 [file] [log] [blame]
Tom Joseph536ea322018-09-14 10:02:20 +05301#include "config.h"
Patrick Williams9638afb2021-02-22 17:16:24 -06002
Tom Joseph536ea322018-09-14 10:02:20 +05303#include "ldap_mapper_mgr.hpp"
4
Patrick Williams9638afb2021-02-22 17:16:24 -06005#include <filesystem>
6#include <string>
7
Ratan Gupta0b1ad3d2022-01-09 14:09:35 +05308int main(int /*argc*/, char** /*argv*/)
Tom Joseph536ea322018-09-14 10:02:20 +05309{
10 auto bus = sdbusplus::bus::new_default();
11 sdbusplus::server::manager::manager objManager(
12 bus, phosphor::user::mapperMgrRoot);
13
Tom Josephf5bd8912018-11-19 09:49:21 +053014 phosphor::user::LDAPMapperMgr mapperMgr(bus, phosphor::user::mapperMgrRoot,
15 LDAP_MAPPER_PERSIST_PATH);
Tom Joseph536ea322018-09-14 10:02:20 +053016
Tom Joseph0b14c472018-09-30 01:42:59 +053017 // Create a directory to persist errors.
Gunnar Mills703131f2020-10-28 14:26:33 -050018 std::filesystem::create_directories(LDAP_MAPPER_PERSIST_PATH);
Tom Joseph0b14c472018-09-30 01:42:59 +053019
20 // Restore the serialized LDAP group privilege mapping.
21 mapperMgr.restore();
22
Tom Joseph536ea322018-09-14 10:02:20 +053023 // Claim the bus name for the application
24 bus.request_name(LDAP_MAPPER_MANAGER_BUSNAME);
25
26 // Wait for client request
27 while (true)
28 {
29 // Process D-Bus calls
30 bus.process_discard();
31 bus.wait();
32 }
33 return 0;
34}