58f329d
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/debugfiles.list policycoreutils-1.27.37/debugfiles.list
58f329d
--- nsapolicycoreutils/debugfiles.list	1969-12-31 19:00:00.000000000 -0500
58f329d
+++ policycoreutils-1.27.37/debugfiles.list	2005-12-07 11:55:05.000000000 -0500
58f329d
@@ -0,0 +1,14 @@
58f329d
+/usr/lib/debug/usr/bin/newrole.debug
58f329d
+/usr/lib/debug/usr/bin/semodule_link.debug
58f329d
+/usr/lib/debug/usr/bin/semodule_expand.debug
58f329d
+/usr/lib/debug/usr/bin/semodule_package.debug
58f329d
+/usr/lib/debug/usr/sbin/sestatus.debug
58f329d
+/usr/lib/debug/usr/sbin/setfiles.debug
58f329d
+/usr/lib/debug/usr/sbin/open_init_pty.debug
58f329d
+/usr/lib/debug/usr/sbin/run_init.debug
58f329d
+/usr/lib/debug/usr/sbin/load_policy.debug
58f329d
+/usr/lib/debug/usr/sbin/semodule.debug
58f329d
+/usr/lib/debug/usr/sbin/audit2why.debug
58f329d
+/usr/lib/debug/usr/sbin/setsebool.debug
58f329d
+/usr/lib/debug/sbin/restorecon.debug
58f329d
+/usr/src/debug/policycoreutils-1.27.37
58f329d
Binary files nsapolicycoreutils/debugsources.list and policycoreutils-1.27.37/debugsources.list differ
58f329d
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/policycoreutils.lang policycoreutils-1.27.37/policycoreutils.lang
58f329d
--- nsapolicycoreutils/policycoreutils.lang	1969-12-31 19:00:00.000000000 -0500
58f329d
+++ policycoreutils-1.27.37/policycoreutils.lang	2005-12-07 11:55:05.000000000 -0500
58f329d
@@ -0,0 +1,80 @@
58f329d
+%defattr (644, root, root, 755)
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+%lang(sv) /usr/share/locale/sv/LC_MESSAGES/policycoreutils.mo
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
58f329d
+
80b61a6
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat policycoreutils-1.27.37/scripts/chcat
80b61a6
--- nsapolicycoreutils/scripts/chcat	1969-12-31 19:00:00.000000000 -0500
58f329d
+++ policycoreutils-1.27.37/scripts/chcat	2005-12-07 11:54:57.000000000 -0500
80b61a6
@@ -0,0 +1,175 @@
80b61a6
+#! /usr/bin/env python
80b61a6
+# Copyright (C) 2005 Red Hat 
80b61a6
+# see file 'COPYING' for use and warranty information
80b61a6
+#
80b61a6
+#    chcat is a script that allows you modify the Security label on a file
80b61a6
+#
80b61a6
+#`   Author: Daniel Walsh <dwalsh@redhat.com>
80b61a6
+#
80b61a6
+#    This program is free software; you can redistribute it and/or
80b61a6
+#    modify it under the terms of the GNU General Public License as
80b61a6
+#    published by the Free Software Foundation; either version 2 of
80b61a6
+#    the License, or (at your option) any later version.
80b61a6
+#
80b61a6
+#    This program is distributed in the hope that it will be useful,
80b61a6
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
80b61a6
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
80b61a6
+#    GNU General Public License for more details.
80b61a6
+#
80b61a6
+#    You should have received a copy of the GNU General Public License
80b61a6
+#    along with this program; if not, write to the Free Software
80b61a6
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     
80b61a6
+#                                        02111-1307  USA
80b61a6
+#
80b61a6
+#  
80b61a6
+import commands, sys, os, pwd, string, getopt, re, selinux
80b61a6
+
80b61a6
+def chcat_add(orig, newcat, files):
80b61a6
+    errors=0
80b61a6
+    cmd='chcon -l '
80b61a6
+    sensitivity=newcat[0]
80b61a6
+    cat=newcat[1]
80b61a6
+    for f in files:
80b61a6
+        (rc, con) = selinux.getfilecon(f)
80b61a6
+        (rc, raw) = selinux.selinux_trans_to_raw_context(con)
80b61a6
+        clist=raw.split(":")[3:]
80b61a6
+        if len(clist) > 1:
80b61a6
+            if clist[0] != sensitivity:
80b61a6
+                print("Can not modify sensitivity levels using '+' on %s" % f)
80b61a6
+                continue
80b61a6
+            cats=clist[1].split(",")
80b61a6
+            if newcat[1] in cats:
80b61a6
+                print "%s is already in %s" % (f, orig)
80b61a6
+                continue
80b61a6
+            cats.append(newcat[1])
80b61a6
+            cats.sort()
80b61a6
+            cat=cats[0]
80b61a6
+            for c in cats[1:]:
80b61a6
+                cat="%s,%s" % (cat, c)
80b61a6
+        cmd='chcon -l %s:%s %s' % (sensitivity, cat, f)
80b61a6
+        rc=commands.getstatusoutput(cmd)
80b61a6
+        if rc[0] != 0:
80b61a6
+            errors+=1
80b61a6
+    return errors
80b61a6
+
80b61a6
+def chcat_remove(orig, newcat, files):
80b61a6
+    errors=0
80b61a6
+    sensitivity=newcat[0]
80b61a6
+    cat=newcat[1]
80b61a6
+    for f in files:
80b61a6
+        (rc, con) = selinux.getfilecon(f)
80b61a6
+        (rc, raw) = selinux.selinux_trans_to_raw_context(con)
80b61a6
+        clist=raw.split(":")[3:]
80b61a6
+        if len(clist) > 1:
80b61a6
+            if clist[0] != sensitivity:
80b61a6
+                print("Can not modify sensitivity levels using '+' on %s" % f)
80b61a6
+                continue
80b61a6
+            cats=clist[1].split(",")
80b61a6
+            if newcat[1] not in cats:
80b61a6
+                print "%s is not in %s" % (f, orig)
80b61a6
+                continue
80b61a6
+            cats.remove(newcat[1])
80b61a6
+            if len(cats) > 0:
80b61a6
+                cat=cats[0]
80b61a6
+                for c in cats[1:]:
80b61a6
+                    cat="%s,%s" % (cat, c)
80b61a6
+            else:
80b61a6
+                cat=""
80b61a6
+        else:
80b61a6
+                print "%s is not in %s" % (f, orig)
80b61a6
+                continue
80b61a6
+        
80b61a6
+        if len(cat) == 0: 
80b61a6
+            cmd='chcon -l %s %s' % (sensitivity, f)
80b61a6
+        else:
80b61a6
+            cmd='chcon -l %s:%s %s' % (sensitivity, cat, f)
80b61a6
+        rc=commands.getstatusoutput(cmd)
80b61a6
+        if rc[0] != 0:
80b61a6
+            errors+=1
80b61a6
+    return errors
80b61a6
+
80b61a6
+def chcat(context, files):
80b61a6
+    errors=0
80b61a6
+    for c in context:
80b61a6
+        if len(c) > 0 and c[0] == "+":
80b61a6
+            (rc, raw) = selinux.selinux_trans_to_raw_context("a:b:c:%s" % c[1:])
80b61a6
+            rlist=raw.split(":")
80b61a6
+            if len(rlist) < 5:
80b61a6
+                print "%s must have a sensitivity and at least one category" % c[1:]
80b61a6
+                continue
80b61a6
+            errors += chcat_add(c[1:], rlist[3:], files)
80b61a6
+            continue
80b61a6
+        if len(c) > 0 and c[0] == "-":
80b61a6
+            (rc, raw) = selinux.selinux_trans_to_raw_context("a:b:c:%s" % c[1:])
80b61a6
+            rlist=raw.split(":")
80b61a6
+            if len(rlist) < 5:
80b61a6
+                print "%s must have a sensitivity and at least one category" % c[1:]
80b61a6
+                continue
80b61a6
+            errors += chcat_remove(c[1:], rlist[3:], files)
80b61a6
+            continue
80b61a6
+
80b61a6
+        cmd='chcon -l "%s"' % c
80b61a6
+        for f in files:
80b61a6
+            cmd = "%s %s" % (cmd, f)
80b61a6
+            
80b61a6
+        rc=commands.getstatusoutput(cmd)
80b61a6
+        if rc[0] != 0:
80b61a6
+            print rc[1]
80b61a6
+            errors += 1
80b61a6
+    return errors
80b61a6
+    
80b61a6
+def usage():
80b61a6
+	print "Usage %s CATEGORY File ..." % sys.argv[0]
80b61a6
+	print "Usage %s [[+|-]CATEGORY],...]q File ..." % sys.argv[0]
80b61a6
+	print "Usage %s -d File ..." % sys.argv[0]
80b61a6
+	sys.exit(1)
80b61a6
+
80b61a6
+def error(msg):
80b61a6
+    print "%s: %s" % (sys.argv[0], msg)
80b61a6
+    sys.exit(1)
80b61a6
+    
80b61a6
+if __name__ == '__main__':
80b61a6
+    if selinux.is_selinux_mls_enabled() != 1:
80b61a6
+        error("Requires a mls enabled system")
80b61a6
+        
80b61a6
+    if selinux.is_selinux_enabled() != 1:
80b61a6
+        error("Requires an SELinux enabled system")
80b61a6
+        
80b61a6
+    delete_ind=0
80b61a6
+    gopts, cmds = getopt.getopt(sys.argv[1:],
80b61a6
+	'dh',
80b61a6
+	['help',
80b61a6
+	    'delete'])
80b61a6
+
80b61a6
+    for o,a in gopts:
80b61a6
+        if o == "-h" or o == "--help":
80b61a6
+            usage()
80b61a6
+        if o == "-d" or o == "--delete":
80b61a6
+            delete_ind=1
80b61a6
+
80b61a6
+    if len(cmds) < 1:
80b61a6
+        usage()
80b61a6
+
80b61a6
+    if delete_ind:
80b61a6
+        sys.exit(chcat([""], cmds))
80b61a6
+
80b61a6
+    if len(cmds) < 2:
80b61a6
+        usage()
80b61a6
+    
80b61a6
+    cats=cmds[0].split(",")
80b61a6
+    set_ind=0
80b61a6
+    mod_ind=0
80b61a6
+    for i in cats:
80b61a6
+        if i[0]=='+' or i[0]=="-":
80b61a6
+            mod_ind=1
80b61a6
+            if set_ind == 1:
80b61a6
+                error("You can not use '%s' with previous categories" % i)
80b61a6
+        else:
80b61a6
+            if mod_ind == 1 or set_ind==1:
80b61a6
+                error("You can not use '%s' with previous categories" % i)
80b61a6
+            set_ind=1
80b61a6
+
80b61a6
+    files=cmds[1:]
80b61a6
+    sys.exit(chcat(cats, files))
80b61a6
+
80b61a6
+
80b61a6
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat.8 policycoreutils-1.27.37/scripts/chcat.8
80b61a6
--- nsapolicycoreutils/scripts/chcat.8	1969-12-31 19:00:00.000000000 -0500
58f329d
+++ policycoreutils-1.27.37/scripts/chcat.8	2005-12-07 11:54:57.000000000 -0500
80b61a6
@@ -0,0 +1,29 @@
80b61a6
+.TH CHCAT "8" "September 2005" "chcat" "User Commands"
80b61a6
+.SH NAME
80b61a6
+chcat \- change file security category
80b61a6
+.SH SYNOPSIS
80b61a6
+.B chcat
80b61a6
+\fICATEGORY FILE\fR...
80b61a6
+.br
80b61a6
+.B chcat
80b61a6
+\fI[[+|-]CATEGORY],...]  FILE\fR...
80b61a6
+.br
80b61a6
+.B chcat
80b61a6
+[\fI-d\fR] \fIFILE\fR...
80b61a6
+.br
80b61a6
+.PP
80b61a6
+Change/Remove the security CATEGORY for each FILE.
80b61a6
+.PP
80b61a6
+Use +/- to add/remove categories from a FILE.
80b61a6
+.TP
80b61a6
+\fB\-d\fR
80b61a6
+delete the category from each file.
80b61a6
+.SH "SEE ALSO"
80b61a6
+.TP
80b61a6
+chcon(1), selinux(8)
80b61a6
+.PP
80b61a6
+.br
80b61a6
+This script wraps the chcon command.
80b61a6
+.SH "FILES"
80b61a6
+/etc/selinux/{SELINUXTYPE}/setrans.conf 
80b61a6
+
80b61a6
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/Makefile policycoreutils-1.27.37/scripts/Makefile
80b61a6
--- nsapolicycoreutils/scripts/Makefile	2005-01-28 15:24:12.000000000 -0500
58f329d
+++ policycoreutils-1.27.37/scripts/Makefile	2005-12-07 11:56:07.000000000 -0500
58f329d
@@ -1,20 +1,23 @@
58f329d
 # Installation directories.
