## <summary>OpenSLP server daemon to dynamically register services.</summary>

########################################
## <summary>
##	Transition to slpd.
## </summary>
## <param name="domain">
## <summary>
##	Domain allowed to transition.
## </summary>
## </param>
#
interface(`slpd_domtrans',`
	gen_require(`
		type slpd_t, slpd_exec_t;
	')

	corecmd_search_bin($1)
	domtrans_pattern($1, slpd_exec_t, slpd_t)
')

########################################
## <summary>
##	Execute slpd server in the slpd domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`slpd_initrc_domtrans',`
	gen_require(`
		type slpd_initrc_exec_t;
	')

	init_labeled_script_domtrans($1, slpd_initrc_exec_t)
')

########################################
## <summary>
##	All of the rules required to
##	administrate an slpd environment.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
## <param name="role">
##	<summary>
##	Role allowed access.
##	</summary>
## </param>
## <rolecap/>
#
interface(`slpd_admin',`
	gen_require(`
		type slpd_t, slpd_initrc_exec_t, slpd_log_t;
		type slpd_var_run_t;
	')

	allow $1 slpd_t:process { ptrace signal_perms };
	ps_process_pattern($1, slpd_t)

	slpd_initrc_domtrans($1)
	domain_system_change_exemption($1)
	role_transition $2 slpd_initrc_exec_t system_r;
	allow $2 system_r;

	logging_search_logs($1)
	admin_pattern($1, slpd_log_t)

	files_search_pids($1)
	admin_pattern($1, slpd_var_run_t)

	optional_policy(`
		systemd_passwd_agent_exec($1)
		systemd_read_fifo_file_passwd_run($1)
	')

')
