summaryrefslogtreecommitdiff
path: root/security/apparmor/policy.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-01-16 00:43:01 -0800
committerJohn Johansen <john.johansen@canonical.com>2017-01-16 01:18:46 -0800
commit47f6e5cc7355e4ff2fd7ace919aa9e291077c26b (patch)
tree28afc953505fa769dafd1532b141a779b80672b9 /security/apparmor/policy.c
parent55a26ebf630b6bf1cb7ddf8882fdc81d58afeaa2 (diff)
apparmor: change op from int to const char *
Having ops be an integer that is an index into an op name table is awkward and brittle. Every op change requires an edit for both the op constant and a string in the table. Instead switch to using const strings directly, eliminating the need for the table that needs to be kept in sync. Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/policy.c')
-rw-r--r--security/apparmor/policy.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 4ec24474bd1a..17754ee58ff1 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -606,7 +606,7 @@ static void audit_cb(struct audit_buffer *ab, void *va)
*
* Returns: the error to be returned after audit is done
*/
-static int audit_policy(struct aa_profile *profile, int op, gfp_t gfp,
+static int audit_policy(struct aa_profile *profile, const char *op, gfp_t gfp,
const char *nsname, const char *name,
const char *info, int error)
{
@@ -670,7 +670,8 @@ bool policy_admin_capable(struct aa_ns *ns)
*
* Returns: 0 if the task is allowed to manipulate policy else error
*/
-int aa_may_manage_policy(struct aa_profile *profile, struct aa_ns *ns, int op)
+int aa_may_manage_policy(struct aa_profile *profile, struct aa_ns *ns,
+ const char *op)
{
/* check if loading policy is locked out */
if (aa_g_lock_policy)
@@ -819,7 +820,7 @@ ssize_t aa_replace_profiles(struct aa_ns *view, struct aa_profile *profile,
const char *ns_name, *info = NULL;
struct aa_ns *ns = NULL;
struct aa_load_ent *ent, *tmp;
- int op = OP_PROF_REPL;
+ const char *op = OP_PROF_REPL;
ssize_t count, error;
LIST_HEAD(lh);