From 6a213d1e946a4ff3c29b1e1502dea06baa1dcc46 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Tue, 7 May 2013 10:50:38 -0400 Subject: [PATCH] Fix exceptionion hanling in audit2allow -o - Generate Man pages for everydomain, not just ones with exec_t entrypoints - sepolicy comunicate should return ValueError not TypeError - Trim header line in sepolicy manpage to use less space - Add missing options to restorecon man page --- policycoreutils-rhat.patch | 54 ++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index 7c8352d..37e9066 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -246577,7 +246577,7 @@ index 11b534f..ae064c4 100644 - install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR) + install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR)/sepolicy diff --git a/policycoreutils/sepolicy/info.c b/policycoreutils/sepolicy/info.c -index 65458e6..b6244be 100644 +index 65458e6..cd1026a 100644 --- a/policycoreutils/sepolicy/info.c +++ b/policycoreutils/sepolicy/info.c @@ -78,6 +78,58 @@ static int py_insert_bool(PyObject *dict, const char *name, int value) @@ -246651,6 +246651,30 @@ index 65458e6..b6244be 100644 goto cleanup; err: +@@ -827,16 +884,14 @@ static PyObject* get_ports(const char *num, const apol_policy_t * policydb) + if (py_insert_string(dict, "type", type)) + goto err; + +- if((range = apol_context_get_range(c)) == NULL) { +- goto err; +- } +- +- range_str = apol_mls_range_render(policydb, range); +- if (range_str == NULL) { +- goto err; ++ if((range = apol_context_get_range(c)) != NULL) { ++ range_str = apol_mls_range_render(policydb, range); ++ if (range_str == NULL) { ++ goto err; ++ } ++ if (py_insert_string(dict, "range", range_str)) ++ goto err; + } +- if (py_insert_string(dict, "range", range_str)) +- goto err; + + if (py_insert_string(dict, "protocol", proto_str)) + goto err; diff --git a/policycoreutils/sepolicy/policy.c b/policycoreutils/sepolicy/policy.c index 4eca22d..eeee0ab 100644 --- a/policycoreutils/sepolicy/policy.c @@ -247265,7 +247289,7 @@ index b25d3b2..7ca5554 100755 except KeyboardInterrupt: sys.exit(0) diff --git a/policycoreutils/sepolicy/sepolicy/__init__.py b/policycoreutils/sepolicy/sepolicy/__init__.py -index 5e7415c..5267ed9 100644 +index 5e7415c..834104b 100644 --- a/policycoreutils/sepolicy/sepolicy/__init__.py +++ b/policycoreutils/sepolicy/sepolicy/__init__.py @@ -7,6 +7,9 @@ import _policy @@ -247360,7 +247384,7 @@ index 5e7415c..5267ed9 100644 all_domains = [] types=get_all_types() types.sort() -@@ -81,11 +133,35 @@ def get_all_entrypoint_domains(): +@@ -81,11 +133,39 @@ def get_all_entrypoint_domains(): all_domains.append(m[0]) return all_domains @@ -247385,7 +247409,11 @@ index 5e7415c..5267ed9 100644 + else: + portrecs [(i['type'], i['protocol'])] = [port] + -+ portrecsbynum[(i['low'], i['high'],i['protocol'])] = (i['type'], i['range']) ++ if 'range' in i: ++ portrecsbynum[(i['low'], i['high'],i['protocol'])] = (i['type'], i['range']) ++ else: ++ portrecsbynum[(i['low'], i['high'],i['protocol'])] = (i['type']) ++ + return ( portrecs, portrecsbynum ) + all_domains = None @@ -247397,7 +247425,7 @@ index 5e7415c..5267ed9 100644 return all_domains roles = None -@@ -139,48 +215,48 @@ def get_all_attributes(): +@@ -139,48 +219,48 @@ def get_all_attributes(): return all_attributes def policy(policy_file): @@ -248206,6 +248234,22 @@ index 0000000..3a3faa6 +# + +""" +diff --git a/policycoreutils/sepolicy/sepolicy/transition.py b/policycoreutils/sepolicy/sepolicy/transition.py +index 5850622..5e308e3 100755 +--- a/policycoreutils/sepolicy/sepolicy/transition.py ++++ b/policycoreutils/sepolicy/sepolicy/transition.py +@@ -64,8 +64,9 @@ class setrans: + return buf + seen.append(name) + +- for t in self.sdict[name]["map"]: +- buf += "%s%s @ %s --> %s\n" % (header, t["source"], t["target"], t["transtype"]) ++ if "map" in self.sdict[name]: ++ for t in self.sdict[name]["map"]: ++ buf += "%s%s @ %s --> %s\n" % (header, t["source"], t["target"], t["transtype"]) + + if "child" in self.sdict[name]: + for x in self.sdict[name]["child"]: diff --git a/policycoreutils/setfiles/restorecon.8 b/policycoreutils/setfiles/restorecon.8 index 80b6d6e..1215a29 100644 --- a/policycoreutils/setfiles/restorecon.8