[policycoreutils] fix sepolgen to not crash on echo "" | audit2allow

Daniel J Walsh dwalsh at fedoraproject.org
Wed Jan 18 21:44:08 UTC 2012


commit 685c820b6d73e58f383b14b02ea84f1516d5ced6
Author: Dan Walsh <dwalsh at redhat.com>
Date:   Wed Jan 18 16:43:57 2012 -0500

    fix sepolgen to not crash on echo "" | audit2allow
    
    Remove sandbox init script, should no longer be necessary

 policycoreutils-sepolgen.patch |   49 ++++++++++++++++++++++++++++++++++++++++
 policycoreutils.spec           |    5 +++-
 2 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/policycoreutils-sepolgen.patch b/policycoreutils-sepolgen.patch
index 5c7af1d..16b300d 100644
--- a/policycoreutils-sepolgen.patch
+++ b/policycoreutils-sepolgen.patch
@@ -1,3 +1,52 @@
+diff --git a/sepolgen/HACKING b/sepolgen/HACKING
+index 5cdf6d5..a0ec323 100644
+--- a/sepolgen/HACKING
++++ b/sepolgen/HACKING
+@@ -76,4 +76,4 @@ information about the object classes - including information flow. It
+ is separated to keep the core from being concerned about the details
+ of the object classes.
+ 
+-[selist]: http://www.nsa.gov/selinux/info/list.cfm
+\ No newline at end of file
++[selist]: http://www.nsa.gov/research/selinux/info/list.cfm
+diff --git a/sepolgen/src/sepolgen/audit.py b/sepolgen/src/sepolgen/audit.py
+index 9fdfafa..9e2ccee 100644
+--- a/sepolgen/src/sepolgen/audit.py
++++ b/sepolgen/src/sepolgen/audit.py
+@@ -20,6 +20,7 @@
+ import refpolicy
+ import access
+ import re
++import sys
+ 
+ # Convenience functions
+ 
+@@ -343,6 +344,7 @@ class AuditParser:
+         self.policy_load_msgs = []
+         self.path_msgs = []
+         self.by_header = { }
++        self.check_input_file = False
+                 
+     # Low-level parsing function - tries to determine if this audit
+     # message is an SELinux related message and then parses it into
+@@ -378,6 +380,7 @@ class AuditParser:
+                 found = True
+                 
+             if found:
++                self.check_input_file = True
+                 try:
+                     msg.from_split_string(rec)
+                 except ValueError:
+@@ -447,6 +450,9 @@ class AuditParser:
+         while line:
+             self.__parse(line)
+             line = input.readline()
++        if not self.check_input_file:
++            sys.stderr.write("Nothing to do\n")
++            sys.exit(0)
+         self.__post_process()
+ 
+     def parse_string(self, input):
 diff --git a/sepolgen/src/sepolgen/matching.py b/sepolgen/src/sepolgen/matching.py
 index 1a9a3e5..d56dd92 100644
 --- a/sepolgen/src/sepolgen/matching.py
diff --git a/policycoreutils.spec b/policycoreutils.spec
index b764079..5e70709 100644
--- a/policycoreutils.spec
+++ b/policycoreutils.spec
@@ -7,7 +7,7 @@
 Summary: SELinux policy core utilities
 Name:	 policycoreutils
 Version: 2.1.10
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPLv2
 Group:	 System Environment/Base
 # Based on git repository with tag 20101221
@@ -355,6 +355,9 @@ fi
 /bin/systemctl try-restart restorecond.service >/dev/null 2>&1 || :
 
 %changelog
+* Wed Jan 18 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.10-9
+- fix sepolgen to not crash on echo "" | audit2allow 
+- 
 * Mon Jan 16 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.10-8
 - Remove sandbox init script, should no longer be necessary
 


More information about the scm-commits mailing list