58f329d
 PREFIX ?= ${DESTDIR}/usr
58f329d
-BINDIR ?= $(PREFIX)/sbin
58f329d
+BINDIR ?= $(PREFIX)/bin
58f329d
+SBINDIR ?= $(PREFIX)/sbin
80b61a6
 MANDIR ?= $(PREFIX)/share/man
80b61a6
 LOCALEDIR ?= /usr/share/locale
b36bfa0
 
80b61a6
-TARGETS=genhomedircon
58f329d
+TARGETS=genhomedircon 
80b61a6
 
80b61a6
 all: $(TARGETS) fixfiles
80b61a6
 
58f329d
 install: all
58f329d
 	-mkdir -p $(BINDIR)
58f329d
-	install -m 755 $(TARGETS) $(BINDIR)
58f329d
+	install -m 755 $(TARGETS) $(SBINDIR)
58f329d
+	install -m 755 chcat $(BINDIR)
58f329d
 	install -m 755 fixfiles $(DESTDIR)/sbin
80b61a6
 	-mkdir -p $(MANDIR)/man8
80b61a6
 	install -m 644 fixfiles.8 $(MANDIR)/man8/
80b61a6
 	install -m 644 genhomedircon.8 $(MANDIR)/man8/
80b61a6
+	install -m 644 chcat.8 $(MANDIR)/man8/
80b61a6
 
80b61a6
 clean:
b36bfa0