We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f14e3a8 commit 52ef1d1Copy full SHA for 52ef1d1
native/src/core/deny/utils.cpp
@@ -10,6 +10,7 @@
10
#include <base.hpp>
11
#include <sqlite.hpp>
12
#include <core.hpp>
13
+#include <selinux.hpp>
14
15
#include "deny.hpp"
16
@@ -108,12 +109,11 @@ static bool proc_name_match(int pid, string_view name) {
108
109
110
bool proc_context_match(int pid, string_view context) {
111
char buf[PATH_MAX];
- sprintf(buf, "/proc/%d/attr/current", pid);
112
- if (auto fp = open_file(buf, "re")) {
113
- fgets(buf, sizeof(buf), fp.get());
114
- if (str_starts(buf, context)) {
115
- return true;
116
- }
+ char con[1024];
+
+ sprintf(buf, "/proc/%d", pid);
+ if (lgetfilecon(buf, { con, sizeof(con) }) >= 0) {
+ return str_starts(con, context);
117
}
118
return false;
119
0 commit comments