Fix semanage export/import commands

- Fix semange module command
This commit is contained in:
Dan Walsh 2013-06-19 10:44:58 -04:00
parent 82362e85ca
commit 11643b3535
3 changed files with 5917 additions and 1127 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.14/semanage/semanage diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.14/semanage/semanage
--- policycoreutils-2.1.14/semanage/semanage.semanage 2013-06-06 16:18:07.684562186 -0400 --- policycoreutils-2.1.14/semanage/semanage.semanage 2013-06-18 14:55:40.909048376 -0400
+++ policycoreutils-2.1.14/semanage/semanage 2013-06-06 16:18:20.773620042 -0400 +++ policycoreutils-2.1.14/semanage/semanage 2013-06-18 15:00:14.100276927 -0400
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
#! /usr/bin/python -Es #! /usr/bin/python -Es
-# Copyright (C) 2005-2012 Red Hat -# Copyright (C) 2005-2012 Red Hat
@ -10,7 +10,7 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
# see file 'COPYING' for use and warranty information # see file 'COPYING' for use and warranty information
# #
# semanage is a tool for managing SELinux configuration files # semanage is a tool for managing SELinux configuration files
@@ -19,567 +21,702 @@ @@ -19,16 +21,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA # 02111-1307 USA
# #
@ -23,29 +23,18 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
import seobject import seobject
import selinux import selinux
-PROGNAME="policycoreutils" -PROGNAME="policycoreutils"
-
+import sys +import sys
import gettext import gettext
-gettext.bindtextdomain(PROGNAME, "/usr/share/locale") -gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
-gettext.textdomain(PROGNAME) -gettext.textdomain(PROGNAME)
-
+PROGNAME="policycoreutils"
try: try:
- gettext.install(PROGNAME, gettext.install(PROGNAME,
- localedir="/usr/share/locale", @@ -39,545 +39,681 @@ except IOError:
- unicode=True, import __builtin__
- codeset = 'utf-8') __builtin__.__dict__['_'] = unicode
+ gettext.install(PROGNAME,
+ localedir="/usr/share/locale",
+ unicode=False,
+ codeset = 'utf-8')
+
except IOError:
- import __builtin__
- __builtin__.__dict__['_'] = unicode
+ import __builtin__
+ __builtin__.__dict__['_'] = unicode
+
+# define custom usages for selected main actions +# define custom usages for selected main actions
+usage_login = "semanage login [-h] [-n] [-N] [-s STORE] [" +usage_login = "semanage login [-h] [-n] [-N] [-s STORE] ["
+usage_login_dict = {' --add':('-s SEUSER','-r RANGE','LOGIN',),' --modify':('-s SEUSER','-r RANGE','LOGIN',),' --delete':('LOGIN',), ' --list':('-C',),' --extract':('',), ' --deleteall':('',)} +usage_login_dict = {' --add':('-s SEUSER','-r RANGE','LOGIN',),' --modify':('-s SEUSER','-r RANGE','LOGIN',),' --delete':('LOGIN',), ' --list':('-C',),' --extract':('',), ' --deleteall':('',)}
@ -721,7 +710,7 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
+ sys.exit(1) + sys.exit(1)
+ except KeyboardInterrupt: + except KeyboardInterrupt:
+ sys.exit(0) + sys.exit(0)
+
if __name__ == '__main__': if __name__ == '__main__':
- manageditems=[ "boolean", "login", "user", "port", "interface", "node", "fcontext"] - manageditems=[ "boolean", "login", "user", "port", "interface", "node", "fcontext"]
- action = False - action = False
@ -744,7 +733,7 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
-semanage module -{a|d|m} [--enable|--disable] [-N] module -semanage module -{a|d|m} [--enable|--disable] [-N] module
-semanage node -{a|d|m|l|D|E} [-Nntr] [ -p protocol ] [-M netmask] addr -semanage node -{a|d|m|l|D|E} [-Nntr] [ -p protocol ] [-M netmask] addr
-semanage fcontext -{a|d|m|l|D|E} [-Nefnrst] file_spec -semanage fcontext -{a|d|m|l|D|E} [-Nefnrst] file_spec
-semanage boolean -{d|m} {--on|--off|-1|-0} [-N] -F boolean | boolean_file -semanage boolean -{d|m} [--on|--off|-1|-0] [-N] -F boolean | boolean_file
-semanage permissive -{d|a|l} [-Nn] type -semanage permissive -{d|a|l} [-Nn] type
-semanage dontaudit [ on | off ] [-N] -semanage dontaudit [ on | off ] [-N]
- -
@ -756,7 +745,7 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
- -i, --input Input multiple semange commands in a transaction - -i, --input Input multiple semange commands in a transaction
- -o, --output Output current customizations as semange commands - -o, --output Output current customizations as semange commands
- -l, --list List the OBJECTS - -l, --list List the OBJECTS
- -E, --extract Extract customizable commands, for use within a transaction - -E, --extract extract customizable commands
- -C, --locallist List OBJECTS local customizations - -C, --locallist List OBJECTS local customizations
- -D, --deleteall Remove all OBJECTS local customizations - -D, --deleteall Remove all OBJECTS local customizations
- -
@ -1128,8 +1117,6 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
- -
- if modify: - if modify:
- if object == "boolean": - if object == "boolean":
- if not value:
- raise ValueError(_("Value Required [ --on | --off ]"))
- OBJECT.modify(target, value, use_file) - OBJECT.modify(target, value, use_file)
- return - return
- -
@ -1267,4 +1254,3 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
- except RuntimeError, error: - except RuntimeError, error:
- errorExit(error.args[0]) - errorExit(error.args[0])
+ do_parser() + do_parser()
+

View File

@ -7,7 +7,7 @@
Summary: SELinux policy core utilities Summary: SELinux policy core utilities
Name: policycoreutils Name: policycoreutils
Version: 2.1.14 Version: 2.1.14
Release: 55%{?dist} Release: 56%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Base Group: System Environment/Base
# Based on git repository with tag 20101221 # Based on git repository with tag 20101221
@ -18,7 +18,6 @@ Source2: policycoreutils_man_ru2.tar.bz2
Source3: system-config-selinux.png Source3: system-config-selinux.png
Patch: policycoreutils-rhat.patch Patch: policycoreutils-rhat.patch
Patch1: policycoreutils-sepolgen.patch Patch1: policycoreutils-sepolgen.patch
Patch2: policycoreutils-semanage.patch
Obsoletes: policycoreutils < 2.0.61-2 Obsoletes: policycoreutils < 2.0.61-2
Conflicts: filesystem < 3 Conflicts: filesystem < 3
Provides: /sbin/fixfiles Provides: /sbin/fixfiles
@ -54,7 +53,6 @@ to switch roles.
%setup -q -a 1 %setup -q -a 1
%patch -p2 -b .rhat %patch -p2 -b .rhat
%patch1 -p2 -b .sepolgen -d sepolgen-%{sepolgenver} %patch1 -p2 -b .sepolgen -d sepolgen-%{sepolgenver}
%patch2 -p1 -b .semanage
%build %build
cp %{SOURCE3} gui/ cp %{SOURCE3} gui/
@ -311,6 +309,10 @@ The policycoreutils-restorecond package contains the restorecond service.
%systemd_postun_with_restart restorecond.service %systemd_postun_with_restart restorecond.service
%changelog %changelog
* Wed Jun 19 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.14-56
- Fix semanage export/import commands
- Fix semange module command
* Tue Jun 18 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.14-55 * Tue Jun 18 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.14-55
- Add man page doc for --role and bash complestion support for sepolicy --role - Add man page doc for --role and bash complestion support for sepolicy --role