blob: eac6ba6c1984988f8a809d8330501e169ef6c046 [file] [log] [blame]
Denis Vlasenko644849a2007-03-24 15:38:49 +00001/*
2 * load_policy
Denis Vlasenko644849a2007-03-24 15:38:49 +00003 * Author: Yuichi Nakamura <ynakam@hitachisoft.jp>
Denis Vlasenkodb12d1d2008-12-07 00:52:58 +00004 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02005 * Licensed under GPLv2, see file LICENSE in this source tree.
Denis Vlasenko644849a2007-03-24 15:38:49 +00006 */
Denys Vlasenkoa8e52da2016-11-23 18:46:40 +01007//config:config LOAD_POLICY
Denys Vlasenkoae178ce2017-07-19 14:32:54 +02008//config: bool "load_policy (1.6 kb)"
Denys Vlasenkoa8e52da2016-11-23 18:46:40 +01009//config: default n
10//config: depends on SELINUX
11//config: help
Denys Vlasenko72089cf2017-07-21 09:50:55 +020012//config: Enable support to load SELinux policy.
Denys Vlasenkoa8e52da2016-11-23 18:46:40 +010013
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 Orga5bc8c002011-04-11 03:29:49 +020017
18//usage:#define load_policy_trivial_usage NOUSAGE_STR
19//usage:#define load_policy_full_usage ""
20
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000021#include "libbb.h"
Denis Vlasenko644849a2007-03-24 15:38:49 +000022
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000023int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denys Vlasenko2ec91ae2010-01-04 14:15:38 +010024int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
Denis Vlasenko644849a2007-03-24 15:38:49 +000025{
Denis Vlasenkob042bd92007-09-26 18:01:32 +000026 int rc;
27
Denys Vlasenko2ec91ae2010-01-04 14:15:38 +010028 if (argv[1]) {
Denis Vlasenko644849a2007-03-24 15:38:49 +000029 bb_show_usage();
30 }
31
Denis Vlasenkob042bd92007-09-26 18:01:32 +000032 rc = selinux_mkload_policy(1);
33 if (rc < 0) {
James Byrne69374872019-07-02 11:35:03 +020034 bb_simple_perror_msg_and_die("can't load policy");
Denis Vlasenko644849a2007-03-24 15:38:49 +000035 }
36
37 return 0;
38}