MCPcopy Create free account
hub / github.com/USBGuard/usbguard / load

Method load

src/Daemon/LDAPRuleSet.cpp:70–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 }
69
70 void LDAPRuleSet::load()
71 {
72 std::shared_ptr<LDAPMessage> message = _LDAP->query(_LDAP->getRuleQuery());
73 std::vector<std::pair<long, std::string>> v = _LDAP->ldapToRules(message);
74 std::sort(v.begin(), v.end(), [](std::pair<long, std::string> a, std::pair<long, std::string> b) {
75 return a.first < b.first;
76 });
77 size_t rule_number = 1;
78
79 for (auto _rule: v) {
80 USBGUARD_LOG(Info) << "Parsing rule: " << rule_number << " RuleOrder: "<< _rule.first;
81 USBGUARD_LOG(Info) << _rule.second;
82 auto rule = parseRuleFromString(_rule.second, "", rule_number);
83 appendRule(rule, Rule::LastID, /*lock=*/false);
84 rule_number++;
85 USBGUARD_LOG(Info);
86 }
87
88 _last_update = std::time(nullptr);
89 }
90
91 void LDAPRuleSet::save() {}
92

Callers 5

loadRulesMethod · 0.45
ThreadMethod · 0.45
ThreadClass · 0.45

Calls 4

parseRuleFromStringFunction · 0.85
queryMethod · 0.80
getRuleQueryMethod · 0.80
ldapToRulesMethod · 0.80

Tested by

no test coverage detected