--- nsaserefpolicy/policy/modules/apps/mplayer.fc	2008-08-07 11:15:03.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/apps/mplayer.fc	2008-08-14 13:53:54.000000000 -0400
@@ -10,4 +10,4 @@
 /usr/bin/mencoder	--	gen_context(system_u:object_r:mencoder_exec_t,s0)
 /usr/bin/xine		--	gen_context(system_u:object_r:mplayer_exec_t,s0)
 
-HOME_DIR/\.mplayer(/.*)?        gen_context(system_u:object_r:ROLE_mplayer_home_t,s0)
+HOME_DIR/\.mplayer(/.*)?        gen_context(system_u:object_r:mplayer_home_t,s0)
--- nsaserefpolicy/policy/modules/apps/mplayer.if	2008-08-07 11:15:03.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/apps/mplayer.if	2008-08-14 13:53:54.000000000 -0400
@@ -34,7 +34,8 @@
 #
 template(`mplayer_per_role_template',`
 	gen_require(`
-		type mencoder_exec_t, mplayer_exec_t, mplayer_etc_t;
+		type mencoder_exec_t, mplayer_exec_t;
+		type user_mplayer_home_t;
 	')
 
 	########################################
@@ -50,9 +51,7 @@
 	application_domain($1_mplayer_t, mplayer_exec_t)
 	role $3 types $1_mplayer_t;
 
-	type $1_mplayer_home_t alias $1_mplayer_rw_t;
-	files_poly_member($1_mplayer_home_t)
-	userdom_user_home_content($1,$1_mplayer_home_t)
+	typealias mplayer_home_t alias $1_mplayer_home_t;
 
 	type $1_mplayer_tmpfs_t;
 	files_tmpfs_file($1_mplayer_tmpfs_t)
@@ -62,9 +61,9 @@
 	# mencoder local policy
 	#
 
-	manage_dirs_pattern($1_mencoder_t, $1_mplayer_home_t, $1_mplayer_home_t)
-	manage_files_pattern($1_mencoder_t, $1_mplayer_home_t, $1_mplayer_home_t)
-	manage_lnk_files_pattern($1_mencoder_t, $1_mplayer_home_t, $1_mplayer_home_t)
+	manage_dirs_pattern($1_mencoder_t, mplayer_home_t, mplayer_home_t)
+	manage_files_pattern($1_mencoder_t, mplayer_home_t, mplayer_home_t)
+	manage_lnk_files_pattern($1_mencoder_t, mplayer_home_t, mplayer_home_t)
 
 	# Read global config
 	allow $1_mencoder_t mplayer_etc_t:dir list_dir_perms;
@@ -200,7 +199,7 @@
 	')
 
 	tunable_policy(`write_untrusted_content',`
-		userdom_manage_user_untrusted_content_files($1, $1_mplayer_t)
+		unprivuser_manage_untrusted_content_files($1_mplayer_t)
 	')
 
 	# Save encoded files
@@ -255,9 +254,9 @@
 	allow $1_mplayer_t self:fifo_file rw_fifo_file_perms;
  	allow $1_mplayer_t self:sem create_sem_perms;
 
-	manage_dirs_pattern($1_mplayer_t, $1_mplayer_home_t, $1_mplayer_home_t)
-	manage_files_pattern($1_mplayer_t, $1_mplayer_home_t, $1_mplayer_home_t)
-	manage_lnk_files_pattern($1_mplayer_t, $1_mplayer_home_t, $1_mplayer_home_t)
+	manage_dirs_pattern($1_mplayer_t, mplayer_home_t, mplayer_home_t)
+	manage_files_pattern($1_mplayer_t, mplayer_home_t, mplayer_home_t)
+	manage_lnk_files_pattern($1_mplayer_t, mplayer_home_t, mplayer_home_t)
 	userdom_search_user_home_dirs($1, $1_mplayer_t)
 
 	manage_files_pattern($1_mplayer_t, $1_mplayer_tmpfs_t, $1_mplayer_tmpfs_t)
@@ -272,12 +271,12 @@
 	read_lnk_files_pattern($1_mplayer_t, mplayer_etc_t, mplayer_etc_t)
 
 	# Home access
-	manage_dirs_pattern($2, $1_mplayer_home_t, $1_mplayer_home_t)
-	manage_files_pattern($2, $1_mplayer_home_t, $1_mplayer_home_t)
-	manage_lnk_files_pattern($2, $1_mplayer_home_t, $1_mplayer_home_t)
-	relabel_dirs_pattern($2, $1_mplayer_home_t, $1_mplayer_home_t)
-	relabel_files_pattern($2, $1_mplayer_home_t, $1_mplayer_home_t)
-	relabel_lnk_files_pattern($2, $1_mplayer_home_t, $1_mplayer_home_t)
+	manage_dirs_pattern($2, mplayer_home_t, mplayer_home_t)
+	manage_files_pattern($2, mplayer_home_t, mplayer_home_t)
+	manage_lnk_files_pattern($2, mplayer_home_t, mplayer_home_t)
+	relabel_dirs_pattern($2, mplayer_home_t, mplayer_home_t)
+	relabel_files_pattern($2, mplayer_home_t, mplayer_home_t)
+	relabel_lnk_files_pattern($2, mplayer_home_t, mplayer_home_t)
 
 	# domain transition
 	domtrans_pattern($2, mplayer_exec_t, $1_mplayer_t)
@@ -307,6 +306,7 @@
 	dev_write_sound_mixer($1_mplayer_t)
 	# RTC clock 
 	dev_read_realtime_clock($1_mplayer_t)
+	dev_read_urand($1_mplayer_t)
 
 	# Access to DVD/CD/V4L
 	storage_raw_read_removable_device($1_mplayer_t)
@@ -340,6 +340,7 @@
 	userdom_read_user_tmp_symlinks($1, $1_mplayer_t)
 	userdom_read_user_home_content_files($1, $1_mplayer_t)
 	userdom_read_user_home_content_symlinks($1, $1_mplayer_t)
+	userdom_write_user_tmp_sockets($1, $1_mplayer_t)
 
 	xserver_user_x_domain_template($1, $1_mplayer, $1_mplayer_t, $1_mplayer_tmpfs_t)
 	
@@ -467,9 +468,11 @@
 ##	</summary>
 ## </param>
 #
-template(`mplayer_domtrans_user_mplayer',`
+template(`mplayer_domtrans_mplayer',`
 	gen_require(`
-		type $1_mplayer_t, mplayer_exec_t;
+		type mplayer_exec_t;
+		type $1_mplayer_t;
+
 	')
 
 	domtrans_pattern($2, mplayer_exec_t, $1_mplayer_t)
@@ -477,6 +480,25 @@
 
 ########################################
 ## <summary>
+##      Execute mplayer in the caller domain.
+## </summary>
+## <param name="domain">
+##      <summary>
+##      Domain allowed access.
+##      </summary>
+## </param>
+#
+#
+interface(`mplayer_exec',`
+	gen_require(`
+		type mplayer_exec_t;
+	')
+
+	can_exec($1, mplayer_exec_t)
+')
+
+########################################
+## <summary>
 ##	Read mplayer per user homedir
 ## </summary>
 ## <desc>
@@ -502,8 +524,8 @@
 #
 template(`mplayer_read_user_home_files',`
 	gen_require(`
-		type $1_mplayer_home_t;
+		type mplayer_home_t;
 	')
 
-	read_files_pattern($2, $1_mplayer_home_t, $1_mplayer_home_t)
+	read_files_pattern($2, mplayer_home_t, mplayer_home_t)
 ')
--- nsaserefpolicy/policy/modules/apps/mplayer.te	2008-08-07 11:15:03.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/apps/mplayer.te	2008-08-14 13:53:54.000000000 -0400
@@ -22,3 +22,7 @@
 type mplayer_exec_t;
 corecmd_executable_file(mplayer_exec_t)
 application_executable_file(mplayer_exec_t)
+
+type mplayer_home_t alias user_mplayer_rw_t;
+userdom_user_home_content(user, mplayer_home_t)
+
