initial commit with v2.6.9
[linux-2.6.9-moxart.git] / security / selinux / ss / constraint.h
blobe394fc9dfb971f74a1a0262e144b5c553865af93
1 /*
2 * A constraint is a condition that must be satisfied in
3 * order for one or more permissions to be granted.
4 * Constraints are used to impose additional restrictions
5 * beyond the type-based rules in `te' or the role-based
6 * transition rules in `rbac'. Constraints are typically
7 * used to prevent a process from transitioning to a new user
8 * identity or role unless it is in a privileged type.
9 * Constraints are likewise typically used to prevent a
10 * process from labeling an object with a different user
11 * identity.
13 * Author : Stephen Smalley, <sds@epoch.ncsc.mil>
15 #ifndef _SS_CONSTRAINT_H_
16 #define _SS_CONSTRAINT_H_
18 #include "ebitmap.h"
20 #define CEXPR_MAXDEPTH 5
22 struct constraint_expr {
23 #define CEXPR_NOT 1 /* not expr */
24 #define CEXPR_AND 2 /* expr and expr */
25 #define CEXPR_OR 3 /* expr or expr */
26 #define CEXPR_ATTR 4 /* attr op attr */
27 #define CEXPR_NAMES 5 /* attr op names */
28 u32 expr_type; /* expression type */
30 #define CEXPR_USER 1 /* user */
31 #define CEXPR_ROLE 2 /* role */
32 #define CEXPR_TYPE 4 /* type */
33 #define CEXPR_TARGET 8 /* target if set, source otherwise */
34 u32 attr; /* attribute */
36 #define CEXPR_EQ 1 /* == or eq */
37 #define CEXPR_NEQ 2 /* != */
38 #define CEXPR_DOM 3 /* dom */
39 #define CEXPR_DOMBY 4 /* domby */
40 #define CEXPR_INCOMP 5 /* incomp */
41 u32 op; /* operator */
43 struct ebitmap names; /* names */
45 struct constraint_expr *next; /* next expression */
48 struct constraint_node {
49 u32 permissions; /* constrained permissions */
50 struct constraint_expr *expr; /* constraint on permissions */
51 struct constraint_node *next; /* next constraint */
54 #endif /* _SS_CONSTRAINT_H_ */