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 c6d4c8
#
Chris PeBenito c6d4c8
# __endline__
Chris PeBenito c6d4c8
#
Chris PeBenito c6d4c8
# dummy macro to insert a newline.  used for 
Chris PeBenito c6d4c8
# errprint, so the close parentheses can be
Chris PeBenito c6d4c8
# indented correctly.
Chris PeBenito c6d4c8
#
Chris PeBenito c6d4c8
define(`__endline__',`
Chris PeBenito c6d4c8
')
Chris PeBenito c6d4c8
Chris PeBenito de9649
########################################
Chris PeBenito de9649
#
Chris PeBenito 90b331
# gen_user(username, prefix, role_set, mls_defaultlevel, mls_range, [mcs_categories])
Chris PeBenito 90b331
#
Chris PeBenito 90b331
define(`gen_user',`dnl
Chris PeBenito 90b331
ifdef(`users_extra',`dnl
Chris PeBenito 90b331
ifelse(`$2',,,`user $1 prefix $2;')
Chris PeBenito 90b331
',`dnl
Chris PeBenito 90b331
user $1 roles { $3 }`'ifdef(`enable_mls', ` level $4 range $5')`'ifdef(`enable_mcs',` level s0 range s0`'ifelse(`$6',,,` - s0:$6')');
Chris PeBenito 90b331
')dnl
Chris PeBenito 90b331
')
Chris PeBenito 712566
Chris PeBenito 712566
########################################
Chris PeBenito 712566
#
Chris PeBenito e02c61
# gen_context(context,mls_sensitivity,[mcs_categories])
Chris PeBenito de9649
#
Chris PeBenito e02c61
define(`gen_context',`$1`'ifdef(`enable_mls',`:$2')`'ifdef(`enable_mcs',`:s0`'ifelse(`$3',,,`:$3')')') 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
')