summaryrefslogtreecommitdiff
path: root/security/apparmor/audit.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-01-16 11:43:01 +0300
committerJohn Johansen <john.johansen@canonical.com>2017-01-16 12:18:46 +0300
commit47f6e5cc7355e4ff2fd7ace919aa9e291077c26b (patch)
tree28afc953505fa769dafd1532b141a779b80672b9 /security/apparmor/audit.c
parent55a26ebf630b6bf1cb7ddf8882fdc81d58afeaa2 (diff)
downloadlinux-47f6e5cc7355e4ff2fd7ace919aa9e291077c26b.tar.xz
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/audit.c')
-rw-r--r--security/apparmor/audit.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c
index 42101c42f446..bcd28d88df7b 100644
--- a/security/apparmor/audit.c
+++ b/security/apparmor/audit.c
@@ -20,59 +20,6 @@
#include "include/policy.h"
#include "include/policy_ns.h"
-const char *const op_table[] = {
- "null",
-
- "sysctl",
- "capable",
-
- "unlink",
- "mkdir",
- "rmdir",
- "mknod",
- "truncate",
- "link",
- "symlink",
- "rename_src",
- "rename_dest",
- "chmod",
- "chown",
- "getattr",
- "open",
-
- "file_perm",
- "file_lock",
- "file_mmap",
- "file_mprotect",
-
- "create",
- "post_create",
- "bind",
- "connect",
- "listen",
- "accept",
- "sendmsg",
- "recvmsg",
- "getsockname",
- "getpeername",
- "getsockopt",
- "setsockopt",
- "socket_shutdown",
-
- "ptrace",
-
- "exec",
- "change_hat",
- "change_profile",
- "change_onexec",
-
- "setprocattr",
- "setrlimit",
-
- "profile_replace",
- "profile_load",
- "profile_remove"
-};
const char *const audit_mode_names[] = {
"normal",
@@ -120,7 +67,7 @@ static void audit_pre(struct audit_buffer *ab, void *ca)
if (sa->aad->op) {
audit_log_format(ab, " operation=");
- audit_log_string(ab, op_table[sa->aad->op]);
+ audit_log_string(ab, sa->aad->op);
}
if (sa->aad->info) {