[selinux-policy: 384/3172] eliminate _depend macros

Daniel J Walsh dwalsh at fedoraproject.org
Thu Oct 7 19:38:01 UTC 2010


commit 77c124c8cd89fb91b8c7f18b01abcc76a48424f6
Author: Chris PeBenito <cpebenito at tresys.com>
Date:   Thu Jun 16 20:30:59 2005 +0000

    eliminate _depend macros

 refpolicy/policy/modules/system/domain.if |  274 +++++++++++------------------
 1 files changed, 103 insertions(+), 171 deletions(-)
---
diff --git a/refpolicy/policy/modules/system/domain.if b/refpolicy/policy/modules/system/domain.if
index 481c201..aa14bbb 100644
--- a/refpolicy/policy/modules/system/domain.if
+++ b/refpolicy/policy/modules/system/domain.if
@@ -6,27 +6,26 @@
 # domain_base_domain_type(domain)
 #
 define(`domain_base_domain_type',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class dir r_dir_perms;
+		class lnk_file r_file_perms;
+		class file rw_file_perms;
+		class process { fork sigchld };
+	')
 
 	# mark as a domain
 	typeattribute $1 domain;
 
 	# allow the domain to read its /proc/pid entries
 	allow $1 self:dir r_dir_perms;
-	allow $1 self:{ file lnk_file } rw_file_perms;
+	allow $1 self:lnk_file r_file_perms;
+	allow $1 self:file rw_file_perms;
 
 	# allow $1 to create child processes in this domain
 	allow $1 self:process { fork sigchld };
 ')
 
-define(`domain_base_domain_type_depend',`
-	attribute domain;
-
-	class dir r_dir_perms;
-	class file rw_file_perms;
-	class lnk_file r_file_perms;
-')
-
 ########################################
 #
 # domain_type(domain)
@@ -58,33 +57,28 @@ define(`domain_type',`
 # domain_entry_file(domain,entrypointfile)
 #
 define(`domain_entry_file',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute entry_type;
+		class file entrypoint;
+	')
 
 	files_file_type($2)
 	allow $1 $2:file entrypoint;
 	typeattribute $2 entry_type;
 ')
 
-define(`domain_entry_file_depend',`
-	attribute entry_type;
-
-	class file entrypoint;
-')
-
 ########################################
 #
 # domain_wide_inherit_fd(domain)
 #
 define(`domain_wide_inherit_fd',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute privfd;
+	')
 
 	typeattribute $1 privfd;
 ')
 
-define(`domain_wide_inherit_fd_depend',`
-	attribute privfd;
-')
-
 ########################################
 ## <interface name="domain_subj_id_change_exempt">
 ##	<description>
@@ -97,15 +91,13 @@ define(`domain_wide_inherit_fd_depend',`
 ## </interface>
 #
 define(`domain_subj_id_change_exempt',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute can_change_process_identity;
+	')
 
 	typeattribute $1 can_change_process_identity;
 ')
 
-define(`domain_subj_id_change_exempt_depend',`
-	attribute can_change_process_identity;
-')
-
 ########################################
 ## <interface name="domain_role_change_exempt">
 ##	<description>
@@ -118,15 +110,13 @@ define(`domain_subj_id_change_exempt_depend',`
 ## </interface>
 #
 define(`domain_role_change_exempt',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute can_change_process_role;
+	')
 
 	typeattribute $1 can_change_process_role;
 ')
 
-define(`domain_role_change_exempt_depend',`
-	attribute can_change_process_role;
-')
-
 ########################################
 ## <interface name="domain_obj_id_change_exempt">
 ##	<description>
@@ -139,63 +129,52 @@ define(`domain_role_change_exempt_depend',`
 ## </interface>
 #
 define(`domain_obj_id_change_exempt',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute can_change_object_identity;
+	')
 
 	typeattribute $1 can_change_object_identity;
 ')
 
-define(`domain_obj_id_change_exempt_depend',`
-	attribute can_change_object_identity;
-')
-
 ########################################
 #
 # domain_use_wide_inherit_fd(domain)
 #
 define(`domain_use_wide_inherit_fd',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute privfd;
+		class fd use;
+	')
 
 	allow $1 privfd:fd use;
 ')
 
-define(`domain_use_wide_inherit_fd_depend',`
-	attribute privfd;
-
-	class fd use;
-')
-
 ########################################
 #
 # domain_dontaudit_use_wide_inherit_fd(domain)
 #
 define(`domain_dontaudit_use_wide_inherit_fd',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute privfd;
+		class fd use;
+	')
 
 	dontaudit $1 privfd:fd use;
 ')
 
-define(`domain_dontaudit_use_wide_inherit_fd_depend',`
-	attribute privfd;
-
-	class fd use;
-')
-
 ########################################
 #
 # domain_setpriority_all_domains(domain)
 #
 define(`domain_setpriority_all_domains',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class process setsched;
+	')
 
 	allow $1 domain:process setsched;
 ')
 
-define(`domain_setpriority_all_domains_depend',`
-	attribute domain;
-
-	class process setsched;
-')
-
 ########################################
 ## <interface name="domain_signal_all_domains">
 ##	<description>
@@ -207,17 +186,14 @@ define(`domain_setpriority_all_domains_depend',`
 ## </interface>
 #
 define(`domain_signal_all_domains',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class process signal;
+	')
 
 	allow $1 domain:process signal;
 ')
 
-define(`domain_signal_all_domains_depend',`
-	attribute domain;
-
-	class process signal;
-')
-
 ########################################
 ## <interface name="domain_signull_all_domains">
 ##	<description>
@@ -229,17 +205,14 @@ define(`domain_signal_all_domains_depend',`
 ## </interface>
 #
 define(`domain_signull_all_domains',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class process signull;
+	')
 
 	allow $1 domain:process signull;
 ')
 
-define(`domain_signull_all_domains_depend',`
-	attribute domain;
-
-	class process signull;
-')
-
 ########################################
 ## <interface name="domain_sigstop_all_domains">
 ##	<description>
@@ -251,17 +224,14 @@ define(`domain_signull_all_domains_depend',`
 ## </interface>
 #
 define(`domain_sigstop_all_domains',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class process sigstop;
+	')
 
 	allow $1 domain:process sigstop;
 ')
 
-define(`domain_sigstop_all_domains_depend',`
-	attribute domain;
-
-	class process sigstop;
-')
-
 ########################################
 ## <interface name="domain_sigchld_all_domains">
 ##	<description>
@@ -273,17 +243,14 @@ define(`domain_sigstop_all_domains_depend',`
 ## </interface>
 #
 define(`domain_sigchld_all_domains',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class process sigchld;
+	')
 
 	allow $1 domain:process sigchld;
 ')
 
-define(`domain_sigchld_all_domains_depend',`
-	attribute domain;
-
-	class process sigchld;
-')
-
 ########################################
 ## <interface name="domain_kill_all_domains">
 ##	<description>
@@ -295,19 +262,16 @@ define(`domain_sigchld_all_domains_depend',`
 ## </interface>
 #
 define(`domain_kill_all_domains',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class process sigkill;
+		class capability kill;
+	')
 
 	allow $1 domain:process sigkill;
 	allow $1 self:capability kill;
 ')
 
-define(`domain_kill_all_domains_depend',`
-	attribute domain;
-
-	class process sigkill;
-	class capability kill;
-')
-
 ########################################
 ## <interface name="domain_read_all_domains_state">
 ##	<description>
@@ -319,7 +283,13 @@ define(`domain_kill_all_domains_depend',`
 ## </interface>
 #
 define(`domain_read_all_domains_state',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class dir r_dir_perms;
+		class lnk_file r_file_perms;
+		class file r_file_perms;
+		class process { getattr ptrace };
+	')
 
 	allow $1 domain:dir r_dir_perms;
 	allow $1 domain:lnk_file r_file_perms;
@@ -333,15 +303,6 @@ define(`domain_read_all_domains_state',`
 	dontaudit $1 domain:process ptrace;
 ')
 
-define(`domain_read_all_domains_state_depend',`
-	attribute domain;
-
-	class dir r_dir_perms;
-	class lnk_file r_file_perms;
-	class file r_file_perms;
-	class process { getattr ptrace };
-')
-
 ########################################
 ## <interface name="domain_dontaudit_list_all_domains_proc">
 ##	<description>
@@ -354,18 +315,14 @@ define(`domain_read_all_domains_state_depend',`
 ## </interface>
 #
 define(`domain_dontaudit_list_all_domains_proc',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class dir r_dir_perms;
+	')
 
 	dontaudit $1 domain:dir r_dir_perms;
 ')
 
-define(`domain_dontaudit_list_all_domains_proc_depend',`
-	attribute domain;
-
-	class dir r_dir_perms;
-')
-
-
 ########################################
 ## <interface name="domain_getsession_all_domains">
 ##	<description>
@@ -377,17 +334,14 @@ define(`domain_dontaudit_list_all_domains_proc_depend',`
 ## </interface>
 #
 define(`domain_getsession_all_domains',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class process getsession;
+	')
 
 	allow $1 domain:process getsession;
 ')
 
-define(`domain_getsession_all_domains_depend',`
-	attribute domain;
-
-	class process getsession;
-')
-
 ########################################
 ## <interface name="domain_dontaudit_getattr_all_udp_sockets">
 ##	<description>
@@ -400,17 +354,14 @@ define(`domain_getsession_all_domains_depend',`
 ## </interface>
 #
 define(`domain_dontaudit_getattr_all_udp_sockets',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class udp_socket getattr;
+	')
 
 	dontaudit $1 domain:udp_socket getattr;
 ')
 
-define(`domain_dontaudit_getattr_all_udp_sockets_depend',`
-	attribute domain;
-
-	class udp_socket getattr;
-')
-
 ########################################
 ## <interface name="domain_dontaudit_getattr_all_tcp_sockets">
 ##	<description>
@@ -423,17 +374,14 @@ define(`domain_dontaudit_getattr_all_udp_sockets_depend',`
 ## </interface>
 #
 define(`domain_dontaudit_getattr_all_tcp_sockets',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class tcp_socket getattr;
+	')
 
 	dontaudit $1 domain:tcp_socket getattr;
 ')
 
-define(`domain_dontaudit_getattr_all_tcp_sockets_depend',`
-	attribute domain;
-
-	class tcp_socket getattr;
-')
-
 ########################################
 ## <interface name="domain_dontaudit_getattr_all_unix_dgram_sockets">
 ##	<description>
@@ -446,17 +394,14 @@ define(`domain_dontaudit_getattr_all_tcp_sockets_depend',`
 ## </interface>
 #
 define(`domain_dontaudit_getattr_all_unix_dgram_sockets',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class unix_dgram_socket getattr;
+	')
 
 	dontaudit $1 domain:unix_dgram_socket getattr;
 ')
 
-define(`domain_dontaudit_getattr_all_unix_dgram_sockets_depend',`
-	attribute domain;
-
-	class unix_dgram_socket getattr;
-')
-
 ########################################
 ## <interface name="domain_dontaudit_getattr_all_unnamed_pipes">
 ##	<description>
@@ -469,32 +414,24 @@ define(`domain_dontaudit_getattr_all_unix_dgram_sockets_depend',`
 ## </interface>
 #
 define(`domain_dontaudit_getattr_all_unnamed_pipes',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute domain;
+		class fifo_file getattr;
+	')
 
 	dontaudit $1 domain:fifo_file getattr;
 ')
 
-define(`domain_dontaudit_getattr_all_unnamed_pipes_depend',`
-	attribute domain;
-
-	class fifo_file getattr;
-')
-
 ########################################
 #
 # domain_exec_all_entry_files(domain)
 #
 define(`domain_exec_all_entry_files',`
-	gen_require(`$0'_depend)
-	
-	can_exec($1,entry_type)
-
-')
-
-define(`domain_exec_all_entry_files_depend',`
-	attribute entry_type;
+	gen_require(`
+		attribute entry_type;
+	')
 
-	class file { getattr read ioctl lock execute execute_no_trans };
+	can_exec($1,entry_type)
 ')
 
 ########################################
@@ -502,25 +439,22 @@ define(`domain_exec_all_entry_files_depend',`
 # domain_read_all_entry_files(domain)
 #
 define(`domain_read_all_entry_files',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		attribute entry_type;
+		class file r_file_perms;
+		class lnk_file r_file_perms;
+	')
 
 	allow $1 entry_type:lnk_file r_file_perms;
 	allow $1 entry_type:file r_file_perms;
 ')
 
-define(`domain_read_all_entry_files_depend',`
-	attribute entry_type;
-
-	class file r_file_perms;
-	class lnk_file r_file_perms;
-')
-
 ## </module>
 
 #
 # These next macros are not interfaces, but actually are 
 # support macros.  Due to the domain_ prefix, they 
-# are placed in this module.
+# are placed in this module, to try to prevent confusion.
 #
 
 ########################################
@@ -528,18 +462,16 @@ define(`domain_read_all_entry_files_depend',`
 # domain_trans(source_domain,entrypoint_file,target_domain)
 #
 define(`domain_trans',`
-	gen_require(`$0'_depend)
+	gen_require(`
+		class file rx_file_perms;
+		process { transition noatsecure siginh rlimitinh };
+	')
 
 	allow $1 $2:file rx_file_perms;
 	allow $1 $3:process transition;
 	dontaudit $1 $3:process { noatsecure siginh rlimitinh };
 ')
 
-define(`domain_trans_depend',`
-	class file rx_file_perms;
-	process { transition noatsecure siginh rlimitinh };
-')
-
 ########################################
 #
 # domain_auto_trans(source_domain,entrypoint_file,target_domain)


More information about the scm-commits mailing list