From e90e9c6c30a98723344fa52c0893769929d62700 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Fri, 31 May 2013 09:10:29 -0400 Subject: [PATCH] Fix mgrepl patch to support all semanage command parsing --- policycoreutils-semanage.patch | 25 +++++++++++++++++++++---- policycoreutils.spec | 5 ++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/policycoreutils-semanage.patch b/policycoreutils-semanage.patch index f110952..9096116 100644 --- a/policycoreutils-semanage.patch +++ b/policycoreutils-semanage.patch @@ -1,5 +1,6 @@ ---- policycoreutils-2.1.14/semanage/semanage.old 2013-05-24 15:11:36.014601386 +0200 -+++ policycoreutils-2.1.14/semanage/semanage 2013-05-24 15:16:56.845299693 +0200 +diff -up policycoreutils-2.1.14/semanage/semanage.semanage policycoreutils-2.1.14/semanage/semanage +--- 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 @@ #! /usr/bin/python -Es -# Copyright (C) 2005-2012 Red Hat @@ -9,7 +10,7 @@ # see file 'COPYING' for use and warranty information # # 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 # 02111-1307 USA # @@ -621,6 +622,7 @@ +def setupDontauditParser(subparsers): + 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('-N', '--noreload', action='store_true', help=_('Do not reload the policy after commit')) + dontauditParser.add_argument('action', choices=["on", "off"]) + dontauditParser.set_defaults(func=handleDontaudit) + @@ -693,10 +695,25 @@ + + 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(): + try: + commandParser = createCommandParser() -+ args = commandParser.parse_args() ++ args = commandParser.parse_args(make_args(sys.argv)) + args.func(args) + sys.exit(0) + except ValueError,e: diff --git a/policycoreutils.spec b/policycoreutils.spec index ccccc50..848dc79 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -7,7 +7,7 @@ Summary: SELinux policy core utilities Name: policycoreutils Version: 2.1.14 -Release: 46%{?dist} +Release: 47%{?dist} License: GPLv2 Group: System Environment/Base # 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 %changelog +* Fri May 31 2013 Dan Walsh - 2.1.14-47 +- Fix mgrepl patch to support all semanage command parsing + * Sun May 26 2013 Dan Walsh - 2.1.14-46 - Fix the name of the spec file generated in the build script - Add mgrepl patch to support argparse for semanage command parsing