--- nsaserefpolicy/policy/modules/services/nscd.fc	2008-08-07 11:15:11.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/services/nscd.fc	2008-08-14 13:53:54.000000000 -0400
@@ -9,3 +9,5 @@
 /var/run/\.nscd_socket	-s	gen_context(system_u:object_r:nscd_var_run_t,s0)
 
 /var/run/nscd(/.*)?		gen_context(system_u:object_r:nscd_var_run_t,s0)
+
+/etc/rc\.d/init\.d/nscd	--	gen_context(system_u:object_r:nscd_script_exec_t,s0)
--- nsaserefpolicy/policy/modules/services/nscd.if	2008-08-07 11:15:11.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/services/nscd.if	2008-08-14 13:53:54.000000000 -0400
@@ -70,15 +70,14 @@
 interface(`nscd_socket_use',`
 	gen_require(`
 		type nscd_t, nscd_var_run_t;
-		class nscd { getpwd getgrp gethost shmempwd shmemgrp shmemhost };
+		class nscd { getserv getpwd getgrp gethost shmempwd shmemgrp shmemhost shmemserv };
 	')
 
 	allow $1 self:unix_stream_socket create_socket_perms;
 
 	allow $1 nscd_t:nscd { getpwd getgrp gethost };
 	dontaudit $1 nscd_t:fd use;
-	dontaudit $1 nscd_t:nscd { shmempwd shmemgrp shmemhost };
-
+	dontaudit $1 nscd_t:nscd { getserv shmempwd shmemgrp shmemhost shmemserv };
 	files_search_pids($1)
 	stream_connect_pattern($1, nscd_var_run_t, nscd_var_run_t, nscd_t)
 	dontaudit $1 nscd_var_run_t:file { getattr read };
@@ -204,3 +203,66 @@
 	role $2 types nscd_t;
 	dontaudit nscd_t $3:chr_file rw_term_perms;
 ')
+
+########################################
+## <summary>
+##	Execute nscd server in the ntpd domain.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	The type of the process performing this action.
+##	</summary>
+## </param>
+#
+interface(`nscd_script_domtrans',`
+	gen_require(`
+		type nscd_script_exec_t;
+	')
+
+	init_script_domtrans_spec($1, nscd_script_exec_t)
+')
+
+########################################
+## <summary>
+##	All of the rules required to administrate 
+##	an nscd environment
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+## <param name="role">
+##	<summary>
+##	The role to be allowed to manage the nscd domain.
+##	</summary>
+## </param>
+## <param name="terminal">
+##	<summary>
+##	The type of the user terminal.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`nscd_admin',`
+	gen_require(`
+		type nscd_t, nscd_log_t, nscd_var_run_t;
+		type nscd_script_exec_t;
+	')
+
+	allow $1 nscd_t:process { ptrace signal_perms };
+	ps_process_pattern($1, nscd_t)
+	        
+	# Allow nscd_t to restart the apache service
+	nscd_script_domtrans($1)
+	domain_system_change_exemption($1)
+	role_transition $2 nscd_script_exec_t system_r;
+	allow $2 system_r;
+
+	logging_list_logs($1)
+        admin_pattern($1, nscd_log_t)
+
+	files_list_pids($1)
+        admin_pattern($1, nscd_var_run_t)
+')
+
--- nsaserefpolicy/policy/modules/services/nscd.te	2008-08-07 11:15:11.000000000 -0400
+++ serefpolicy-3.5.5/policy/modules/services/nscd.te	2008-08-14 13:53:54.000000000 -0400
@@ -23,19 +23,22 @@
 type nscd_log_t;
 logging_log_file(nscd_log_t)
 
+type nscd_script_exec_t;
+init_script_type(nscd_script_exec_t)
+
 ########################################
 #
 # Local policy
 #
 
-allow nscd_t self:capability { kill setgid setuid audit_write };
+allow nscd_t self:capability { kill setgid setuid };
 dontaudit nscd_t self:capability sys_tty_config;
-allow nscd_t self:process { getattr setsched signal_perms };
+allow nscd_t self:process { getattr getcap setcap setsched signal_perms };
 allow nscd_t self:fifo_file { read write };
 allow nscd_t self:unix_stream_socket create_stream_socket_perms;
 allow nscd_t self:unix_dgram_socket create_socket_perms;
 allow nscd_t self:netlink_selinux_socket create_socket_perms;
-allow nscd_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
+
 allow nscd_t self:tcp_socket create_socket_perms;
 allow nscd_t self:udp_socket create_socket_perms;
 
@@ -50,6 +53,8 @@
 manage_sock_files_pattern(nscd_t, nscd_var_run_t, nscd_var_run_t)
 files_pid_filetrans(nscd_t, nscd_var_run_t, { file sock_file })
 
+can_exec(nscd_t, nscd_exec_t)
+
 kernel_read_kernel_sysctls(nscd_t)
 kernel_list_proc(nscd_t)
 kernel_read_proc_symlinks(nscd_t)
@@ -60,6 +65,7 @@
 
 fs_getattr_all_fs(nscd_t)
 fs_search_auto_mountpoints(nscd_t)
+fs_list_inotifyfs(nscd_t)
 
 # for when /etc/passwd has just been updated and has the wrong type
 auth_getattr_shadow(nscd_t)
@@ -73,6 +79,7 @@
 corenet_udp_sendrecv_all_nodes(nscd_t)
 corenet_tcp_sendrecv_all_ports(nscd_t)
 corenet_udp_sendrecv_all_ports(nscd_t)
+corenet_udp_bind_all_nodes(nscd_t)
 corenet_tcp_connect_all_ports(nscd_t)
 corenet_sendrecv_all_client_packets(nscd_t)
 corenet_rw_tun_tap_dev(nscd_t)
@@ -84,6 +91,7 @@
 selinux_compute_relabel_context(nscd_t)
 selinux_compute_user_contexts(nscd_t)
 domain_use_interactive_fds(nscd_t)
+domain_search_all_domains_state(nscd_t)
 
 files_read_etc_files(nscd_t)
 files_read_generic_tmp_symlinks(nscd_t)
@@ -93,6 +101,7 @@
 libs_use_ld_so(nscd_t)
 libs_use_shared_libs(nscd_t)
 
+logging_send_audit_msgs(nscd_t)
 logging_send_syslog_msg(nscd_t)
 
 miscfiles_read_localization(nscd_t)
@@ -108,6 +117,14 @@
 sysadm_dontaudit_search_home_dirs(nscd_t)
 
 optional_policy(`
+	cron_read_system_job_tmp_files(nscd_t)
+')
+
+optional_policy(`
+	kerberos_use(nscd_t)
+')
+
+optional_policy(`
 	udev_read_db(nscd_t)
 ')
 
@@ -115,3 +132,12 @@
 	xen_dontaudit_rw_unix_stream_sockets(nscd_t)
 	xen_append_log(nscd_t)
 ')
+
+optional_policy(`
+	tunable_policy(`samba_domain_controller',`
+		samba_append_log(nscd_t)
+		samba_dontaudit_use_fds(nscd_t)
+	')
+	samba_read_config(nscd_t)
+	samba_read_var_files(nscd_t)
+')
