## <summary>UUID generation daemon.</summary>

########################################
## <summary>
##	Execute uuidd in the uuidd domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed to transition.
##	</summary>
## </param>
#
interface(`uuidd_domtrans',`
	gen_require(`
		type uuidd_t, uuidd_exec_t;
	')

	corecmd_search_bin($1)
	domtrans_pattern($1, uuidd_exec_t, uuidd_t)
')

########################################
## <summary>
##	Execute uuidd init scripts in
##	the initrc domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`uuidd_initrc_domtrans',`
	gen_require(`
		type uuidd_initrc_exec_t;
	')

	init_labeled_script_domtrans($1, uuidd_initrc_exec_t)
')

########################################
## <summary>
##	Search uuidd lib directories.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`uuidd_search_lib',`
	gen_require(`
		type uuidd_var_lib_t;
	')

	files_search_var_lib($1)
	allow $1 uuidd_var_lib_t:dir search_dir_perms;
')

########################################
## <summary>
##	Read uuidd lib files.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`uuidd_read_lib_files',`
	gen_require(`
		type uuidd_var_lib_t;
	')

	files_search_var_lib($1)
	read_files_pattern($1, uuidd_var_lib_t, uuidd_var_lib_t)
')

########################################
## <summary>
##	Create, read, write, and delete
##	uuidd lib files.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`uuidd_manage_lib_files',`
	gen_require(`
		type uuidd_var_lib_t;
	')

	files_search_var_lib($1)
	manage_files_pattern($1, uuidd_var_lib_t, uuidd_var_lib_t)
')

########################################
## <summary>
##	Create, read, write, and delete
##	uuidd lib directories.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`uuidd_manage_lib_dirs',`
	gen_require(`
		type uuidd_var_lib_t;
	')

	files_search_var_lib($1)
	manage_dirs_pattern($1, uuidd_var_lib_t, uuidd_var_lib_t)
')

########################################
## <summary>
##	Read uuidd pid files.  (Deprecated)
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`uuidd_read_pid_files',`
	refpolicywarn(`$0($*) has been deprecated.')
')

########################################
## <summary>
##	Connect to uuidd with an unix
##	domain stream socket.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`uuidd_stream_connect_manager',`
	gen_require(`
		type uuidd_t, uuidd_runtime_t;
	')

	files_search_runtime($1)
	stream_connect_pattern($1, uuidd_runtime_t, uuidd_runtime_t, uuidd_t)
')

########################################
## <summary>
##	All of the rules required to
##	administrate an uuidd environment.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
## <param name="role">
##	<summary>
##	Role allowed access.
##	</summary>
## </param>
## <rolecap/>
#
interface(`uuidd_admin',`
	gen_require(`
		type uuidd_t, uuidd_initrc_exec_t;
		type uuidd_runtime_t, uuidd_var_lib_t;
	')

	allow $1 uuidd_t:process signal_perms;
	ps_process_pattern($1, uuidd_t)

	init_startstop_service($1, $2, uuidd_t, uuidd_initrc_exec_t)

	files_search_var_lib($1)
	admin_pattern($1, uuidd_var_lib_t)

	files_search_runtime($1)
	admin_pattern($1, uuidd_runtime_t)
')
