aboutsummaryrefslogtreecommitdiff
path: root/selinux/load_policy.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-24 15:38:49 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-24 15:38:49 +0000
commit644849a3aa0c834a942fb7777ec449d8098bcfc9 (patch)
tree0d34ff399cd6c04ab0cd7adf6c939f5291c169da /selinux/load_policy.c
parent1fc6e56684dafddf00c3e9689a77e273f0126ea4 (diff)
downloadbusybox-w32-644849a3aa0c834a942fb7777ec449d8098bcfc9.tar.gz
busybox-w32-644849a3aa0c834a942fb7777ec449d8098bcfc9.tar.bz2
busybox-w32-644849a3aa0c834a942fb7777ec449d8098bcfc9.zip
SELinux: load_policy applet - this time with svn add
Diffstat (limited to 'selinux/load_policy.c')
-rw-r--r--selinux/load_policy.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/selinux/load_policy.c b/selinux/load_policy.c
new file mode 100644
index 000000000..83051e697
--- /dev/null
+++ b/selinux/load_policy.c
@@ -0,0 +1,31 @@
1/*
2 * load_policy
3 * This implementation is based on old load_policy to be small.
4 * Author: Yuichi Nakamura <ynakam@hitachisoft.jp>
5 */
6#include "busybox.h"
7
8int load_policy_main(int argc, char *argv[]);
9int load_policy_main(int argc, char *argv[])
10{
11 int fd;
12 struct stat st;
13 void *data;
14 if (argc != 2) {
15 bb_show_usage();
16 }
17
18 fd = xopen(argv[1], O_RDONLY);
19 if (fstat(fd, &st) < 0) {
20 bb_perror_msg_and_die("can't fstat");
21 }
22 data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
23 if (data == MAP_FAILED) {
24 bb_perror_msg_and_die("can't mmap");
25 }
26 if (security_load_policy(data, st.st_size) < 0) {
27 bb_perror_msg_and_die("can't load policy");
28 }
29
30 return 0;
31}