aboutsummaryrefslogtreecommitdiffstats
path: root/sway/security.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/security.c')
-rw-r--r--sway/security.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sway/security.c b/sway/security.c
index 5b762b07..96af2b88 100644
--- a/sway/security.c
+++ b/sway/security.c
@@ -94,6 +94,26 @@ static const char *get_pid_exe(pid_t pid) {
94 return link; 94 return link;
95} 95}
96 96
97struct feature_policy *get_feature_policy(const char *name) {
98 struct feature_policy *policy = NULL;
99
100 for (int i = 0; i < config->feature_policies->length; ++i) {
101 struct feature_policy *p = config->feature_policies->items[i];
102 if (strcmp(p->program, name) == 0) {
103 policy = p;
104 break;
105 }
106 }
107 if (!policy) {
108 policy = alloc_feature_policy(name);
109 if (!policy) {
110 sway_abort("Unable to allocate security policy");
111 }
112 list_add(config->feature_policies, policy);
113 }
114 return policy;
115}
116
97uint32_t get_feature_policy_mask(pid_t pid) { 117uint32_t get_feature_policy_mask(pid_t pid) {
98 uint32_t default_policy = 0; 118 uint32_t default_policy = 0;
99 const char *link = get_pid_exe(pid); 119 const char *link = get_pid_exe(pid);