Path: blob/master/security/selinux/include/audit.h
10817 views
/*1* SELinux support for the Audit LSM hooks2*3* Most of below header was moved from include/linux/selinux.h which4* is released under below copyrights:5*6* Author: James Morris <[email protected]>7*8* Copyright (C) 2005 Red Hat, Inc., James Morris <[email protected]>9* Copyright (C) 2006 Trusted Computer Solutions, Inc. <[email protected]>10* Copyright (C) 2006 IBM Corporation, Timothy R. Chavez <[email protected]>11*12* This program is free software; you can redistribute it and/or modify13* it under the terms of the GNU General Public License version 2,14* as published by the Free Software Foundation.15*/1617#ifndef _SELINUX_AUDIT_H18#define _SELINUX_AUDIT_H1920/**21* selinux_audit_rule_init - alloc/init an selinux audit rule structure.22* @field: the field this rule refers to23* @op: the operater the rule uses24* @rulestr: the text "target" of the rule25* @rule: pointer to the new rule structure returned via this26*27* Returns 0 if successful, -errno if not. On success, the rule structure28* will be allocated internally. The caller must free this structure with29* selinux_audit_rule_free() after use.30*/31int selinux_audit_rule_init(u32 field, u32 op, char *rulestr, void **rule);3233/**34* selinux_audit_rule_free - free an selinux audit rule structure.35* @rule: pointer to the audit rule to be freed36*37* This will free all memory associated with the given rule.38* If @rule is NULL, no operation is performed.39*/40void selinux_audit_rule_free(void *rule);4142/**43* selinux_audit_rule_match - determine if a context ID matches a rule.44* @sid: the context ID to check45* @field: the field this rule refers to46* @op: the operater the rule uses47* @rule: pointer to the audit rule to check against48* @actx: the audit context (can be NULL) associated with the check49*50* Returns 1 if the context id matches the rule, 0 if it does not, and51* -errno on failure.52*/53int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *rule,54struct audit_context *actx);5556/**57* selinux_audit_rule_known - check to see if rule contains selinux fields.58* @rule: rule to be checked59* Returns 1 if there are selinux fields specified in the rule, 0 otherwise.60*/61int selinux_audit_rule_known(struct audit_krule *krule);6263#endif /* _SELINUX_AUDIT_H */64656667