aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 73f932b7deb6..31917ac730af 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -187,7 +187,8 @@ static struct list_head audit_filter_list[AUDIT_NR_FILTERS] = {
187 LIST_HEAD_INIT(audit_filter_list[2]), 187 LIST_HEAD_INIT(audit_filter_list[2]),
188 LIST_HEAD_INIT(audit_filter_list[3]), 188 LIST_HEAD_INIT(audit_filter_list[3]),
189 LIST_HEAD_INIT(audit_filter_list[4]), 189 LIST_HEAD_INIT(audit_filter_list[4]),
190#if AUDIT_NR_FILTERS != 5 190 LIST_HEAD_INIT(audit_filter_list[5]),
191#if AUDIT_NR_FILTERS != 6
191#error Fix audit_filter_list initialiser 192#error Fix audit_filter_list initialiser
192#endif 193#endif
193}; 194};
@@ -663,6 +664,38 @@ int audit_filter_user(struct netlink_skb_parms *cb, int type)
663 return ret; /* Audit by default */ 664 return ret; /* Audit by default */
664} 665}
665 666
667int audit_filter_type(int type)
668{
669 struct audit_entry *e;
670 int result = 0;
671
672 rcu_read_lock();
673 if (list_empty(&audit_filter_list[AUDIT_FILTER_TYPE]))
674 goto unlock_and_return;
675
676 list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_TYPE],
677 list) {
678 struct audit_rule *rule = &e->rule;
679 int i;
680 for (i = 0; i < rule->field_count; i++) {
681 u32 field = rule->fields[i] & ~AUDIT_OPERATORS;
682 u32 op = rule->fields[i] & AUDIT_OPERATORS;
683 u32 value = rule->values[i];
684 if ( field == AUDIT_MSGTYPE ) {
685 result = audit_comparator(type, op, value);
686 if (!result)
687 break;
688 }
689 }
690 if (result)
691 goto unlock_and_return;
692 }
693unlock_and_return:
694 rcu_read_unlock();
695 return result;
696}
697
698
666/* This should be called with task_lock() held. */ 699/* This should be called with task_lock() held. */
667static inline struct audit_context *audit_get_context(struct task_struct *tsk, 700static inline struct audit_context *audit_get_context(struct task_struct *tsk,
668 int return_valid, 701 int return_valid,