aboutsummaryrefslogtreecommitdiff
path: root/nscd/nscd.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/nscd.c')
-rw-r--r--nscd/nscd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/nscd/nscd.c b/nscd/nscd.c
index facea5e..b0e7a20 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -44,6 +44,7 @@
#include "dbg_log.h"
#include "nscd.h"
+#include "selinux.h"
#include "../nss/nsswitch.h"
#include <device-nrs.h>
@@ -126,6 +127,9 @@ main (int argc, char **argv)
/* Set the text message domain. */
textdomain (PACKAGE);
+ /* Determine if the kernel has SELinux support. */
+ nscd_selinux_enabled (&selinux_enabled);
+
/* Parse and process arguments. */
argp_parse (&argp, argc, argv, 0, &remaining, NULL);
@@ -244,6 +248,10 @@ main (int argc, char **argv)
signal (SIGTSTP, SIG_IGN);
}
+ /* Start the SELinux AVC. */
+ if (selinux_enabled)
+ nscd_avc_init ();
+
signal (SIGINT, termination_handler);
signal (SIGQUIT, termination_handler);
signal (SIGTERM, termination_handler);
@@ -421,6 +429,10 @@ termination_handler (int signum)
// XXX async OK?
msync (dbs[cnt].head, dbs[cnt].memsize, MS_ASYNC);
+ /* Shutdown the SELinux AVC. */
+ if (selinux_enabled)
+ nscd_avc_destroy ();
+
_exit (EXIT_SUCCESS);
}