diff options
author | Chris PeBenito <pebenito@gentoo.org> | 2004-04-20 01:57:44 +0000 |
---|---|---|
committer | Chris PeBenito <pebenito@gentoo.org> | 2004-04-20 01:57:44 +0000 |
commit | 690030f9b72cdddbb6414584adc82a4bc93a3cef (patch) | |
tree | 49477b8f76042e6885aaccf80bf388e3d6ba1a7a /sys-apps/policycoreutils | |
parent | stable on amd64 (diff) | |
download | gentoo-2-690030f9b72cdddbb6414584adc82a4bc93a3cef.tar.gz gentoo-2-690030f9b72cdddbb6414584adc82a4bc93a3cef.tar.bz2 gentoo-2-690030f9b72cdddbb6414584adc82a4bc93a3cef.zip |
new upstream version
Diffstat (limited to 'sys-apps/policycoreutils')
3 files changed, 170 insertions, 0 deletions
diff --git a/sys-apps/policycoreutils/files/digest-policycoreutils-1.10 b/sys-apps/policycoreutils/files/digest-policycoreutils-1.10 new file mode 100644 index 000000000000..7f9660414016 --- /dev/null +++ b/sys-apps/policycoreutils/files/digest-policycoreutils-1.10 @@ -0,0 +1,2 @@ +MD5 50c449595b8d415e2e00afd1bea2abe0 policycoreutils-1.10.tgz 38548 +MD5 e3f37c89c63fad4ca89a9b26399fd180 policycoreutils-extra-1.2.tar.bz2 8032 diff --git a/sys-apps/policycoreutils/files/policycoreutils-1.10-genhomedircon-reverse.diff b/sys-apps/policycoreutils/files/policycoreutils-1.10-genhomedircon-reverse.diff new file mode 100644 index 000000000000..9ffc8e53749b --- /dev/null +++ b/sys-apps/policycoreutils/files/policycoreutils-1.10-genhomedircon-reverse.diff @@ -0,0 +1,96 @@ +diff -urN policycoreutils-1.10/scripts/genhomedircon policycoreutils-1.8/scripts/genhomedircon +--- policycoreutils-1.10/scripts/genhomedircon 2004-03-24 11:48:00.000000000 -0600 ++++ policycoreutils-1.8/scripts/genhomedircon 2004-03-09 09:19:51.000000000 -0600 +@@ -6,8 +6,6 @@ + # genhomedircon - Replace HOME_ROOT, HOME_DIR, and ROLE macros in .fc files + # with generic and user-specific values. + # +-# Based off original script by Dan Walsh, <dwalsh@redhat.com> +-# + # ASSUMPTIONS: + # + # If a user has more than one role in FILECONTEXTDIR/users, genhomedircon uses +@@ -24,6 +22,7 @@ + + import commands, sys, os, pwd, string + ++FILECONTEXTDIR="/etc/security/selinux/src/policy/" + EXCLUDE_LOGINS=["/sbin/nologin", "/bin/false"] + STARTING_UID=100 + +@@ -39,7 +38,7 @@ + if not prefixes.has_key(prefix): + prefixes[prefix] = "" + return prefixes +- ++ + def getUsers(): + rc = commands.getstatusoutput("grep ^user %s/users" % FILECONTEXTDIR) + udict = {} +@@ -66,12 +65,12 @@ + def usage(error = ""): + if error != "": + sys.stderr.write("%s\n" % (error,)) +- sys.stderr.write("Usage: %s POLICYSOURCEDIR FILE_CONTEXTS\n" % sys.argv[0]) ++ sys.stderr.write("Usage: %s FILE_CONTEXTS\n" % sys.argv[0]) + sys.stderr.flush() + sys.exit(1) +- ++ + def update(filecontext, user, prefs): +- rc=commands.getstatusoutput("grep -h '^HOME_DIR' %s | grep -v vmware | sed -e 's|HOME_DIR|%s|' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (filecontext, prefs["home"], prefs["role"], user)) ++ rc=commands.getstatusoutput("grep -h '^HOME_DIR' %s | grep -v vmware | sed -e 's|HOME_DIR|%s|g' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (filecontext, prefs["home"], prefs["role"], user)) + if rc[0] == 0: + print rc[1] + else: +@@ -79,11 +78,6 @@ + return rc + + try: +- if len(sys.argv) != 3: +- print len(sys.argv) +- usage() +- +- FILECONTEXTDIR=sys.argv[1] + prefixes = getPrefixes() + + rc=commands.getstatusoutput("grep -h '^HOME' /etc/default/useradd") +@@ -91,20 +85,21 @@ + homedir = rc[1].split("=")[1] + else: + sys.stderr.write("%s\n" % (rc[1],)) +- sys.stderr.write("You do not have access to /etc/default/useradd, default /home\n") ++ sys.stderr.write("Do you have access to /etc/default/useradd?\n") + sys.stderr.flush() +- homedir = "/home" +- ++ sys.exit(1) + + if not prefixes.has_key(homedir): + prefixes[homedir] = "" + +- # There may be a more elegant sed script to expand a macro to multiple lines, but this works +- sed_root = "h; s|^HOME_ROOT|%s|" % (string.join(prefixes.keys(), "|; p; g; s|^HOME_ROOT|"),) +- sed_dir = "h; s|^HOME_DIR|%s/[^/]+|; s|ROLE_|user_|" % (string.join(prefixes.keys(), "/[^/]+|; s|ROLE_|user_|; p; g; s|^HOME_DIR|"),) ++ if len(prefixes) == 1: ++ regex_root = prefixes.keys()[0] ++ else: ++ regex_root = "(%s)" % (string.join(prefixes, "\|"),) ++ regex_dir = "%s/[^/]+" % (regex_root,) + + # Fill in HOME_ROOT, HOME_DIR, and ROLE for users not explicitly defined in /etc/security/selinux/src/policy/users +- rc=commands.getstatusoutput("sed -e \"/^HOME_ROOT/{%s}\" -e \"/^HOME_DIR/{%s}\" %s" % (sed_root, sed_dir, sys.argv[2])) ++ rc=commands.getstatusoutput("sed -e 's|^HOME_ROOT|%s|g' -e 's|^HOME_DIR|%s|g' -e 's/ROLE_/user_/' %s" % (regex_root, regex_dir, sys.argv[1])) + if rc[0] == 0: + print rc[1] + else: +@@ -115,7 +110,8 @@ + + # Fill in HOME and ROLE for users that are defined + for u in users.keys(): +- update(sys.argv[2], u, users[u]) ++ update(sys.argv[1], u, users[u]) ++ + except ValueError, error: + usage(error) + except IndexError, error: diff --git a/sys-apps/policycoreutils/policycoreutils-1.10.ebuild b/sys-apps/policycoreutils/policycoreutils-1.10.ebuild new file mode 100644 index 000000000000..15d76336abb9 --- /dev/null +++ b/sys-apps/policycoreutils/policycoreutils-1.10.ebuild @@ -0,0 +1,72 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/policycoreutils/policycoreutils-1.10.ebuild,v 1.1 2004/04/20 01:57:43 pebenito Exp $ + +IUSE="build" + +inherit eutils + +EXTRAS_VER="1.2" + +DESCRIPTION="SELinux core utilites" +HOMEPAGE="http://www.nsa.gov/selinux" +SRC_URI="http://www.nsa.gov/selinux/archives/${P}.tgz + mirror://gentoo/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~ppc ~sparc" + +DEPEND=">=sys-libs/libselinux-${PV} + sys-devel/gettext + !build? ( sys-libs/pam )" + +RDEPEND="${DEPEND}" + +S2=${WORKDIR}/policycoreutils-extra + +src_unpack() { + unpack ${A} + + cd ${S} + epatch ${FILESDIR}/policycoreutils-1.10-genhomedircon-reverse.diff + + # Change script paths POLICYDIR + sed -i -e "s:/etc/security/selinux/src/policy/:${POLICYDIR}:g" ${S}/scripts/genhomedircon + + # fix up to accept Gentoo CFLAGS + local SUBDIRS="`cd ${S} && find -type d | cut -d/ -f2`" + for i in ${SUBDIRS}; do + sed -i -e "s:-Wall:-Wall ${CFLAGS}:g" ${S}/${i}/Makefile \ + || die "${i} Makefile CFLAGS fix failed." + done +} + +src_compile() { + if use build; then + einfo "Compiling setfiles" + emake -C ${S}/setfiles || die + else + einfo "Compiling policycoreutils" + emake -C ${S} || die + einfo "Compiling policycoreutils-extra" + emake -C ${S2} || die + fi +} + +src_install() { + if use build; then + dosbin ${S}/setfiles/setfiles + else + einfo "Installing policycoreutils" + make DESTDIR="${D}" -C ${S} install || die + einfo "Installing policycoreutils-extra" + make DESTDIR="${D}" -C ${S2} install || die + fi +} + +pkg_postinst() { + ewarn "WARNING: seinit is deprecated, and is no" + ewarn "longer installed. Please remove seinit from" + ewarn "your bootloader. The policy is now loaded" + ewarn "by init itself." +} |