Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
audit.h
Go to the documentation of this file.
1 /*
2  * AppArmor security module
3  *
4  * This file contains AppArmor auditing function definitions.
5  *
6  * Copyright (C) 1998-2008 Novell/SUSE
7  * Copyright 2009-2010 Canonical Ltd.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation, version 2 of the
12  * License.
13  */
14 
15 #ifndef __AA_AUDIT_H
16 #define __AA_AUDIT_H
17 
18 #include <linux/audit.h>
19 #include <linux/fs.h>
20 #include <linux/lsm_audit.h>
21 #include <linux/sched.h>
22 #include <linux/slab.h>
23 
24 #include "file.h"
25 
26 struct aa_profile;
27 
28 extern const char *const audit_mode_names[];
29 #define AUDIT_MAX_INDEX 5
30 
31 enum audit_mode {
32  AUDIT_NORMAL, /* follow normal auditing of accesses */
33  AUDIT_QUIET_DENIED, /* quiet all denied access messages */
34  AUDIT_QUIET, /* quiet all messages */
35  AUDIT_NOQUIET, /* do not quiet audit messages */
36  AUDIT_ALL /* audit all accesses */
37 };
38 
39 enum audit_type {
48 };
49 
50 extern const char *const op_table[];
51 enum aa_ops {
53 
56 
70 
75 
89 
91 
96 
99 
103 };
104 
105 
107  int error;
108  int op;
109  int type;
110  void *profile;
111  const char *name;
112  const char *info;
113  struct task_struct *tsk;
114  union {
115  void *target;
116  struct {
117  long pos;
118  void *target;
119  } iface;
120  struct {
121  int rlim;
122  unsigned long max;
123  } rlim;
124  struct {
125  const char *target;
129  } fs;
130  };
131 };
132 
133 /* define a short hand for apparmor_audit_data structure */
134 #define aad apparmor_audit_data
135 
136 void aa_audit_msg(int type, struct common_audit_data *sa,
137  void (*cb) (struct audit_buffer *, void *));
138 int aa_audit(int type, struct aa_profile *profile, gfp_t gfp,
139  struct common_audit_data *sa,
140  void (*cb) (struct audit_buffer *, void *));
141 
142 static inline int complain_error(int error)
143 {
144  if (error == -EPERM || error == -EACCES)
145  return 0;
146  return error;
147 }
148 
149 #endif /* __AA_AUDIT_H */