[PATCH 10/12] Tell git about security/selinux/include/audit.h

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: James Morris
Date: Thursday, April 17, 2008 - 4:06 am

Signed-off-by: James Morris <jmorris@namei.org>
---
 security/selinux/include/audit.h |   65 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 security/selinux/include/audit.h

diff --git a/security/selinux/include/audit.h b/security/selinux/include/audit.h
new file mode 100644
index 0000000..6c8b9ef
--- /dev/null
+++ b/security/selinux/include/audit.h
@@ -0,0 +1,65 @@
+/*
+ * SELinux support for the Audit LSM hooks
+ *
+ * Most of below header was moved from include/linux/selinux.h which 
+ * is released under below copyrights:
+ *
+ * Author: James Morris <jmorris@redhat.com>
+ *
+ * Copyright (C) 2005 Red Hat, Inc., James Morris <jmorris@redhat.com>
+ * Copyright (C) 2006 Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
+ * Copyright (C) 2006 IBM Corporation, Timothy R. Chavez <tinytim@us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ */
+
+#ifndef _SELINUX_AUDIT_H
+#define _SELINUX_AUDIT_H
+
+/**
+ *	selinux_audit_rule_init - alloc/init an selinux audit rule structure.
+ *	@field: the field this rule refers to
+ *	@op: the operater the rule uses
+ *	@rulestr: the text "target" of the rule
+ *	@rule: pointer to the new rule structure returned via this
+ *
+ *	Returns 0 if successful, -errno if not.  On success, the rule structure
+ *	will be allocated internally.  The caller must free this structure with
+ *	selinux_audit_rule_free() after use.
+ */
+int selinux_audit_rule_init(u32 field, u32 op, char *rulestr, void **rule);
+
+/**
+ *	selinux_audit_rule_free - free an selinux audit rule structure.
+ *	@rule: pointer to the audit rule to be freed
+ *
+ *	This will free all memory associated with the given rule.
+ *	If @rule is NULL, no operation is performed.
+ */
+void selinux_audit_rule_free(void *rule);
+
+/**
+ *	selinux_audit_rule_match - determine if a context ID matches a rule.
+ *	@sid: the context ID to check
+ *	@field: the field this rule refers to
+ *	@op: the operater the rule uses
+ *	@rule: pointer to the audit rule to check against
+ *	@actx: the audit context (can be NULL) associated with the check
+ *
+ *	Returns 1 if the context id matches the rule, 0 if it does not, and
+ *	-errno on failure.
+ */
+int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *rule,
+                             struct audit_context *actx);
+
+/**
+ *	selinux_audit_rule_known - check to see if rule contains selinux fields.
+ *	@rule: rule to be checked
+ *	Returns 1 if there are selinux fields specified in the rule, 0 otherwise.
+ */
+int selinux_audit_rule_known(struct audit_krule *krule);
+
+#endif /* _SELINUX_AUDIT_H */
+
-- 
1.5.4.2

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Security testing tree patch review for 2.6.26, James Morris, (Thu Apr 17, 4:05 am)
[PATCH 04/12] Netlink: Use generic LSM hook, James Morris, (Thu Apr 17, 4:06 am)
[PATCH 05/12] SELinux: remove redundant exports, James Morris, (Thu Apr 17, 4:06 am)
[PATCH 09/12] Audit: Final renamings and cleanup, James Morris, (Thu Apr 17, 4:06 am)
[PATCH 10/12] Tell git about security/selinux/include/audit.h, James Morris, (Thu Apr 17, 4:06 am)
[PATCH 2.6.26 #repost] Smack: Integrate with Audit, Ahmed S. Darwish, (Thu Apr 17, 9:10 am)
Re: Security testing tree patch review for 2.6.26, Casey Schaufler, (Fri Apr 18, 11:11 am)
Re: [PATCH 2.6.26 #repost] Smack: Integrate with Audit, Casey Schaufler, (Sat Apr 19, 3:19 pm)
Re: Security testing tree patch review for 2.6.26, Alexander Viro, (Mon Apr 28, 9:32 am)