All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>, SE Linux <selinux@tycho.nsa.gov>
Subject: Fixes for policycoreutils scripts
Date: Fri, 11 Jan 2008 16:20:14 -0500	[thread overview]
Message-ID: <4787DD8E.1040502@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remove python hack to handle lanquage translations on errors.  Python
works properly now.

Fix fixfiles to handle multiple inputs on the command line correctly


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkeH3Y0ACgkQrlYvE4MpobO5HwCg6xLhCuOPYY0NBIVa8XCa/rYN
+t8An3eqHjDNSsGhN9hAEoULsyiWkAqo
=Oasn
-----END PGP SIGNATURE-----

[-- Attachment #2: policycoreutils-scripts.patch --]
[-- Type: text/plain, Size: 3072 bytes --]

--- nsapolicycoreutils/scripts/chcat	2007-08-23 16:52:26.000000000 -0400
+++ policycoreutils-2.0.35/scripts/chcat	2008-01-11 11:17:46.000000000 -0500
@@ -25,10 +25,6 @@
 import commands, sys, os, pwd, string, getopt, selinux
 import seobject
 import gettext
-import codecs
-import locale
-sys.stderr = codecs.getwriter(locale.getpreferredencoding())(sys.__stderr__, 'replace')
-sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.__stdout__, 'replace')
 
 try:
     gettext.install('policycoreutils')
--- nsapolicycoreutils/scripts/fixfiles	2007-12-10 21:42:28.000000000 -0500
+++ policycoreutils-2.0.35/scripts/fixfiles	2008-01-11 11:17:46.000000000 -0500
@@ -126,17 +126,15 @@
     done
     exit $?
 fi
-if [ ! -z "$DIRS" ]; then
+if [ ! -z "$FILEPATH" ]; then
     if [ -x /usr/bin/find ]; then
-	for d in ${DIRS} ; do find $d \
+	/usr/bin/find "$FILEPATH" \
 	    ! \( -fstype ext2 -o -fstype ext3 -o -fstype jfs -o -fstype xfs \) -prune  -o -print | \
 	    ${RESTORECON} ${OUTFILES} ${FORCEFLAG} $* -f - 2>&1 >> $LOGFILE
-	done
     else
-	${RESTORECON} ${OUTFILES} ${FORCEFLAG} -R $* $DIRS 2>&1 >> $LOGFILE
+	${RESTORECON} ${OUTFILES} ${FORCEFLAG} -R $* $FILEPATH 2>&1 >> $LOGFILE
     fi
-
-    exit $?
+    return
 fi
 LogReadOnly
 ${SETFILES} -q ${OUTFILES} ${SYSLOGFLAG} ${FORCEFLAG} $* ${FC} ${FILESYSTEMSRW} 2>&1 >> $LOGFILE
@@ -173,6 +171,20 @@
     fi
 }
 
+process() {
+#
+# Make sure they specified one of the three valid commands
+#
+case "$1" in
+    restore) restore -p ;;
+    check) restore -n -v;;
+    verify) restore -n -o -;;
+    relabel) relabel;;
+    *)
+    usage
+    exit 1
+esac
+}
 usage() {
       	echo $"Usage: $0 [-l logfile ] [-o outputfile ] { check | restore|[-F] relabel } [[dir] ... ] "
 	echo or
@@ -229,22 +241,19 @@
 
 shift 1
 if [ ! -z "$RPMFILES" ]; then
+    process $command
     if [ $# -gt 0 ]; then
 	    usage
     fi
 else
-    DIRS=$*
+    if [ -z "$1" ]; then
+	process $command
+    else
+	while [ -n "$1" ]; do 
+	    FILEPATH=$1
+	    process $command 
+	    shift
+    	done
+    fi
 fi
-
-#
-# Make sure they specified one of the three valid commands
-#
-case "$command" in
-    restore) restore -p ;;
-    check) restore -n -v ;;
-    verify) restore -n -o -;;
-    relabel) relabel;;
-    *)
-    usage
-    exit 1
-esac
+exit $?
--- nsapolicycoreutils/semanage/semanage	2007-10-05 13:09:53.000000000 -0400
+++ policycoreutils-2.0.35/semanage/semanage	2008-01-11 11:17:46.000000000 -0500
@@ -1,5 +1,5 @@
 #! /usr/bin/python -E
-# Copyright (C) 2005 Red Hat 
+# Copyright (C) 2005, 2006, 2007 Red Hat 
 # see file 'COPYING' for use and warranty information
 #
 # semanage is a tool for managing SELinux configuration files
@@ -28,10 +28,6 @@
 import gettext
 gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
 gettext.textdomain(PROGNAME)
-import codecs
-import locale
-sys.stderr = codecs.getwriter(locale.getpreferredencoding())(sys.__stderr__, 'replace')
-sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.__stdout__, 'replace')
 
 try:
        gettext.install(PROGNAME,

[-- Attachment #3: policycoreutils-scripts.patch.sig --]
[-- Type: application/octet-stream, Size: 72 bytes --]

             reply	other threads:[~2008-01-11 21:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 21:20 Daniel J Walsh [this message]
2008-01-23 21:02 ` Fixes for policycoreutils scripts Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4787DD8E.1040502@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.