Fix mgrepl patch to support all semanage command parsing

This commit is contained in:
Dan Walsh 2013-05-31 09:10:29 -04:00
parent 16ab1d5de7
commit e90e9c6c30
2 changed files with 25 additions and 5 deletions

View File

@ -1,5 +1,6 @@
--- policycoreutils-2.1.14/semanage/semanage.old 2013-05-24 15:11:36.014601386 +0200 diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.14/semanage/semanage
+++ policycoreutils-2.1.14/semanage/semanage 2013-05-24 15:16:56.845299693 +0200 --- policycoreutils-2.1.14/semanage/semanage.semanage 2013-05-28 11:04:07.196665120 -0400
+++ policycoreutils-2.1.14/semanage/semanage 2013-05-28 11:04:21.122726993 -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
@ -9,7 +10,7 @@
# 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,689 @@ @@ -19,567 +21,705 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA # 02111-1307 USA
# #
@ -621,6 +622,7 @@
+def setupDontauditParser(subparsers): +def setupDontauditParser(subparsers):
+ dontauditParser = subparsers.add_parser('dontaudit', help=_('Disable/Enable dontaudit rules in policy')) + dontauditParser = subparsers.add_parser('dontaudit', help=_('Disable/Enable dontaudit rules in policy'))
+ dontauditParser.add_argument('-S', '--store', nargs=1, action=SetStore, help=_('Select an alternate SELinux Policy Store to manage')) + dontauditParser.add_argument('-S', '--store', nargs=1, action=SetStore, help=_('Select an alternate SELinux Policy Store to manage'))
+ dontauditParser.add_argument('-N', '--noreload', action='store_true', help=_('Do not reload the policy after commit'))
+ dontauditParser.add_argument('action', choices=["on", "off"]) + dontauditParser.add_argument('action', choices=["on", "off"])
+ dontauditParser.set_defaults(func=handleDontaudit) + dontauditParser.set_defaults(func=handleDontaudit)
+ +
@ -693,10 +695,25 @@
+ +
+ return commandParser + return commandParser
+ +
+def make_args(sys_args):
+ args = None
+
+ # handle old '-o' and '-i" options for semanage
+ if sys_args[1] == "-o" and len(sys_args) == 3:
+ args = [ "export", "-f", sys_args[2] ]
+ if sys_args[1] == "-S" and sys_args[3] == "-o" and len(sys_args) == 5:
+ args = [ "export", "-S", sys_args[2], "-f", sys_args[4] ]
+ if sys_args[1] == "-i" and len(sys_args) == 3:
+ args = [ "import", "-f", sys.argv[2] ]
+ if sys_args[1] == "-S" and sys_args[3] == "-i" and len(sys_args) == 5:
+ args = [ "import", "-S", sys_args[2], "-f", sys_args[4] ]
+
+ return args
+
+def do_parser(): +def do_parser():
+ try: + try:
+ commandParser = createCommandParser() + commandParser = createCommandParser()
+ args = commandParser.parse_args() + args = commandParser.parse_args(make_args(sys.argv))
+ args.func(args) + args.func(args)
+ sys.exit(0) + sys.exit(0)
+ except ValueError,e: + except ValueError,e:

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: 46%{?dist} Release: 47%{?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
@ -311,6 +311,9 @@ The policycoreutils-restorecond package contains the restorecond service.
%systemd_postun_with_restart restorecond.service %systemd_postun_with_restart restorecond.service
%changelog %changelog
* Fri May 31 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.14-47
- Fix mgrepl patch to support all semanage command parsing
* Sun May 26 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.14-46 * Sun May 26 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.14-46
- Fix the name of the spec file generated in the build script - Fix the name of the spec file generated in the build script
- Add mgrepl patch to support argparse for semanage command parsing - Add mgrepl patch to support argparse for semanage command parsing