diff options
Diffstat (limited to 'sway/security.c')
-rw-r--r-- | sway/security.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sway/security.c b/sway/security.c index a4cecf16..670cae56 100644 --- a/sway/security.c +++ b/sway/security.c | |||
@@ -11,6 +11,13 @@ struct feature_policy *alloc_feature_policy(const char *program) { | |||
11 | return policy; | 11 | return policy; |
12 | } | 12 | } |
13 | 13 | ||
14 | struct command_policy *alloc_command_policy(const char *command) { | ||
15 | struct command_policy *policy = malloc(sizeof(struct command_policy)); | ||
16 | policy->command = strdup(command); | ||
17 | policy->context = CONTEXT_ALL; | ||
18 | return policy; | ||
19 | } | ||
20 | |||
14 | enum secure_feature get_feature_policy(pid_t pid) { | 21 | enum secure_feature get_feature_policy(pid_t pid) { |
15 | const char *fmt = "/proc/%d/exe"; | 22 | const char *fmt = "/proc/%d/exe"; |
16 | int pathlen = snprintf(NULL, 0, fmt, pid); | 23 | int pathlen = snprintf(NULL, 0, fmt, pid); |
@@ -50,9 +57,6 @@ enum command_context get_command_policy(const char *cmd) { | |||
50 | 57 | ||
51 | for (int i = 0; i < config->command_policies->length; ++i) { | 58 | for (int i = 0; i < config->command_policies->length; ++i) { |
52 | struct command_policy *policy = config->command_policies->items[i]; | 59 | struct command_policy *policy = config->command_policies->items[i]; |
53 | if (strcmp(policy->command, "*") == 0) { | ||
54 | default_policy = policy->context; | ||
55 | } | ||
56 | if (strcmp(policy->command, cmd) == 0) { | 60 | if (strcmp(policy->command, cmd) == 0) { |
57 | return policy->context; | 61 | return policy->context; |
58 | } | 62 | } |