Blame refpolicy/policy/support/misc_macros.spt
|
Chris PeBenito |
de9649 |
|
|
Chris PeBenito |
de9649 |
########################################
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
de9649 |
# Helper macros
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
de9649 |
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
de9649 |
# shiftn(num,list...)
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
de9649 |
# shift the list num times
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
de9649 |
define(`shiftn',`ifelse($1,0,`shift($*)',`shiftn(decr($1),shift(shift($*)))')')
|
|
Chris PeBenito |
de9649 |
|
|
Chris PeBenito |
de9649 |
########################################
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
712566 |
# gen_user(username, role_set, mls_defaultlevel, mls_range)
|
|
Chris PeBenito |
712566 |
#
|
|
Chris PeBenito |
712566 |
define(`gen_user',`
|
|
Chris PeBenito |
712566 |
user $1 roles { $2 } ifdef(`enable_mls', `level $3 range $4');
|
|
Chris PeBenito |
712566 |
')
|
|
Chris PeBenito |
712566 |
|
|
Chris PeBenito |
712566 |
########################################
|
|
Chris PeBenito |
712566 |
#
|
|
Karl MacMillan |
eb5e23 |
# gen_con(context,sensitivity)
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
de9649 |
# Optionally put the sensitivity for the file
|
|
Chris PeBenito |
de9649 |
#
|
|
Chris PeBenito |
de9649 |
define(`context_template',`ifdef(`enable_mls',`$1:$2',`$1')') dnl
|
|
Chris PeBenito |
e3fd77 |
|
|
Chris PeBenito |
21871a |
########################################
|
|
Chris PeBenito |
21871a |
#
|
|
Chris PeBenito |
21871a |
# can_exec(domain,executable)
|
|
Chris PeBenito |
21871a |
#
|
|
Chris PeBenito |
8c2f3a |
define(`can_exec',`
|
|
Chris PeBenito |
8c2f3a |
gen_require(`
|
|
Chris PeBenito |
8c2f3a |
class file { rx_file_perms execute_no_trans };
|
|
Chris PeBenito |
8c2f3a |
')
|
|
Chris PeBenito |
8c2f3a |
|
|
Chris PeBenito |
8c2f3a |
allow $1 $2:file { rx_file_perms execute_no_trans };
|
|
Chris PeBenito |
8c2f3a |
')
|
|
Chris PeBenito |
21871a |
|
|
Chris PeBenito |
21871a |
########################################
|
|
Chris PeBenito |
21871a |
#
|
|
Chris PeBenito |
21871a |
# gen_bool(name,default_value)
|
|
Chris PeBenito |
21871a |
#
|
|
Chris PeBenito |
21871a |
define(`gen_bool',`
|
|
Chris PeBenito |
21871a |
bool $1 dflt_or_overr(`$1'_conf,$2);
|
|
Chris PeBenito |
21871a |
')
|