policycoreutils/policycoreutils-sepolgen.patch
Dan Walsh 685c820b6d fix sepolgen to not crash on echo "" | audit2allow
Remove sandbox init script, should no longer be necessary
2012-01-18 16:43:57 -05:00

82 lines
2.6 KiB
Diff

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
+++ b/sepolgen/src/sepolgen/matching.py
@@ -50,7 +50,7 @@ class Match:
return 1
class MatchList:
- DEFAULT_THRESHOLD = 120
+ DEFAULT_THRESHOLD = 150
def __init__(self):
# Match objects that pass the threshold
self.children = []
@@ -63,14 +63,15 @@ class MatchList:
def best(self):
if len(self.children):
return self.children[0]
- else:
- return None
+ if len(self.bastards):
+ return self.bastards[0]
+ return None
def __len__(self):
# Only return the length of the matches so
# that this can be used to test if there is
# a match.
- return len(self.children)
+ return len(self.children) + len(self.bastards)
def __iter__(self):
return iter(self.children)