summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-18 11:48:56 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-18 11:48:56 +0100
commita4330fe3787a97fe5b55eb787ce5746cea46ad14 (patch)
treedd0142a638d4d7582286c1cd9bbb40714e7c46e8 /src/config/ConfigManager.cpp
parent716d713b04b1957c5d961810d851e6719142e117 (diff)
misc: scan ppids in exec rules
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 9454c16a..375dde1b 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1673,18 +1673,22 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
returns.push_back(rule);
}
- const uint64_t PID = pWindow->getPID();
- bool anyExecFound = false;
+ std::vector<uint64_t> PIDs = {(uint64_t)pWindow->getPID()};
+ while (getPPIDof(PIDs.back()) > 10)
+ PIDs.push_back(getPPIDof(PIDs.back()));
+
+ bool anyExecFound = false;
for (auto& er : execRequestedRules) {
- if (er.iPid == PID) {
+ if (std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == er.iPid; })) {
returns.push_back({er.szRule, "execRule"});
anyExecFound = true;
}
}
if (anyExecFound) // remove exec rules to unclog searches in the future, why have the garbage here.
- execRequestedRules.erase(std::remove_if(execRequestedRules.begin(), execRequestedRules.end(), [&](const SExecRequestedRule& other) { return other.iPid == PID; }));
+ execRequestedRules.erase(std::remove_if(execRequestedRules.begin(), execRequestedRules.end(),
+ [&](const SExecRequestedRule& other) { return std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == other.iPid; }); }));
return returns;
}