load_policy.c 866 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * load_policy
  3. * Author: Yuichi Nakamura <ynakam@hitachisoft.jp>
  4. *
  5. * Licensed under GPLv2, see file LICENSE in this source tree.
  6. */
  7. //config:config LOAD_POLICY
  8. //config: bool "load_policy (1.6 kb)"
  9. //config: default n
  10. //config: depends on SELINUX
  11. //config: help
  12. //config: Enable support to load SELinux policy.
  13. //applet:IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
  14. //kbuild:lib-$(CONFIG_LOAD_POLICY) += load_policy.o
  15. //usage:#define load_policy_trivial_usage NOUSAGE_STR
  16. //usage:#define load_policy_full_usage ""
  17. #include "libbb.h"
  18. int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  19. int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
  20. {
  21. int rc;
  22. if (argv[1]) {
  23. bb_show_usage();
  24. }
  25. rc = selinux_mkload_policy(1);
  26. if (rc < 0) {
  27. bb_perror_msg_and_die("can't load policy");
  28. }
  29. return 0;
  30. }