Skip to content

Commit

Permalink
rm filter to "allow"
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperlarson committed Sep 2, 2024
1 parent 47a3710 commit 6a8f592
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion include/forti_api/dns_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ struct DNSFilterOptions {

void allow(unsigned int category) {
const auto& [match_found, index] = binary_search(category);
if (match_found) filters[index].action = "allow";
if (match_found) {
std::vector<Filter> new_filters(filters.size() - 1);
if (index == filters.size() - 1) filters.resize(filters.size() - 1);
else if (index == 0) std::move(filters.begin() + 1, filters.end(), new_filters.begin());
else {
std::move(filters.begin(), filters.begin() + index, new_filters.begin());
std::move(filters.begin() + index + 1, filters.end(), new_filters.begin() + index);
}
filters = new_filters;
}
}

void monitor(unsigned int category) {
Expand Down

0 comments on commit 6a8f592

Please sign in to comment.