From bfb99235e323e31689e280867103d3bc2e39ac22 Mon Sep 17 00:00:00 2001 From: Jerzi Kaminsky Date: Sat, 15 Apr 2017 17:16:32 +0300 Subject: Move get_feature_policy to sway/security.c --- sway/security.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sway/security.c') 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); -- cgit v1.2.3-54-g00ecf