diff --git a/policycoreutils/.gitignore b/policycoreutils/.gitignore index 50f8b82..aa1045a 100644 --- a/policycoreutils/.gitignore +++ b/policycoreutils/.gitignore @@ -14,3 +14,4 @@ sestatus/sestatus setfiles/restorecon setfiles/setfiles setsebool/setsebool +gui diff --git a/policycoreutils/Makefile b/policycoreutils/Makefile index 9cfe3bc..e31f7d3 100644 --- a/policycoreutils/Makefile +++ b/policycoreutils/Makefile @@ -1,4 +1,4 @@ -SUBDIRS = setfiles semanage load_policy newrole run_init sandbox secon audit2allow audit2why scripts sestatus semodule_package semodule semodule_link semodule_expand semodule_deps sepolgen-ifgen setsebool po man +SUBDIRS = setfiles semanage semanage/default_encoding load_policy newrole run_init sandbox secon audit2allow audit2why scripts sestatus semodule_package semodule semodule_link semodule_expand semodule_deps sepolgen-ifgen setsebool po man INOTIFYH = $(shell ls /usr/include/sys/inotify.h 2>/dev/null) diff --git a/policycoreutils/audit2allow/sepolgen-ifgen b/policycoreutils/audit2allow/sepolgen-ifgen index ef4bec3..9b313ec 100644 --- a/policycoreutils/audit2allow/sepolgen-ifgen +++ b/policycoreutils/audit2allow/sepolgen-ifgen @@ -61,20 +61,10 @@ def parse_options(): return options -def get_policy(): - i = selinux.security_policyvers() - p = selinux.selinux_binary_policy_path() + "." + str(i) - while i > 0 and not os.path.exists(p): - i = i - 1 - p = selinux.selinux_binary_policy_path() + "." + str(i) - if i > 0: - return p - return None - def get_attrs(policy_path): try: if not policy_path: - policy_path = get_policy() + policy_path = selinux.selinux_current_policy_path() if not policy_path: sys.stderr.write("No installed policy to check\n") return None diff --git a/policycoreutils/load_policy/Makefile b/policycoreutils/load_policy/Makefile index 5da2e0d..0e9d66f 100644 --- a/policycoreutils/load_policy/Makefile +++ b/policycoreutils/load_policy/Makefile @@ -19,7 +19,7 @@ install: all test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 install -m 644 load_policy.8 $(MANDIR)/man8/ -mkdir -p $(USRSBINDIR) - -ln -sf /sbin/load_policy $(USRSBINDIR)/load_policy + -ln -s /sbin/load_policy $(USRSBINDIR)/load_policy clean: -rm -f $(TARGETS) *.o diff --git a/policycoreutils/mcstrans/man/man8/mcstransd.8 b/policycoreutils/mcstrans/man/man8/mcstransd.8 index 4c63965..718fd85 100644 --- a/policycoreutils/mcstrans/man/man8/mcstransd.8 +++ b/policycoreutils/mcstrans/man/man8/mcstransd.8 @@ -3,7 +3,7 @@ mcstransd \- MCS (Multiple Category System) daemon. Translates SELinux MCS/MLS labels to human readable form. .SH "SYNOPSIS" -.B mcstransd +.B mcstransd [-f] [-h] .P .SH "DESCRIPTION" @@ -12,6 +12,13 @@ This manual page describes the program. .P This daemon reads /etc/selinux/{SELINUXTYPE}/setrans.conf configuration file, and communicates with libselinux via a socket in /var/run/setrans. +.SH "OPTIONS" +.TP +-f +Run mcstransd in the foreground. Do not run as a daemon. +.TP +-h +Output a short summary of available command line options\&. .SH "AUTHOR" This man page was written by Dan Walsh . diff --git a/policycoreutils/mcstrans/src/mcstransd.c b/policycoreutils/mcstrans/src/mcstransd.c index 26d9be8..a65076d 100644 --- a/policycoreutils/mcstrans/src/mcstransd.c +++ b/policycoreutils/mcstrans/src/mcstransd.c @@ -1,5 +1,4 @@ /* Copyright (c) 2006 Trusted Computer Solutions, Inc. */ - #include #include #include @@ -13,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -556,9 +556,31 @@ void dropprivs(void) cap_free(new_caps); } +static void usage(char *program) +{ + printf("%s [-f] [-h] \n", program); +} + int -main(int UNUSED(argc), char *argv[]) +main(int argc, char *argv[]) { + int opt; + int do_fork = 1; + while ((opt = getopt(argc, argv, "hf")) > 0) { + switch (opt) { + case 'f': + do_fork = 0; + break; + case 'h': + usage(argv[0]); + exit(0); + break; + case '?': + usage(argv[0]); + exit(-1); + } + } + #ifndef DEBUG /* Make sure we are root */ if (getuid() != 0) { @@ -576,7 +598,7 @@ main(int UNUSED(argc), char *argv[]) dropprivs(); /* run in the background as a daemon */ - if (daemon(0, 0)) { + if (do_fork && daemon(0, 0)) { syslog(LOG_ERR, "daemon() failed: %m"); cleanup_exit(1); } diff --git a/policycoreutils/newrole/newrole.c b/policycoreutils/newrole/newrole.c index 42f08d0..989817b 100644 --- a/policycoreutils/newrole/newrole.c +++ b/policycoreutils/newrole/newrole.c @@ -543,14 +543,14 @@ static int restore_environment(int preserve_environment, #if defined(AUDIT_LOG_PRIV) && !defined(NAMESPACE_PRIV) static int drop_capabilities(int full) { + uid_t uid = getuid(); + if (!uid) return 0; + capng_setpid(getpid()); capng_clear(CAPNG_SELECT_BOTH); if (capng_lock() < 0) return -1; - uid_t uid = getuid(); - if (!uid) return 0; - /* Change uid */ if (setresuid(uid, uid, uid)) { fprintf(stderr, _("Error changing uid, aborting.\n")); @@ -1032,10 +1032,11 @@ int main(int argc, char *argv[]) * if it makes sense to continue to run newrole, and setting up * a scrubbed environment. */ - if (drop_capabilities(FALSE)) { +/* if (drop_capabilities(FALSE)) { perror(_("Sorry, newrole failed to drop capabilities\n")); return -1; } +*/ if (set_signal_handles()) return -1; diff --git a/policycoreutils/po/af.po b/policycoreutils/po/af.po deleted file mode 100644 index afeaa9f..0000000 --- a/policycoreutils/po/af.po +++ /dev/null @@ -1,1270 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-27 10:49-0400\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../run_init/run_init.c:67 -msgid "" -"USAGE: run_init