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
--- policycoreutils-2.1.14/semanage/semanage.semanage 2013-06-06 16:18:07.684562186 -0400
+++ policycoreutils-2.1.14/semanage/semanage 2013-06-06 16:18:20.773620042 -0400
--- policycoreutils-2.1.14/semanage/semanage.semanage 2013-06-18 14:55:40.909048376 -0400
+++ policycoreutils-2.1.14/semanage/semanage 2013-06-18 15:00:14.100276927 -0400
@@ -1,5 +1,7 @@
#! /usr/bin/python -Es
-# Copyright (C) 2005-2012 Red Hat
@ -10,12 +10,12 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
# see file 'COPYING' for use and warranty information
#
# 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
# 02111-1307 USA
#
-#
+#
+#
+
import policycoreutils.default_encoding_utf8
-import sys, getopt, re
@ -23,29 +23,18 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
import seobject
import selinux
-PROGNAME="policycoreutils"
-
+import sys
import gettext
-gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
-gettext.textdomain(PROGNAME)
-
+PROGNAME="policycoreutils"
try:
- gettext.install(PROGNAME,
- localedir="/usr/share/locale",
- unicode=True,
- codeset = 'utf-8')
+ gettext.install(PROGNAME,
+ localedir="/usr/share/locale",
+ unicode=False,
+ codeset = 'utf-8')
+
except IOError:
- import __builtin__
- __builtin__.__dict__['_'] = unicode
+ import __builtin__
+ __builtin__.__dict__['_'] = unicode
+
gettext.install(PROGNAME,
@@ -39,545 +39,681 @@ except IOError:
import __builtin__
__builtin__.__dict__['_'] = unicode
+# define custom usages for selected main actions
+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':('',)}
@ -721,7 +710,7 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
+ sys.exit(1)
+ except KeyboardInterrupt:
+ sys.exit(0)
+
if __name__ == '__main__':
- manageditems=[ "boolean", "login", "user", "port", "interface", "node", "fcontext"]
- 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 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 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 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
- -o, --output Output current customizations as semange commands
- -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
- -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 object == "boolean":
- if not value:
- raise ValueError(_("Value Required [ --on | --off ]"))
- OBJECT.modify(target, value, use_file)
- return
-
@ -1266,5 +1253,4 @@ diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.1
- errorExit(error.args[1])
- except RuntimeError, error:
- errorExit(error.args[0])
+ do_parser()
+
+ do_parser()

View File

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