Denis Vlasenko | 644849a | 2007-03-24 15:38:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * load_policy |
Denis Vlasenko | 644849a | 2007-03-24 15:38:49 +0000 | [diff] [blame] | 3 | * Author: Yuichi Nakamura <ynakam@hitachisoft.jp> |
Denis Vlasenko | db12d1d | 2008-12-07 00:52:58 +0000 | [diff] [blame] | 4 | * |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 5 | * Licensed under GPLv2, see file LICENSE in this source tree. |
Denis Vlasenko | 644849a | 2007-03-24 15:38:49 +0000 | [diff] [blame] | 6 | */ |
Denys Vlasenko | a8e52da | 2016-11-23 18:46:40 +0100 | [diff] [blame] | 7 | //config:config LOAD_POLICY |
| 8 | //config: bool "load_policy" |
| 9 | //config: default n |
| 10 | //config: depends on SELINUX |
| 11 | //config: help |
| 12 | //config: Enable support to load SELinux policy. |
| 13 | |
| 14 | //applet:IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP)) |
| 15 | |
| 16 | //kbuild:lib-$(CONFIG_LOAD_POLICY) += load_policy.o |
Pere Orga | 5bc8c00 | 2011-04-11 03:29:49 +0200 | [diff] [blame] | 17 | |
| 18 | //usage:#define load_policy_trivial_usage NOUSAGE_STR |
| 19 | //usage:#define load_policy_full_usage "" |
| 20 | |
Denis Vlasenko | b6adbf1 | 2007-05-26 19:00:18 +0000 | [diff] [blame] | 21 | #include "libbb.h" |
Denis Vlasenko | 644849a | 2007-03-24 15:38:49 +0000 | [diff] [blame] | 22 | |
Denis Vlasenko | 9b49a5e | 2007-10-11 10:05:36 +0000 | [diff] [blame] | 23 | int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
Denys Vlasenko | 2ec91ae | 2010-01-04 14:15:38 +0100 | [diff] [blame] | 24 | int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
Denis Vlasenko | 644849a | 2007-03-24 15:38:49 +0000 | [diff] [blame] | 25 | { |
Denis Vlasenko | b042bd9 | 2007-09-26 18:01:32 +0000 | [diff] [blame] | 26 | int rc; |
| 27 | |
Denys Vlasenko | 2ec91ae | 2010-01-04 14:15:38 +0100 | [diff] [blame] | 28 | if (argv[1]) { |
Denis Vlasenko | 644849a | 2007-03-24 15:38:49 +0000 | [diff] [blame] | 29 | bb_show_usage(); |
| 30 | } |
| 31 | |
Denis Vlasenko | b042bd9 | 2007-09-26 18:01:32 +0000 | [diff] [blame] | 32 | rc = selinux_mkload_policy(1); |
| 33 | if (rc < 0) { |
Denis Vlasenko | 644849a | 2007-03-24 15:38:49 +0000 | [diff] [blame] | 34 | bb_perror_msg_and_die("can't load policy"); |
| 35 | } |
| 36 | |
| 37 | return 0; |
| 38 | } |