diff options
author | Jerzi Kaminsky <JerziKaminsky@users.noreply.github.com> | 2017-04-15 17:16:32 +0300 |
---|---|---|
committer | Jerzi Kaminsky <JerziKaminsky@users.noreply.github.com> | 2017-04-16 17:09:53 +0300 |
commit | bfb99235e323e31689e280867103d3bc2e39ac22 (patch) | |
tree | 8332d7d88a2bcca48bf62a212ad55ee01ff87f6b /sway | |
parent | b4357a8eb6b9a5c0452fc0d127e37e54dc09e1a0 (diff) | |
download | sway-bfb99235e323e31689e280867103d3bc2e39ac22.tar.xz |
Move get_feature_policy to sway/security.c
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands/permit.c | 19 | ||||
-rw-r--r-- | sway/security.c | 20 |
2 files changed, 20 insertions, 19 deletions
diff --git a/sway/commands/permit.c b/sway/commands/permit.c index 4a78ef0d..c55f46d8 100644 --- a/sway/commands/permit.c +++ b/sway/commands/permit.c @@ -38,25 +38,6 @@ static enum secure_feature get_features(int argc, char **argv, return features; } -static struct feature_policy *get_feature_policy(const char *name) { - struct feature_policy *policy = NULL; - for (int i = 0; i < config->feature_policies->length; ++i) { - struct feature_policy *p = config->feature_policies->items[i]; - if (strcmp(p->program, name) == 0) { - policy = p; - break; - } - } - if (!policy) { - policy = alloc_feature_policy(name); - if (!policy) { - sway_abort("Unable to allocate security policy"); - } - list_add(config->feature_policies, policy); - } - return policy; -} - struct cmd_results *cmd_permit(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "permit", EXPECTED_MORE_THAN, 1))) { 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) { return link; } +struct feature_policy *get_feature_policy(const char *name) { + struct feature_policy *policy = NULL; + + for (int i = 0; i < config->feature_policies->length; ++i) { + struct feature_policy *p = config->feature_policies->items[i]; + if (strcmp(p->program, name) == 0) { + policy = p; + break; + } + } + if (!policy) { + policy = alloc_feature_policy(name); + if (!policy) { + sway_abort("Unable to allocate security policy"); + } + list_add(config->feature_policies, policy); + } + return policy; +} + uint32_t get_feature_policy_mask(pid_t pid) { uint32_t default_policy = 0; const char *link = get_pid_exe(pid); |