| 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 |
no test coverage detected